/* ============================================================
   FluxWillow Games. Design System v1.8
   "Jungle table, carved clay board". warm, high-contrast,
   mobile-first. Signature element: the tactile game board.
   ============================================================ */


:root {
  /* --- Base surfaces (deep jungle teal-charcoal) --- */
  --bg:          #0c1413;
  --bg-grad-1:   #0e1817;
  --bg-grad-2:   #0a100f;
  --surface:     #15201e;
  --surface-2:   #1c2a27;
  --surface-3:   #233330;
  --line:        #2b3a37;
  --line-soft:   #223230;

  /* --- Clay board (the signature) --- */
  --board-1:     #e7c79b;
  --board-2:     #d3a878;
  --board-3:     #bb8a5c;
  --groove:      #8a6038;
  --groove-hi:   #f3dcba;
  --socket:      #b98f63;
  --socket-in:   #8c6741;

  /* --- Pieces / teams --- */
  --tiger:       #f5862e;
  --tiger-hi:    #ffa758;
  --tiger-deep:  #c9621a;
  --sheep:       #f3efe6;
  --sheep-hi:    #ffffff;
  --sheep-deep:  #c3c9cc;

  /* --- Functional accents --- */
  --go:          #4fc78a;   /* valid move / success */
  --go-soft:     rgba(79,199,138,.16);
  --danger:      #e6503d;   /* capture / lose */
  --danger-soft: rgba(230,80,61,.16);
  --gold:        #f2b840;   /* trophies / streaks */

  /* --- Text --- */
  --text:        #f4efe4;
  --text-2:      #cdd8d3;
  --muted:       #95a8a2;
  --faint:       #6f827d;

  /* --- Shape & motion --- */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --r-pill: 999px;
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.35);
  --ease: cubic-bezier(.22,.61,.36,1);
  --t: .2s var(--ease);
  --font-display: 'Fredoka', system-ui, sans-serif;
  --font: 'Nunito Sans', system-ui, -apple-system, sans-serif;

  --maxw: 1080px;
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-grad-1), transparent 70%),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  background-color: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button { font-family: var(--font); }

::selection { background: var(--tiger); color: #1a0d03; }

:focus-visible {
  outline: 3px solid var(--tiger-hi);
  outline-offset: 2px;
  border-radius: 6px;
}

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

/* ============================================================
   NAV
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .8rem clamp(1rem, 4vw, 2rem);
  background: rgba(10,16,15,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.15rem;
  color: var(--text); text-decoration: none;
  display: inline-flex; align-items: baseline; gap: .45rem;
  letter-spacing: -.01em;
}
.nav-logo .fw-mark {
  display: inline-grid; place-items: center;
  width: 1.7rem; height: 1.7rem; border-radius: 9px;
  background: linear-gradient(150deg, var(--tiger-hi), var(--tiger-deep));
  font-size: .95rem; box-shadow: 0 3px 10px rgba(245,134,46,.35);
  transform: translateY(.15rem);
}
.nav-logo span { color: var(--tiger-hi); }
.nav-logo small {
  font-family: var(--font); font-weight: 700; font-size: .58rem;
  letter-spacing: .22em; color: var(--muted); align-self: center;
  border: 1px solid var(--line); padding: .12rem .4rem; border-radius: var(--r-pill);
}
.nav-links { display: flex; gap: .3rem; }
.nav-links a {
  font-weight: 700; font-size: .82rem; color: var(--text-2);
  text-decoration: none; padding: .45rem .8rem; border-radius: var(--r-pill);
  transition: background var(--t), color var(--t);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current] { color: var(--tiger-hi); background: var(--surface); }

main { max-width: var(--maxw); margin: 0 auto; }

/* ============================================================
   HERO (home)
   ============================================================ */
.hero { text-align: center; padding: clamp(2.4rem, 7vw, 4rem) 1.2rem 1.4rem; }
.hero-inner { max-width: 620px; margin: 0 auto; }
.eyebrow {
  display: inline-block; font-weight: 700; font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--tiger-hi);
  background: rgba(245,134,46,.1); border: 1px solid rgba(245,134,46,.25);
  padding: .35rem .8rem; border-radius: var(--r-pill); margin-bottom: 1.1rem;
}
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.1rem, 8vw, 3.5rem); line-height: 1.05;
  letter-spacing: -.02em; margin-bottom: .8rem;
}
.hero h1 em { font-style: normal; color: var(--tiger-hi); }
.hero-sub { color: var(--text-2); font-size: 1.02rem; max-width: 460px; margin: 0 auto 1.6rem; }

.search-wrap {
  display: flex; max-width: 380px; margin: 0 auto; gap: .4rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: .3rem .3rem .3rem 1.1rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.search-wrap:focus-within { border-color: var(--tiger); box-shadow: 0 0 0 4px rgba(245,134,46,.14); }
.search-wrap input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: .95rem; font-family: var(--font); font-weight: 600;
}
.search-wrap input::placeholder { color: var(--faint); font-weight: 400; }
.search-wrap button {
  border: none; cursor: pointer; font-weight: 700; font-size: .9rem;
  padding: .55rem 1.2rem; border-radius: var(--r-pill); color: #1a0d03;
  background: linear-gradient(150deg, var(--tiger-hi), var(--tiger-deep));
  transition: transform var(--t), filter var(--t);
}
.search-wrap button:hover { filter: brightness(1.08); }
.search-wrap button:active { transform: scale(.96); }

/* ---- Stats strip ---- */
.stats-strip {
  display: grid; grid-template-columns: repeat(3,1fr); gap: .6rem;
  margin: 1.4rem clamp(1rem,4vw,2rem) 0;
}
.stat-item {
  background: var(--surface); border: 1px solid var(--line);
  padding: .9rem; text-align: center; border-radius: var(--r);
}
.stat-n { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: var(--tiger-hi); line-height: 1; }
.stat-l { display: block; font-size: .68rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: .4rem; font-weight: 700; }

/* ============================================================
   CATEGORY TABS + GAME GRID
   ============================================================ */
.cat-tabs {
  display: flex; gap: .45rem; padding: 1.6rem clamp(1rem,4vw,2rem) .4rem;
  flex-wrap: wrap;
}
.cat-tab {
  padding: .5rem 1rem; border-radius: var(--r-pill); font-size: .85rem; font-weight: 700;
  cursor: pointer; border: 1px solid var(--line); color: var(--text-2);
  background: var(--surface); transition: all var(--t);
}
.cat-tab:hover { border-color: var(--line); color: var(--text); background: var(--surface-2); }
.cat-tab.active {
  background: linear-gradient(150deg, var(--tiger-hi), var(--tiger-deep));
  color: #1a0d03; border-color: transparent;
}

.games-section { padding: 1rem clamp(1rem,4vw,2rem); }
.section-header { display: flex; align-items: baseline; gap: .7rem; margin-bottom: 1rem; }
.section-header h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--text); }
.section-count { font-size: .8rem; color: var(--muted); font-weight: 700; }

.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }

.game-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.game-card:not(.disabled):hover { transform: translateY(-4px); border-color: rgba(245,134,46,.4); box-shadow: var(--shadow); }
.game-card.disabled { opacity: .55; }
.game-card.disabled .card-link { pointer-events: none; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-board {
  height: 132px; display: grid; place-items: center; padding: .6rem;
  background:
    radial-gradient(120px 80px at 50% 30%, rgba(245,134,46,.08), transparent 70%),
    var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.card-body { padding: 1rem 1rem 1.1rem; }
.game-name { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; color: var(--text); margin-bottom: .25rem; }
.game-tagline { font-size: .85rem; color: var(--muted); line-height: 1.45; margin-bottom: .9rem; min-height: 2.4em; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }

.badge { font-size: .68rem; font-weight: 700; padding: .25rem .6rem; border-radius: var(--r-pill); letter-spacing: .02em; }
.badge-hunt     { background: rgba(245,134,46,.14); color: var(--tiger-hi);  border: 1px solid rgba(245,134,46,.3); }
.badge-strategy { background: rgba(79,199,138,.14); color: var(--go);        border: 1px solid rgba(79,199,138,.3); }
.badge-puzzle   { background: rgba(124,131,222,.16); color: #aab0f4;         border: 1px solid rgba(124,131,222,.35); }
.badge-racing   { background: rgba(242,184,64,.14); color: var(--gold);      border: 1px solid rgba(242,184,64,.3); }
.coming-soon-badge { font-size: .68rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: .25rem .6rem; border-radius: var(--r-pill); }
.play-cta { font-size: .85rem; font-weight: 700; color: var(--tiger-hi); }

/* ============================================================
   GAME SHELL
   ============================================================ */
.game-shell { padding: 0 clamp(.6rem, 3vw, 1.5rem) 2rem; }

.game-topbar {
  display: flex; align-items: center; gap: .8rem;
  padding: .9rem .2rem .4rem;
}
.back-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  font-weight: 700; font-size: .85rem; color: var(--text-2); text-decoration: none;
  padding: .45rem .8rem .45rem .65rem; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line); transition: all var(--t);
}
.back-btn:hover { color: var(--text); border-color: var(--line); background: var(--surface-2); }
.game-topbar-title { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--text); flex: 1; }
.room-code-display:empty { display: none; }
.room-code-display {
  font-weight: 800; font-size: .8rem; color: var(--tiger-hi); letter-spacing: .12em;
  background: var(--surface); border: 1px solid rgba(245,134,46,.3);
  padding: .35rem .7rem; border-radius: var(--r-pill);
}

/* ---- Setup controls (the "top buttons") ---- */
.game-setup { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.1rem; }

.control-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .55rem; }
.control-label {
  font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: .1rem .2rem .45rem; display: block;
}

/* segmented controls */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .3rem; }
.seg-btn {
  appearance: none; border: none; cursor: pointer;
  padding: .65rem .4rem; border-radius: 11px;
  font-weight: 700; font-size: .9rem; color: var(--text-2);
  background: var(--surface-2); transition: all var(--t);
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
}
.seg-btn:hover { background: var(--surface-3); color: var(--text); }
.seg-btn.active {
  background: linear-gradient(150deg, var(--tiger-hi), var(--tiger-deep));
  color: #1a0d03; box-shadow: 0 4px 12px rgba(245,134,46,.3);
}
.seg-btn .ico { font-size: 1.05rem; line-height: 1; }

/* difficulty variant uses go-color when active */
.seg.seg-diff .seg-btn.active {
  background: linear-gradient(150deg, #6ad6a0, #2f9b67);
  box-shadow: 0 4px 12px rgba(79,199,138,.3); color: #06241a;
}

/* role variant: tiger/sheep tinted */
.seg.seg-role .seg-btn { font-weight: 700; }
.seg.seg-role .seg-btn[data-role="tiger"].active {
  background: linear-gradient(150deg, var(--tiger-hi), var(--tiger-deep)); color:#1a0d03;
  box-shadow: 0 4px 12px rgba(245,134,46,.3);
}
.seg.seg-role .seg-btn[data-role="sheep"].active {
  background: linear-gradient(150deg, #ffffff, #c8cfd2); color:#202a2c;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

.hidden { display: none !important; }

/* ---- Online panel ---- */
.online-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin-bottom: .6rem; }
.online-tab {
  border: none; cursor: pointer; padding: .55rem; border-radius: 10px; font-weight: 700; font-size: .85rem;
  color: var(--text-2); background: var(--surface-2); transition: all var(--t);
}
.online-tab.active { background: var(--surface-3); color: var(--text); }
.join-wrap { display: flex; gap: .4rem; }
.join-wrap input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: .65rem .9rem; border-radius: 10px; font-size: 1rem; font-weight: 800; outline: none;
  text-transform: uppercase; letter-spacing: .14em;
}
.join-wrap input::placeholder { font-weight: 400; letter-spacing: .04em; color: var(--faint); }
.room-share-wrap { text-align: center; margin-top: .7rem; padding: 1rem; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--r); }
.room-share-label { font-size: .82rem; color: var(--muted); margin-bottom: .3rem; font-weight: 600; }
.room-code-big { font-family: var(--font-display); font-weight: 700; font-size: 2.4rem; color: var(--tiger-hi); letter-spacing: .22em; margin: .2rem 0 .6rem; }
.room-waiting { font-size: .82rem; color: var(--text-2); margin-top: .7rem; font-weight: 600; }
.room-waiting::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--go); margin-right: .4rem; animation: blink 1.2s infinite; vertical-align: middle; }

/* ============================================================
   GAME LAYOUT. scoreboard, board, status
   ============================================================ */
.game-layout { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

/* scoreboard: two team cards */
.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; width: 100%; max-width: 520px; }
.team-card {
  position: relative; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r); padding: .8rem .85rem; transition: border-color var(--t), box-shadow var(--t);
  overflow: hidden;
}
.team-card.active-turn { border-color: var(--tiger); box-shadow: 0 0 0 3px rgba(245,134,46,.16); }
.team-card[data-team="sheep"].active-turn { border-color: var(--sheep-deep); box-shadow: 0 0 0 3px rgba(255,255,255,.12); }
.team-head { display: flex; align-items: center; gap: .55rem; }
.team-emoji {
  font-size: 1.5rem; line-height: 1; width: 2.3rem; height: 2.3rem; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 12px; background: var(--surface-2);
}
.team-card[data-team="tiger"] .team-emoji { background: rgba(245,134,46,.16); }
.team-card[data-team="sheep"] .team-emoji { background: rgba(255,255,255,.1); }
.team-meta { min-width: 0; }
.team-name { font-family: var(--font-display); font-weight: 600; font-size: 1rem; line-height: 1.1; }
.team-who { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.team-turn-dot { position: absolute; top: .7rem; right: .7rem; width: 9px; height: 9px; border-radius: 50%; background: var(--go); opacity: 0; transition: opacity var(--t); }
.team-card.active-turn .team-turn-dot { opacity: 1; animation: blink 1.1s infinite; }

.team-stats { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin-top: .65rem; }
.stat-chip {
  display: inline-flex; align-items: baseline; gap: .3rem; font-size: .74rem; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line-soft); padding: .25rem .5rem; border-radius: var(--r-pill);
  color: var(--text-2);
}
.stat-chip b { font-size: .85rem; color: var(--text); }
.captured-tray { display: flex; flex-wrap: wrap; gap: 2px; margin-top: .55rem; min-height: 1.1rem; font-size: .9rem; line-height: 1; }
.captured-tray:empty::after { content: "No captures yet"; font-size: .7rem; color: var(--faint); font-weight: 600; }
.reserve-pips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: .55rem; }
.reserve-pip { width: 9px; height: 9px; border-radius: 50%; background: var(--sheep); opacity: .9; }
.reserve-pip.used { background: var(--surface-3); opacity: 1; }

/* ---- Board area ---- */
.board-area { width: 100%; max-width: 480px; display: flex; flex-direction: column; align-items: center; gap: .7rem; }

.phase-indicator { width: 100%; max-width: 360px; }
.phase-pips { display: flex; gap: .35rem; margin-bottom: .35rem; }
.phase-pip { flex: 1; height: 5px; border-radius: var(--r-pill); background: var(--surface-2); transition: background var(--t); }
.phase-pip.active { background: var(--tiger); }
.phase-pip.done { background: var(--go); }
.phase-name { font-size: .8rem; color: var(--text-2); font-weight: 700; text-align: center; letter-spacing: .02em; }

.board-stage { position: relative; width: 100%; }
.board-container { width: 100%; touch-action: manipulation; }
.board-container svg { width: 100%; height: auto; }
.board-container.disabled { pointer-events: none; }
.board-container.disabled svg { filter: saturate(.85) brightness(.96); }

/* ---- Turn status banner ---- */
.turn-badge {
  width: 100%; max-width: 420px; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: .6rem 1rem; font-size: .92rem; font-weight: 700;
  color: var(--text-2); transition: all var(--t);
}
.turn-badge.my-turn { color: var(--text); border-color: rgba(245,134,46,.4); background: rgba(245,134,46,.08); }
.turn-badge.thinking { color: var(--text-2); }
.turn-badge.thinking::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: .5rem; vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--tiger-hi); border-radius: 50%; animation: spin .7s linear infinite; }
.turn-badge.error { color: #fff; border-color: var(--danger); background: var(--danger-soft); }

/* ---- Action log ---- */
.action-log {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: .55rem .9rem;
  font-size: .8rem; color: var(--muted); max-height: 96px; overflow-y: auto;
}
.action-log:empty { display: none; }
.log-item { line-height: 1.7; padding: .12rem 0; border-bottom: 1px solid var(--line-soft); }
.log-item:last-child { border-bottom: none; }
.ev-tiger { color: var(--tiger-hi); font-weight: 800; }
.ev-sheep { color: var(--sheep); font-weight: 800; }
.ev-phase { color: var(--go); font-weight: 800; }

.new-game-btn {
  margin-top: .3rem; width: 100%; max-width: 420px; padding: .85rem;
  border: none; cursor: pointer; border-radius: var(--r-pill);
  font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: #1a0d03;
  background: linear-gradient(150deg, var(--tiger-hi), var(--tiger-deep));
  box-shadow: 0 6px 18px rgba(245,134,46,.3); transition: transform var(--t), filter var(--t);
}
.new-game-btn:hover { filter: brightness(1.06); }
.new-game-btn:active { transform: translateY(1px) scale(.99); }

/* ---- Animation overlay ---- */
.anim-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(8,12,11,.55); opacity: 0; pointer-events: none;
  transition: opacity .2s; z-index: 40; border-radius: var(--r-lg);
}
.anim-overlay.show { opacity: 1; }
.anim-capture { font-size: 3.2rem; animation: captureBurst .9s var(--ease); }
.anim-phase { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--gold); animation: phaseIn 1.2s var(--ease); text-shadow: 0 2px 12px rgba(0,0,0,.5); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(6,10,9,.72); backdrop-filter: blur(6px); padding: 1.2rem;
  animation: fadeIn .2s var(--ease);
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 2rem 1.6rem 1.6rem; text-align: center; max-width: 340px; width: 100%;
  box-shadow: var(--shadow); animation: popIn .32s var(--ease);
}
.modal-icon { font-size: 3.6rem; margin-bottom: .5rem; line-height: 1; animation: trophyPop .5s var(--ease) .1s both; }
.modal h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; margin-bottom: .4rem; }
.modal.win h2 { color: var(--gold); }
.modal.lose h2 { color: var(--text); }
.modal.draw h2 { color: var(--text-2); }
.modal p { font-size: .95rem; color: var(--text-2); margin-bottom: 1.4rem; }
.modal-actions { display: flex; flex-direction: column; gap: .6rem; }

/* ============================================================
   BUTTONS (shared)
   ============================================================ */
.btn-primary {
  display: block; text-align: center; text-decoration: none; cursor: pointer; border: none;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; color: #1a0d03;
  padding: .8rem 1.3rem; border-radius: var(--r-pill);
  background: linear-gradient(150deg, var(--tiger-hi), var(--tiger-deep));
  box-shadow: 0 6px 18px rgba(245,134,46,.3); transition: transform var(--t), filter var(--t);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px) scale(.99); }
.btn-secondary {
  display: block; text-align: center; text-decoration: none; cursor: pointer;
  font-weight: 700; font-size: .95rem; color: var(--text-2);
  padding: .75rem 1.3rem; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line); transition: all var(--t);
}
.btn-secondary:hover { color: var(--text); border-color: var(--line); background: var(--surface-3); }

/* ============================================================
   GAME-DISABLED / HOW-TO STRIP
   ============================================================ */
.game-disabled-notice { text-align: center; padding: 3rem 1.5rem; }
.game-disabled-notice h2 { font-family: var(--font-display); font-weight: 700; color: var(--tiger-hi); font-size: 1.5rem; margin-bottom: .6rem; }
.game-disabled-notice p { color: var(--muted); margin-bottom: 1.4rem; }
.game-disabled-notice .btn-primary { display: inline-block; }

.how-to-play-strip {
  max-width: 520px; margin: 2rem auto 0; padding: 1.4rem clamp(1rem,4vw,1.5rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.how-to-play-strip h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin-bottom: .5rem; }
.how-to-play-strip p { font-size: .9rem; color: var(--text-2); margin-bottom: .8rem; }
.how-to-play-strip a { font-size: .9rem; font-weight: 700; color: var(--tiger-hi); text-decoration: none; }
.how-to-play-strip a:hover { text-decoration: underline; }

/* ============================================================
   CONTENT PAGES (howtoplay / static / leaderboard / 404)
   ============================================================ */
.howtoplay-inner, .static-inner, .leaderboard-inner { max-width: 720px; margin: 0 auto; padding: 1rem clamp(1rem,4vw,1.5rem) 3rem; }

.breadcrumb ol { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; font-size: .82rem; padding: 1.2rem 0 .6rem; font-weight: 600; }
.breadcrumb li::after { content: '›'; color: var(--faint); margin-left: .4rem; }
.breadcrumb li:last-child::after { display: none; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--tiger-hi); }
.breadcrumb [aria-current] { color: var(--text-2); }

.howtoplay-header { margin-bottom: 2rem; }
.game-meta-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.origin-badge { font-size: .76rem; font-weight: 700; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); padding: .3rem .65rem; border-radius: var(--r-pill); }
.howtoplay-header h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem,5vw,2.3rem); margin-bottom: .7rem; letter-spacing: -.01em; }
.howtoplay-lead { color: var(--text-2); font-size: 1.02rem; line-height: 1.7; }
.howtoplay-header .btn-primary { display: inline-block; margin-top: 1.2rem; }

.howtoplay-content { color: var(--text-2); line-height: 1.8; font-size: 1rem; }
.howtoplay-content h2 { font-family: var(--font-display); font-weight: 600; color: var(--text); font-size: 1.3rem; margin: 1.8rem 0 .6rem; }
.howtoplay-content h3 { font-weight: 800; color: var(--tiger-hi); font-size: 1.02rem; margin: 1.2rem 0 .35rem; }
.howtoplay-content p { margin-bottom: .9rem; }
.howtoplay-content ul { padding-left: 1.3rem; margin-bottom: .9rem; }
.howtoplay-content li { margin-bottom: .35rem; }
.howtoplay-content strong { color: var(--text); }

.faq-section { margin: 2.5rem 0; }
.faq-section h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; margin-bottom: 1rem; }
.faq-item { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: .6rem; overflow: hidden; background: var(--surface); }
.faq-q { padding: .9rem 1.1rem; cursor: pointer; font-size: .98rem; font-weight: 700; color: var(--text); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after { content: '+'; color: var(--tiger-hi); font-size: 1.4rem; font-weight: 400; line-height: 1; flex-shrink: 0; transition: transform var(--t); }
.faq-item[open] .faq-q::after { transform: rotate(45deg); }
.faq-a { padding: 0 1.1rem 1rem; font-size: .92rem; color: var(--text-2); line-height: 1.7; }

.howtoplay-cta { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1.8rem; text-align: center; }
.howtoplay-cta h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; margin-bottom: .4rem; }
.howtoplay-cta p { color: var(--text-2); margin-bottom: 1.2rem; }
.howtoplay-cta .btn-primary { display: inline-block; }

.static-content { color: var(--text-2); line-height: 1.8; font-size: 1rem; }
.static-content h1 { font-family: var(--font-display); font-weight: 700; color: var(--text); font-size: clamp(1.7rem,5vw,2.3rem); margin-bottom: 1rem; }
.static-content h2 { font-family: var(--font-display); font-weight: 600; color: var(--tiger-hi); font-size: 1.25rem; margin: 1.8rem 0 .6rem; }
.static-content p { margin-bottom: .9rem; }
.static-content ul { padding-left: 1.3rem; margin-bottom: .9rem; }
.static-content li { margin-bottom: .35rem; }
.static-content a { color: var(--tiger-hi); }
.static-content code { background: var(--surface); padding: .12rem .45rem; border-radius: 6px; font-size: .9rem; }

/* ---- Leaderboard ---- */
.leaderboard-header { text-align: center; padding: 1.8rem 0 1.4rem; }
.leaderboard-header h1 { font-family: var(--font-display); font-weight: 700; font-size: 2rem; margin-bottom: .4rem; }
.leaderboard-header p { color: var(--muted); font-size: .92rem; }
.lb-game-tabs { display: flex; gap: .45rem; justify-content: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.lb-tab { padding: .5rem 1rem; border-radius: var(--r-pill); font-size: .85rem; font-weight: 700; text-decoration: none; border: 1px solid var(--line); color: var(--text-2); background: var(--surface); transition: all var(--t); }
.lb-tab:hover { color: var(--text); background: var(--surface-2); }
.lb-tab.active { background: linear-gradient(150deg, var(--tiger-hi), var(--tiger-deep)); color: #1a0d03; border-color: transparent; }
.lb-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.lb-table th { text-align: left; padding: .6rem .8rem; color: var(--muted); font-weight: 800; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.lb-table td { padding: .7rem .8rem; border-bottom: 1px solid var(--line-soft); font-weight: 600; }
.lb-table tr.rank-1 td { color: var(--gold); }
.lb-table tr.rank-2 td { color: #d3dce0; }
.lb-table tr.rank-3 td { color: #d9a06a; }
.lb-table .elo { font-weight: 800; }
.lb-table .wins { color: var(--go); }
.lb-empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.lb-empty p { margin-bottom: .6rem; }
.lb-empty .btn-primary { display: inline-block; margin-top: 1rem; }

/* ---- 404 ---- */
.not-found-page { display: grid; place-items: center; min-height: 60vh; padding: 2rem; }
.nf-inner { text-align: center; }
.nf-icon { font-size: 4.5rem; margin-bottom: 1rem; }
.nf-inner h1 { font-family: var(--font-display); font-weight: 700; color: var(--tiger-hi); font-size: 1.8rem; margin-bottom: .6rem; }
.nf-inner p { color: var(--muted); margin-bottom: 1.5rem; }
.nf-inner .btn-primary { display: inline-block; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { text-align: center; padding: 2.5rem 1.5rem; border-top: 1px solid var(--line-soft); margin-top: 2.5rem; }
.site-footer p { font-size: .82rem; color: var(--muted); }
.site-footer a { color: var(--text-2); text-decoration: none; font-weight: 700; }
.site-footer a:hover { color: var(--tiger-hi); }

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes popIn { 0%{transform:scale(.85);opacity:0} 100%{transform:scale(1);opacity:1} }
@keyframes trophyPop { 0%{transform:scale(0) rotate(-12deg)} 70%{transform:scale(1.2) rotate(6deg)} 100%{transform:scale(1) rotate(0)} }
@keyframes captureBurst { 0%{transform:scale(.3);opacity:0} 45%{transform:scale(1.45);opacity:1} 100%{transform:scale(1);opacity:1} }
@keyframes phaseIn { 0%{transform:translateY(14px);opacity:0} 35%{opacity:1} 100%{transform:translateY(0)} }

/* board piece animations (driven by renderer classes) */
.fw-hint-dot { animation: hintPulse 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.fw-capture-ring { animation: capPulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.fw-piece-selected { animation: piecePulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes hintPulse { 0%,100%{opacity:.55; transform:scale(.85)} 50%{opacity:1; transform:scale(1.1)} }
@keyframes capPulse { 0%,100%{opacity:.7} 50%{opacity:1} }
@keyframes piecePulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.06)} }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 760px) {
  .game-shell { padding-top: .5rem; }
  .scoreboard { max-width: 560px; }
  .board-area { max-width: 520px; }
}

@media (max-width: 380px) {
  body { font-size: 15px; }
  .team-stats { gap: .3rem; }
  .stat-chip { font-size: .68rem; padding: .2rem .42rem; }
  .room-code-big { font-size: 2rem; }
}
