:root {
  --bg: #050608;
  --ink: #f4efe6;
  --dim: #a99c8a;
  --hot: #ff7a00;
  --gold: #ffd21a;
  --red: #ff2d1a;
  --panel: rgba(10, 8, 6, 0.86);
  --edge: rgba(255, 170, 60, 0.45);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none;
  font-family: "Orbitron", "Arial Black", sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

button { font: inherit; color: var(--ink); background: linear-gradient(#2a1d12, #120c07); border: 2px solid var(--edge);
  border-radius: 10px; padding: 12px 22px; font-size: 15px; letter-spacing: 2px; cursor: pointer; min-width: 220px; margin: 6px;
  box-shadow: 0 0 0 1px #000, 0 4px 14px rgba(0,0,0,0.6); transition: transform .08s, border-color .15s, box-shadow .15s; }
button:hover, button:focus-visible { border-color: var(--gold); box-shadow: 0 0 18px rgba(255,160,40,.45); outline: none; }
button:active { transform: scale(0.97); }
button.big { font-family: "Black Ops One", Impact, sans-serif; font-size: 24px; letter-spacing: 3px;
  background: linear-gradient(#ff8a1a, #c22a00); border-color: #ffd28a; color: #fff; text-shadow: 0 2px 0 #000; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px; text-align: center; z-index: 20; }
.screen.show { display: flex; animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

#boot { background: radial-gradient(ellipse at 50% 40%, #3a0f00 0%, #0a0302 60%, #000 100%); }
#boot .logo { font-family: "Black Ops One", Impact, sans-serif; font-size: clamp(64px, 18vw, 150px); line-height: .9; color: #fff;
  text-shadow: 0 0 30px rgba(255,90,0,.7), 0 6px 0 #6b1500; letter-spacing: 6px; }
#boot .logo span { display: block; font-size: .36em; letter-spacing: .55em; color: var(--hot); margin-left: .5em; }
#boot .presents { font-size: 14px; letter-spacing: 8px; color: var(--dim); margin: 14px 0 30px; text-transform: uppercase; }
#loadbar { width: min(320px, 80vw); height: 8px; border: 1px solid var(--edge); border-radius: 4px; overflow: hidden; }
#loadfill { height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .2s; }
#loadtxt { margin-top: 10px; font-size: 12px; letter-spacing: 3px; color: var(--dim); }
#btnEnter { margin-top: 26px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 30px rgba(255,120,0,.7); } }
.small { font-size: 11px; color: var(--dim); letter-spacing: 2px; margin-top: 18px; }

#title { background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,0) 55%, rgba(0,0,0,.75) 100%); justify-content: space-between; padding: max(24px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); }
.title { margin: 0; font-family: "Black Ops One", Impact, sans-serif; line-height: .9; font-weight: 400; }
.title small { display: block; font-size: clamp(22px, 6vw, 48px); color: var(--gold); letter-spacing: 6px; text-shadow: 0 3px 0 #000, 0 0 20px rgba(0,0,0,.8); }
.title b { display: block; font-weight: 400; font-size: clamp(60px, 17vw, 150px);
  background: linear-gradient(#fff6a8 0%, #ffb400 45%, #ff2d00 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 5px 0 #000) drop-shadow(0 0 22px rgba(255,90,0,.65)); animation: throb 2.4s ease-in-out infinite; }
@keyframes throb { 50% { transform: scale(1.035) rotate(-1deg); } }
#title nav { display: flex; flex-direction: column; align-items: center; }
#hiscore { font-size: 12px; letter-spacing: 3px; color: var(--gold); min-height: 1em; }
footer { font-size: 11px; letter-spacing: 2px; color: var(--dim); }

.panel { background: var(--panel); border: 2px solid var(--edge); border-radius: 16px; padding: 22px 24px; max-width: 760px; width: 100%;
  max-height: calc(100vh - 32px); overflow: auto; text-align: left; box-shadow: 0 20px 60px rgba(0,0,0,.7); touch-action: pan-y; }
.panel.small { max-width: 380px; text-align: center; }
.panel h2 { font-family: "Black Ops One", Impact, sans-serif; font-weight: 400; color: var(--hot); letter-spacing: 4px; margin: 0 0 12px; font-size: 28px; text-align: center; }
.panel h3 { color: var(--gold); font-size: 13px; letter-spacing: 3px; margin: 14px 0 6px; }
.panel p, .panel li { font-size: 13px; line-height: 1.55; color: #e9dfcf; margin: 4px 0; font-family: system-ui, sans-serif; }
.panel .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .panel .cols { grid-template-columns: 1fr; } }
.panel .back { display: block; margin: 18px auto 0; }
kbd { font-family: "Press Start 2P", monospace; font-size: 10px; background: #2b2118; border: 1px solid #6b5137; border-bottom-width: 3px; border-radius: 5px; padding: 3px 6px; color: #fff; }
#howto, #pause, #over { background: rgba(0,0,0,.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

#overScore { font-family: "Black Ops One", Impact, sans-serif; font-size: 40px; color: var(--gold); margin: 6px 0; }
#overHigh { font-size: 12px; letter-spacing: 3px; color: var(--dim); margin-bottom: 12px; }

/* ---------- credits ---------- */
#credits { background: rgba(0,0,0,.72); flex-direction: row; gap: 20px; }
#credits .roll { flex: 1; height: 100%; overflow: hidden; position: relative; mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent);
  -webkit-mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent); }
#roll { display: flex; flex-direction: column; align-items: center; --start: 90vh; }
#roll.run { animation: roll 34s linear infinite; }
@keyframes roll { from { transform: translateY(var(--start)); } to { transform: translateY(-100%); } }
@media (max-width: 760px) { #roll { --start: 30vh; } }
#roll .title b { font-size: clamp(48px, 9vw, 110px); }
#roll .role { margin: 26px 0 4px; font-size: 12px; letter-spacing: 4px; color: var(--dim); text-transform: uppercase; }
#roll .name { margin: 0; font-family: "Black Ops One", Impact, sans-serif; font-size: 26px; color: #fff; letter-spacing: 2px; }
#roll .quote { margin: 60px 0; font-family: "Black Ops One", Impact, sans-serif; font-size: 34px; color: var(--gold); }
.board { max-width: 440px; }
#board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
#board button { min-width: 0; margin: 0; padding: 8px; font-size: 11px; letter-spacing: 0; text-align: left; font-family: system-ui, sans-serif; line-height: 1.3; border-radius: 8px; }
#board button.playing { border-color: var(--gold); background: linear-gradient(#6b2a00, #2a1000); }
@media (max-width: 760px) {
  #credits { flex-direction: column; padding: 12px; }
  #credits .roll { flex: 0 0 34vh; width: 100%; }
  .board { flex: 1; min-height: 0; }
}

/* ---------- HUD ---------- */
#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; align-items: flex-start;
  padding: max(6px, env(safe-area-inset-top)) 8px 0; pointer-events: none; }
#dmd { width: min(96vw, 560px, 60vh); aspect-ratio: 4 / 1; background: #0a0503; border: 3px solid #222; border-radius: 6px;
  box-shadow: 0 0 0 2px #000, 0 6px 22px rgba(0,0,0,.8), inset 0 0 20px rgba(255,90,0,.1); }
#hudBtns { position: absolute; right: 8px; top: max(6px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
#hudBtns button { min-width: 0; width: 38px; height: 38px; padding: 0; margin: 0; font-size: 14px; border-radius: 50%; letter-spacing: 0; background: rgba(20,14,8,.8); }
@media (max-width: 700px) { #dmd { width: calc(100vw - 64px); } #hud { justify-content: flex-start; } }

#touch { position: fixed; inset: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
#touch > div { display: flex; justify-content: center; }
#touch > div.flip { align-items: flex-end; padding-bottom: 22px; }
#touch > div.nudge { align-items: center; padding-top: 14vh; }
#touch span { font-size: 10px; letter-spacing: 3px; color: rgba(255,255,255,.18); }
#touch > div.flip.on { background: radial-gradient(ellipse at 50% 100%, rgba(255,140,30,.18), transparent 60%); }
#touch > div.nudge.on { background: radial-gradient(ellipse at 50% 50%, rgba(80,160,255,.14), transparent 60%); }
body.touch #touch > div.flip:first-of-type { border-top: 1px dashed rgba(255,255,255,.06); }
body:not(.touch) #touch span { display: none; }

#btnPlunger { position: fixed; z-index: 12; right: 14px; bottom: max(90px, calc(env(safe-area-inset-bottom) + 90px)); min-width: 0; width: 92px; height: 92px;
  border-radius: 50%; padding: 0; font-family: "Black Ops One", Impact, sans-serif; font-size: 15px; letter-spacing: 1px;
  background: radial-gradient(circle at 40% 35%, #ff9a3a, #b21d00); border-color: #ffd28a; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#btnPlunger span { font-size: 9px; font-family: "Orbitron", sans-serif; opacity: .8; }
#btnPlunger.pull { transform: scale(.9); box-shadow: 0 0 30px rgba(255,120,0,.9); }

/* ---------- splash + screen flash ---------- */
#flashfx { position: fixed; inset: 0; z-index: 8; pointer-events: none; opacity: 0; mix-blend-mode: screen; }
#flashfx.go { animation: flashfx .45s ease-out; }
@keyframes flashfx { 0% { opacity: .55; } 100% { opacity: 0; } }
#splash { --c: #ffd21a; position: fixed; left: 50%; top: 46%; z-index: 9; pointer-events: none; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; opacity: 0; text-align: center; width: 100%; }
#splash::before { content: ""; position: absolute; left: 50%; top: 50%; width: 160vmin; height: 160vmin; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--c) 35%, transparent) 0 6deg, transparent 6deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 0 15%, transparent 55%); mask-image: radial-gradient(circle, #000 0 15%, transparent 55%); z-index: -1; }
#splash b { font-family: "Black Ops One", Impact, sans-serif; font-weight: 400; font-size: clamp(34px, 9vw, 96px); white-space: nowrap; max-width: 96vw; line-height: 1; color: #fff;
  -webkit-text-stroke: 3px #000; paint-order: stroke fill;
  text-shadow: 0 6px 0 #000, 0 0 30px var(--c), 0 0 60px var(--c); letter-spacing: 2px; }
#splash small { margin-top: 8px; font-size: clamp(12px, 3vw, 20px); letter-spacing: 4px; color: var(--c); text-shadow: 0 2px 0 #000, 0 0 12px #000; font-weight: 800; }
#splash.go { animation: slam 1.8s cubic-bezier(.2,1.6,.4,1) forwards; }
#splash.go::before { animation: spin 1.8s linear; }
@keyframes slam {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(3) rotate(-8deg); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
  20% { transform: translate(-48%, -51%) scale(1.04) rotate(-2deg); }
  26% { transform: translate(-51%, -49%) scale(1) rotate(-3deg); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1.06) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.9) rotate(-3deg); }
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(40deg); } }

/* full-screen backdrop behind the table: current playfield art, blurred and darkened */
#bgfx { position: fixed; inset: 0; transform: scale(1.1); z-index: 0; background: #050608 center / cover no-repeat; filter: blur(14px) brightness(0.38) saturate(1.2); transition: background-image .6s; }
#gl { z-index: 1; }
.screen, #hud, #touch { z-index: 20; }
#touch { z-index: 5; } #hud { z-index: 10; }
footer a, #roll a { color: var(--gold); text-decoration: none; pointer-events: auto; }
#roll { pointer-events: none; } #roll a { pointer-events: auto; }
.tagline { max-width: 34em; margin: 6px auto 0; padding: 8px 14px; background: rgba(0,0,0,.62); border-radius: 10px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); text-align: center; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: clamp(11px, 3.2vw, 14px); line-height: 1.45; letter-spacing: .3px; color: rgba(255,255,255,.78); text-shadow: 0 1px 3px #000; }
#roll .tagline { margin: 10px auto 26px; background: none; color: rgba(255,255,255,.85); }
