/* Ghost Metronome: chart-recorder paper on a dark bench. System fonts only. */
:root{--bench:#15191e;--paper:#efe6d2;--ink:#1d3a44;--muted:#6f6550;--brass:#b5832a;--red:#c0392b;--text:#e9e2cf}
*{box-sizing:border-box}
body{margin:0;background:var(--bench);color:var(--text);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-tap-highlight-color:transparent}
.game-header{display:flex;justify-content:space-between;align-items:center;padding:.6rem 1rem;border-bottom:1px solid #2b333b}
.game-header a{color:var(--text);text-decoration:none;font-weight:600;min-height:44px;display:inline-flex;align-items:center}
.game-tag{font-size:.8rem;color:#9aa3ab}
.game-wrap{padding-left:max(1rem,env(safe-area-inset-left));padding-right:max(1rem,env(safe-area-inset-right));padding-bottom:max(1rem,env(safe-area-inset-bottom))}
.game-title{text-align:center;margin-bottom:.6rem}
.game-title p{margin:0;font:700 .7rem ui-monospace,Menlo,Consolas,monospace;letter-spacing:.14em;text-transform:uppercase;color:#9aa3ab}
.game-title h1{margin:.1rem 0 0;font-size:1.5rem;font-weight:800;letter-spacing:.01em}
.stage{position:relative;width:100%;height:min(clamp(430px,146vw,600px),84vh);border:3px solid #0b0d10;border-radius:14px;overflow:hidden;background:var(--paper);box-shadow:0 0 0 2px #39424b,0 10px 30px rgba(0,0,0,.45);touch-action:none;user-select:none;-webkit-user-select:none}
#gm-field{position:absolute;left:0;top:0;display:block;touch-action:none;cursor:pointer}
.gm-mute{position:absolute;top:6px;right:6px;width:48px;height:48px;border:2px solid var(--ink);border-radius:10px;background:#f6efdc;color:var(--ink);display:grid;place-items:center;cursor:pointer;z-index:3;padding:0}
.gm-mute .x{display:none}.gm-mute.off .w{display:none}.gm-mute.off .x{display:inline}
.gm-mute:focus-visible,.btn:focus-visible,.gm-sw:focus-visible{outline:3px solid var(--brass);outline-offset:2px}
.panel{position:absolute;z-index:2;color:var(--ink);font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace}
.panel[hidden]{display:none}
.title{inset:0;background:rgba(239,230,210,.94);padding:max(54px,6%) 18px 14px;display:flex;flex-direction:column;align-items:stretch;gap:9px;overflow:hidden}
.title h2{margin:0;font-size:1.35rem;text-align:center}
.how{margin:0;padding-left:1.3rem;font-size:.86rem;line-height:1.45}
.btn{min-height:52px;border:2px solid var(--ink);border-radius:10px;font:700 1rem ui-monospace,Menlo,Consolas,monospace;cursor:pointer;color:var(--ink);background:#f6efdc;padding:0 14px;touch-action:manipulation}
.btn.main{background:var(--ink);color:#f6efdc;font-size:1.15rem}
.btn:active{transform:translateY(1px)}
.note{margin:0;font-size:.75rem;color:var(--muted);text-align:center;line-height:1.4}
.stats{white-space:pre-wrap}
.sw-row{display:flex;align-items:center;justify-content:center;gap:10px;font-size:.8rem}
.swatches{display:flex;gap:8px}
.gm-sw{width:46px;height:46px;border-radius:50%;border:3px solid var(--ink);background:var(--sw);color:#fff;font:700 .85rem ui-monospace,monospace;cursor:pointer;padding:0;touch-action:manipulation}
.gm-sw.on{box-shadow:0 0 0 3px var(--brass)}
.gm-sw:disabled{opacity:.45;cursor:not-allowed;background:#b9ad8c}
.result{left:0;right:0;bottom:0;background:#f8f2e2;border-top:3px solid var(--ink);padding:12px 14px calc(12px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:10px}
.res-top{display:flex;gap:14px;align-items:center}
.rank{flex:0 0 68px;height:68px;border:4px solid var(--ink);border-radius:8px;display:grid;place-items:center;font:800 2.4rem ui-monospace,Menlo,monospace;color:var(--ink);transform:rotate(-6deg)}
.rank[data-pass="0"]{color:var(--red);border-color:var(--red)}
.lines p{margin:0;font-size:.82rem;line-height:1.4}
.lines .goal{color:var(--muted);font-size:.74rem;margin-top:3px}.lines .goal:empty{display:none}
.lines .pts{font-weight:800;margin-top:3px}
.res-btns{display:grid;grid-template-columns:2fr 1fr;gap:8px}
.result.pop .rank{animation:stamp .35s cubic-bezier(.2,1.6,.4,1) both}
.result.pop{animation:rise .25s ease-out both}
@keyframes stamp{from{transform:rotate(-6deg) scale(2.2);opacity:0}to{transform:rotate(-6deg) scale(1);opacity:1}}
@keyframes rise{from{transform:translateY(30px);opacity:0}to{transform:none;opacity:1}}
.gm-help{margin:.7rem 0 0;font-size:.8rem;color:#9aa3ab;line-height:1.5;text-align:center}
@media (prefers-reduced-motion:reduce){.result.pop,.result.pop .rank{animation:none}.btn:active{transform:none}}
@media (max-height:700px){.title{gap:6px;padding-top:50px}.how{font-size:.78rem}}

/* Full screen: stage fills the area under the dock; chrome hidden, nothing deleted */
html.pip-immersive .game-title,html.pip-immersive .gm-help,html.pip-immersive .game-header,html.pip-immersive .ad-well,html.pip-immersive #similar-games,html.pip-immersive footer,html.pip-native .game-title,html.pip-native .gm-help,html.pip-native .ad-well{display:none!important}
html.pip-immersive .game-wrap,html.pip-native .game-wrap{max-width:none;padding:0}
html.pip-immersive .stage,.stage:fullscreen{width:100%!important;height:100%!important;max-height:none!important;border-radius:0;border-width:0;box-shadow:none}
html.pip-immersive .title{padding-top:max(60px,env(safe-area-inset-top))}
html.pip-immersive .gm-mute,.stage:fullscreen .gm-mute{top:max(6px,env(safe-area-inset-top))}
.stage:fullscreen .result,html.pip-immersive .result{padding-bottom:calc(12px + env(safe-area-inset-bottom))}
@media (orientation:landscape) and (max-height:500px){
html.pip-immersive .title,.stage:fullscreen .title{padding:10px 18px;display:grid;grid-template-columns:1fr 1fr;align-items:center;gap:6px 18px}
html.pip-immersive .title h2,.stage:fullscreen .title h2{grid-column:1/-1}
html.pip-immersive .how,.stage:fullscreen .how{font-size:.74rem}
html.pip-immersive .result,.stage:fullscreen .result{left:auto;width:min(60%,480px);border-left:3px solid var(--ink);top:0;justify-content:center}
}
@media (orientation:landscape) and (max-height:500px){html.pip-immersive .stats,html.pip-immersive .title .sw-row{display:none}}
