/* Panic Pad's own look (Doug: every game looks different): an emergency control panel. Brushed dark steel panels
   with rivets, yellow-and-black hazard stripes, a red alarm light, amber readouts, and four colored arrow keys
   (red up, blue right, yellow down, green left: color plus shape, never color alone). Bungee for headings and
   numbers (self-hosted, SIL OFL), Inter for reading. Loaded after games.css, which keeps the shared base rules. */
@font-face { font-family: Bungee; src: url(/fonts/Bungee.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/Inter.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/Inter-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --bg: #12141b; --bg2: #1b1f2a; --panel: #262b38; --panel2: #303646; --line: #454c60; --ink: #07080b;
  --text: #f2f4f8; --soft: #aeb6c8; --accent: #ffb000; --alarm: #ff3b3b; --good: #3ddc84; --hz: #ffcc1a;
  --u: #ff5a5a; --r: #3fb6ff; --d: #ffd23f; --l: #3ddc84;
}
body.pp {
  font: 400 16px/1.42 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 50% -20%, #ff3b3b22 0, transparent 50%),
    repeating-linear-gradient(90deg, #ffffff05 0 2px, transparent 2px 6px),
    linear-gradient(180deg, var(--bg2), var(--bg));
  background-attachment: fixed;
  overflow-x: hidden;
}
.pp h1, .pp h2, .pp h3, .pp .bng { font-family: Bungee, Impact, sans-serif; font-weight: 400; letter-spacing: .01em; }
.pp a { color: var(--accent); }
.pp button { font-family: Bungee, Impact, sans-serif; font-weight: 400; letter-spacing: .02em; background: var(--accent); color: #1a1200; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); border-radius: 14px; }
.pp button.quiet { background: #ffffff0d; color: var(--text); border: 2px solid var(--line); box-shadow: none; font-family: Inter, sans-serif; font-weight: 700; }
.pp button.alarm { background: radial-gradient(circle at 50% 30%, #ff7a7a, var(--alarm) 55%, #b51818); color: #fff; text-shadow: 0 2px 0 #0006; }
.pp button.steel { background: linear-gradient(180deg, #4a5268, #2e3445); color: var(--text); }
.pp .muted { color: var(--soft); }

/* hazard stripe band */
.hazard { height: 12px; background: repeating-linear-gradient(-45deg, var(--hz) 0 14px, #111 14px 28px); border-block: 2px solid var(--ink); }

/* the steel panel with four rivets */
.panel {
  position: relative; background: linear-gradient(170deg, var(--panel2), var(--panel)); border: 3px solid var(--ink); border-radius: 18px;
  box-shadow: 0 6px 0 var(--ink), inset 0 2px 0 #ffffff14; padding: 18px;
}
.panel::before { content: ''; position: absolute; inset: 7px; pointer-events: none; border-radius: 12px;
  background:
    radial-gradient(circle at 0 0, #8a93a8 0 3px, #0000 4px) top left / 10px 10px no-repeat,
    radial-gradient(circle at 100% 0, #8a93a8 0 3px, #0000 4px) top right / 10px 10px no-repeat,
    radial-gradient(circle at 0 100%, #8a93a8 0 3px, #0000 4px) bottom left / 10px 10px no-repeat,
    radial-gradient(circle at 100% 100%, #8a93a8 0 3px, #0000 4px) bottom right / 10px 10px no-repeat; }
.panel > * + * { margin-top: 12px; }

/* top bar */
.pp-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 64px; position: relative; z-index: 5; }
.pp-top .grow { flex: 1; min-width: 0; }
.pp-top .chip-r { font-family: Bungee, sans-serif; font-size: 14px; background: #000a; border: 2px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--accent); white-space: nowrap; }
.pp .icon { min-width: 44px; min-height: 44px; padding: 0; background: #ffffff0d; border: 2px solid var(--line); box-shadow: none; color: var(--text); font-size: 18px; border-radius: 12px; }

/* logo: the word with a blinking alarm light */
.logo { font-size: clamp(36px, 11vw, 64px); line-height: .95; margin: 0; color: var(--text); text-shadow: 0 4px 0 var(--ink); display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.logo em { font-style: normal; color: var(--alarm); }
.beacon { width: .7em; height: .7em; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff 0 10%, #ff7a7a 25%, var(--alarm) 60%, #7a0d0d); border: 3px solid var(--ink); box-shadow: 0 0 22px #ff3b3b; animation: beacon 1s steps(2) infinite; }
@keyframes beacon { 50% { box-shadow: 0 0 2px #ff3b3b; filter: brightness(.6); } }

/* home */
.home { max-width: 560px; margin: 0 auto; padding: 4px 16px 22px; display: grid; gap: 12px; text-align: center; }
.home .tag { margin: 0; color: var(--soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pp .chip { min-height: 44px; padding: 6px 16px; font-size: 15px; background: #0006; color: var(--text); border: 2px solid var(--line); box-shadow: none; }
.pp .chip[aria-pressed="true"] { background: var(--accent); color: #1a1200; border-color: var(--ink); }
.modes { display: grid; gap: 10px; }
.mode { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; min-height: 76px; width: 100%; }
.mode .ico { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; background: #0007; border: 2px solid var(--ink); font-size: 28px; }
.mode b { display: block; font-size: 19px; }
.mode span.sub { display: block; font: 600 13.5px/1.25 Inter, sans-serif; letter-spacing: 0; opacity: .85; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
.links { display: flex; gap: 18px; justify-content: center; align-items: center; flex-wrap: wrap; font-weight: 700; }
.links > a { font: 700 15px Inter, sans-serif; min-height: 40px; display: inline-flex; align-items: center; }
.links a, .links button.link { color: var(--accent); background: none; border: 0; box-shadow: none; font: 700 15px Inter, sans-serif; min-height: 40px; padding: 0 4px; text-decoration: underline; }
.note { font-size: 13px; color: var(--soft); margin: 0; }
.best { font-family: Bungee, sans-serif; color: var(--accent); margin: 0; font-size: 15px; }

/* the round screen: scene, code, pad */
.arena { display: grid; grid-template-rows: auto auto 1fr; gap: 8px; padding: 0 12px 12px; height: calc(100dvh - 82px); max-width: 640px; margin: 0 auto; }
.arena-head { display: flex; align-items: center; gap: 10px; }
.arena-head h2 { font-size: clamp(18px, 5.4vw, 26px); margin: 0; flex: 1; color: var(--text); text-shadow: 0 3px 0 var(--ink); }
.twist { font-family: Bungee, sans-serif; font-size: 14px; background: var(--alarm); color: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 4px 10px; animation: twist .6s steps(2) infinite; }
@keyframes twist { 50% { background: #8a1414; } }
.scene { position: relative; height: clamp(120px, 24dvh, 220px); border-radius: 16px; overflow: hidden; border: 3px solid var(--ink); background: #0c0e14; }
.scene svg { width: 100%; height: 100%; display: block; }
.stamp { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.stamp b { font-family: Bungee, sans-serif; font-size: clamp(28px, 9vw, 54px); color: var(--good); -webkit-text-stroke: 2px #000; text-shadow: 0 5px 0 #000; transform: rotate(-8deg); animation: stamp .35s cubic-bezier(.2,1.6,.4,1) both; }
.stamp.lose b { color: var(--alarm); }
@keyframes stamp { from { transform: rotate(-8deg) scale(2.4); opacity: 0; } }
.count { position: absolute; inset: 0; display: grid; place-items: center; background: #000a; font-family: Bungee, sans-serif; font-size: clamp(56px, 18vw, 120px); color: var(--accent); text-shadow: 0 6px 0 #000; }
.count small { display: block; font-size: 18px; color: var(--text); text-align: center; }

.mid { display: grid; gap: 8px; align-content: start; }
.code { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 54px; padding: 8px; background: #05070acc; border: 3px solid var(--ink); border-radius: 14px; box-shadow: inset 0 0 18px #000; }
.key { width: clamp(34px, 9.6vw, 50px); height: clamp(34px, 9.6vw, 50px); border-radius: 10px; display: grid; place-items: center; background: #1a1d26; border: 2px solid #000; color: var(--k); position: relative; }
.key svg { width: 70%; height: 70%; }
.key svg path { fill: var(--k); stroke: #000; stroke-width: 6; stroke-linejoin: round; }
.key.k0 { --k: var(--u); } .key.k1 { --k: var(--r); } .key.k2 { --k: var(--d); } .key.k3 { --k: var(--l); }
.key.now { outline: 3px solid #fff; outline-offset: 2px; transform: translateY(-3px); }
.key.ok { background: color-mix(in srgb, var(--k) 35%, #0b0d12); box-shadow: 0 0 12px var(--k); }
.key.ok::after { content: '✓'; position: absolute; right: -4px; top: -8px; font: 700 14px Inter; color: var(--good); }
.key.hide svg { visibility: hidden; }
.key.hide::before { content: '?'; font-family: Bungee, sans-serif; color: var(--soft); font-size: 20px; }
.key.ok.hide svg { visibility: visible; }
.key.ok.hide::before { content: none; }
.tbar { height: 12px; border-radius: 99px; background: #000; border: 2px solid var(--ink); overflow: hidden; }
.tbar i { display: block; height: 100%; width: calc(var(--left, 1) * 100%); background: linear-gradient(90deg, var(--alarm), var(--accent)); }
.rivals { display: grid; gap: 4px; }
.lane { display: grid; grid-template-columns: 76px 1fr 40px; gap: 8px; align-items: center; font: 700 13px Inter, sans-serif; }
.lane .nm { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lane .bar { height: 10px; background: #000; border-radius: 99px; overflow: hidden; border: 1px solid #000; }
.lane .bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--c, var(--accent)); transition: width .15s; }
.lane .st { text-align: right; font-family: Bungee, sans-serif; font-size: 11px; color: var(--good); }
.lane.me .nm { color: var(--accent); }
.padbox { display: grid; place-items: center; align-self: stretch; min-height: 0; }
.padbox .dpad { --dp-size: min(86vw, 40dvh, 340px); --dp-face: #2a2f3d; --dp-edge: #07080b; --dp-hub: #12141b; --dp-0: var(--u); --dp-1: var(--r); --dp-2: var(--d); --dp-3: var(--l); }

/* sideways phones and computers: the code on the left, the pad on the right */
@media (orientation: landscape) and (min-width: 600px) {
  .arena { max-width: 1100px; grid-template-columns: 1.2fr 1fr; grid-template-rows: auto 1fr; column-gap: 18px; }
  .arena-head { grid-column: 1 / -1; }
  .padbox { grid-row: 2; grid-column: 2; }
  .padbox .dpad { --dp-size: min(44vw, 70dvh, 360px); }
  .mid { grid-column: 1; grid-row: 2; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .pp-top { min-height: 48px; padding: 4px 10px; }
  .hazard { height: 6px; }
  .arena { height: calc(100dvh - 62px); grid-template-rows: auto minmax(0, 1fr); }
  .scene { height: 34dvh; }
  .padbox .dpad { --dp-size: min(44vw, calc(100dvh - 110px), 300px); }
  .home { grid-template-columns: 1fr 1.3fr; align-items: center; max-width: 900px; column-gap: 18px; row-gap: 8px; padding-top: 0; }
  .home > .logo, .home > .tag, .home > .chips, .home > .best, .home > .links, .home > .note { grid-column: 1; }
  .home > .modes { grid-column: 2; grid-row: 1 / span 6; grid-template-columns: 1fr 1fr; }
  .home .logo { font-size: 38px; }
  .mode { grid-template-columns: 1fr; justify-items: center; text-align: center; min-height: 0; padding: 8px; gap: 4px; }
  .mode .ico { width: 40px; height: 40px; font-size: 22px; }
  .mode b { font-size: 16px; }
  .mode span.sub { font-size: 12px; }
  .key { width: 32px; height: 32px; }
  .rivals { display: none; }
}

/* end card and boards */
.endc { max-width: 520px; margin: 0 auto; padding: 0 16px 20px; display: grid; gap: 12px; text-align: center; }
.endc h2 { font-size: clamp(28px, 8vw, 44px); margin: 0; color: var(--accent); text-shadow: 0 4px 0 var(--ink); }
.places { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.places li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: #0006; border: 2px solid var(--ink); border-radius: 12px; padding: 8px 12px; font-weight: 700; }
.places li .pl { font-family: Bungee, sans-serif; color: var(--accent); }
.places li .sc { font-family: Bungee, sans-serif; }
.places li .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c); margin-right: 8px; border: 2px solid #000; vertical-align: -1px; }
.places li.me { border-color: var(--accent); }
.name-box { width: 100%; font: 700 20px Inter, sans-serif; padding: 12px 14px; border-radius: 12px; border: 3px solid var(--ink); background: #f2f4f8; color: #111; text-align: center; }
.err { color: #ff8a8a; font-weight: 700; min-height: 1.2em; margin: 0; }
.status { position: fixed; bottom: 8px; left: 0; right: 0; text-align: center; font-weight: 700; color: var(--accent); pointer-events: none; }

/* the big screen */
.tv { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.tv main { padding: 0 2.4vw 2vw; display: grid; }
.tv-lobby { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.4vw; align-items: center; }
.tv-lobby .steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: clamp(18px, 2vw, 30px); font-weight: 700; text-align: left; }
.tv-lobby .steps .n { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--accent); color: #111; font-family: Bungee, sans-serif; margin-right: 10px; border: 3px solid var(--ink); }
.big-code { font-family: Bungee, sans-serif; font-size: clamp(56px, 9vw, 150px); letter-spacing: .12em; color: var(--accent); text-shadow: 0 6px 0 #000; text-align: center; }
.qr { background: #fff; padding: 12px; border-radius: 14px; border: 3px solid var(--ink); justify-self: center; text-align: center; color: #111; font-weight: 700; }
.qr img, .qr canvas { display: block; width: clamp(140px, 17vw, 260px); height: auto; image-rendering: pixelated; }
.who { display: flex; flex-wrap: wrap; gap: 8px; }
.who span { background: #0007; border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: clamp(14px, 1.4vw, 22px); }
.who span i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c); margin-right: 6px; border: 2px solid #000; }
.tv-play { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2vw; align-items: stretch; }
.tv-play .scene { height: auto; min-height: 44vh; }
.tv-play .arena-head h2 { font-size: clamp(24px, 3vw, 52px); }
.tv-play .code .key { width: clamp(40px, 4.4vw, 76px); height: clamp(40px, 4.4vw, 76px); }
.tv-lanes { display: grid; gap: 1.2vh; align-content: center; }
.tv-lanes .lane { grid-template-columns: minmax(80px, 11vw) 1fr 70px; font-size: clamp(14px, 1.6vw, 26px); }
.tv-lanes .lane .bar { height: clamp(14px, 2vh, 26px); }
.tv-lanes .lane .st { font-size: clamp(11px, 1.1vw, 18px); }
.tv .places li { font-size: clamp(16px, 1.8vw, 30px); }
.lvl { font-family: Bungee, sans-serif; color: var(--accent); }
@media (max-width: 800px) { .tv-lobby, .tv-play { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .beacon, .twist { animation: none; }
  .stamp b { animation: none; }
  .key.now { transform: none; }
}

/* the big screen's round: the scene and code on the left, everyone's lanes big on the right */
.tv .arena { max-width: none; height: auto; min-height: calc(100dvh - 90px); grid-template-rows: auto 1fr; grid-template-columns: 1fr; }
.tv .arena-head h2 { font-size: clamp(24px, 3.4vw, 60px); }
.tv .arena-head .twist, .tv .arena-head .chip-r { font-size: clamp(14px, 1.4vw, 24px); }
.tv .mid { grid-template-columns: 1.25fr 1fr; grid-template-areas: "scene lanes" "bar lanes" "code lanes" "how lanes"; column-gap: 2.4vw; align-content: start; }
.tv .mid .scene { grid-area: scene; height: clamp(200px, 46dvh, 560px); }
.tv .mid .tbar { grid-area: bar; height: 18px; }
.tv .mid .code { grid-area: code; }
.tv .mid .twist-how { grid-area: how; font-size: clamp(16px, 1.6vw, 28px); color: var(--accent); }
.tv .mid .rivals { grid-area: lanes; align-content: center; gap: 1.6vh; }
.tv .rivals .lane { grid-template-columns: minmax(90px, 12vw) 1fr 60px; font-size: clamp(16px, 1.8vw, 32px); }
.tv .rivals .lane .bar { height: clamp(16px, 2.6vh, 32px); }
.tv .rivals .lane .st { font-size: clamp(14px, 1.6vw, 28px); }
.tv .code .key { width: clamp(44px, 4.6vw, 84px); height: clamp(44px, 4.6vw, 84px); }
@media (max-width: 800px) { .tv .mid { grid-template-columns: 1fr; grid-template-areas: "scene" "bar" "code" "how" "lanes"; } }
a.mode { border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 var(--ink); background: linear-gradient(180deg, #4a5268, #2e3445); color: var(--text); text-decoration: none; font-family: Bungee, sans-serif; }
