@font-face { font-family: "Lilita"; src: url(fonts/lilita.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Righteous"; src: url(fonts/righteous.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Orbitron"; src: url(fonts/orbitron.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --pink: #ff2d95;
  --cyan: #19e3ff;
  --yellow: #ffe600;
  --green: #2bff6a;
  --red: #ff2a3d;
  --ink: #0b0614;
  --display: "Lilita", "Arial Rounded MT Bold", system-ui, sans-serif;
  --retro: "Righteous", "Lilita", system-ui, sans-serif;
  --led: "Orbitron", ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: #050308;
  color: #fff;
  font-family: var(--retro);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

/* ---------- Cabinet and screen ---------- */
.cabinet {
  min-height: 100%;
  padding: calc(8px + var(--safe-top)) 8px calc(8px + var(--safe-bottom));
  background:
    radial-gradient(120% 60% at 50% 0%, #2a2133 0%, #120d18 55%, #050308 100%);
  display: flex;
  justify-content: center;
}
.screen {
  position: relative;
  width: 100%;
  max-width: 1100px;
  min-height: calc(100dvh - 16px - var(--safe-top) - var(--safe-bottom));
  border-radius: 22px;
  padding: 10px;
  background:
    radial-gradient(80% 50% at 50% 45%, rgba(110, 40, 160, .35), transparent 70%),
    linear-gradient(180deg, #120a22, #07040d);
  border: 6px solid #1b1622;
  box-shadow:
    0 0 0 2px #3a3343,
    inset 0 0 40px rgba(0, 0, 0, .9),
    0 20px 60px rgba(0, 0, 0, .8);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
/* scanlines */
.screen::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px);
  border-radius: 16px;
}

/* ---------- Marquee ---------- */
.marquee {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #1d0a2a, #0c0414);
  border: 3px solid var(--pink);
  box-shadow: 0 0 12px var(--pink), inset 0 0 14px rgba(255, 45, 149, .5);
}
.marquee-title {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .35em;
  font-family: var(--display);
  font-size: clamp(22px, 6vw, 46px);
  line-height: 1;
  letter-spacing: .5px;
}
.mt-1 { color: #fff; text-shadow: 3px 3px 0 #000; }
.mt-2 {
  color: var(--pink);
  text-shadow: 0 0 10px var(--pink), 3px 3px 0 #000;
  animation: flicker 4s infinite;
}
.roundel {
  flex: none;
  width: 58px; height: 58px;
  border-radius: 50%;
  display: grid; place-items: center; align-content: center;
  font-family: var(--display);
  line-height: .85;
  text-align: center;
  background: repeating-radial-gradient(circle, #ff2d95 0 3px, #3a0d6b 3px 6px, #19e3ff 6px 8px, #3a0d6b 8px 11px);
  box-shadow: 0 0 10px #ff2d95;
}
.roundel span { font-size: 12px; color: #ffe600; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
.roundel b { font-size: 22px; color: #fff; text-shadow: 2px 2px 0 #000; }
.menu-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-content: center; gap: 5px;
  background: #24112f;
  border: 2px solid rgba(255,255,255,.25);
}
.menu-btn span { display: block; width: 20px; height: 3px; border-radius: 2px; background: #fff; }

/* ---------- Score strip ---------- */
.scores {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
}
.score {
  position: relative;
  border-radius: 14px;
  padding: 6px 10px 8px;
  background: linear-gradient(180deg, #d9dde6, #8a92a3);
  border: 3px solid var(--team);
  box-shadow: 0 0 10px var(--team);
  color: #111;
  text-align: center;
  transition: transform .2s;
}
.score.on { transform: translateY(-2px); box-shadow: 0 0 22px var(--team), 0 0 4px #fff; }
.score.on::before {
  content: "";
  position: absolute; left: 50%; top: -9px;
  width: 0; height: 0;
  margin-left: -8px;
  border: 8px solid transparent;
  border-bottom: 0;
  border-top-color: var(--team);
  transform: rotate(180deg);
  filter: drop-shadow(0 0 4px var(--team));
}
.score-name {
  font-family: var(--display);
  font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.led {
  margin-top: 3px;
  border-radius: 9px;
  background: #050a10;
  border: 2px solid #2b3240;
  font-family: var(--led);
  font-weight: 700;
  font-size: clamp(22px, 6vw, 34px);
  color: var(--team);
  text-shadow: 0 0 8px var(--team);
  padding: 2px 0;
}

/* ---------- Main view ---------- */
#view { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.bar {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px;
}
.bar h1 {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(20px, 5vw, 30px);
  line-height: 1.05;
  color: var(--team, #fff);
  text-shadow: 0 0 10px var(--team, transparent), 2px 2px 0 #000;
}
.back {
  flex: none;
  height: 44px; padding: 0 14px;
  border-radius: 12px;
  background: #24112f;
  border: 2px solid rgba(255,255,255,.25);
  font-family: var(--display);
  font-size: 18px;
}
.pill {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--led);
  font-weight: 700;
  font-size: 14px;
  color: var(--yellow);
  background: #050a10;
  border: 2px solid #2b3240;
  text-shadow: 0 0 6px var(--yellow);
}

/* ---------- Tiles (categories and sub-categories) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid.cats { grid-template-columns: repeat(4, 1fr); } }

.tile {
  --a: #ff2d95; --b: #6a00ff; --c: #ffe600; --t: #fff;
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  padding: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, transparent 0 22%, rgba(0,0,0,.28) 70%),
    repeating-conic-gradient(from 0deg at 50% 42%, var(--a) 0 10deg, var(--b) 10deg 20deg);
  border: 4px solid #fff;
  box-shadow:
    0 0 0 3px #000,
    0 6px 0 3px rgba(0,0,0,.6),
    0 0 18px var(--a);
  transition: transform .12s;
}
.tile::before {
  /* glossy app-icon shine */
  content: "";
  position: absolute; left: -10%; right: -10%; top: -40%;
  height: 75%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0));
  pointer-events: none;
}
.tile:active { transform: scale(.96); }
.tile .icon {
  font-size: clamp(34px, 11vw, 58px);
  line-height: 1;
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,.7));
}
.tile .name {
  position: relative;
  margin-top: 6px;
  font-family: var(--display);
  font-size: clamp(19px, 5.4vw, 30px);
  line-height: .98;
  color: var(--t);
  -webkit-text-stroke: 6px #000;
  paint-order: stroke fill;
  text-shadow: 3px 4px 0 #000;
  transform: rotate(-4deg);
}
.tile:nth-child(even) .name { transform: rotate(3deg); }
.tile .left {
  position: absolute; right: 8px; top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--led);
  font-weight: 700;
  font-size: 12px;
  color: var(--c);
  background: rgba(0,0,0,.75);
  text-shadow: 0 0 5px var(--c);
}
.tile.done { filter: grayscale(1) brightness(.45); pointer-events: none; }
.tile.wide { grid-column: 1 / -1; aspect-ratio: auto; min-height: 96px; flex-direction: row; gap: 12px; }
.tile.wide .name { margin: 0; }
.grid.subs .tile { aspect-ratio: auto; min-height: 120px; }
.grid.subs .tile .name { font-size: clamp(18px, 4.8vw, 26px); -webkit-text-stroke-width: 5px; }

/* category colour sets */
.c1  { --a: #ff2d95; --b: #7a0dd6; --c: #ffe600; --t: #ffe600; }
.c2  { --a: #ff6a00; --b: #c40024; --c: #ffe600; --t: #fff; }
.c3  { --a: #e8b04a; --b: #7a4a14; --c: #fff3c4; --t: #fff3c4; }
.c4  { --a: #ffd400; --b: #5b2bd6; --c: #ffd400; --t: #ffd400; }
.c5  { --a: #c03bff; --b: #2a0a6b; --c: #19e3ff; --t: #fff; }
.c6  { --a: #e8001c; --b: #0b8a2e; --c: #fff; --t: #fff; }
.c7  { --a: #19e3ff; --b: #0047ff; --c: #ffe600; --t: #ffe600; }
.c8  { --a: #2a6bff; --b: #ff1f4b; --c: #fff; --t: #fff; }
.c9  { --a: #7dff2a; --b: #0a7a52; --c: #ffe600; --t: #fff; }
.c10 { --a: #ffe600; --b: #ff5a00; --c: #fff; --t: #fff; }
.c0  { --a: #ff2d95; --b: #19e3ff; --c: #ffe600; --t: #ffe600; }
.c0 { background:
  radial-gradient(circle at 50% 50%, transparent 0 22%, rgba(0,0,0,.3) 80%),
  repeating-conic-gradient(from 0deg at 50% 50%, #ff2d95 0 12deg, #ffe600 12deg 24deg, #19e3ff 24deg 36deg, #7dff2a 36deg 48deg); }
.c0 .icon { animation: spin 3s linear infinite; }

/* ---------- Question ---------- */
.qcard {
  position: relative;
  border-radius: 20px;
  padding: 18px 16px 20px;
  background: linear-gradient(180deg, #1a0d2b, #0d0618);
  border: 3px solid var(--a, var(--cyan));
  box-shadow: 0 0 16px var(--a, var(--cyan)), inset 0 0 22px rgba(0,0,0,.8);
}
.qmeta {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  margin-bottom: 12px;
  font-family: var(--display);
  font-size: 16px;
  color: var(--a);
}
.qmeta .sub { color: #fff; opacity: .85; }
.qtext {
  margin: 0;
  font-family: var(--retro);
  font-weight: 400;
  font-size: clamp(21px, 5.6vw, 34px);
  line-height: 1.25;
}
.opts { display: grid; gap: 10px; }
@media (min-width: 760px) { .opts { grid-template-columns: 1fr 1fr; } }
.opt {
  --o: var(--pink);
  display: flex; align-items: center; gap: 12px;
  min-height: 62px;
  padding: 10px 14px 10px 10px;
  border-radius: 16px;
  text-align: left;
  font-family: var(--retro);
  font-size: clamp(18px, 4.8vw, 24px);
  line-height: 1.15;
  background: linear-gradient(180deg, color-mix(in srgb, var(--o) 30%, #140a20), #0d0618);
  border: 3px solid var(--o);
  box-shadow: 0 0 10px color-mix(in srgb, var(--o) 70%, transparent), 0 4px 0 #000;
  transition: transform .1s, opacity .3s, filter .3s;
}
.opt:active { transform: translateY(2px); }
.opt .key {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display);
  font-size: 24px;
  color: #000;
  background: var(--o);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.3), 0 0 8px var(--o);
}
.opt:nth-child(1) { --o: #ff2d95; }
.opt:nth-child(2) { --o: #19e3ff; }
.opt:nth-child(3) { --o: #ffe600; }
.opt:nth-child(4) { --o: #7dff2a; }
.opts.locked .opt { pointer-events: none; }
.opts.locked .opt.dim { opacity: .3; filter: grayscale(.8); }
.opt.right { --o: var(--green); animation: blink .35s steps(2) 4; }
.opt.wrong { --o: var(--red); }
.opt.right .key::after { content: ""; }

.answer {
  border-radius: 18px;
  padding: 12px 14px;
  background: #050a10;
  border: 3px solid var(--green);
  box-shadow: 0 0 14px var(--green);
  text-align: center;
}
.answer .lbl { font-family: var(--display); font-size: 15px; color: #9fb3c8; }
.answer .val {
  font-family: var(--display);
  font-size: clamp(26px, 7vw, 42px);
  line-height: 1.05;
  color: var(--green);
  text-shadow: 0 0 10px var(--green);
}
.answer .acc { margin-top: 6px; font-size: 16px; color: #cfe; }

.actions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-top: auto; }
.actions.one { grid-template-columns: 1fr; }
.big {
  min-height: 64px;
  padding: 10px 14px;
  border-radius: 18px;
  font-family: var(--display);
  font-size: clamp(22px, 6vw, 30px);
  line-height: 1;
  color: #000;
  background: linear-gradient(180deg, color-mix(in srgb, var(--b, var(--yellow)) 100%, #fff 0%), color-mix(in srgb, var(--b, var(--yellow)) 70%, #000));
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px #000, 0 6px 0 3px rgba(0,0,0,.6), 0 0 16px var(--b, var(--yellow));
  transition: transform .1s;
}
a.big { display: grid; place-items: center; text-align: center; text-decoration: none; }
.big:active { transform: translateY(3px); }
.big.go   { --b: var(--yellow); }
.big.yes  { --b: var(--green); }
.big.no   { --b: var(--red); color: #fff; text-shadow: 2px 2px 0 #000; }
.big.cyan { --b: var(--cyan); }
.big.pink { --b: var(--pink); color: #fff; text-shadow: 2px 2px 0 #000; }
.big.pulse { animation: pulse 1.2s ease-in-out infinite; }

.verdict {
  font-family: var(--display);
  text-align: center;
  font-size: clamp(32px, 10vw, 60px);
  line-height: 1;
  -webkit-text-stroke: 7px #000;
  paint-order: stroke fill;
  text-shadow: 4px 5px 0 #000;
  animation: pop .35s cubic-bezier(.3, 1.8, .6, 1);
}
.verdict.yes { color: var(--green); }
.verdict.no { color: var(--red); }
.link {
  align-self: center;
  padding: 8px 14px;
  font-family: var(--retro);
  font-size: 16px;
  color: #c9b8ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.row { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; }

/* ---------- Hand-over, setup and scores ---------- */
.center {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  text-align: center;
}
.shout {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(44px, 14vw, 96px);
  line-height: .95;
  color: var(--team);
  -webkit-text-stroke: 8px #000;
  paint-order: stroke fill;
  text-shadow: 0 0 26px var(--team), 5px 6px 0 #000;
  animation: pop .45s cubic-bezier(.3, 1.8, .6, 1), wobble 2.4s ease-in-out .5s infinite;
}
.shout small { display: block; font-size: .45em; color: #fff; text-shadow: 3px 3px 0 #000; }
.center .big { width: min(100%, 420px); }

.form { display: flex; flex-direction: column; gap: 14px; }
.form h2, .sheet h2, .sub-h {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 26px;
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255, 230, 0, .6), 2px 2px 0 #000;
}
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button {
  min-height: 56px;
  border-radius: 14px;
  font-family: var(--display);
  font-size: 22px;
  background: #1a0d2b;
  border: 3px solid #4b3a63;
}
.seg button.on { background: var(--pink); border-color: #fff; box-shadow: 0 0 14px var(--pink); }
.field { display: flex; align-items: center; gap: 10px; }
.swatch { flex: none; width: 18px; height: 44px; border-radius: 6px; background: var(--team); box-shadow: 0 0 10px var(--team); }
.field input {
  flex: 1; min-width: 0;
  height: 54px;
  padding: 0 14px;
  border-radius: 14px;
  border: 3px solid var(--team);
  background: #050a10;
  color: #fff;
  font-family: var(--display);
  font-size: 22px;
  -webkit-user-select: text; user-select: text;
}
.field input:focus { outline: none; box-shadow: 0 0 14px var(--team); }
.stats { font-family: var(--led); font-weight: 700; font-size: 14px; color: var(--cyan); text-align: center; }

.board { display: flex; flex-direction: column; gap: 10px; }
.board-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #120a20;
  border: 3px solid var(--team);
  box-shadow: 0 0 10px var(--team);
}
.board-row .who { flex: 1; font-family: var(--display); font-size: 24px; color: var(--team); }
.board-row .led { margin: 0; min-width: 76px; text-align: center; }
.adj {
  width: 44px; height: 44px;
  border-radius: 12px;
  font-family: var(--display);
  font-size: 26px;
  background: #24112f;
  border: 2px solid rgba(255,255,255,.3);
}
.crown { font-size: 64px; animation: wobble 2s ease-in-out infinite; }

/* menu sheet */
.sheet {
  position: fixed; inset: 0;
  z-index: 10;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(5, 3, 8, .8);
  backdrop-filter: blur(4px);
}
.sheet-card {
  width: min(100%, 420px);
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #1d0a2a, #0c0414);
  border: 3px solid var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
}
.sheet-card button {
  min-height: 54px;
  border-radius: 14px;
  font-family: var(--display);
  font-size: 21px;
  background: #24112f;
  border: 2px solid rgba(255,255,255,.25);
}
.sheet-card button.ghost { background: none; border-color: transparent; color: #c9b8ff; }
.sheet-card button.danger { border-color: var(--red); color: #ffb3ba; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i {
  position: absolute; top: -20px;
  width: 10px; height: 16px;
  animation: fall linear forwards;
}

@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .4; } 95% { opacity: 1; } 96% { opacity: .5; } }
@keyframes blink { 50% { filter: brightness(1.8); } }
@keyframes pulse { 50% { transform: scale(1.03); filter: brightness(1.15); } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
