:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}
.game-shell { min-height: 0; padding: max(6px, var(--safe-top)) max(6px, var(--safe-right)) max(6px, var(--safe-bottom)) max(6px, var(--safe-left)); }
.game-panel, .game-panel:has(.overlay:not(.hidden)) { height: 100%; max-height: 100%; }
.overlay, .howto-overlay, .unlock-overlay { position: fixed; inset: 0; padding: max(8px, var(--safe-top)) max(8px, var(--safe-right)) max(8px, var(--safe-bottom)) max(8px, var(--safe-left)); }
.overlay-card { min-height: 0; align-items: stretch; max-height: 100%; }
.overlay-content { min-height: 0; grid-template-rows: minmax(0, 1fr) auto; }
.overlay-scroll { display: grid; gap: 10px; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.overlay-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-selector button, .difficulty-selector button, .overlay-actions button, .unlock-button, .control-button, .howto-header button, .unlock-header button { min-height: 44px; }
.mode-selector span, .difficulty-selector button { font-size: 11px; }
.mode-selector small { font-size: 10px; }
.howto-card, .unlock-card { max-height: 100%; }
button:focus-visible, a:focus-visible, canvas:focus-visible, .overlay-scroll:focus-visible { outline: 3px solid var(--cyan); outline-offset: -3px; }
@media (max-height: 540px) and (min-width: 521px) {
    .game-topbar { grid-template-columns: auto 1fr auto; gap: 8px; padding: 5px 8px; }
    .game-title h1 { font-size: 18px; }
    .game-title p { display: none; }
    .scoreboard { grid-column: auto; gap: 5px; }
    .scoreboard div { padding: 4px 8px; }
    .scoreboard strong { font-size: 18px; }
    .controls { grid-template-columns: 1.2fr 1fr; padding: 4px; gap: 6px; }
    .chop-controls, .system-controls { padding: 3px; gap: 5px; border-top: 0; }
    .control-button { min-height: 44px; padding: 4px 8px; }
    .control-copy small { display: none; }
    .control-copy strong { font-size: 11px; }
    .control-glyph { font-size: 15px; width: 28px; min-width: 28px; }
    .status-strip { top: 40px; right: 8px; width: 100px; gap: 3px; }
    .status-chip { padding: 3px 5px; }
    .status-chip span { font-size: 8px; }
    .status-chip strong { font-size: 11px; }
    .overlay-card { grid-template-columns: 1fr; width: min(760px, 100%); padding: 10px; }
    .overlay-visual { display: none; }
    .overlay-card h2 { font-size: 26px; }
    .overlay-scroll { gap: 8px; }
}
