/* ==================================================================
   JUNO — all the styling for both the player page and the big board.

   Section 1 draws the cards themselves. Sections 2 onwards lay out
   the pages around them.
   ================================================================== */

:root {
  --felt-1: #1c7359;
  --felt-2: #0c4335;
  --felt-3: #06231c;
  --panel: rgba(5, 26, 21, 0.74);
  --panel-solid: #0d2a23;
  --line: rgba(255, 255, 255, 0.13);
  --text: #eef6f2;
  --muted: rgba(238, 246, 242, 0.6);
  --accent: #f5c400;
  --danger: #e5231f;
  --ok: #10a05a;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 80% at 50% 32%, var(--felt-1) 0%, var(--felt-2) 52%, var(--felt-3) 100%),
    var(--felt-3);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ==================================================================
   1. THE CARDS
   ================================================================== */

.card {
  --cw: 76px;
  --ch: calc(var(--cw) * 1.5);
  --face: #1c1c1c;
  --ink: #1c1c1c;

  position: relative;
  display: block;
  flex: none;
  width: var(--cw);
  height: var(--ch);
  padding: 0;
  border: 0;
  border-radius: calc(var(--cw) * 0.12);
  background: #fff;
  box-shadow:
    0 calc(var(--cw) * 0.03) calc(var(--cw) * 0.09) rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(0, 0, 0, 0.18);
  font-family: var(--font);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.card--size-xs { --cw: 30px; }
.card--size-sm { --cw: 48px; }
.card--size-md { --cw: 76px; }
.card--size-lg { --cw: 112px; }
.card--size-xl { --cw: 150px; }

.card--r { --face: #e5231f; --ink: #cf1410; }
.card--y { --face: #f5c400; --ink: #c99d00; }
.card--g { --face: #10a05a; --ink: #0a8248; }
.card--b { --face: #0f72c4; --ink: #0a5799; }
.card--w,
.card--back { --face: #1c1c1c; --ink: #1c1c1c; }

.card__face {
  position: absolute;
  inset: calc(var(--cw) * 0.055);
  display: block;
  overflow: hidden;
  border-radius: calc(var(--cw) * 0.08);
  background: var(--face);
}

/* The tilted white oval across the middle of every card. */
.card__oval {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Height is a share of the face, which is half again as tall as it is wide —
     so this works out to roughly a 2:1 ellipse, like the real thing. */
  width: 96%;
  height: 40%;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) rotate(-25deg);
}

/* On a Wild card that oval is split into four colours instead. */
.card__oval--wild { background: none; }
.card__oval--wild .q {
  position: absolute;
  width: 50.5%;
  height: 50.5%;
}
.q--r { top: 0; left: 0; background: #e5231f; }
.q--g { top: 0; right: 0; background: #10a05a; }
.q--b { bottom: 0; left: 0; background: #0f72c4; }
.q--y { bottom: 0; right: 0; background: #f5c400; }

.card__oval--back { background: #e5231f; }

.card__centre {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.card__centre .num {
  font-size: calc(var(--cw) * 0.74);
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 calc(var(--cw) * 0.022) 0 rgba(0, 0, 0, 0.3);
}
/* 6 and 9 get an underline so they can't be read the wrong way up. */
.card__centre .num--bar { border-bottom: calc(var(--cw) * 0.055) solid currentColor; }

.card__centre .glyph {
  width: calc(var(--cw) * 0.56);
  height: calc(var(--cw) * 0.56);
  filter: drop-shadow(0 calc(var(--cw) * 0.018) 0 rgba(0, 0, 0, 0.28));
}
/* The Wild Draw Four's little cards sit straight on the black face. */
.card--w .card__centre .glyph { width: calc(var(--cw) * 0.8); height: calc(var(--cw) * 0.8); }

.card__corner {
  position: absolute;
  display: block;
  color: #fff;
  font-size: calc(var(--cw) * 0.23);
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.card__corner--tl { top: calc(var(--cw) * 0.075); left: calc(var(--cw) * 0.085); }
.card__corner--br {
  right: calc(var(--cw) * 0.085);
  bottom: calc(var(--cw) * 0.075);
  transform: rotate(180deg);
}
.card__corner .glyph {
  display: block;
  width: calc(var(--cw) * 0.2);
  height: calc(var(--cw) * 0.2);
  color: #fff;
}
.pip-text { display: block; }

/* Corners are unreadable at thumbnail size, so hide them there. */
.card--size-xs .card__corner { display: none; }

.card__logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5c400;
  font-size: calc(var(--cw) * 0.36);
  font-weight: 900;
  font-style: italic;
  letter-spacing: calc(var(--cw) * -0.005);
  transform: rotate(-25deg);
  -webkit-text-stroke: calc(var(--cw) * 0.022) #1c1c1c;
  paint-order: stroke fill;
}

/* Ring showing which colour a wild was set to. */
.card__chosen {
  position: absolute;
  inset: 0;
  border: calc(var(--cw) * 0.07) solid var(--chosen);
  border-radius: calc(var(--cw) * 0.08);
  pointer-events: none;
}

/* Cards you're allowed to play lift up; the rest fade back. */
button.card { cursor: pointer; }
.card.is-playable { cursor: pointer; }
.card.is-dim {
  filter: grayscale(0.55) brightness(0.62);
  cursor: not-allowed;
}

.fan { position: relative; display: inline-flex; }
.fan__slot { margin-left: -14px; }
.fan__slot:first-child { margin-left: 0; }
.fan__slot .card { transform: rotate(calc((var(--i) - 2) * 4deg)); }

/* ==================================================================
   2. SHARED FURNITURE — buttons, panels, toasts
   ================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s, transform 0.08s, border-color 0.14s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.17); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }

.btn--primary {
  border-color: transparent;
  background: var(--accent);
  color: #22200a;
}
.btn--primary:hover:not(:disabled) { background: #ffd726; }

.btn--danger { border-color: transparent; background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #f5423e; }

.btn--go { border-color: transparent; background: var(--ok); color: #fff; }
.btn--go:hover:not(:disabled) { background: #17b869; }

.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--big { padding: 15px 30px; font-size: 18px; }

.field {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field--code {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 8px;
  text-align: center;
  text-transform: uppercase;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(7px);
}

.wordmark {
  display: inline-block;
  font-size: 44px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -1px;
  color: var(--accent);
  -webkit-text-stroke: 3px #1c1c1c;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 90;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, 22px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hidden { display: none !important; }

/* ==================================================================
   3. JOIN SCREEN
   ================================================================== */

.screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
}

.join {
  width: 100%;
  max-width: 430px;
  padding: 30px 28px 26px;
  text-align: center;
}
.join__tag { margin: 4px 0 24px; color: var(--muted); font-size: 15px; }
.join__row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.join__or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.join__or::before,
.join__or::after { flex: 1; height: 1px; background: var(--line); content: ""; }
.join__note { margin-top: 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.join__note a { color: var(--accent); }

.join__deco {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.join__deco .card { margin-left: -22px; }
.join__deco .card:first-child { margin-left: 0; }
.join__deco .card:nth-child(1) { transform: rotate(-12deg); }
.join__deco .card:nth-child(2) { transform: rotate(-4deg) translateY(-6px); }
.join__deco .card:nth-child(3) { transform: rotate(4deg) translateY(-6px); }
.join__deco .card:nth-child(4) { transform: rotate(12deg); }

/* ==================================================================
   4. GAME LAYOUT
   ================================================================== */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}
.topbar__brand {
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
  color: var(--accent);
  -webkit-text-stroke: 2px #1c1c1c;
  paint-order: stroke fill;
}
.topbar__code {
  padding: 4px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
}
.topbar__spacer { flex: 1; }
.topbar__meta { color: var(--muted); font-size: 13px; }

.wire {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.wire::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}
.wire.is-live::before { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.wire.is-poll::before { background: var(--accent); }
.wire.is-down::before { background: var(--danger); }

/* --- opponents ------------------------------------------------- */

.opponents {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  padding: 12px 12px 4px;
}

.seat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 148px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.2s, background 0.2s;
}
.seat.is-turn {
  background: rgba(245, 196, 0, 0.14);
  box-shadow: 0 0 0 2px var(--accent), 0 0 18px rgba(245, 196, 0, 0.35);
}
/* Away players stay legible — you need to know who is missing, not squint. */
.seat.is-away {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.45);
}
.seat.is-away .seat__name,
.seat.is-away .seat__count { opacity: 0.55; }
.seat__clock {
  position: absolute;
  right: -6px;
  bottom: -8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.8);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.seat__away {
  position: absolute;
  top: -9px;
  left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #6b4a00;
  color: #ffe8a3;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}
.seat.is-waiting { border-style: dashed; opacity: 0.72; }

.seat__body { min-width: 0; }
.seat__name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat__sub { color: var(--muted); font-size: 12px; }

.seat__count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 7px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 16px;
  font-weight: 800;
}
.seat__count.is-low { background: var(--danger); }

.seat__juno {
  position: absolute;
  top: -9px;
  right: -6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #241f00;
  font-size: 11px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.5px;
}

.crown { color: var(--accent); }

/* --- the middle of the table ----------------------------------- */

.board {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 7vw, 74px);
  padding: 16px 12px;
}

.pile { position: relative; text-align: center; }
.pile__label {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

/* The draw pile is a stack of real card edges peeking out from under the top
   card, so it gets visibly thinner as the deck runs down. The layers are
   decoration only: they sit behind the card and never swallow a click. */
.pile__stack {
  --deck-r: 13px;
  position: relative;
  display: inline-block;
}
.pile__depth {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.pile__layer {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--deck-r);
  background: #191914;
  transform: translate(calc(var(--i) * 2px), calc(var(--i) * 2.5px));
}
.pile__stack > .card {
  position: relative;
  z-index: 1;
}

/* Shown in place of the deck when it has run out (it refills on the next draw). */
.card--ghost {
  border: 2px dashed rgba(255, 255, 255, 0.3);
  background: none;
  box-shadow: none;
}

.pile--draw .card { transition: transform 0.12s; }
.pile--draw button.card:hover:not(:disabled) { transform: translateY(-6px); }

/* Halo around the discard pile in whatever colour is currently in play. */
.discard-wrap {
  position: relative;
  display: inline-flex;
  padding: 15px;
  border-radius: 26px;
  transition: box-shadow 0.3s, background 0.3s;
}
/* Previously played cards, fanned out under the top one. */
#discardPile, #tvDiscard { position: relative; }
.discard__under {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.55;
  transform: rotate(calc((var(--i) - 0.5) * 11deg)) translate(calc(var(--i) * 3px), 2px);
}
#discardPile > .card, #tvDiscard > .card { position: relative; z-index: 1; }

.hand.is-dealing { opacity: 0; }

.discard-wrap[data-colour="r"] { background: rgba(229, 35, 31, 0.2); box-shadow: 0 0 0 3px #e5231f, 0 0 34px rgba(229, 35, 31, 0.5); }
.discard-wrap[data-colour="y"] { background: rgba(245, 196, 0, 0.2); box-shadow: 0 0 0 3px #f5c400, 0 0 34px rgba(245, 196, 0, 0.5); }
.discard-wrap[data-colour="g"] { background: rgba(16, 160, 90, 0.2); box-shadow: 0 0 0 3px #10a05a, 0 0 34px rgba(16, 160, 90, 0.5); }
.discard-wrap[data-colour="b"] { background: rgba(15, 114, 196, 0.2); box-shadow: 0 0 0 3px #0f72c4, 0 0 34px rgba(15, 114, 196, 0.5); }

/* Which way play is moving round the table. A curved arrow, because the old
   dashed circle told nobody anything. Mirrored horizontally when reversed. */
.dir {
  --mirror: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}
.dir.is-ccw { --mirror: -1; }
.dir__arrow {
  width: 58px;
  height: 58px;
  color: rgba(255, 255, 255, 0.8);
  transform: scaleX(var(--mirror));
}
.dir__arc {
  fill: none;
  stroke: currentColor;
  stroke-width: 8;
  stroke-linecap: round;
}
.dir__head { fill: currentColor; }

.dir__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: 0.7;
}
.dir__value {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

/* A Reverse spins the arrow round once so the change is impossible to miss. */
.dir.is-flipping .dir__arrow { animation: dir-flip 0.55s ease; }
@keyframes dir-flip {
  from { transform: rotate(0deg) scaleX(var(--mirror, 1)); }
  to   { transform: rotate(360deg) scaleX(var(--mirror, 1)); }
}

/* --- your hand -------------------------------------------------- */

.tray {
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.16));
  backdrop-filter: blur(6px);
}

.actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 10px 12px 2px;
}
.actionbar__msg { color: var(--muted); font-size: 14px; }
.actionbar__msg strong { color: var(--text); }
.actionbar__msg.is-you { color: var(--accent); font-weight: 700; }

.hand {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 132px;
  padding: 14px 14px 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.hand__inner { display: flex; align-items: flex-end; padding: 0 4px; }
.hand .card {
  margin-left: calc(var(--cw) * -0.4);
  transition: transform 0.13s ease, filter 0.13s;
}
.hand .card:first-child { margin-left: 0; }
/* A big hand overlaps harder so it still fits without scrolling. */
.hand.is-packed .card { margin-left: calc(var(--cw) * -0.62); }
.hand.is-packed .card:first-child { margin-left: 0; }

/* Keyboard players get the same lift as a mouse hover. */
.hand .card.is-cursor { z-index: 4; transform: translateY(-16px); box-shadow: 0 0 0 3px #fff, 0 10px 20px rgba(0, 0, 0, 0.5); }
.hand .card.is-playable:hover,
.hand .card.is-playable:focus-visible { z-index: 2; transform: translateY(-16px); }
.hand__empty { color: var(--muted); font-size: 15px; }

/* The card you just drew: lifted and ringed so it's obvious which one is new
   and that you can click it to play it. */
.hand .card.is-drawn {
  z-index: 3;
  transform: translateY(-14px);
  box-shadow:
    0 0 0 3px var(--accent),
    0 10px 22px rgba(0, 0, 0, 0.5);
  animation: drawn-pop 0.4s ease;
}
@keyframes drawn-pop {
  from { transform: translateY(6px) scale(0.9); }
  to   { transform: translateY(-14px) scale(1); }
}

/* --- activity log ----------------------------------------------- */

.log {
  max-height: 132px;
  padding: 9px 14px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.log p { margin: 0; }
.log p:last-child { color: var(--text); }

/* ==================================================================
   5. LOBBY & OVERLAYS
   ================================================================== */

.lobby { max-width: 640px; margin: 26px auto; padding: 24px; }
.lobby h2 { margin: 0 0 4px; font-size: 21px; }
.lobby__hint { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.share {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 20px;
}
.share input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.roster { display: flex; flex-direction: column; gap: 7px; margin-bottom: 20px; }
.roster__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
}
.roster__row span:first-child { flex: 1; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.chip {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.chip.is-on { border-color: transparent; background: var(--accent); color: #241f00; font-weight: 700; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(3px);
}
.modal {
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  padding: 26px;
  overflow-y: auto;
  background: var(--panel-solid);
  text-align: center;
}
.modal h2 { margin: 0 0 6px; font-size: 23px; }
.modal p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.modal__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* Colour picker for wilds. */
.swatches { display: flex; gap: 14px; justify-content: center; margin-bottom: 20px; }
.swatch {
  width: 76px;
  height: 76px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.swatch:hover, .swatch:focus-visible { border-color: #fff; transform: scale(1.09); }
.swatch--r { background: #e5231f; }
.swatch--y { background: #f5c400; }
.swatch--g { background: #10a05a; }
.swatch--b { background: #0f72c4; }

/* Scoreboard on the round-over screen. */
.scores { width: 100%; margin: 0 0 18px; border-collapse: collapse; text-align: left; }
.scores th, .scores td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.scores th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.scores td:last-child, .scores th:last-child { text-align: right; }
.scores tr.is-winner td { color: var(--accent); font-weight: 800; }

.revealed { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; text-align: left; }
.revealed__row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.revealed__who { width: 100%; color: var(--muted); font-size: 12px; }

.juno-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  animation: pulse 0.85s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.035); } }

/* ==================================================================
   6. BIG BOARD (the page you screenshare)
   ================================================================== */

.tv {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
.tv__head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}
.tv__brand {
  font-size: 34px;
  font-weight: 900;
  font-style: italic;
  color: var(--accent);
  -webkit-text-stroke: 3px #1c1c1c;
  paint-order: stroke fill;
}
.tv__code { font-size: 26px; font-weight: 800; letter-spacing: 9px; }
.tv__join { color: var(--muted); font-size: 16px; }

.tv__ring {
  position: relative;
  flex: 1;
  min-height: 0;
}
.tv .pile__stack { --deck-r: 18px; }
.tv .dir__arrow { width: 76px; height: 76px; }
.tv__centre {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  gap: 52px;
  align-items: center;
  transform: translate(-50%, -50%);
}

.tv-seat {
  position: absolute;
  width: 190px;
  padding: 11px 13px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.42);
  text-align: center;
  transform: translate(-50%, -50%);
  transition: box-shadow 0.25s, background 0.25s;
}
.tv-seat.is-turn {
  background: rgba(245, 196, 0, 0.18);
  box-shadow: 0 0 0 3px var(--accent), 0 0 30px rgba(245, 196, 0, 0.42);
}
.tv-seat.is-away { opacity: 0.45; }
.tv-seat__name {
  overflow: hidden;
  font-size: 18px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-seat__cards { display: flex; justify-content: center; margin: 7px 0 5px; }
.tv-seat__meta { color: var(--muted); font-size: 13px; }
.tv-seat__juno {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #241f00;
  font-size: 13px;
  font-weight: 900;
  font-style: italic;
}

.tv__foot {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  padding: 12px 26px 16px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
}
.tv__log { flex: 1; max-height: 86px; overflow: hidden; color: var(--muted); font-size: 15px; line-height: 1.5; }
.tv__log p { margin: 0; }
.tv__log p:last-child { color: var(--text); font-weight: 600; }
.tv__scores { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 15px; }
.tv__scores b { color: var(--accent); }

/* ==================================================================
   7. EFFECTS LAYER
   Everything animated floats in here, above the page and untouchable.
   ================================================================== */

#fxLayer {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow: hidden;
  pointer-events: none;
}

.fx-fly {
  position: absolute;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.fx-stamp {
  position: absolute;
  padding: 6px 16px;
  border: 3px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}
.fx-stamp--warn { border-color: var(--accent); color: var(--accent); }

.fx-burst {
  position: absolute;
  top: 42%;
  left: 50%;
  color: var(--accent);
  font-size: clamp(64px, 15vw, 170px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: -3px;
  -webkit-text-stroke: 5px #1c1c1c;
  paint-order: stroke fill;
  text-shadow: 0 10px 0 rgba(0, 0, 0, 0.28);
  white-space: nowrap;
}
.fx-burst--bad { color: var(--danger); }
.fx-burst--count { color: #fff; -webkit-text-stroke-width: 4px; }

.fx-wash { position: absolute; inset: 0; }
.fx-wash[data-colour="r"] { box-shadow: inset 0 0 130px 40px rgba(229, 35, 31, 0.85); }
.fx-wash[data-colour="y"] { box-shadow: inset 0 0 130px 40px rgba(245, 196, 0, 0.85); }
.fx-wash[data-colour="g"] { box-shadow: inset 0 0 130px 40px rgba(16, 160, 90, 0.85); }
.fx-wash[data-colour="b"] { box-shadow: inset 0 0 130px 40px rgba(15, 114, 196, 0.85); }

.fx-float {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.fx-float__emoji {
  font-size: 64px;
  line-height: 1;
  /* Layered shadows so it stays readable over cards, felt or a bright wash. */
  filter:
    drop-shadow(0 0 3px rgba(0, 0, 0, 0.9))
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.65));
}
.fx-float__who {
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

@media (max-width: 720px) {
  .fx-float__emoji { font-size: 46px; }
}

.fx-confetti {
  position: absolute;
  top: 0;
  border-radius: 2px;
  will-change: transform, opacity;
}

/* ==================================================================
   8. SOUND, SCOREBOARD, REACTIONS
   ================================================================== */

.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tool:hover { background: rgba(255, 255, 255, 0.16); }
.tool.is-off { color: var(--muted); }

.popover {
  position: fixed;
  top: 46px;
  right: 12px;
  z-index: 65;
  width: 250px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-solid);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.popover h3 { margin: 0 0 12px; font-size: 14px; }
.popover label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.popover input[type="range"] { width: 100%; margin-bottom: 14px; accent-color: var(--accent); }
.popover__note { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* Sits under the top bar and says something everyone needs to know right now. */
.banner {
  position: fixed;
  top: 42px;
  left: 50%;
  z-index: 64;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 24px));
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--panel-solid);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--line);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transform: translateX(-50%);
}
.banner--warn { background: #6b4a00; }
.banner--bad { background: var(--danger); }
.banner__dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  animation: blip 1s ease-in-out infinite;
}
@keyframes blip { 50% { opacity: 0.25; } }

.board-panel { width: 300px; }
.board-panel table { width: 100%; border-collapse: collapse; }
.board-panel th,
.board-panel td { padding: 6px 5px; border-bottom: 1px solid var(--line); font-size: 13px; text-align: left; }
.board-panel th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.board-panel td:last-child,
.board-panel th:last-child { text-align: right; }
.board-panel tr.is-me td { color: var(--accent); font-weight: 700; }

.bar {
  height: 4px;
  margin-top: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  overflow: hidden;
}
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

.reacts { display: flex; gap: 6px; }
/* Tucked into the corners of the tray, out of the way of the cards. */
.tray__reacts { position: absolute; top: 8px; right: 12px; z-index: 2; }
.tray__sort { position: absolute; top: 8px; left: 12px; z-index: 2; }
.reacts button {
  width: 36px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s, background 0.12s;
}
.reacts button:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-2px); }

/* Gentle nudge if you sit on your turn too long. */
.hand.is-nudging .card.is-playable { animation: nudge 1.5s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

/* Winner podium. */
.podium {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  justify-content: center;
  margin: 6px 0 18px;
  min-height: 150px;
}
.podium__slot { display: flex; flex-direction: column; align-items: center; width: 92px; }
.podium__who {
  margin-bottom: 5px;
  overflow: hidden;
  max-width: 100%;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium__pts { color: var(--accent); font-size: 17px; font-weight: 900; }
.podium__block {
  width: 100%;
  margin-top: 6px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.07));
  color: var(--muted);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.9;
  text-align: center;
}
.podium__slot--1 .podium__block { height: 96px; background: linear-gradient(to bottom, var(--accent), #a67f00); color: #241f00; }
.podium__slot--2 .podium__block { height: 68px; }
.podium__slot--3 .podium__block { height: 46px; }

/* ==================================================================
   9. SMALL SCREENS
   ================================================================== */

@media (max-width: 720px) {
  .card--size-lg { --cw: 84px; }
  .card--size-md { --cw: 62px; }
  .board { gap: 18px; padding: 10px; }
  .seat { min-width: 0; flex: 1 1 auto; padding: 6px 9px; gap: 7px; }
  .seat__name { font-size: 13px; }
  .opponents { gap: 6px; padding: 8px 8px 2px; }
  .hand { min-height: 118px; padding: 10px 8px 14px; }
  .log { max-height: 76px; font-size: 12px; }
  .wordmark { font-size: 36px; }
  .swatch { width: 62px; height: 62px; }
  /* Kept on phones, just smaller — it was confusing because it was cryptic,
     not because it was in the way. */
  .dir__arrow { width: 40px; height: 40px; }
  .dir__label { display: none; }
  .pile__stack { --deck-r: 10px; }
}

@media (max-width: 420px) {
  .card--size-lg { --cw: 74px; }
  .topbar { padding: 7px 10px; gap: 8px; }
  .topbar__meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
