/* Boys vs Girls — built in the War Card Games design language (WarGame/web/app/tokens +
   styles.css): Sunbeam sunburst stage, Ink Navy type, warm-cream information tiles with
   a lip, and the chunky arcade button (white ring, hard cast, under-lip that collapses
   on press). One deliberate light look, like War: no dark mode.
   Layout: phone-first single column for players; two-column console for the host; a
   full-bleed stage for the big screen. */
:root {
  color-scheme: light;
  /* War brand palette (tokens/colors.css) */
  --sunbeam: #FFC93C; --sunbeam-deep: #E8AF1F; --sunbeam-lift: #FFDC74; --sunbeam-ray: #FFD45E;
  --warm-cream: #FCF6E9; --cream-lift: #FFFDF6; --cream-deep: #E4D6BB;
  --ink-navy: #1D3557; --ink-navy-soft: #5B6B80;
  --sky: #4EA8DE; --sky-deep: #3B8BBD; --sky-lift: #7BC2E8;
  --coral: #FF8C61; --coral-deep: #DE6237; --coral-lift: #FFB397;
  --grass: #52B788; --grass-deep: #3F9970; --grass-lift: #7ACFA3;
  --grape: #9D4EDD; --grape-deep: #7E35BD; --grape-lift: #B87AE8;
  --signal-red: #E63946; --red-deep: #C42B3A; --signal-red-lift: #F0636E;
  --mist: #8592A6; --mist-deep: #6D7A8D; --mist-lift: #A9B5C6;
  --cloud: #F1F5F9; --control-face: #EDF2F7; --control-deep: #C7D0DB;

  /* roles used by the pages */
  --ink: var(--sunbeam);            /* stage */
  --panel: var(--warm-cream);       /* information tiles */
  --panel-2: var(--control-face);   /* rows inside a tile */
  --line: var(--cream-deep);
  --text: var(--ink-navy);
  --muted: var(--ink-navy-soft);
  --boys: var(--sky);   --boys-deep: var(--sky-deep);
  --girls: var(--coral); --girls-deep: var(--coral-deep);
  --a: var(--sunbeam); --b: var(--grass); --c: var(--grape); --d: var(--signal-red);
  --on-tile: var(--ink-navy);
  --good: var(--grass-deep);
  --bad: var(--signal-red);

  /* War type: Passion One titles + buttons, Nunito (SF Rounded where present) body,
     Luckiest Guy only for the wordmark lockup. */
  --display: 'Passion One', ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, sans-serif;
  --body: ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, -apple-system, sans-serif;
  --wordmark: 'Luckiest Guy', 'Passion One', system-ui, sans-serif;
  --tracking-title: 0.075em;

  /* War controls (tokens/spacing.css) */
  --r: 22px;
  --ring: 5px;
  --cast: 0 6px 0 rgba(29, 53, 87, .16);
  --tile-shadow: inset 0 3px 0 var(--cream-lift), inset 0 -8px 0 var(--cream-deep), 0 6px 0 rgba(29, 53, 87, .10);
  --ease-arcade: cubic-bezier(.2, 1.6, .4, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background-color: var(--sunbeam);
  /* the sunburst behind War's wordmark */
  background-image: repeating-conic-gradient(from -4deg at 50% 18%, var(--sunbeam-ray) 0deg 9deg, var(--sunbeam) 9deg 18deg);
  background-attachment: fixed;
  font: 600 17px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
}
body.plain { background: var(--cloud); }
[hidden] { display: none !important; }
h1, h2, h3, .display {
  font-family: var(--display); font-weight: 700; letter-spacing: 0.01em; line-height: 1.05;
  text-wrap: balance; margin: 0;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--display); font-weight: 700; font-size: 16px;
  letter-spacing: var(--tracking-title); text-transform: uppercase; color: var(--muted);
}

/* ---- wordmark: Luckiest Guy, white keyline, navy outer outline (War's lockup) -------------- */
.wordmark {
  font-family: var(--wordmark); font-weight: 400; line-height: .9; letter-spacing: .02em;
  text-transform: uppercase; margin: 0;
  -webkit-text-stroke: .14em #fff; paint-order: stroke fill;
  filter: drop-shadow(3px 0 0 var(--ink-navy)) drop-shadow(-3px 0 0 var(--ink-navy))
          drop-shadow(0 3px 0 var(--ink-navy)) drop-shadow(0 -3px 0 var(--ink-navy))
          drop-shadow(0 6px 0 var(--ink-navy));
}
.wordmark .b { color: var(--sky); }
.wordmark .g { color: var(--coral); }
.wordmark .vs { color: var(--ink-navy); font-size: .5em; }

/* ---- chunky arcade button ------------------------------------------------------------------ */
/* One element version of War's .btn: white ring, deep-tone under-lip, hairline lift, hard
   cast that never moves; :active collapses the lip and drops the label. */
.btn {
  --_fill: var(--mist); --_deep: var(--mist-deep); --_lift: var(--mist-lift); --_fg: #fff;
  --_lip: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 52px; padding: 8px 22px calc(8px + var(--_lip));
  border: var(--ring) solid #fff; border-radius: 999px;
  background: var(--_fill); color: var(--_fg);
  box-shadow: inset 0 3px 0 var(--_lift), inset 0 calc(-1 * var(--_lip)) 0 var(--_deep), var(--cast);
  font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.05;
  letter-spacing: var(--tracking-title); text-transform: uppercase; text-align: center;
  text-shadow: 0 2px 0 var(--_deep);
  transition: box-shadow .09s ease, padding .09s ease;
}
.btn:active:not(:disabled) { --_lip: 3px; padding-top: 14px; }
.btn.primary { --_fill: var(--sunbeam); --_deep: var(--sunbeam-deep); --_lift: var(--sunbeam-lift); --_fg: #fff; }
.btn.win { --_fill: var(--grass); --_deep: var(--grass-deep); --_lift: var(--grass-lift); }
.btn.sky { --_fill: var(--sky); --_deep: var(--sky-deep); --_lift: var(--sky-lift); }
.btn.orange { --_fill: var(--coral); --_deep: var(--coral-deep); --_lift: var(--coral-lift); }
.btn.danger, .btn.armed { --_fill: var(--signal-red); --_deep: var(--red-deep); --_lift: var(--signal-red-lift); }
.btn.ghost { --_fill: var(--warm-cream); --_deep: var(--cream-deep); --_lift: var(--cream-lift); --_fg: var(--ink-navy); text-shadow: 0 1px 0 var(--cream-deep); }
.btn.big { min-height: 72px; font-size: 26px; padding-inline: 30px; }
.btn.small { --_lip: 5px; min-height: 38px; font-size: 14px; padding: 5px 12px calc(5px + var(--_lip)); border-width: 3px; box-shadow: inset 0 2px 0 var(--_lift), inset 0 calc(-1 * var(--_lip)) 0 var(--_deep), 0 3px 0 rgba(29,53,87,.16); }
.btn.small:active:not(:disabled) { --_lip: 2px; padding-top: 8px; }
/* on the sunbeam stage a sunbeam button needs the navy face to separate */
.on-sun .btn.primary, .btn.navy { --_fill: var(--ink-navy); --_deep: #0f2038; --_lift: #34507a; }
/* disabled last, so it wins over every color variant above */
.btn.btn:disabled {   /* doubled class: must beat .btn.primary etc. */
  --_fill: var(--cloud); --_deep: var(--cloud); --_lift: var(--cloud); --_fg: var(--ink-navy-soft);
  border-color: var(--ink-navy-soft); text-shadow: none; cursor: not-allowed; --_lip: 0px;
  padding-bottom: 8px;
}

/* ---- information tile (War's cream tile recipe) -------------------------------------------- */
.card {
  background: var(--warm-cream); border-radius: var(--r);
  box-shadow: var(--tile-shadow);
  padding: 18px 18px 24px;
}

/* ---- team chips ---------------------------------------------------------------------------- */
.team-boys { --team: var(--boys); --team-deep: var(--boys-deep); }
.team-girls { --team: var(--girls); --team-deep: var(--girls-deep); }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 14px 6px; border-radius: 999px; border: 3px solid #fff;
  background: var(--team); color: #fff; box-shadow: inset 0 -4px 0 var(--team-deep);
  font-family: var(--display); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  text-shadow: 0 2px 0 var(--team-deep);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 5px 12px 7px; border-radius: 999px;
  background: var(--warm-cream); color: var(--ink-navy);
  border: 3px solid var(--team);
  box-shadow: inset 0 -3px 0 var(--cream-deep);
  font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .2s ease, transform .25s var(--ease-arcade), opacity .2s ease, color .2s ease;
}
.chip.off { opacity: .5; }
.chip.voted { background: var(--team); color: #fff; border-color: #fff; box-shadow: inset 0 -3px 0 var(--team-deep); transform: scale(1.06); }

/* ---- answer tiles (four arcade faces with a shape AND a letter) -------------------------- */
.tile {
  --tile: var(--a); --tile-deep: var(--sunbeam-deep); --tile-lift: var(--sunbeam-lift); --tile-fg: var(--ink-navy);
  --_lip: 9px;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px;
  width: 100%; min-height: 88px; padding: 12px 18px calc(12px + var(--_lip));
  border: var(--ring) solid #fff; border-radius: var(--r);
  background: var(--tile); color: var(--tile-fg); text-align: left;
  font-family: var(--body); font-weight: 800; font-size: 20px; line-height: 1.2;
  box-shadow: inset 0 3px 0 var(--tile-lift), inset 0 calc(-1 * var(--_lip)) 0 var(--tile-deep), var(--cast);
  transition: transform .15s var(--ease-arcade), opacity .2s ease, filter .2s ease, box-shadow .09s ease, padding .09s ease;
  min-width: 0;
}
.tile[data-i="1"] { --tile: var(--b); --tile-deep: var(--grass-deep); --tile-lift: var(--grass-lift); --tile-fg: #fff; }
.tile[data-i="2"] { --tile: var(--c); --tile-deep: var(--grape-deep); --tile-lift: var(--grape-lift); --tile-fg: #fff; }
.tile[data-i="3"] { --tile: var(--d); --tile-deep: var(--red-deep); --tile-lift: var(--signal-red-lift); --tile-fg: #fff; }
.tile:not([data-i="0"]) .label { text-shadow: 0 2px 0 var(--tile-deep); }
.tile:active:not(:disabled) { --_lip: 3px; padding-top: 18px; }
.tile .mark {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
  background: #fff; color: var(--tile-deep); font-size: 15px; line-height: 1; text-align: center;
  box-shadow: inset 0 -4px 0 var(--control-deep);
}
.tile .mark b { display: block; font-family: var(--display); font-size: 24px; color: var(--ink-navy); }
.tile .label { min-width: 0; overflow-wrap: anywhere; }
.tile:disabled { cursor: default; }
.tile.picked { border-color: var(--ink-navy); transform: scale(1.03); }
.tiles.has-pick .tile:not(.picked) { opacity: .5; filter: saturate(.6); }
.tile.right { border-color: var(--ink-navy); animation: pop .6s var(--ease-arcade); }
.tile.wrong { opacity: .3; filter: saturate(.25); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.07); } 100% { transform: scale(1.02); } }

/* ---- countdown bar (War's progress track) -------------------------------------------------- */
.timebar { height: 16px; border-radius: 999px; background: #2B3F58; border: 3px solid #fff; overflow: hidden; box-shadow: var(--cast); }
.timebar > i { display: block; height: 100%; width: 100%; background: var(--grass); transform-origin: left; }
.timebar.low > i { background: var(--signal-red); }

/* ---- scoreboard ---------------------------------------------------------------------------- */
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.score {
  padding: 10px 14px 14px; border-radius: 18px; border: 4px solid #fff;
  background: var(--team); color: #fff;
  box-shadow: inset 0 -6px 0 var(--team-deep), var(--cast);
  text-shadow: 0 2px 0 var(--team-deep);
}
.score .who { font-family: var(--display); font-weight: 700; letter-spacing: var(--tracking-title); text-transform: uppercase; }
.score .pts { font-family: var(--display); font-weight: 700; font-size: 36px; font-variant-numeric: tabular-nums; line-height: 1; }
.score .muted { color: #fff; opacity: .92; font-size: 14px; }

.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--ink-navy); }
.status-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--signal-red); box-shadow: 0 0 0 2px #fff; }
.status-dot.on::before { background: var(--grass); }

.field { display: grid; gap: 6px; }
.field > span { font-family: var(--display); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: 15px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%; padding: 14px 16px; border-radius: 16px; border: 3px solid var(--control-deep);
  background: #fff; color: var(--ink-navy); font-size: 18px; font-weight: 700;
  box-shadow: inset 0 3px 0 var(--control-face);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus { border-color: var(--sky); outline: none; }
.error { color: var(--signal-red); font-weight: 800; min-height: 1.4em; margin: 0; }

/* sound toggle (players + big screen) */
.sound-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 3px solid #fff; border-radius: 50%; background: var(--warm-cream); color: var(--ink-navy);
  box-shadow: inset 0 -4px 0 var(--cream-deep), 0 3px 0 rgba(29,53,87,.16); font-size: 18px; line-height: 1;
}
.sound-btn[aria-pressed="false"] { color: var(--muted); }

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