html, body { margin: 0; }
img { max-width: 100%; }
/* Layout: one screen. The cabinet fills the viewport; a slim score bar sits over the top edge; the poster art is the start screen. */
[hidden] { display: none !important; }
:root {
  --ink: #04070d; --deep: #0a1520; --storm: #16324a; --mist: #8fb6c9; --bone: #e9e2c8; --amber: #ffb347; --ember: #ff7a1a; --teal: #4fd6e0;
  --display: "Griffy", "IM Fell English SC", Georgia, serif;
  --label: "IM Fell English SC", Georgia, "Times New Roman", serif;
  --digit: "Orbitron", "Courier New", monospace;
  color-scheme: dark;
}
html, body { height: 100%; height: 100dvh; }
body { background: var(--ink); color: var(--bone); font-family: var(--label); font-size: 16px; overflow: hidden; overscroll-behavior: none; }
#app { position: relative; height: 100%; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#gl { position: absolute; top: var(--hud-height, 74px); left: 0; width: 100%; height: calc(100% - var(--hud-height, 74px)); display: block; }
#hud { position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap;
  padding-top: max(8px, env(safe-area-inset-top, 0px)); padding-bottom: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(to bottom, rgba(4,7,13,0.92), rgba(4,7,13,0.55) 70%, rgba(4,7,13,0)); pointer-events: none; }
#score { font-family: var(--digit); font-weight: 700; font-size: clamp(1.5rem, 5vw, 2.2rem); color: var(--amber); text-shadow: 0 0 14px rgba(255,122,26,0.7); font-variant-numeric: tabular-nums; line-height: 1; min-width: 5ch; }
.stats { display: flex; gap: 14px; margin-left: auto; align-items: center; font-size: 1.02rem; letter-spacing: 0.06em; }
.stats b { font-family: var(--digit); font-weight: 600; color: var(--teal); font-variant-numeric: tabular-nums; margin-left: 5px; font-size: 0.95em; }
.stats .hot b { color: var(--ember); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.icon { white-space: nowrap; pointer-events: auto; background: linear-gradient(180deg, rgba(143,182,201,0.14), rgba(10,21,32,0.94)); border: 1px solid rgba(233,226,200,0.25); color: var(--bone); border-radius: 999px; padding: 9px 17px; min-height: 44px; font-size: 0.9rem; letter-spacing: 0.06em; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.25); }
.icon[aria-pressed="true"] { border-color: var(--amber); background-color: var(--deep); }
.audio-controls { display: flex; gap: 8px; pointer-events: auto; }
.audio-toggle { display: inline-flex; align-items: center; gap: 7px; }
.audio-state { font-family: var(--digit); font-size: 0.68em; letter-spacing: 0.02em; color: var(--teal); }
.audio-toggle[aria-pressed="false"] { border-color: rgba(233,226,200,0.2); }
.audio-toggle[aria-pressed="false"] .audio-state { color: var(--mist); }
button:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }
button:active:not(:disabled) { transform: translateY(1px) scale(0.97); }
#toast { position: absolute; left: 50%; top: var(--toast-top, 84px); transform: translateX(-50%); max-width: min(92%, 34rem); text-align: center; text-wrap: balance;
  font-family: var(--display); font-size: clamp(1.3rem, 4.6vw, 2.1rem); color: var(--bone); text-shadow: 0 2px 0 var(--ink), 0 0 18px rgba(79,214,224,0.75); opacity: 0; transition: opacity 0.25s; pointer-events: none; }
#toast.on { opacity: 1; }
#launch { --p: 0; position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(40px + env(safe-area-inset-bottom, 0px)); width: 112px; height: 112px; padding: 0; border-radius: 50%;
  border: 3px solid var(--ink); outline: 2px solid rgba(233,226,200,0.55);
  background: conic-gradient(from 0deg, var(--amber) calc(var(--p) * 1%), #1b2a36 0);
  box-shadow: 0 0 0 1px var(--ink), 0 10px 26px rgba(0,0,0,0.75), 0 0 calc(10px + var(--p) * 0.4px) rgba(255,179,71,calc(0.25 + var(--p) * 0.007)); }
#launch::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 3px solid var(--ink);
  background:
    radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 58%, rgba(40,60,70,0.55) 100%),
    repeating-conic-gradient(from 10deg, rgba(150,60,50,0.16) 0 2deg, rgba(0,0,0,0) 2deg 31deg),
    radial-gradient(circle at 36% 30%, #f6f3e6 0, #d2d3c8 55%, #8b979a 100%); }
#launch::after { content: ""; position: absolute; left: 50%; top: 50%; width: calc(24px + var(--p) * 0.16px); height: calc(24px + var(--p) * 0.16px); border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 34% 30%, #fff 0 9%, rgba(255,255,255,0) 11%), radial-gradient(circle, #04070d 62%, #16324a 64% 100%); border: 2px solid var(--ink); }
#launch span { position: absolute; right: 0; top: 100%; margin-top: 8px; white-space: nowrap; font-family: var(--display); font-size: 1.15rem; color: var(--bone); text-shadow: 0 2px 0 var(--ink), 0 0 12px var(--ink); }
#launch.down { outline-color: var(--amber); }
#launch.full { animation: tremble 0.09s linear infinite; }
@keyframes tremble { 0% { transform: translate(1px, 0); } 50% { transform: translate(-1px, 1px); } 100% { transform: translate(0, -1px); } }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4,7,13,0.9); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.jukebox { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; height: 100%; width: 100%; justify-items: center; padding-block: 10px; box-sizing: border-box; }
.poster { position: relative; height: 100%; aspect-ratio: 2 / 3; max-width: 100%; min-height: 0; background: var(--deep) center top / contain no-repeat; box-shadow: 0 0 80px rgba(0,0,0,0.9); overflow: hidden; }
.poster .panel { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 10px; justify-items: center; text-align: center; padding: 70px 8% 18px; background: linear-gradient(to bottom, rgba(4,7,13,0), rgba(4,7,13,0.82) 42%, rgba(4,7,13,0.94)); }
.name { margin: 0; font-family: var(--display); font-size: clamp(1.3rem, 5vw, 1.9rem); color: var(--bone); text-shadow: 0 2px 0 var(--ink); text-wrap: balance; line-height: 1.05; }
.nav { position: absolute; top: 42%; width: 46px; height: 58px; font-size: 2.2rem; line-height: 1; background: linear-gradient(180deg, rgba(22,50,74,0.85), rgba(4,7,13,0.92)); color: var(--bone); border: 1px solid rgba(233,226,200,0.32); border-radius: 999px; padding: 0 0 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 6px 20px rgba(0,0,0,0.4); }
#prev { left: 8px; } #next { right: 8px; }
.strip { display: flex; gap: 8px; max-width: 100%; overflow-x: auto; padding: 8px 6px 8px; box-sizing: border-box; touch-action: pan-x; scrollbar-width: thin; }
.thumb { flex: 0 0 auto; width: 46px; aspect-ratio: 2 / 3; background: var(--deep) center / cover no-repeat; border: 2px solid rgba(233,226,200,0.22); border-radius: 10px; padding: 0; opacity: 0.65; box-shadow: 0 3px 8px rgba(0,0,0,0.4); }
.thumb[aria-pressed="true"] { border-color: var(--amber); opacity: 1; box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px var(--amber), 0 5px 18px rgba(0,0,0,0.5); transform: translateY(-2px); }
@media (max-width: 460px) { .thumb { width: 36px; } .strip { gap: 6px; } }
h1.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.play { pointer-events: auto; font-family: var(--display); font-size: clamp(1.5rem, 6vw, 2.2rem); min-height: 56px; padding: 12px 44px 14px; color: var(--ink); background: linear-gradient(175deg, #fff9eb, var(--bone) 65%); border: 1px solid rgba(255,255,255,0.65); border-radius: 999px; box-shadow: inset 0 2px 0 rgba(255,255,255,0.65), inset 0 -3px 0 rgba(4,7,13,0.12), 0 8px 24px rgba(0,0,0,0.4), 0 0 22px rgba(255,179,71,0.18); }
.play:disabled { opacity: 0.55; cursor: default; }
@media (hover: hover) {
  .play:hover:not(:disabled) { background: var(--amber); transform: translateY(-2px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 10px 28px rgba(0,0,0,0.45), 0 0 28px rgba(255,179,71,0.3); }
  .nav:hover, .icon:hover { border-color: var(--amber); background-color: var(--storm); transform: translateY(-1px); }
  .thumb:hover { opacity: 1; border-color: var(--bone); }
}
.keys { margin: 0; font-size: clamp(0.92rem, 3.2vw, 1.08rem); line-height: 1.45; color: var(--bone); text-shadow: 0 1px 0 var(--ink), 0 0 10px var(--ink); max-width: 30rem; text-wrap: balance; }
.keys kbd { font-family: var(--digit); font-size: 0.78em; border: 1px solid var(--mist); border-radius: 3px; padding: 1px 6px; background: rgba(4,7,13,0.7); color: var(--amber); }
.hi { font-family: var(--digit); font-size: 0.86rem; color: var(--teal); letter-spacing: 0.1em; font-variant-numeric: tabular-nums; margin: 0; }
#over { background: rgba(4,7,13,0.72); }
#over .card { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 26px 30px 30px; border: 2px solid var(--bone); background: rgba(10,21,32,0.92); max-width: 26rem; }
#over h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.7rem, 7vw, 2.5rem); margin: 0; text-wrap: balance; line-height: 1.1; }
#over .final { font-family: var(--digit); font-weight: 700; font-size: clamp(1.9rem, 8vw, 2.8rem); color: var(--amber); text-shadow: 0 0 16px rgba(255,122,26,0.7); font-variant-numeric: tabular-nums; margin: 0; }
#canary { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); bottom: 12px; margin: 0; font: 11px/1.35 var(--digit); color: #9f9; background: rgba(0,0,0,0.75); padding: 6px 8px; pointer-events: none; }
@media (max-width: 520px) { .stats { gap: 10px; font-size: 0.9rem; } #launch { width: 96px; height: 96px; } }
@media (max-width: 600px) {
  #hud { gap: 8px; background: #04070d; }
  #score { width: 100%; font-size: 1.65rem; }
  .stats { width: 100%; margin-left: 0; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 0.85rem; }
  .stats b { margin-left: 3px; }
  .audio-controls { margin-left: auto; }
  .icon { min-height: 44px; padding: 5px 8px; box-sizing: border-box; }
  .jukebox { padding-top: max(10px, env(safe-area-inset-top, 0px)); padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
  .poster { width: 100%; aspect-ratio: auto; }
  .thumb { min-width: 40px; min-height: 60px; }
}
@media (max-height: 560px) {
  .overlay { overflow-y: auto; touch-action: pan-y; align-items: start; }
  .jukebox { min-height: 560px; }
}
@media (prefers-reduced-motion: reduce) { #toast, button { transition: none; } #launch.full { animation: none; } }
/* per-table typography: the display face, weight and size follow the selected table */
#toast, .name, .play, #over h2, #launch span { font-weight: var(--dw, 400); }
#app[data-type="tech"] :is(#toast, .name, #over h2) { font-size: clamp(0.95rem, 3.5vw, 1.45rem); letter-spacing: 0.05em; text-transform: uppercase; }
#app[data-type="tech"] .play { font-size: clamp(1.05rem, 4.2vw, 1.5rem); letter-spacing: 0.1em; text-transform: uppercase; }
#app[data-type="tech"] #launch span { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
#app[data-type="type"] :is(#toast, .name, #over h2) { font-size: clamp(1.05rem, 3.9vw, 1.6rem); }
#app[data-type="type"] .play { font-size: clamp(1.2rem, 4.8vw, 1.75rem); padding-top: 12px; }
#app[data-type="type"] #launch span { font-size: 0.95rem; }
#app[data-type="carved"] :is(#toast, .name, #over h2) { font-size: clamp(1.05rem, 3.9vw, 1.6rem); letter-spacing: 0.04em; }
#app[data-type="carved"] .play { font-size: clamp(1.2rem, 4.8vw, 1.75rem); letter-spacing: 0.06em; }
#app[data-type="carved"] #launch span { font-size: 0.95rem; }
.made { margin: 0; font-size: 0.95rem; letter-spacing: 0.06em; }
.made a { color: var(--bone); text-decoration: underline; text-decoration-color: var(--amber); text-underline-offset: 3px; pointer-events: auto; }
.made a:hover, .made a:focus-visible { color: var(--amber); }
/* Compact chooser typography only; gameplay and game-over text stay unchanged. */
#start .panel { gap: 8px; padding-bottom: 16px; }
#app #start .play { font-size: clamp(1.25rem, 5vw, 1.85rem); }
#app[data-type="tech"] #start .play { font-size: clamp(0.95rem, 3.6vw, 1.3rem); }
#app:is([data-type="type"], [data-type="carved"]) #start .play { font-size: clamp(1.05rem, 4.2vw, 1.5rem); }
#start .keys { font-size: clamp(0.85rem, 2.8vw, 0.95rem); line-height: 1.35; }
#start .hi { font-size: 0.76rem; letter-spacing: 0.08em; }
#start .made { font-size: 0.85rem; letter-spacing: 0.04em; }
/* Give the chooser room to breathe on monitors; retain compact phone/landscape sizing. */
@media (min-width: 1000px) and (min-height: 650px) {
  #start .jukebox {
    gap: 18px;
    padding-top: 18px;
    padding-bottom: clamp(32px, 5dvh, 72px);
  }
  #start .strip { gap: 12px; padding: 10px 10px 12px; }
  #start .thumb { width: clamp(64px, 4.5vw, 96px); border-radius: 14px; }
  #start .panel { gap: 12px; padding-bottom: 28px; }
  #start .keys { font-size: 1.05rem; line-height: 1.4; }
  #start .hi { font-size: 0.9rem; }
  #start .made { font-size: 1rem; }
}
.tips { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; justify-content: center; font-size: 0.95rem; letter-spacing: 0.05em; }
.tips .icon { font-family: var(--digit); font-size: 0.72rem; border-color: var(--amber); color: var(--amber); }
.tips .icon:hover { background: var(--amber); color: var(--ink); }
.tipmsg { flex-basis: 100%; min-height: 1.2em; font-size: 0.85rem; color: var(--teal); }
.solo .strip, .solo .nav { display: none; }
