* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9ec7e8; font-family: system-ui, sans-serif; color: #1d2a1d; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#hud { position: fixed; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
#stats { display: flex; gap: 8px; flex-wrap: wrap; }
#stats span { background: rgba(255,255,255,.88); padding: 8px 12px; border-radius: 10px; font-size: 18px; font-variant-numeric: tabular-nums; min-height: 44px; display: inline-flex; align-items: center; }
#side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#buttons { display: flex; gap: 8px; pointer-events: auto; }
/* the mode, small, under the top buttons: the stats keep their width, so it takes no room from the meadow's signs */
#mode { background: rgba(255,255,255,.88); padding: 4px 12px; border-radius: 10px; font-size: 16px; font-weight: 700; }
button { font: inherit; font-size: 18px; min-height: 52px; min-width: 52px; padding: 8px 16px; border: 0; border-radius: 10px; background: #2f6b3a; color: #fff; cursor: pointer; touch-action: manipulation; }
button:active { background: #25552e; }
#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(20,40,20,.35); padding: 16px; z-index: 8; }
#overlay[hidden], #error[hidden] { display: none; }
.card { background: #fffdf4; border-radius: 16px; padding: 20px 24px; max-width: 460px; max-height: 100%; overflow-y: auto; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.card h1 { margin: 0 0 8px; font-size: 30px; }
.card p { margin: 6px 0 14px; font-size: 18px; line-height: 1.35; }
.card p:empty { display: none; }
#modes { display: grid; gap: 10px; margin: 0 0 14px; }
#modes button { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #eef3e4; color: #1d2a1d; border: 3px solid #b9cbaa; line-height: 1.25; }
#modes button strong { font-size: 22px; }
#modes button span { font-size: 15px; }
#modes button[aria-pressed="true"] { background: #2f6b3a; color: #fff; border-color: #1d4a27; box-shadow: 0 0 0 3px #ffe14a; }
#go { min-width: 180px; font-size: 22px; font-weight: 700; }
/* a wide screen (a phone on its side): the three modes in one row */
@media (orientation: landscape) { #modes { grid-template-columns: repeat(3, minmax(0, 1fr)); } .card { max-width: 640px; } }
@media (max-height: 520px) { #overlay { padding: 8px; } .card { padding: 10px 16px; } .card h1 { font-size: 22px; margin-bottom: 2px; } .card p { font-size: 15px; margin: 2px 0 8px; } #modes { margin-bottom: 10px; } }
#error { position: fixed; left: 16px; right: 16px; bottom: 16px; background: #fff0f0; color: #7a1010; padding: 12px; border-radius: 10px; white-space: pre-wrap; font-size: 14px; }
#pad { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; align-items: flex-end; z-index: 5; }
#pad[hidden], #toast[hidden], #gate[hidden] { display: none; }
/* the gate button: a wide pill at the top of the pad column, above Seed and Yell, so it can never sit on either; it appears only beside a gate */
.pill { min-height: 56px; min-width: 132px; padding: 10px 20px; border-radius: 28px; font-weight: 700; font-size: 18px; background: #7a4a1f; box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.pill:active { background: #5e3814; }
.round { width: var(--btn, 64px); height: var(--btn, 64px); border-radius: 50%; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; font-weight: 700; font-size: 17px; box-shadow: 0 3px 10px rgba(0,0,0,.35); touch-action: none; }
.round small { font-size: 14px; font-weight: 600; opacity: .95; }
#yell { background: radial-gradient(circle at 50% 50%, #c2562b 0 62%, #8a3a1c 100%); }
#yell.wait { background: conic-gradient(#8f9a8f calc(var(--rec, 0) * 1turn), #5a6a5a 0); color: #e8efe8; }
#yell.held { transform: scale(1.12); background: #e0752f; }
#seed { background: #b8892c; }
#seed[aria-pressed="true"] { background: #e3c25b; color: #2a1c0e; outline: 4px solid #fff; }
#seed:disabled { background: #7a7a6a; opacity: .75; }
#toast { position: fixed; left: max(12px, env(safe-area-inset-left)); right: calc(var(--btn, 64px) + 36px + env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); max-width: 520px; background: rgba(255,253,244,.96); border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 4px 16px rgba(0,0,0,.3); pointer-events: none; z-index: 6; }
#toast p { margin: 0; font-size: 16px; line-height: 1.3; flex: 1; }
#toast button { pointer-events: auto; flex: none; }
/* on a touch screen the movement controls own the lower left (content/ui/move-pad.css), so the one-time hint stands under the top bar */
html.mp-touch #toast { bottom: auto; top: calc(max(8px, env(safe-area-inset-top)) + 156px); right: max(12px, env(safe-area-inset-right)); }
