/* Smarter Than A Crow: black and white, deadpan, one shiny accent. Mobile-first. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

:root {
  --bg: #000;
  --fg: #fff;
  --panel: #0d0d0d;
  --line: #262626;
  --muted: #8c8c8c;
  --dim: #3a3a3a;
  --gold: #f5c542;
  --gold-soft: rgba(245, 197, 66, 0.14);
  --red: #ff5c5c;
  --red-soft: rgba(255, 92, 92, 0.12);
  --green: #5ee08a;
  --amber: #ffb547;
  --radius: 14px;
  --gutter: max(16px, env(safe-area-inset-left));
  color-scheme: dark;
}

html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
  overflow-x: hidden;
}

#app { width: 100%; }

.view {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.view[hidden] { display: none; }

.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.h2 { font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.error { color: var(--red); font-size: 15px; text-align: center; }
.error[hidden] { display: none; }

/* --- Buttons + inputs --- */
.btn {
  appearance: none;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.btn-primary { background: var(--fg); color: var(--bg); }
.btn[hidden] { display: none; }

.link-btn {
  appearance: none;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 8px;
  align-self: center;
}
.link-btn:hover { color: var(--fg); }

.input {
  width: 100%;
  min-width: 0;
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--dim);
  border-radius: 12px;
  color: var(--fg);
  font: inherit;
  font-size: 18px; /* ≥16px so iOS doesn't zoom */
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s ease;
}
.input:focus { border-color: var(--fg); }
.input::placeholder { color: #5c5c5c; }

.field-label { font-size: 13px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* --- Banner (connection state) --- */
.banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  background: var(--amber);
  color: #000;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  padding-top: max(8px, env(safe-area-inset-top));
}
.banner[hidden] { display: none; }

/* --- Home --- */
#view-home { justify-content: center; }
.home-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 8px; }
.wordmark { font-size: clamp(36px, 11vw, 54px); line-height: 0.95; letter-spacing: -0.02em; font-weight: 800; text-transform: uppercase; }
.tagline { color: var(--muted); font-size: 17px; }
.home-actions { display: flex; flex-direction: column; gap: 14px; }
.home-actions > .btn { width: 100%; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 10px; }
.input-code { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 700; text-align: center; flex: 1; }
.input-code::placeholder { letter-spacing: 0.3em; }

.rules { border-top: 1px solid var(--line); padding-top: 14px; font-size: 15px; }
.rules summary { cursor: pointer; color: var(--muted); }
.rules ul { margin-top: 10px; padding-left: 18px; display: grid; gap: 6px; color: #cfcfcf; }

.small { font-size: 13px; }

/* --- Lobby --- */
.lobby-code-wrap { text-align: center; padding: 12px 0 4px; }
.room-code {
  font-size: clamp(64px, 24vw, 112px);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  margin: 6px 0 4px;
  padding-left: 0.12em; /* balance the trailing letter-spacing */
  font-variant-numeric: tabular-nums;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.player-list { list-style: none; display: flex; flex-direction: column; }
.player-list li { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 18px; }
.player-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--dim); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.tag-you { color: var(--fg); border-color: var(--fg); }
.conn { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.conn.off { background: var(--dim); }
.kick { appearance: none; border: 1px solid var(--dim); background: none; color: var(--muted); border-radius: 999px; width: 32px; height: 32px; font-size: 16px; cursor: pointer; flex: none; }
.kick:hover { color: var(--red); border-color: var(--red); }
.lobby-auto { text-align: center; font-size: 15px; color: var(--amber); font-variant-numeric: tabular-nums; }
.lobby-auto[hidden] { display: none; }
.lobby-auto.go { color: var(--green); }

/* Host settings: duel length stepper */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.setting-text { display: grid; gap: 2px; min-width: 0; }
.setting-label { font-weight: 700; font-size: 16px; }
.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.step { appearance: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--dim); background: var(--bg); color: var(--fg); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.step:disabled { opacity: 0.3; cursor: default; }
.step[hidden] { display: none; }
.setting[hidden] { display: none; }
label.setting { cursor: pointer; }

/* On/off switch (Open to randoms) */
.switch { position: relative; flex: none; width: 52px; height: 30px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--dim); transition: background 0.15s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--fg); transition: transform 0.15s ease; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--fg); outline-offset: 2px; }

.step-value { min-width: 2.2ch; text-align: center; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }

.lobby-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.lobby-footer > .btn { width: 100%; }

/* --- Game bar --- */
.view-game { gap: 14px; }
.game-bar { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.round-label { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.round-label.hot { color: var(--red); }
.lives { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
/* Pixel heart (7 x 6 grid), drawn with clip-path so it matches the pixel crow. */
.heart {
  display: inline-block;
  width: 21px;
  height: 18px;
  background: var(--red);
  clip-path: polygon(14.29% 0, 42.86% 0, 42.86% 16.67%, 57.14% 16.67%, 57.14% 0, 85.71% 0, 85.71% 16.67%, 100% 16.67%,
    100% 50%, 85.71% 50%, 85.71% 66.67%, 71.43% 66.67%, 71.43% 83.33%, 57.14% 83.33%, 57.14% 100%, 42.86% 100%,
    42.86% 83.33%, 28.57% 83.33%, 28.57% 66.67%, 14.29% 66.67%, 14.29% 50%, 0 50%, 0 16.67%, 14.29% 16.67%);
}
.heart.lost { background: var(--dim); }
.ghost-label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #cfd6ff; border: 1px dashed var(--muted); border-radius: 999px; padding: 3px 10px; }

.ghost-badge {
  align-self: flex-start;
  font-size: 14px;
  border: 1px dashed var(--muted);
  color: #d6d6d6;
  border-radius: 999px;
  padding: 5px 12px;
}
.ghost-badge[hidden] { display: none; }

.prompt { font-size: clamp(26px, 7.4vw, 36px); line-height: 1.12; font-weight: 800; letter-spacing: -0.01em; margin-top: 6px; overflow-wrap: anywhere; }
.prompt-small { font-size: 20px; margin-top: 0; color: #d9d9d9; }

.timer { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--fg); border-radius: inherit; transform-origin: left center; }
.timer-fill.low { background: var(--red); }
.timer-secs { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -6px; }

.answer-form { display: flex; gap: 10px; }
.answer-form[hidden] { display: none; }
.input-answer { flex: 1; font-size: 20px; }
.answer-form .btn { flex: none; padding-left: 18px; padding-right: 18px; }
.feedback { min-height: 22px; font-size: 16px; color: var(--muted); }
.feedback.bad { color: var(--red); }
.feedback.hint { color: var(--amber); }
.shake { animation: shake 0.32s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.locked {
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(94, 224, 138, 0.07);
  animation: pop 0.25s ease;
}
.locked[hidden] { display: none; }
.locked .eyebrow { color: var(--green); }
.locked-name { font-size: 26px; font-weight: 800; margin-top: 2px; overflow-wrap: anywhere; }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

.answered { margin-top: auto; padding-top: 8px; display: grid; gap: 10px; }
.dots { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.dots li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 6px;
  max-width: 100%;
}
.dots li .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--dim); flex: none; transition: background 0.2s ease, border-color 0.2s ease; }
.dots li.done { color: var(--fg); border-color: var(--dim); }
.dots li.done .dot { background: var(--fg); border-color: var(--fg); }
.dots li.ghost { opacity: 0.6; }
.dots li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }

/* --- Duel board --- */
.duel-board { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel); }
.duel-board[hidden] { display: none; }
.duelist { display: grid; gap: 2px; min-width: 0; }
.duelist:last-child { text-align: right; }
.duelist .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duelist .avg { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.duelist .pips { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.duelist.lead .avg { color: var(--gold); }
.duel-vs { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }

/* --- Reveal --- */
.reveal-banner { border-radius: var(--radius); padding: 14px 16px; font-weight: 700; text-align: center; font-size: 17px; animation: pop 0.25s ease; }
.reveal-banner[hidden] { display: none; }
.reveal-banner.saved { background: var(--gold-soft); border: 1px solid var(--gold); color: var(--gold); }
.reveal-banner.duel { background: var(--panel); border: 1px solid var(--fg); }
.groups { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--panel);
  display: grid;
  gap: 8px;
  animation: rise 0.35s ease both;
}
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.group-answer { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.niche { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: #d0d0d0; }
.niche small { font-weight: 400; color: var(--muted); }
.group-players { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 14px; border-radius: 999px; padding: 3px 10px; background: #1a1a1a; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.me { outline: 1px solid var(--fg); }
.chip .loss { color: var(--red); font-weight: 700; margin-left: 4px; }
.chip.ghost { background: none; border: 1px dashed var(--dim); color: #b8b8b8; }
.group.collision { border-color: var(--red); background: var(--red-soft); }
.group.collision .group-answer::after { content: "  collision"; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--red); font-weight: 700; vertical-align: middle; }
.group.none { border-style: dashed; }
.group.none .group-answer { color: var(--muted); font-weight: 700; }
.group.shiny { border-color: var(--gold); background: var(--gold-soft); }
.group.shiny .niche { color: var(--gold); }
.common { font-size: 14px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Shinies: crows hoard shiny things. ≥90% niche gets the treatment. */
.shiny-text, .group.shiny .group-answer {
  background: linear-gradient(100deg, var(--gold) 20%, #fff6cf 40%, var(--gold) 60%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }

.next-bar { height: 3px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: auto; }
.next-fill { height: 100%; width: 0; background: var(--muted); }

/* --- Duel intro --- */

/* --- Game over --- */
.over-title { font-size: clamp(30px, 9vw, 44px); font-weight: 800; text-align: center; line-height: 1.1; overflow-wrap: anywhere; }
.podiums { display: grid; gap: 14px; }
.podium-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--panel); display: grid; gap: 10px; }
.podium { list-style: none; display: grid; gap: 2px; }
.podium li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.podium li:last-child { border-bottom: 0; }
.podium .rank { font-size: 20px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.podium .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .stat { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.podium li.top .nm { font-weight: 800; }
.podium li.top .rank { color: var(--gold); font-weight: 800; }
.podium li.me .nm::after { content: " (you)"; color: var(--muted); font-weight: 400; }

@media (min-width: 720px) {
  .podiums { grid-template-columns: 1fr 1fr; }
  #view-over { max-width: 760px; }
}

/* --- Pixel crow --- */
.crow-slot { position: relative; }
.crow-perch { display: flex; align-items: flex-end; min-height: 64px; }
.crow-center { justify-content: center; }
.crow { position: relative; width: 64px; height: 64px; flex: none; }
.crow-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.crow-big .crow { width: 112px; height: 112px; }
.crow-referee .crow { width: 80px; height: 80px; }
.crow-referee { margin-top: 40px; } /* room for its speech bubble below the DUEL title */
.crow.ghost .crow-canvas { opacity: 0.6; animation: ghostFloat 2.4s ease-in-out infinite; filter: drop-shadow(0 0 6px rgba(170, 190, 255, 0.55)); }
@keyframes ghostFloat { 50% { transform: translateY(-4px); } }

.crow-bubble {
  position: absolute;
  left: calc(100% + 8px);
  bottom: 38%;
  width: max-content;
  max-width: min(250px, 62vw);
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  padding: 7px 11px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(6px) scale(0.92);
  transform-origin: left bottom;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 2;
}
.crow-bubble::before {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 10px;
  border: 6px solid transparent;
  border-left: 0;
  border-right-color: var(--fg);
}
.crow-bubble.show { opacity: 1; transform: none; }
/* Centered crows (home, game over, referee) put the bubble above. */
.crow-big .crow-bubble, .crow-center .crow-bubble, .crow-referee .crow-bubble {
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translate(-50%, 6px) scale(0.92);
  transform-origin: center bottom;
  text-align: center;
}
.crow-big .crow-bubble.show, .crow-center .crow-bubble.show, .crow-referee .crow-bubble.show { transform: translate(-50%, 0); }
.crow-big .crow-bubble::before, .crow-center .crow-bubble::before, .crow-referee .crow-bubble::before {
  left: calc(50% - 6px);
  bottom: -6px;
  border: 6px solid transparent;
  border-bottom: 0;
  border-top-color: var(--fg);
}

/* Wide screens: the home crow's bubble goes beside it. Above it, it could run off the top of a
   short desktop window (the home page is taller than the window, so the crow sits at the top). */
@media (min-width: 600px) {
  .crow-big .crow-bubble {
    left: calc(100% + 10px);
    bottom: 45%;
    max-width: 260px;
    text-align: left;
    transform: translateY(6px) scale(0.92);
    transform-origin: left bottom;
  }
  .crow-big .crow-bubble.show { transform: none; }
  .crow-big .crow-bubble::before {
    left: -6px;
    bottom: 10px;
    border: 6px solid transparent;
    border-left: 0;
    border-right-color: var(--fg);
  }
}

/* --- Effects canvas --- */
.fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 20; }
.screen-shake { animation: screenShake 0.45s ease; }
@keyframes screenShake {
  0%, 100% { transform: none; }
  15% { transform: translate(-7px, 3px); }
  30% { transform: translate(6px, -4px); }
  45% { transform: translate(-5px, -2px); }
  60% { transform: translate(4px, 3px); }
  80% { transform: translate(-2px, 1px); }
}

/* --- Round stamp (duel question / sudden death) --- */
.view-game { position: relative; }
.round-stamp {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 5;
  font-size: clamp(34px, 11vw, 64px);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 1;
}
.round-stamp[hidden] { display: none; }
.round-stamp span { padding: 10px 18px; background: var(--bg); border: 3px solid currentColor; border-radius: 14px; animation: stampIn 1.2s cubic-bezier(.2, 1.6, .4, 1) both; }
.round-stamp.duel { color: var(--gold); }
.round-stamp.sudden { color: var(--red); }
.round-stamp.sudden span { animation: stampIn 1.4s cubic-bezier(.2, 1.6, .4, 1) both, heartbeat 0.7s ease-in-out 0.3s 2; }
@keyframes stampIn {
  0% { transform: scale(2.6) rotate(-10deg); opacity: 0; }
  25% { transform: scale(1) rotate(-4deg); opacity: 1; }
  80% { transform: scale(1) rotate(-4deg); opacity: 1; }
  100% { transform: scale(0.9) rotate(-4deg); opacity: 0; }
}
@keyframes heartbeat { 30% { transform: scale(1.12) rotate(-4deg); } 60% { transform: scale(0.98) rotate(-4deg); } }
.round-label.hot { animation: labelPulse 1s ease-in-out infinite; }
@keyframes labelPulse { 50% { opacity: 0.55; } }

/* --- Duel board extras --- */
.duelist .avg { transition: color 0.3s ease; }
.duel-board.hit { animation: boardHit 0.5s ease; }
@keyframes boardHit { 30% { transform: scale(1.03); box-shadow: 0 0 0 2px var(--gold); } }

/* --- Duel intro --- */
.view-duel { justify-content: center; align-items: center; text-align: center; overflow: hidden; gap: 16px; }
.duel-burst {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 160vmax;
  height: 160vmax;
  margin: -80vmax 0 0 -80vmax;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.06) 0deg 5deg, transparent 5deg 15deg);
  opacity: 0;
  pointer-events: none;
}
.duel-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.duel-eyebrow, .duel-rules, .duel-title, .crow-referee { position: relative; z-index: 1; }
.duel-stage { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; width: 100%; }
.duel-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 16px 8px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 2px solid;
  min-width: 0;
}
.duel-card.left { border-color: #5ab0ff; box-shadow: 0 0 28px rgba(90, 176, 255, 0.3); }
.duel-card.right { border-color: var(--red); box-shadow: 0 0 28px rgba(255, 92, 92, 0.3); }
.duel-av {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
  color: #000;
  border-radius: 6px;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.25), inset 4px 4px 0 rgba(255, 255, 255, 0.3);
}
.duel-card .nm { font-size: 18px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-card .stat { font-size: 12px; color: var(--muted); }
.duel-vs-big { font-size: 34px; font-weight: 900; color: var(--gold); text-shadow: 0 0 18px rgba(255, 214, 77, 0.6); }
.duel-title { font-size: clamp(72px, 27vw, 168px); font-weight: 900; letter-spacing: -0.04em; line-height: 0.9; display: flex; justify-content: center; }
.duel-title span { display: inline-block; text-shadow: 0 0 24px rgba(255, 92, 92, 0.7), 4px 4px 0 #6a1010; }
.duel-rules { font-size: 15px; }

/* The sequence (5 s phase): cards slide in, clash at ~0.85 s, VS stamps, letters drop, rules. */
.view-duel.play .duel-card.left { animation: slideL 0.6s cubic-bezier(.2, .9, .3, 1.25) 0.2s both, clashL 0.3s ease-out 0.85s; }
.view-duel.play .duel-card.right { animation: slideR 0.6s cubic-bezier(.2, .9, .3, 1.25) 0.2s both, clashR 0.3s ease-out 0.85s; }
.view-duel.play .duel-vs-big { animation: stamp 0.5s cubic-bezier(.2, 1.8, .4, 1) 0.9s both; }
.view-duel.play .duel-flash { animation: flash 0.5s ease-out 0.85s both; }
.view-duel.play .duel-burst { animation: burstIn 0.6s ease-out 0.85s both, spin 14s linear 0.85s infinite; }
.view-duel.play .duel-title span { animation: drop 0.45s cubic-bezier(.2, 1.7, .4, 1) calc(1.3s + var(--i) * 0.09s) both; }
.view-duel.play .duel-rules { animation: fadeUp 0.5s ease 2.1s both; }
.view-duel.play .duel-eyebrow { animation: fadeUp 0.4s ease 0s both; }
.view-duel.play .crow-referee { animation: fadeUp 0.4s ease 1.8s both; }
@keyframes slideL { from { transform: translateX(-160%) skewX(-14deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideR { from { transform: translateX(160%) skewX(14deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes clashL { 40% { transform: translateX(16px) rotate(-3deg); } }
@keyframes clashR { 40% { transform: translateX(-16px) rotate(3deg); } }
@keyframes stamp { from { transform: scale(3.2) rotate(-25deg); opacity: 0; } to { transform: rotate(-8deg); opacity: 1; } }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }
@keyframes burstIn { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drop { from { transform: translateY(-120%) scale(1.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeUp { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
