/* ============================ 1v1 Pictures ============================ */
:root {
  --bg:        #0c0d1a;
  --bg-2:      #14162b;
  --panel:     #1b1e38;
  --panel-2:   #23264a;
  --line:      #2d3160;
  --text:      #eef0ff;
  --muted:     #9aa0c7;
  --accent:    #6c5ce7;
  --accent-2:  #00d2ff;
  --good:      #2ee6a6;
  --warn:      #ffb020;
  --bad:       #ff4d6d;
  --gold:      #ffd34e;
  --radius:    18px;
  --shadow:    0 18px 50px rgba(0,0,0,.45);
  --grad:      linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --font:      'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(108,92,231,.30), transparent 60%),
    radial-gradient(1000px 600px at -10% 110%, rgba(0,210,255,.22), transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

/* ----- top nav ----- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; max-width: 1080px; margin: 0 auto;
  flex-wrap: wrap; gap: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 1.25rem; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad);
  display: grid; place-items: center; font-size: 20px; box-shadow: 0 6px 18px rgba(108,92,231,.5);
}
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-weight: 600; white-space: nowrap; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ----- buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font); font-weight: 700; font-size: 1rem;
  padding: 14px 24px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--panel-2); color: var(--text); transition: transform .12s ease, filter .12s ease, background .2s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); color: #0b0c18; box-shadow: 0 12px 30px rgba(108,92,231,.45); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); color: var(--text); }
.btn-danger { background: rgba(255,77,109,.15); color: var(--bad); border: 1.5px solid rgba(255,77,109,.4); }
.btn-lg { padding: 17px 30px; font-size: 1.1rem; }
.btn-sm { padding: 9px 15px; font-size: .9rem; border-radius: 11px; }
.btn-block { width: 100%; }

/* ----- landing hero ----- */
.hero { text-align: center; padding: 46px 0 30px; }
.tagpill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 15px; border-radius: 999px;
  background: rgba(108,92,231,.14); border: 1px solid var(--line); color: var(--muted);
  font-weight: 600; font-size: .85rem; margin-bottom: 22px;
}
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); line-height: 1.02; margin: 0 0 18px; letter-spacing: -1.5px; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p.sub { font-size: clamp(1.05rem, 2.4vw, 1.35rem); color: var(--muted); max-width: 640px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ----- feature cards ----- */
.section-title { text-align: center; font-size: 1.9rem; margin: 60px 0 8px; }
.section-sub { text-align: center; color: var(--muted); margin: 0 0 30px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.card {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(27,30,56,.6) 100%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.card .ico { font-size: 30px; margin-bottom: 14px; display: block; }
.card h3 { margin: 0 0 9px; font-size: 1.2rem; }
.card p { margin: 0; color: var(--muted); line-height: 1.5; }

/* ----- steps ----- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 18px; counter-reset: step; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; position: relative; }
.step .num {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #0b0c18;
  display: grid; place-items: center; font-weight: 800; margin-bottom: 12px;
}
.step h4 { margin: 0 0 6px; }
.step p { margin: 0; color: var(--muted); line-height: 1.5; }

/* ----- category chips ----- */
.chips { display: flex; flex-wrap: wrap; gap: 11px; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 9px; padding: 11px 17px; border-radius: 13px;
  background: var(--panel); border: 1px solid var(--line); font-weight: 600;
}
.chip .em { font-size: 1.15rem; }
.chip .ct { color: var(--muted); font-size: .82rem; background: rgba(255,255,255,.05); padding: 2px 8px; border-radius: 8px; }

/* ----- footer ----- */
footer { text-align: center; color: var(--muted); padding: 60px 0 40px; }
footer .note { font-size: .82rem; opacity: .7; margin-top: 10px; max-width: 560px; margin-left: auto; margin-right: auto; }

/* ============================ PLAY PAGE ============================ */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.center-col { max-width: 560px; margin: 30px auto; }
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 7px; color: var(--muted); }
.input, select {
  width: 100%; padding: 13px 15px; border-radius: 12px; background: var(--bg-2);
  border: 1.5px solid var(--line); color: var(--text); font-family: var(--font); font-size: 1rem;
}
.input:focus, select:focus { outline: none; border-color: var(--accent); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.seg { display: flex; gap: 8px; background: var(--bg-2); padding: 6px; border-radius: 14px; border: 1px solid var(--line); }
.seg button {
  flex: 1; padding: 13px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font-family: var(--font); font-weight: 700; font-size: 1rem; cursor: pointer; transition: all .15s;
}
.seg button.on { background: var(--grad); color: #0b0c18; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 10px; max-height: 280px; overflow-y: auto; padding: 4px; }
.subject {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 14px; cursor: pointer;
  background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 13px; transition: all .15s;
}
.subject:hover { border-color: var(--accent); }
.subject.sel { border-color: var(--accent); background: rgba(108,92,231,.16); }
.subject .em { font-size: 1.5rem; }
.subject .nm { font-weight: 700; font-size: .95rem; }
.subject .ct { color: var(--muted); font-size: .78rem; }

.help { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.muted { color: var(--muted); }
.err { background: rgba(255,77,109,.12); border: 1px solid rgba(255,77,109,.4); color: #ffced8; padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; }
.banner { padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; background: rgba(0,210,255,.1); border: 1px solid rgba(0,210,255,.35); color: #c6f3ff; }

/* ----- share / waiting ----- */
.code-box { text-align: center; padding: 18px; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 14px; margin: 14px 0; }
.code-box .code { font-size: 2.4rem; font-weight: 800; letter-spacing: 6px; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.share-row { display: flex; gap: 8px; margin-top: 8px; }
.share-row .input { font-size: .9rem; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent-2); border-radius: 50%; animation: spin 1s linear infinite; margin: 6px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ GAME BOARD ============================ */
.board { max-width: 1000px; margin: 8px auto; padding: 0 16px; }

/* ---- viewport-fit game board: no page scroll between the clock and the input ----
   While a board is on screen the page is locked to the viewport height and the
   image becomes the one flexible element (it shrinks to fill leftover space), so the
   clocks stay pinned at the top and the mic/controls/type box stay reachable at the
   bottom without scrolling. Scoped to body.playing so every other page is untouched. */
body.playing { display: flex; flex-direction: column; min-height: 100dvh; }
body.playing .nav { display: none; }
body.playing #app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#screen-game.active, #screen-turn.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#screen-game .board, #screen-turn .board { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#screen-game .stage, #screen-turn .stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#screen-game .imgwrap, #screen-turn .imgwrap { flex: 1 1 auto; min-height: 60px; aspect-ratio: auto; }
#screen-game .board-top, #screen-game .players, #screen-game #game-banner,
#screen-turn .board-top, #screen-turn .roster { flex: 0 0 auto; }
#screen-game .turnbar, #screen-game .mic, #screen-game #captions, #screen-game .controls, #screen-game #typebox,
#screen-turn .turnbar, #screen-turn .turn-clock, #screen-turn .mic, #screen-turn #captions,
#screen-turn .controls, #screen-turn #typebox { flex: 0 0 auto; }
.board-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.board-top .cat { font-weight: 700; }
.board-top .cat .em { font-size: 1.2rem; }

.players { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; margin-bottom: 16px; }
.pcard {
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  transition: border-color .2s, box-shadow .2s; position: relative; overflow: hidden;
}
.pcard.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 12px 34px rgba(108,92,231,.35); }
.pcard.active::before {
  content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(108,92,231,.16), transparent 60%);
  pointer-events: none;
}
.pcard .pname { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; }
.pcard .pname .you { font-size: .68rem; background: var(--grad); color: #0b0c18; padding: 2px 7px; border-radius: 7px; }
.pcard .pmeta { color: var(--muted); font-size: .8rem; margin: 2px 0 10px; }
.clock { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.clock.low { color: var(--warn); }
.clock.crit { color: var(--bad); animation: pulse .7s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.pcard .score { position: absolute; top: 14px; right: 16px; color: var(--muted); font-size: .82rem; }
.pcard .turnflag { font-size: .78rem; font-weight: 700; color: var(--accent-2); height: 14px; margin-top: 4px; }
.vs { display: grid; place-items: center; font-weight: 800; color: var(--muted); font-size: 1.1rem; min-width: 30px; }

.stage { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.imgwrap { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-2); aspect-ratio: 4/3; display: grid; place-items: center; }
.imgwrap img { width: 100%; height: 100%; object-fit: contain; }
.imgwrap .reveal {
  position: absolute; inset: 0; display: none; flex-direction: column; gap: 6px; align-items: center; justify-content: center;
  background: rgba(8,9,20,.86); backdrop-filter: blur(3px); text-align: center; padding: 20px;
}
.imgwrap .reveal.show { display: flex; animation: fade .2s; }
.imgwrap .reveal .who { color: var(--muted); font-weight: 600; }
.imgwrap .reveal .ans { font-size: 1.9rem; font-weight: 800; }
.imgwrap .reveal .tick { font-size: 2rem; }

.turnbar { text-align: center; margin: 8px 0 4px; min-height: 22px; font-size: 1.1rem; font-weight: 700; }
.turnbar.you { color: var(--good); }
.turnbar.them { color: var(--muted); }

/* mic + captions */
.mic { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 8px; }
.mic .dot { width: 13px; height: 13px; border-radius: 50%; background: var(--muted); }
.mic.live .dot { background: var(--bad); box-shadow: 0 0 0 0 rgba(255,77,109,.7); animation: ring 1.4s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255,77,109,.6);} 70% { box-shadow: 0 0 0 14px rgba(255,77,109,0);} 100%{box-shadow:0 0 0 0 rgba(255,77,109,0);} }
.captions {
  min-height: 26px; text-align: center; color: var(--muted); font-size: 1.05rem; margin-top: 10px;
  font-style: italic; transition: color .15s;
}
.captions.miss { color: var(--bad); }
.controls { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.typebox { display: none; gap: 8px; max-width: 420px; margin: 10px auto 0; }
.typebox.show { display: flex; }

/* game over */
.gameover { text-align: center; }
.gameover .result { font-size: 2.4rem; font-weight: 800; margin-bottom: 4px; }
.gameover .result.win { color: var(--good); }
.gameover .result.lose { color: var(--bad); }
.elo-row { display: flex; justify-content: center; gap: 26px; margin: 18px 0; flex-wrap: wrap; }
.elo-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 22px; min-width: 150px; }
.elo-card .nm { font-weight: 700; }
.elo-card .val { font-size: 1.7rem; font-weight: 800; }
.elo-card .delta.up { color: var(--good); } .elo-card .delta.down { color: var(--bad); }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--panel-2); border: 1px solid var(--line); padding: 12px 20px; border-radius: 12px;
  box-shadow: var(--shadow); transition: all .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* leaderboard */
table.lb { width: 100%; border-collapse: collapse; }
table.lb th, table.lb td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.lb th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; }
table.lb td.rank { font-weight: 800; width: 50px; }
table.lb tr:nth-child(1) td.rank { color: var(--gold); }
table.lb td.elo { font-weight: 800; color: var(--accent-2); }

@media (max-width: 620px) {
  .players { grid-template-columns: 1fr 1fr; gap: 10px; }
  .vs { display: none; }
  .clock { font-size: 1.7rem; }
  .pcard { padding: 10px 12px; }
  .pcard .score { font-size: .72rem; top: 10px; right: 12px; }
  .pcard .pmeta { margin: 1px 0 6px; }
  .stage { padding: 12px; }
  .nav { padding: 14px 16px; }
  .nav-links { width: 100%; justify-content: center; gap: 10px 16px; font-size: .94rem; }
}

/* ============ playjake.win network bar (shared brand across games) ============ */
.pjbar{background:#0b0c16;border-bottom:1px solid #23264a;position:sticky;top:0;z-index:100}
.pjbar-inner{max-width:1080px;margin:0 auto;padding:8px 22px;display:flex;align-items:center;
  justify-content:space-between;gap:12px;font-size:13px}
.pjbar a{text-decoration:none}
.pjbar-brand{display:flex;align-items:center;gap:8px;font-weight:700;color:#eef0ff}
.pjbar-brand .l{width:22px;height:22px;border-radius:7px;background:linear-gradient(135deg,#6c5ce7,#00d2ff);
  display:grid;place-items:center;font-size:12px}
.pjbar-brand .w{background:linear-gradient(135deg,#6c5ce7,#00d2ff);-webkit-background-clip:text;
  background-clip:text;-webkit-text-fill-color:transparent}
.pjbar-other{color:#9aa0c7;font-weight:600}
.pjbar-other:hover{color:#fff}
@media(max-width:520px){.pjbar-inner{font-size:12px;padding:8px 14px}}
