/* Styled after arenabreakoutinfinite.com: RefrigeratorDeluxe, rust red #ca4d31 on black,
   flat UI (no gradients or blur on text), grey rule titles with a red marker, and red corner
   brackets on the selected item. Phone first, safe-area aware like abi-tier-maker. */
@font-face {
  font-family: "RefrigeratorDeluxe";
  src: url("/fonts/RefrigeratorDeluxe-regular.otf") format("opentype");
  font-display: swap;
}

:root {
  --accent: #ca4d31;
  --accent-dark: #a34132;
  --right: #3ba55d;
  --wrong: #ca4d31;
  --text: #e6e6e6;
  --text-dim: rgba(209, 209, 209, 0.8);
  --text-mute: #9b9b9b;
  --line: rgba(155, 155, 155, 0.3);
  --tile: rgba(0, 0, 0, 0.55);
  --tile-hover: rgba(77, 77, 77, 0.55);
  --font: "RefrigeratorDeluxe", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: #000;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  letter-spacing: 0.02em;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { cursor: default; }

#app {
  position: relative;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
}

/* Game art behind a heavy black overlay, like the site's section backgrounds */
/* Blurred so the key art's own text (logo, season line) never competes with the quiz. */
.bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}
.bg::before {
  content: "";
  position: absolute;
  inset: -24px;
  background: url("/img/banner.jpg") center / cover no-repeat;
  filter: blur(8px);
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
}

/* ---------- header ---------- */
/* logo | player pill (centred) | hud */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  flex: none;
  margin-bottom: 10px;
}
.logo { height: 34px; width: auto; justify-self: start; }
.hud { grid-column: 3; justify-self: end; display: flex; gap: 8px; font-size: 15px; text-transform: uppercase; white-space: nowrap; }
.hud-item b { color: var(--text-mute); font-weight: normal; margin-right: 3px; }
.hud-item span { color: var(--text); }
.hud-item b span { color: inherit; }
.hud .long { display: none; }

.user-pill {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 36vw;
  height: 34px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line);
}
.user-avatar {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent) center / cover no-repeat;
  display: grid;
  place-items: center;
  font-size: 15px;
  color: #fff;
}
.user-name {
  font-size: 17px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

main { flex: 1; min-height: 0; position: relative; }

/* ---------- screens ---------- */
.screen { display: none; height: 100%; overflow-y: auto; }
.screen.on { display: flex; flex-direction: column; animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel { width: 100%; max-width: 620px; margin: auto; padding: 8px 0 16px; }
.center { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* ---------- section title (site .sec-title) ---------- */
.sec-title {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding-bottom: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.sec-title::before { /* grey tick under the start of the rule */
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 36px;
  height: 3px;
  background: #85898c;
}
.sec-title h2 {
  position: relative;
  font-size: 30px;
  font-weight: normal;
  line-height: 1;
  color: var(--text-dim);
  text-transform: uppercase;
}
.sec-title h2::before { /* red triangle */
  content: "";
  position: absolute;
  left: 100%;
  margin-left: 10px;
  top: 0.25em;
  border-right: 8px solid var(--accent);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.sec-title h2::after { /* marker strip */
  content: "";
  position: absolute;
  left: 100%;
  bottom: 0.2em;
  margin-left: 22px;
  width: 50px;
  height: 6px;
  background: url("/img/titlemarker.png") left center / 100% auto no-repeat;
}

.lead { font-size: 19px; line-height: 1.3; color: var(--text); margin-bottom: 16px; }
.dim { color: var(--text-mute); }
.small { font-size: 14px; }
.hint { font-size: 17px; margin: -4px 0 14px; }
.accent { color: var(--accent) !important; }

.rules { margin-bottom: 22px; }
.rules dt {
  font-size: 15px;
  color: var(--text-mute);
  text-transform: uppercase;
  margin-top: 12px;
}
.rules dd { font-size: 18px; line-height: 1.3; color: var(--text); }

/* ---------- main button (site's painted red button) ---------- */
.btn-main {
  display: block;
  width: 100%;
  max-width: 320px;
  height: 64px;
  margin: 0 auto;
  background: url("/img/btn.png") center / 100% 100% no-repeat;
  font-size: 28px;
  text-transform: uppercase;
  color: #fff;
  transition: transform 0.08s, filter 0.15s;
}
.btn-main > span { position: relative; left: 14px; display: inline-flex; align-items: center; gap: 12px; } /* clears the >>> chevrons */
.btn-main:hover:not(:disabled) { background-image: url("/img/btn-act.png"); filter: brightness(1.08); }
.btn-main:active:not(:disabled) { transform: scale(0.98); }
.btn-main:disabled { opacity: 0.5; }

/* ---------- audio players ----------
   Understated HUD tile: thin corner ticks (no full frame), round play button with a progress ring
   that sweeps red while the sound plays, rounded waveform with a playhead. Motion is GSAP (app.js). */
.players { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 20px; }
.player {
  --tick: rgba(255, 255, 255, 0.28);
  position: relative;
  display: grid;
  grid-template-columns: 60px 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 16px 14px 14px;
  background:
    linear-gradient(var(--tick), var(--tick)) top left / 12px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) top left / 1px 12px no-repeat,
    linear-gradient(var(--tick), var(--tick)) top right / 12px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) top right / 1px 12px no-repeat,
    linear-gradient(var(--tick), var(--tick)) bottom left / 12px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) bottom left / 1px 12px no-repeat,
    linear-gradient(var(--tick), var(--tick)) bottom right / 12px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) bottom right / 1px 12px no-repeat,
    rgba(8, 8, 8, 0.62);
  transition: --tick 0.2s;
}
.player.playing { --tick: var(--accent); background-color: rgba(202, 77, 49, 0.07); }

.pl-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.2s;
}
.pl-btn:hover:not(:disabled) { background: rgba(202, 77, 49, 0.14); }
.pl-btn:disabled { opacity: 0.35; }
.pl-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.2); stroke-width: 1.5; transition: stroke 0.2s; }
.ring-prog {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 175.93;  /* 2 * PI * 28 */
  stroke-dashoffset: 175.93;
}
.pl-btn:hover:not(:disabled) .ring-track { stroke: rgba(202, 77, 49, 0.55); }
.pl-ico { position: relative; width: 22px; height: 22px; fill: #f2f2f2; }
.ico-play { margin-left: 3px; }
.ico-pause { display: none; }
.player.playing .ico-play { display: none; }
.player.playing .ico-pause { display: block; }
.player.playing .pl-btn { background: rgba(202, 77, 49, 0.16); }

.pl-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pl-head { display: flex; align-items: center; gap: 10px; }
.pl-tag {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  padding: 3px 5px 2px;
  color: var(--accent);
  border: 1px solid rgba(202, 77, 49, 0.5);
}
.pl-label { font-size: 22px; line-height: 1; text-transform: uppercase; letter-spacing: 0.04em; }
.pl-time {
  margin-left: auto;
  font-size: 14px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pl-time i { font-style: normal; opacity: 0.4; margin: 0 4px; }
.pl-cur { color: var(--text); }
.pl-wave { display: block; width: 100%; height: 30px; cursor: pointer; }

/* ---------- answer options: a proper pick-one question ---------- */
.opt-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 18px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.opt-head .dim { font-size: 14px; }
.options { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 16px; }
.opt {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr 22px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 14px 8px 10px;
  text-align: left;
  color: var(--text);
  background: var(--tile);
  border: 1px solid var(--line);
  transition: background 0.12s, border-color 0.12s, opacity 0.2s;
}
.opt::before, .opt::after { /* the site's red corner brackets */
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 14px;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.opt::before { left: -1px; border-right: none; }
.opt::after { right: -1px; border-left: none; }
.opt-key { /* A B C D */
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 19px;
  color: var(--text-mute);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.opt-name { font-size: 20px; line-height: 1.15; text-transform: uppercase; }
.opt-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-mute);
  display: grid;
  place-items: center;
  transition: border-color 0.12s;
}
.opt-radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.12s;
}
.opt:hover:not(:disabled) { background: var(--tile-hover); }
.opt:hover:not(:disabled)::before, .opt:hover:not(:disabled)::after { opacity: 0.6; }
.opt.selected { background: rgba(202, 77, 49, 0.14); border-color: rgba(202, 77, 49, 0.6); }
.opt.selected::before, .opt.selected::after { opacity: 1; }
.opt.selected .opt-key { background: var(--accent); color: #fff; border-color: var(--accent); }
.opt.selected .opt-radio { border-color: var(--accent); }
.opt.selected .opt-radio::after { transform: scale(1); }
.opt:disabled { cursor: default; }

.opt.is-right { background: rgba(59, 165, 93, 0.2); border-color: var(--right); }
.opt.is-right::before, .opt.is-right::after { border-color: var(--right); opacity: 1; }
.opt.is-right .opt-key { background: var(--right); color: #fff; border-color: var(--right); }
.opt.is-right .opt-radio { border-color: var(--right); }
.opt.is-right .opt-radio::after { background: var(--right); transform: scale(1); }
.opt.is-wrong { background: rgba(202, 77, 49, 0.25); border-color: var(--wrong); }
.opt.is-wrong::before, .opt.is-wrong::after { border-color: var(--wrong); opacity: 1; }
.opt.faded { opacity: 0.4; }

.btn-main.lock:disabled { opacity: 0.35; filter: grayscale(0.6); }
.btn-main.lock:disabled:not(.loading) > span { font-size: 0.8em; } /* "Play a sound first" fits on phones */

/* Checking state: stays fully lit with a spinner, so it never feels frozen */
.lock-spin {
  display: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn-main.lock.loading { opacity: 1; filter: none; cursor: progress; }
.btn-main.lock.loading .lock-spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- reveal overlay ---------- */
.reveal {
  position: fixed;
  inset: 0;
  z-index: 5;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  animation: fadein 0.2s ease;
}
.reveal-box {
  position: relative;
  width: min(360px, 100%);
  padding: 22px 20px 18px;
  text-align: center;
  background: #000;
}
.reveal-box::before { /* inner hairline frame, like the site's dialogs */
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(65, 66, 68, 0.6);
  pointer-events: none;
}
.reveal-tag { font-size: 40px; text-transform: uppercase; line-height: 1; margin-bottom: 10px; }
.reveal.right .reveal-tag { color: var(--right); }
.reveal.wrong .reveal-tag { color: var(--wrong); }
.reveal-img { width: 150px; height: 150px; object-fit: contain; margin: 4px auto 8px; display: block; }
.reveal-name { font-size: 22px; text-transform: uppercase; margin-bottom: 14px; }
.countdown { height: 3px; background: var(--line); margin: 0 10px 8px; overflow: hidden; }
.countdown i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.countdown i.run { animation: shrink var(--dur, 3s) linear forwards; }
@keyframes shrink { to { transform: scaleX(0); } }

/* ---------- result ---------- */
.result { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--tile);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
}
.stat-label { font-size: 15px; color: var(--text-mute); text-transform: uppercase; }
.stat-value { font-size: 36px; line-height: 1; }

/* ---------- loader ---------- */
.loader { display: flex; gap: 6px; }
.loader i { width: 10px; height: 10px; background: var(--accent); animation: dot 0.9s infinite alternate; }
.loader i:nth-child(2) { animation-delay: 0.2s; }
.loader i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { from { opacity: 0.2; } to { opacity: 1; } }
#loading-text { text-transform: uppercase; font-size: 18px; }


/* ---------- secondary button ---------- */
.btn-ghost {
  display: block;
  margin: 14px auto 0;
  padding: 10px 18px;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: #fff; border-color: var(--accent); }
.btn-ghost.small { margin: 0; padding: 6px 12px; font-size: 15px; }

/* ---------- staff sound library ---------- */
.panel.wide { max-width: 980px; }
.staff-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -4px 0 14px; }
.staff-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.staff-card {
  padding: 12px;
  background: var(--tile);
  border: 1px solid var(--line);
}
.staff-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.staff-head .staff-sounds { margin-left: auto; }
.staff-id { font-size: 13px; color: var(--text-mute); letter-spacing: 0.06em; }
.staff-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.staff-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
}
.staff-item img { width: 44px; height: 44px; object-fit: contain; }
.staff-item span { font-size: 12px; line-height: 1.15; text-transform: uppercase; color: var(--text-dim); }
.staff-sounds { display: flex; gap: 6px; }
.staff-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 4px;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.staff-play::before {
  content: "";
  border-left: 8px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.staff-play:hover:not(:disabled) { border-color: var(--accent); }
.staff-play.playing { color: #fff; background: var(--accent); border-color: var(--accent); }
.staff-play:disabled { opacity: 0.4; }

/* ---------- wider screens (PC client) ---------- */
@media (min-width: 560px) {
  .hud { gap: 14px; font-size: 16px; }
  .hud .long { display: inline; }
  .hud .short { display: none; }
  .user-pill { max-width: 40vw; }
}
@media (min-width: 720px) {
  .logo { height: 50px; }
  .hud { font-size: 19px; gap: 20px; }
  .user-pill { height: 38px; }
  .user-name { font-size: 19px; }
  .sec-title h2 { font-size: 40px; }
  .players { grid-template-columns: 1fr 1fr; gap: 10px; }
  .options { grid-template-columns: 1fr 1fr; gap: 10px; }
  .opt { min-height: 62px; }
  .opt-name { font-size: 21px; }
}
