* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14202b; 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: 6px; flex-wrap: wrap; min-width: 0; }
#stats span { background: rgba(255,255,255,.9); padding: 6px 10px; border-radius: 10px; font-size: 17px; font-variant-numeric: tabular-nums; min-height: 40px; display: inline-flex; align-items: center; white-space: nowrap; }
#timer.low { background: #ffd3c9; color: #7a1010; font-weight: 700; }
#buttons { display: flex; gap: 8px; pointer-events: auto; flex: none; }
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(10,20,30,.55); padding: 16px; z-index: 8; }
#overlay[hidden], #error[hidden], #banner[hidden], #toast[hidden] { display: none; }
.card { background: #fffdf4; border-radius: 16px; padding: 20px 24px; max-width: 460px; 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; }
#banner { position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(255,248,214,.96); border: 3px solid #e3b73a; border-radius: 18px; padding: 14px 26px; box-shadow: 0 6px 24px rgba(0,0,0,.4); pointer-events: none; z-index: 7; text-align: center; max-width: calc(100% - 24px); }
#banner strong { font-size: 30px; color: #7a4d00; }
#banner span { font-size: 22px; color: #1d2a1d; }
#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; z-index: 9; }
#toast { position: fixed; left: max(12px, env(safe-area-inset-left)); right: max(12px, 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 corners (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)) + 104px); }
/* a desktop keeps the turn row where it was, above the hint */
html:not(.mp-touch) #turn { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 84px); }
