/* TGPlay Chess — screen-specific styles, scoped under .tgc.
 *
 * Covers the 9 design screens:
 *   1. Lobby (hero, continue cards, stats, modes-grid, friends, history)
 *   2. Matchmaking (radar, params)
 *   3. Game (eval-bar, right rail, moves, opening, chat)
 *   4. Result (verb, delta, ribbons)
 *   5. Tournaments (featured, list)
 *   6. Puzzles (board+side, streak, categories)
 *   7. Watch (featured, grid, mini-boards)
 *   8. Leaderboard (podium, table)
 *   9. Profile (hero, openings, achievements)
 *
 * Generic primitives (board, sidebar, topbar, buttons, chips, stat tile,
 * mode card, pstrip, rack) live in components.css.
 */

/* ════════════════════ 1. LOBBY ════════════════════ */
.tgc .lobby-hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  background: linear-gradient(135deg, oklch(0.2 0.04 265) 0%, oklch(0.16 0.025 265) 100%);
  border: 1px solid var(--ink-4);
  border-radius: var(--radius-xl);
  padding: 34px 36px;
  margin: 8px 0;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-pop);
}
.tgc .lobby-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(60% 80% at 0% 50%, oklch(0.35 0.18 var(--hue-primary) / 0.25), transparent 60%);
  pointer-events: none;
}
.tgc .lobby-hero__text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.tgc .lobby-hero__title {
  font-family: var(--font-display);
  font-size: 38px; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.05; margin: 0;
  text-wrap: balance;
}
.tgc .lobby-hero__title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--amber), var(--brand-hi));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tgc .lobby-hero__desc { color: var(--text-2); font-size: 14px; margin: 0; max-width: 460px; }
.tgc .lobby-hero__cta { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.tgc .lobby-hero__meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-3); margin-top: 10px; align-items: center; flex-wrap: wrap; }
.tgc .lobby-hero__meta b { color: var(--text-1); font-weight: 700; }
.tgc .lobby-hero__board { position: relative; z-index: 1; }
.tgc .lobby-hero__tag {
  position: absolute; top: -10px; right: 0;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 10px; background: var(--ink-3); color: var(--amber);
  border-radius: 999px; border: 1px solid var(--ink-4);
  z-index: 2;
}

/* CONTINUE row */
.tgc .continue-row {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px;
  margin: 0 calc(var(--page-pad) * -1);
  padding-left: var(--page-pad); padding-right: var(--page-pad);
  scrollbar-width: none;
}
.tgc .continue-row::-webkit-scrollbar { display: none; }
.tgc .continue {
  flex: 0 0 340px;
  display: flex; gap: 12px; padding: 12px;
  background: var(--ink-2); border: 1px solid var(--ink-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s;
}
.tgc .continue:hover { border-color: oklch(0.45 0.15 var(--hue-primary) / 0.6); }
.tgc .continue__mini { flex: 0 0 84px; border-radius: 8px; overflow: hidden; }
.tgc .continue__mini .board { border-radius: 8px; box-shadow: none; }
.tgc .continue__mini .board__rank, .tgc .continue__mini .board__file { display: none; }
.tgc .continue__info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.tgc .continue__who { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.tgc .continue__status { font-size: 11px; color: var(--text-3); }
.tgc .continue__progress { height: 3px; background: var(--ink-3); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.tgc .continue__progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-lo), var(--brand-hi)); }
.tgc .continue__resume { font-size: 10px; font-weight: 700; color: var(--brand-hi); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }

/* STATS grid (4 stat tiles in a row) */
.tgc .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tgc .winbar { display: flex; height: 4px; border-radius: 2px; overflow: hidden; gap: 1px; }
.tgc .winbar span { height: 100%; }

/* MODES grid */
.tgc .modes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* Bot level chips inside Mode card */
.tgc .lvl {
  flex: 1; padding: 8px 6px;
  background: var(--ink-3);
  border-radius: 8px;
  border: 1px solid transparent;
  text-align: center;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.tgc .lvl:hover { border-color: var(--ink-5); }
.tgc .lvl--on { background: oklch(0.3 0.08 var(--hue-chess) / 0.3); border-color: var(--amber-lo); }
.tgc .lvl__v { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--text-2); }
.tgc .lvl--on .lvl__v { color: var(--amber); }
.tgc .lvl__bars { display: flex; gap: 1.5px; margin-top: 4px; justify-content: center; }
.tgc .lvl__bars span { width: 3px; height: 6px; background: var(--ink-4); border-radius: 1px; }
.tgc .lvl__bars span.on { background: var(--text-2); }
.tgc .lvl--on .lvl__bars span.on { background: var(--amber); }

/* Mini-tournament list inside Mode card */
.tgc .mini-tourn { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--ink-3); }
.tgc .mini-tourn:last-of-type { border: 0; }
.tgc .mini-tourn b { font-weight: 600; }
.tgc .mini-tourn small { color: var(--text-3); font-size: 11px; }
.tgc .mini-tourn u { margin-left: auto; text-decoration: none; color: var(--text-3); font-family: var(--font-mono); font-size: 11px; }

/* Watch row inside Mode card */
.tgc .watchrow { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--ink-3); }
.tgc .watchrow:last-of-type { border: 0; }
.tgc .watchrow b { font-weight: 600; }
.tgc .watchrow small { color: var(--text-3); font-size: 11px; }
.tgc .watchrow u { margin-left: auto; text-decoration: none; color: var(--live); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }

/* Puzzle streak inside Mode card */
.tgc .puzz-streak { display: flex; flex-direction: column; gap: 4px; }
.tgc .puzz-streak__v { font-size: 11px; color: var(--text-3); }
.tgc .puzz-streak__bar { display: flex; gap: 3px; }
.tgc .puzz-streak__bar span { flex: 1; height: 8px; border-radius: 2px; background: var(--ink-3); }
.tgc .puzz-streak__bar span.on { background: linear-gradient(90deg, var(--amber-lo), var(--amber)); }
.tgc .puzz-streak__n { font-family: var(--font-mono); font-size: 12px; color: var(--amber); font-weight: 700; }

/* Friend-link copy row */
.tgc .link-row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--ink-3); border-radius: 8px; }
.tgc .link-row code { flex: 1; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

/* LOBBY RAIL — friends + history */
.tgc .lobby-rail { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; margin-top: 10px; }
.tgc .friends { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.tgc .friend { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.tgc .friend__avatar {
  position: relative;
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, oklch(0.4 0.1 var(--hue-primary)), oklch(0.28 0.08 var(--hue-primary)));
  display: grid; place-items: center; font-weight: 700; color: white; font-size: 13px;
  flex-shrink: 0;
}
.tgc .friend b { font-size: 13px; font-weight: 600; }

.tgc .history { display: flex; flex-direction: column; gap: 4px; }
.tgc .histrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.tgc .histrow__badge { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 13px; }
.tgc .histrow__badge--W { background: oklch(0.28 0.1 150 / 0.4); color: var(--live); }
.tgc .histrow__badge--L { background: oklch(0.28 0.12 25 / 0.4); color: var(--hot); }
.tgc .histrow__badge--D { background: var(--ink-3); color: var(--text-2); }

/* ════════════════════ 2. MATCHMAKING ════════════════════ */
.tgc .mm-hero {
  display: grid; grid-template-columns: 280px 1fr;
  gap: 32px; padding: 28px;
  border: 1px solid var(--ink-4); border-radius: var(--radius-xl);
  background: linear-gradient(135deg, oklch(0.2 0.04 265), oklch(0.15 0.025 265));
  margin-top: 8px; align-items: center; box-shadow: var(--shadow-pop);
}
.tgc .mm-radar { position: relative; width: 280px; height: 280px; }
.tgc .mm-radar__ring { position: absolute; inset: 50%; border-radius: 50%; border: 1px solid oklch(0.5 0.18 var(--hue-chess) / 0.3); transform: translate(-50%,-50%); }
.tgc .mm-radar__ring--1 { width: 100px; height: 100px; }
.tgc .mm-radar__ring--2 { width: 180px; height: 180px; opacity: 0.7; }
.tgc .mm-radar__ring--3 { width: 260px; height: 260px; opacity: 0.4; }
.tgc .mm-radar__ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--amber); opacity: 0.5; animation: tgc-radar 2.4s infinite var(--tap); }
@keyframes tgc-radar { 0%{transform:scale(0.6); opacity:0.6} 100%{transform:scale(1.4); opacity:0} }
.tgc .mm-radar__core {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px; border-radius: 50%;
  transform: translate(-50%,-50%);
  background: linear-gradient(135deg, var(--amber), var(--amber-lo));
  display: grid; place-items: center;
  font-size: 28px; color: oklch(0.18 0.04 55);
  box-shadow: 0 0 30px var(--amber-glow);
  z-index: 2;
}
.tgc .mm-radar__node {
  position: absolute; padding: 4px 8px; border-radius: 999px;
  background: var(--ink-3); border: 1px solid var(--ink-4);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--text-2);
  transform: translate(-50%,-50%);
}
.tgc .mm-radar__node--match { background: var(--amber); color: oklch(0.2 0.04 55); border-color: var(--amber); animation: tgc-pulse 1.4s infinite; }
.tgc .mm-info__title { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; margin: 8px 0 12px; }
.tgc .mm-info__title em { font-style: normal; color: var(--brand-hi); }
.tgc .mm-info__bar { height: 5px; border-radius: 3px; background: var(--ink-3); overflow: hidden; margin-bottom: 10px; }
.tgc .mm-info__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-lo), var(--amber)); border-radius: inherit; }
.tgc .mm-info__time { display: flex; align-items: baseline; gap: 10px; }
.tgc .mm-info__time small { color: var(--text-3); font-size: 12px; }
.tgc .mm-info__counts { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.tgc .mm-info__counts b { color: var(--text-1); font-weight: 700; }
.tgc .mm-params { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 8px; }
.tgc .mm-param { padding: 12px 14px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.tgc .mm-param__k { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.tgc .mm-param__v { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin-top: 4px; }
.tgc .mm-param__v small { font-size: 11px; color: var(--text-3); font-family: var(--font-body); font-weight: 500; margin-left: 4px; }

/* ════════════════════ 3. GAME ════════════════════ */
.tgc .game-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  padding-top: 4px;
}
.tgc .game-center { display: flex; flex-direction: column; gap: 10px; }
.tgc .game-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }

.tgc .evalbar {
  width: 22px; border-radius: 8px; overflow: hidden;
  background: var(--ink-3);
  position: relative; border: 1px solid var(--ink-4);
  min-height: 480px; align-self: start;
}
.tgc .evalbar__black { background: oklch(0.2 0.02 265); width: 100%; position: relative; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; }
.tgc .evalbar__white { background: oklch(0.9 0.01 85); width: 100%; position: relative; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; }
.tgc .evalbar__v { font-family: var(--font-mono); font-size: 9px; font-weight: 700; }
.tgc .evalbar__black .evalbar__v { color: oklch(0.8 0.01 265); }
.tgc .evalbar__white .evalbar__v { color: oklch(0.18 0.02 265); }
.tgc .evalbar__mid { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: oklch(0.5 0.18 var(--hue-chess) / 0.5); }

.tgc .flag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  padding: 2px 5px; border-radius: 4px;
  background: var(--ink-3); color: var(--text-3);
  font-family: var(--font-mono);
  margin-left: 4px;
}

.tgc .game-right { display: flex; flex-direction: column; gap: 10px; }
.tgc .rtabs { display: flex; gap: 2px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: 10px; padding: 3px; }
.tgc .rtab {
  flex: 1; padding: 7px 4px;
  font-size: 12px; font-weight: 600;
  color: var(--text-2); border-radius: 7px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.tgc .rtab--on { background: var(--ink-0); color: var(--text-1); box-shadow: 0 2px 8px -2px oklch(0 0 0 / 0.4); }
.tgc .rtab u { font-size: 10px; color: var(--brand-hi); font-family: var(--font-mono); text-decoration: none; }

.tgc .opening-card {
  padding: 12px 14px;
  background: linear-gradient(135deg, oklch(0.22 0.06 var(--hue-primary) / 0.35), oklch(0.18 0.04 var(--hue-primary) / 0.25));
  border: 1px solid oklch(0.45 0.15 var(--hue-primary) / 0.3);
  border-radius: var(--radius-md);
}
.tgc .opening-card__eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand-hi); }
.tgc .opening-card__title { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: -0.01em; margin-top: 4px; line-height: 1.2; }
.tgc .opening-card__book { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.tgc .opening-card__book b { color: var(--text-1); }

.tgc .moves {
  background: var(--ink-2); border: 1px solid var(--ink-4);
  border-radius: var(--radius-md);
  padding: 8px;
  max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1px;
  font-family: var(--font-mono); font-size: 12px;
}
.tgc .moves__row { display: grid; grid-template-columns: 26px 1fr 1fr; gap: 4px; padding: 3px 4px; border-radius: 4px; }
.tgc .moves__row:hover { background: var(--ink-3); }
.tgc .moves__n { color: var(--text-4); }
.tgc .moves__m { color: var(--text-2); padding: 0 4px; }
.tgc .moves__m--on { background: oklch(0.5 0.18 var(--hue-chess) / 0.35); color: var(--amber); border-radius: 3px; font-weight: 700; }
.tgc .moves__m--pending { color: var(--text-3); font-style: italic; }

.tgc .chat-mini {
  background: var(--ink-2); border: 1px solid var(--ink-4);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
  max-height: 220px;
}
.tgc .chat-mini__msg { font-size: 12px; }
.tgc .chat-mini__msg b { font-weight: 700; color: var(--text-1); }
.tgc .chat-mini__msg small { color: var(--text-3); font-size: 10px; margin-left: 4px; }
.tgc .chat-mini__msg p { margin: 2px 0 0; color: var(--text-2); }
.tgc .chat-mini__input { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.tgc .chat-mini__input input {
  padding: 8px 10px; background: var(--ink-3); border: 1px solid var(--ink-4);
  border-radius: 8px; font-size: 12px; outline: none; color: var(--text-1);
}
.tgc .chat-mini__input input:focus { border-color: var(--brand); }
.tgc .chat-mini__quick { display: flex; gap: 3px; }
.tgc .chat-mini__quick button {
  flex: 1; padding: 6px;
  background: var(--ink-3); border: 1px solid var(--ink-4);
  border-radius: 6px; font-size: 13px;
}
.tgc .chat-mini__quick button:hover { background: var(--ink-4); }

/* ════════════════════ 4. RESULT ════════════════════ */
.tgc .result {
  display: grid; grid-template-columns: 220px 1fr 1fr; gap: 16px;
  padding: 24px;
  background: linear-gradient(135deg, oklch(0.22 0.06 var(--hue-primary) / 0.4), oklch(0.16 0.025 265));
  border: 1px solid oklch(0.45 0.15 var(--hue-primary) / 0.3);
  border-radius: var(--radius-xl);
  margin-top: 8px;
  box-shadow: var(--shadow-pop);
  align-items: center;
}
.tgc .result__badge { text-align: center; }
.tgc .result__crown { font-size: 56px; color: var(--amber); text-shadow: 0 6px 20px var(--amber-glow); }
.tgc .result__verb {
  font-family: var(--font-display); font-size: 32px; font-weight: 800;
  letter-spacing: -0.025em; margin-top: 4px;
  background: linear-gradient(135deg, var(--amber), var(--brand-hi));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tgc .result__how { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.tgc .result__delta { padding: 14px 18px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.tgc .result__ribbons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tgc .ribbon { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-sm); }
.tgc .ribbon__ic { font-size: 18px; }
.tgc .ribbon__t { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.tgc .ribbon__s { font-family: var(--font-display); font-weight: 700; font-size: 14px; margin-top: 2px; }
.tgc .result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }

/* ════════════════════ 5. TOURNAMENTS ════════════════════ */
.tgc .t-feature {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px;
  padding: 24px;
  background: linear-gradient(135deg, oklch(0.2 0.04 265), oklch(0.15 0.025 265));
  border: 1px solid var(--ink-4); border-radius: var(--radius-xl);
  margin: 8px 0; box-shadow: var(--shadow-pop);
  position: relative; overflow: hidden;
}
.tgc .t-feature::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(60% 80% at 0% 0%, oklch(0.4 0.18 var(--hue-chess) / 0.15), transparent 60%);
  pointer-events: none;
}
.tgc .t-feature__main { position: relative; z-index: 1; }
.tgc .t-feature__leaders { background: var(--ink-1); border: 1px solid var(--ink-4); border-radius: var(--radius-md); padding: 14px; }
.tgc .t-feature__progress { margin-top: 10px; }
.tgc .t-feature__steps { display: flex; gap: 4px; }
.tgc .t-step { flex: 1; padding: 8px 4px; background: var(--ink-3); border-radius: 6px; text-align: center; font-size: 11px; color: var(--text-3); }
.tgc .t-step--on { background: oklch(0.28 0.1 var(--hue-primary) / 0.5); color: var(--brand-hi); }
.tgc .t-step--now { background: var(--amber); color: oklch(0.2 0.04 55); font-weight: 700; }
.tgc .t-step__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin: 0 auto 4px; }
.tgc .t-leader { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--ink-3); }
.tgc .t-leader:last-of-type { border: 0; }
.tgc .t-leader__p { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 12px; }
.tgc .t-leader__p--top { background: linear-gradient(135deg, var(--amber), var(--amber-lo)); color: oklch(0.2 0.04 55); }
.tgc .t-leader__p--rest { background: var(--ink-3); color: var(--text-3); }

.tgc .t-list { display: flex; flex-direction: column; gap: 8px; }
.tgc .t-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.tgc .t-row__icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; flex-shrink: 0; background: var(--ink-3); color: var(--text-2); }
.tgc .t-row--live  .t-row__icon { background: oklch(0.28 0.10 150 / 0.4); color: var(--live); }
.tgc .t-row--amber .t-row__icon { background: oklch(0.30 0.08 var(--hue-chess) / 0.4); color: var(--amber); }
.tgc .t-row--hot   .t-row__icon { background: oklch(0.30 0.10 var(--hue-accent-hot) / 0.35); color: var(--hot); }
.tgc .t-row--brand .t-row__icon { background: oklch(0.28 0.10 var(--hue-primary) / 0.4); color: var(--brand-hi); }
.tgc .t-row__cell { min-width: 80px; }
.tgc .t-row__k { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.tgc .t-row__v { font-family: var(--font-display); font-weight: 700; font-size: 14px; margin-top: 2px; }

/* ════════════════════ 6. PUZZLES ════════════════════ */
.tgc .puzz-grid { display: grid; grid-template-columns: 1fr 360px; gap: 20px; margin-top: 8px; }
.tgc .puzz-board { display: flex; flex-direction: column; gap: 10px; }
.tgc .puzz-board__hud { display: flex; gap: 8px; flex-wrap: wrap; }
.tgc .puzz-prompt { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.tgc .puzz-side { display: flex; flex-direction: column; gap: 12px; }
.tgc .puzz-stat-card {
  padding: 16px;
  background: linear-gradient(135deg, oklch(0.22 0.05 var(--hue-chess) / 0.25), oklch(0.16 0.025 265));
  border: 1px solid oklch(0.5 0.15 var(--hue-chess) / 0.25);
  border-radius: var(--radius-md);
}
.tgc .puzz-rating { display: flex; flex-direction: column; align-items: flex-start; }
.tgc .puzz-chart { width: 100%; margin-top: 10px; }

/* ════════════════════ 7. WATCH ════════════════════ */
.tgc .watch-feature {
  display: grid; grid-template-columns: 1fr 360px; gap: 20px;
  margin: 8px 0; padding: 16px;
  background: var(--ink-2); border: 1px solid var(--ink-4);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-pop);
}
.tgc .watch-feature__board { position: relative; border-radius: var(--radius-md); overflow: hidden; }
.tgc .watch-feature__live {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  padding: 4px 10px; background: oklch(0 0 0 / 0.6); backdrop-filter: blur(8px);
  border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--text-1);
  display: inline-flex; align-items: center; gap: 6px;
}
.tgc .watch-feature__nudge {
  position: absolute; bottom: 12px; right: 12px; z-index: 2;
  padding: 6px 10px; background: oklch(0 0 0 / 0.6); backdrop-filter: blur(8px);
  border-radius: 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--amber);
}
.tgc .watch-feature__side { padding: 6px; }

.tgc .watch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tgc .watch-card { background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); overflow: hidden; cursor: pointer; transition: transform .2s var(--tap), border-color .15s; }
.tgc .watch-card:hover { transform: translateY(-2px); border-color: oklch(0.45 0.15 var(--hue-primary) / 0.5); }
.tgc .watch-card__board { position: relative; }
.tgc .watch-card__live {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 8px; background: oklch(0 0 0 / 0.7); backdrop-filter: blur(6px);
  border-radius: 999px; font-size: 10px; font-weight: 700; color: var(--text-1);
  display: inline-flex; align-items: center; gap: 4px;
}
.tgc .watch-card__body { padding: 12px; }
.tgc .watch-card__pair { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.tgc .watch-card__pair b { font-weight: 700; }
.tgc .watch-card__pair small { font-family: var(--font-mono); color: var(--text-3); font-size: 11px; }

/* ════════════════════ 8. LEADERBOARD ════════════════════ */
.tgc .podium { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 12px; align-items: end; margin: 16px 0 24px; }
.tgc .podium__col { display: flex; flex-direction: column; align-items: center; }
.tgc .podium__avatar {
  position: relative; width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, oklch(0.5 0.15 var(--hue-primary)), oklch(0.32 0.10 var(--hue-primary)));
  color: white; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 24px; font-weight: 800;
  margin-bottom: 8px;
}
.tgc .podium__avatar--king {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--amber), var(--amber-lo));
  color: oklch(0.2 0.04 55);
  box-shadow: 0 8px 30px -8px var(--amber-glow);
}
.tgc .podium__crown { position: absolute; top: -16px; font-size: 20px; color: var(--amber); }
.tgc .podium__name { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.tgc .podium__rating { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--brand-hi); margin-top: 2px; }
.tgc .podium__col--1 .podium__rating { color: var(--amber); }
.tgc .podium__stats { font-size: 11px; font-family: var(--font-mono); color: var(--text-3); margin-top: 2px; }
.tgc .podium__plinth {
  width: 100%; padding: 16px 0; margin-top: 10px;
  border-radius: 12px 12px 0 0;
  background: var(--ink-2); border: 1px solid var(--ink-4); border-bottom: 0;
  text-align: center;
}
.tgc .podium__plinth--1 {
  padding: 28px 0;
  background: linear-gradient(180deg, oklch(0.3 0.08 var(--hue-chess) / 0.3), oklch(0.18 0.025 265));
  border-color: oklch(0.5 0.15 var(--hue-chess) / 0.3);
}
.tgc .podium__plinth--2 { padding: 22px 0; }
.tgc .podium__place { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--text-3); }
.tgc .podium__col--1 .podium__place { color: var(--amber); font-size: 22px; }

.tgc .lb-table { background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); overflow: hidden; }
.tgc .lb-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--ink-1); border-bottom: 1px solid var(--ink-4);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--text-3);
}
.tgc .lb-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--ink-3); }
.tgc .lb-row:last-child { border: 0; }
.tgc .lb-row:hover { background: oklch(1 0 0 / 0.02); }
.tgc .lb-row--you { background: oklch(0.28 0.10 var(--hue-primary) / 0.15); }
.tgc .lb-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, oklch(0.4 0.1 var(--hue-primary)), oklch(0.28 0.08 var(--hue-primary)));
  color: white; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.tgc .lb-avatar--big { width: 40px; height: 40px; font-size: 16px; border-radius: 10px; }

/* ════════════════════ 9. PROFILE ════════════════════ */
.tgc .prof-hero {
  display: grid; grid-template-columns: 88px 1fr 200px;
  gap: 20px; align-items: center; padding: 24px;
  background: linear-gradient(135deg, oklch(0.2 0.04 265), oklch(0.15 0.025 265));
  border: 1px solid var(--ink-4); border-radius: var(--radius-xl);
  margin-top: 8px; box-shadow: var(--shadow-pop);
}
.tgc .prof-hero__avatar {
  position: relative; width: 88px; height: 88px; border-radius: 22px;
  background: linear-gradient(135deg, var(--hot), oklch(0.5 0.22 40));
  color: white; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 36px;
  box-shadow: 0 10px 28px -8px oklch(0 0 0 / 0.5);
}
.tgc .prof-hero__rating { text-align: right; }
.tgc .prof-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin: 20px 0; }
.tgc .achv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tgc .achv {
  padding: 10px 8px;
  background: var(--ink-3); border: 1px solid var(--ink-4);
  border-radius: 10px; text-align: center;
  opacity: 0.4;
}
.tgc .achv--on { opacity: 1; background: linear-gradient(135deg, var(--ink-2), var(--ink-3)); }
.tgc .achv__icon { font-size: 22px; margin-bottom: 4px; color: var(--text-3); }
.tgc .achv--on .achv__icon { color: var(--text-1); }
.tgc .achv__n { font-size: 10px; color: var(--text-3); font-weight: 600; }
/* ════════════════════ 10. MODALS (document-wide) ════════════════════ *
 * Style applied without .tgc scope because modals are appended to body.
 * Affects .modal (used by draw/resign) and #time-control-modal.
 * Show/hide logic stays in original code (.hidden / .active toggling).
 */

.modal,
#time-control-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: oklch(0 0 0 / 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-body);
  color: var(--text-1);
  /* Reset legacy positioning that was using top/left + transform */
  top: 0 !important; left: 0 !important;
  transform: none !important;
}
.modal.hidden,
#time-control-modal:not(.active) { display: none !important; }

.modal .modal-content,
#time-control-modal .modal-content {
  background: var(--ink-2);
  border: 1px solid var(--ink-4);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-pop);
  font-family: var(--font-body);
  color: var(--text-1);
}
.modal .modal-content h3,
#time-control-modal .modal-content h3 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800; letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--text-1);
}
.modal .modal-content p,
#time-control-modal .modal-content p {
  margin: 0 0 18px;
  color: var(--text-2); font-size: 14px;
}

/* Modal header (time-control) */
#time-control-modal .modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--ink-3);
}
#time-control-modal .modal-header h3 { margin: 0; }
#time-control-modal .modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--ink-3); border: 1px solid var(--ink-4);
  color: var(--text-2); cursor: pointer;
  font-size: 18px; line-height: 1;
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
#time-control-modal .modal-close:hover { background: var(--ink-4); color: var(--text-1); }

/* Time-control grid: 3 sections (Bullet / Blitz / Rapid) */
#time-control-modal .time-control-grid {
  display: flex; flex-direction: column; gap: 14px;
}
#time-control-modal .time-control-section {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 10px;
}
#time-control-modal .time-control-section h4 {
  margin: 0;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-3);
}
#time-control-modal .time-control-section .time-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px;
  background: var(--ink-3);
  border: 1px solid var(--ink-4);
  border-radius: 10px;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  margin-right: 6px; margin-bottom: 6px;
  transition: background .12s, border-color .12s, transform .1s var(--tap);
}
#time-control-modal .time-control-section .time-btn:hover {
  background: var(--ink-4);
  transform: translateY(-1px);
}
/* Per-section accent colours */
#time-control-modal .time-control-section:nth-child(1) h4 { color: var(--hot); }
#time-control-modal .time-control-section:nth-child(1) .time-btn:hover {
  border-color: oklch(0.5 0.18 var(--hue-accent-hot) / 0.5);
  background: oklch(0.30 0.10 var(--hue-accent-hot) / 0.25);
}
#time-control-modal .time-control-section:nth-child(2) h4 { color: var(--amber); }
#time-control-modal .time-control-section:nth-child(2) .time-btn:hover {
  border-color: oklch(0.5 0.15 var(--hue-chess) / 0.5);
  background: oklch(0.30 0.08 var(--hue-chess) / 0.25);
}
#time-control-modal .time-control-section:nth-child(3) h4 { color: var(--brand-hi); }
#time-control-modal .time-control-section:nth-child(3) .time-btn:hover {
  border-color: oklch(0.5 0.18 var(--hue-primary) / 0.5);
  background: oklch(0.28 0.10 var(--hue-primary) / 0.3);
}

/* Generic modal-actions (draw/resign confirm buttons) */
.modal .modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 18px;
}
.modal .modal-actions .btn,
.modal .modal-actions button {
  padding: 10px 18px; min-height: 40px;
  border: none; border-radius: 10px;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: transform .1s var(--tap), background .15s;
}
.modal .modal-actions .btn-primary,
.modal .modal-actions button.btn-primary {
  background: var(--brand); color: white;
  box-shadow: 0 8px 20px -8px var(--brand-glow);
}
.modal .modal-actions .btn-primary:hover { background: var(--brand-hi); transform: translateY(-1px); }
.modal .modal-actions .btn-secondary,
.modal .modal-actions button.btn-secondary {
  background: oklch(1 0 0 / 0.07);
  color: var(--text-1);
}
.modal .modal-actions .btn-secondary:hover { background: oklch(1 0 0 / 0.13); }

/* ════════════════════ 11. RESPONSIVE ════════════════════ */

/* Tablet — stack hero, 2-up modes/stats */
@media (max-width: 1024px) {
  .tgc .lobby-hero {
    grid-template-columns: 1fr;
    padding: 24px 24px;
    gap: 20px;
  }
  .tgc .lobby-hero__board { max-width: 360px; margin: 0 auto; }
  .tgc .modes-grid { grid-template-columns: repeat(2, 1fr); }
  .tgc .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tgc .game-grid { grid-template-columns: 1fr; }
  .tgc .game-right { order: 2; }
}

/* Mobile / Telegram WebApp viewport */
@media (max-width: 640px) {
  :root {
    --page-pad: 14px;
    --gap: 12px;
  }
  .tgc .lobby-hero {
    padding: 20px 18px;
    border-radius: var(--radius-lg);
  }
  .tgc .lobby-hero__title { font-size: 26px; }
  .tgc .lobby-hero__desc { font-size: 13px; }
  .tgc .lobby-hero__cta { flex-direction: column; align-items: stretch; }
  .tgc .lobby-hero__cta .btn-amber,
  .tgc .lobby-hero__cta .btn-ghost { width: 100%; }
  .tgc .lobby-hero__board { max-width: none; }

  .tgc .modes-grid { grid-template-columns: 1fr; }
  .tgc .stats-grid { grid-template-columns: 1fr 1fr; }
  .tgc .stat__v { font-size: 20px; }

  .tgc .section-title { margin: 20px 0 10px; }
  .tgc .section-title h3 { font-size: 16px; }

  /* Modals on mobile */
  .modal,
  #time-control-modal { padding: 12px; }
  #time-control-modal .modal-content { padding: 18px; }
  #time-control-modal .time-control-section {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  #time-control-modal .modal-content h3 { font-size: 17px; }
}
/* ════════════════════ 12. GAME-SCREEN tweaks ════════════════════ *
 * Layout adjustments for the redesigned #game-screen.
 */

#game-screen.tgc { padding: 16px var(--page-pad); background: var(--ink-0); }
#game-screen.tgc .game-grid { max-width: 1200px; margin: 0 auto; gap: 24px; }
#game-screen.tgc .game-center {
  display: flex; flex-direction: column; gap: 8px;
  max-width: 600px; margin: 0 auto;
  width: 100%;
}

#game-screen #board-container {
  width: 100%;
  aspect-ratio: 1;
  margin: 4px 0;
}
#game-screen #chess-board { width: 100%; height: 100%; }

#game-screen #board-overlay {
  position: absolute; inset: 0;
  background: oklch(0 0 0 / 0.7); backdrop-filter: blur(6px);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  text-align: center; padding: 20px;
  z-index: 10; pointer-events: none;
}
#game-screen #board-overlay.hidden { display: none !important; }
#game-screen .overlay-status {
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
  color: var(--text-1);
}
#game-screen .overlay-countdown {
  font-family: var(--font-mono); font-size: 28px; font-weight: 700;
  color: var(--amber);
}

#game-screen #promotion-overlay {
  position: absolute; inset: 0;
  background: oklch(0 0 0 / 0.6); backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  z-index: 11;
}
#game-screen #promotion-overlay.hidden { display: none !important; }
#game-screen #promotion-choices {
  display: flex; gap: 8px;
  background: var(--ink-2);
  border: 1px solid var(--ink-4);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-pop);
}
#game-screen #promotion-choices button,
#game-screen #promotion-choices .promotion-choice {
  width: 56px; height: 56px;
  background: var(--ink-3);
  border: 1px solid var(--ink-4);
  border-radius: 10px;
  font-family: var(--font-piece);
  font-size: 36px; line-height: 1;
  color: var(--text-1);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .12s, transform .1s var(--tap), border-color .12s;
}
#game-screen #promotion-choices button:hover,
#game-screen #promotion-choices .promotion-choice:hover {
  background: oklch(0.30 0.08 var(--hue-chess) / 0.3);
  border-color: var(--amber-lo);
  transform: translateY(-1px);
}

#game-screen .pstrip__avatar .player-color {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid oklch(1 0 0 / 0.2);
}
#game-screen .pstrip__avatar .player-color.white { background: oklch(0.95 0.01 90); }
#game-screen .pstrip__avatar .player-color.black { background: oklch(0.18 0.02 265); }

#game-screen .game-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 6px; flex-wrap: wrap;
}
#game-screen .game-actions button {
  font-size: 13px; padding: 9px 14px; min-height: 38px;
}

#game-screen .game-right {
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
}

#game-screen .player-bar,
#game-screen .opponent,
#game-screen .player-info,
#game-screen .captured-pieces,
#game-screen .timer,
#game-screen .moves-panel,
#game-screen .action-btn { all: unset; }

@media (max-width: 900px) {
  #game-screen.tgc .game-grid { grid-template-columns: 1fr; gap: 16px; }
  #game-screen.tgc .game-right { order: 2; }
}
@media (max-width: 640px) {
  #game-screen.tgc { padding: 8px 10px; }
  #game-screen.tgc .game-center { gap: 6px; }
  #game-screen #promotion-choices button,
  #game-screen #promotion-choices .promotion-choice { width: 48px; height: 48px; font-size: 30px; }
  #game-screen .pstrip { padding: 8px 10px; gap: 8px; }
  #game-screen .pstrip__clock { font-size: 22px; min-width: 76px; }
  #game-screen .pstrip__avatar { width: 34px; height: 34px; }
}
