/* ==========================================================================
   intosudoku — play page styles (the actual game UI)
   Visual rules mirror the Flutter prototype's widgets (sudoku_grid.dart,
   number_pad.dart, action_bar.dart, status_bar.dart) rebuilt for the DOM.
   Requires style.css to be loaded first for CSS variables.
   ========================================================================== */

.game-page {
  min-height: calc(100vh - 76px);
  padding: 28px 0 60px;
}

/* Modifier for when the game is embedded as one section of a longer page
   (the homepage's #play) rather than being the whole page: no forced
   min-height, and a scroll-margin so the sticky navbar doesn't cover the
   toolbar when a link jumps straight to #play. */
.game-page-embedded {
  min-height: 0;
  padding: 50px 0 70px;
  scroll-margin-top: 90px;
}

.game-shell {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 16px;
}

/* ---------- Status bar ---------- */
.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 30px;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: default;
  user-select: none;
}
.status-chip.clickable { cursor: pointer; transition: border-color .15s ease; }
.status-chip.clickable:hover { border-color: var(--accent); }
.status-chip .dot { width: 15px; text-align: center; }
.status-chip.danger { color: var(--error); }

/* ---------- Board + entry controls layout ----------
   Default (mobile, or any short/narrow viewport): stacked, board on top,
   number pad + action bar below it — matches the original layout.
   On screens with room in BOTH dimensions (see the wide-and-tall media
   query near the bottom of this file), this switches to a side-by-side
   layout with the number pad/actions in a rail to the right of the board,
   so entering numbers doesn't require scrolling down and back up. */
.board-and-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.entry-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.board-wrap {
  display: flex;
  justify-content: center;
  position: relative;
}
.sudoku-play-board {
  width: min(100%, 520px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  background: var(--surface);
  border-radius: 20px;
  border: 2px solid rgba(243, 246, 251, 0.85);
  box-shadow: var(--shadow-glow), 0 24px 48px rgba(0,0,0,0.45);
  overflow: hidden;
  position: relative;
  touch-action: manipulation;
}
/* Bold 3x3 box dividers, drawn as four absolutely-positioned lines (two
   vertical, two horizontal) laid directly over the board. `left`/`top`
   accept percentages, so these track the board's size on resize; a
   box-shadow offset would not, since shadow offsets are plain lengths. */
.box-divider {
  position: absolute;
  background: rgba(243, 246, 251, 0.85);
  pointer-events: none;
  z-index: 3;
}
.box-divider.v { top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.box-divider.v.at-3 { left: 33.3333%; }
.box-divider.v.at-6 { left: 66.6667%; }
.box-divider.h { left: 0; right: 0; height: 2px; margin-top: -1px; }
.box-divider.h.at-3 { top: 33.3333%; }
.box-divider.h.at-6 { top: 66.6667%; }

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(15px, 4.4vw, 26px);
  color: var(--accent);
  background: var(--surface);
  border-right: 0.6px solid rgba(38, 47, 66, 0.6);
  border-bottom: 0.6px solid rgba(38, 47, 66, 0.6);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .12s ease;
}
.cell.box-tint { background: var(--box-alt); }
.cell.given { color: var(--text-primary); font-weight: 600; cursor: default; }
.cell.peer { background: var(--surface-elevated); }
.cell.same-value { background: rgba(94, 234, 212, 0.10); }
.cell.selected { background: var(--accent-soft); }
.cell.conflict { color: var(--error); }
.cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 2; }

.cell .notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 3px;
}
.cell .notes span {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(7px, 1.6vw, 10px);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Board overlay for paused / won / game-over states */
.board-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
  background: rgba(8, 11, 18, 0.88);
  backdrop-filter: blur(6px);
  border-radius: 20px;
}
.board-overlay.hidden { display: none; }
.board-overlay h3 { font-size: 24px; margin: 0; }
.board-overlay p { margin: 0; font-size: 14px; }
.overlay-icon { font-size: 40px; }
.overlay-stats {
  display: flex;
  gap: 24px;
  margin: 6px 0;
}
.overlay-stats div { display: flex; flex-direction: column; align-items: center; }
.overlay-stats strong { font-family: var(--font-display); font-size: 20px; }
.overlay-stats span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.overlay-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- Number pad ---------- */
.number-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}
@media (max-width: 420px) {
  .number-pad { grid-template-columns: repeat(5, 1fr); }
}
.num-btn {
  height: 50px;
  border-radius: 14px;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 19px;
  cursor: pointer;
  transition: opacity .2s ease, border-color .15s ease, background .15s ease;
}
.num-btn:hover:not(:disabled) { border-color: var(--accent); }
.num-btn.noted { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.num-btn:disabled { opacity: 0.25; cursor: default; }

/* ---------- Action bar (undo / erase / notes / hint) ---------- */
.action-bar {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 2px;
  transition: opacity .2s ease;
}
.action-btn .circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line);
  font-size: 19px;
}
.action-btn.active { color: var(--accent); }
.action-btn.active .circle { background: var(--accent-soft); border-color: var(--accent); }
.action-btn span.label { font-size: 11px; font-weight: 600; }
.action-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------- Toolbar row above board (difficulty switch, new game) ---------- */
.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.game-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.difficulty-select {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: 999px;
  padding: 4px;
}
.difficulty-select button {
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.difficulty-select button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131A;
}
/* Picked but not yet started (before "Start Puzzle" is pressed) — a lighter
   outline than .active so mid-game "this is what's running" stays distinct
   from "this is what you've picked for next time". */
.difficulty-select button.pending {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ---------- Toggle switches (mistakes) ---------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
}
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--grid-line-bold);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease;
}
.switch .track::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform .15s ease;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(18px); background: #06131A; }

/* ---------- Modal (new-game / discard confirm) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop.hidden { display: none; }
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line-bold);
  border-radius: var(--radius-md);
  padding: 26px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}
.modal-card h3 { font-size: 18px; margin-bottom: 8px; }
.modal-card p { font-size: 14px; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line-bold);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Continue banner ---------- */
.continue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(94,234,212,0.10), rgba(129,140,248,0.10));
  border: 1px solid rgba(94, 234, 212, 0.25);
  flex-wrap: wrap;
}
.continue-banner p { margin: 0; font-size: 13px; }
.continue-banner strong { color: var(--text-primary); }

@media (max-width: 480px) {
  .game-shell { padding: 0 10px; gap: 14px; }
  .status-chip { font-size: 12px; padding: 7px 11px; }
  .action-btn .circle { width: 40px; height: 40px; font-size: 16px; }
  .num-btn { height: 44px; font-size: 16px; }
}

/* ---------- Side-by-side entry controls whenever height is the scarce
   dimension ----------------------------------------------------------------
   Two triggers share the same row layout:

   1. A rotated phone/small tablet (`orientation: landscape` + a modest
      min-width to rule out odd narrow-portrait cases + a max-height cap so
      it doesn't fight rule 2 on a large desktop window). This is the case
      that matters most: pick the phone up in portrait and the pad sits
      below the board as normal; rotate it to landscape and the pad moves
      beside the board automatically, with no up/down scrolling needed to
      reach it — landscape phones are wide but short, so width is the
      dimension with room to spare.
   2. A generously sized desktop/tablet window (min-width AND min-height
      both large) — same side-by-side idea, just roomier sizing since
      neither dimension is under pressure there.

   Anything outside both — a portrait phone, a small or squarish window —
   keeps the default stacked layout above, where the pad below the board is
   never more than a short scroll away because the whole layout is compact
   to begin with. */
@media (orientation: landscape) and (min-width: 560px) and (max-height: 560px) {
  .game-page-embedded { padding: 20px 0 30px; scroll-margin-top: 76px; }
  .game-shell { max-width: 720px; gap: 10px; }
  .game-toolbar { gap: 6px; }
  .status-bar { gap: 6px; }
  .board-and-controls {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }
  .board-wrap { flex: 0 1 auto; }
  .sudoku-play-board { width: min(80vh, 420px); }
  .entry-controls { flex: 0 0 160px; gap: 10px; }
  .number-pad { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .num-btn { height: 38px; font-size: 15px; border-radius: 10px; }
  .action-bar { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .action-btn {
    flex: 0 0 calc(50% - 3px);
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 2px;
  }
  .action-btn .circle { width: 32px; height: 32px; font-size: 14px; }
  .action-btn span.label { font-size: 11px; }
  .toggle-row { padding: 8px 14px; font-size: 12px; }
}

@media (min-width: 900px) and (min-height: 760px) {
  .game-shell { max-width: 820px; }
  .board-and-controls {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
  }
  .board-wrap { flex: 0 1 520px; }
  .entry-controls {
    flex: 0 0 220px;
    justify-content: center;
    align-self: center;
    gap: 20px;
  }
  .number-pad {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .num-btn { height: 56px; font-size: 20px; }
  .action-bar { flex-direction: column; gap: 10px; }
  .action-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 6px 4px;
  }
  .action-btn span.label { font-size: 13px; }
}

/* ==========================================================================
   Sudoku Solver page
   ========================================================================== */
.solver-cell.solved-cell { color: var(--accent); cursor: default; }
.solver-cell.given { color: var(--text-primary); }

.solver-message {
  min-height: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.solver-message.ok { color: var(--accent); }
.solver-message.err { color: var(--error); }

.solver-toolbar {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Sudoku Variants page (4×4, 6×6, 9×9, 12×12, 16×16)
   ========================================================================== */
.variant-size-select {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: 999px;
  padding: 4px;
  justify-content: center;
}
.variant-size-select button {
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.variant-size-select button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131A;
}

/* Size-agnostic board: grid-template-columns/rows and box-divider positions
   are set inline by variants.js (a fixed CSS rule per size doesn't work
   here since the same class serves 4×4 through 16×16). */
.variant-board {
  width: min(100%, 520px);
  aspect-ratio: 1;
  display: grid;
  background: var(--surface);
  border-radius: 20px;
  border: 2px solid rgba(243, 246, 251, 0.85);
  box-shadow: var(--shadow-glow), 0 24px 48px rgba(0,0,0,0.45);
  overflow: hidden;
  position: relative;
  touch-action: manipulation;
}
.variant-board .cell {
  font-size: clamp(10px, 3.4vw, 22px);
}
/* Box dividers for the variant board reuse .box-divider's v/h base rule
   (game.css above) but get their left/top offsets set inline by JS per
   size, since box width/height differ per size (12×12's boxes are 4 cols ×
   3 rows, for example) rather than the fixed 33%/66% the 9×9 board uses. */
.variant-board .box-divider.v { left: var(--divider-pos, 0); }
.variant-board .box-divider.h { top: var(--divider-pos, 0); }
/* 16×16 needs smaller per-cell type than the default .cell rule allows for,
   since 256 cells share the same board width as a 9×9's 81. */
.variant-board[data-size="16"] .cell,
.variant-board[data-size="12"] .cell {
  font-size: clamp(9px, 2.6vw, 17px);
}

.variant-number-pad {
  display: grid;
  gap: 6px;
}

.variant-meta {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.variant-meta strong { color: var(--text-secondary); }

.variant-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(8, 11, 18, 0.88);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}
.variant-loading .spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--grid-line-bold);
  border-top-color: var(--accent);
  animation: variant-spin 0.8s linear infinite;
}
@keyframes variant-spin { to { transform: rotate(360deg); } }
.variant-loading.hidden { display: none; }

.size-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.size-card {
  padding: 22px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  transition: transform .2s ease, border-color .2s ease;
}
.size-card:hover { transform: translateY(-3px); border-color: rgba(94,234,212,0.3); }
.size-card h3 { font-family: var(--font-display); font-size: 20px; margin-bottom: 6px; }
.size-card p { font-size: 13.5px; color: var(--text-secondary); margin: 0 0 14px; }
.size-card .btn { width: 100%; text-align: center; }

/* ==========================================================================
   Printable Sudoku Generator page
   ========================================================================== */
.gen-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.gen-panel {
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.gen-field { display: flex; flex-direction: column; gap: 10px; }
.gen-field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.gen-field-label strong { font-size: 14px; color: var(--text-primary); }
.gen-field-label span { font-size: 12px; color: var(--text-dim); }
.gen-field-hint { font-size: 12px; color: var(--text-dim); margin: -4px 0 0; }

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line);
  border-radius: 999px;
  padding: 4px;
}
.pill-group button {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.pill-group button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131A;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line);
  border-radius: 999px;
  overflow: hidden;
  width: fit-content;
}
.stepper button {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease;
}
.stepper button:hover:not(:disabled) { background: rgba(255,255,255,0.06); }
.stepper button:disabled { opacity: 0.3; cursor: default; }
.stepper output {
  min-width: 42px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.gen-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.gen-actions .btn { flex: 1; min-width: 180px; }

.gen-summary {
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
}
.gen-summary strong { color: var(--text-secondary); }

.gen-status {
  min-height: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.gen-status.ok { color: var(--accent); }
.gen-status.err { color: var(--error); }

.gen-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.gen-preview-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gen-preview-cell .mini-grid {
  width: 78%;
  height: 78%;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 1px solid var(--grid-line-bold);
}
.gen-preview-cell .mini-grid span {
  border-right: 0.5px solid rgba(139,150,172,0.25);
  border-bottom: 0.5px solid rgba(139,150,172,0.25);
}
.gen-preview-cell .mini-grid span:nth-child(9n) { border-right: none; }
.gen-preview-cell .mini-grid span:nth-child(9n+3),
.gen-preview-cell .mini-grid span:nth-child(9n+6) { border-right: 1px solid var(--grid-line-bold); }
.gen-preview-cell .mini-grid span:nth-child(n+19):nth-child(-n+27),
.gen-preview-cell .mini-grid span:nth-child(n+46):nth-child(-n+54) { border-bottom: 1px solid var(--grid-line-bold); }
.gen-preview-cell.dim { opacity: 0.25; }

@media (max-width: 480px) {
  .gen-panel { padding: 18px; }
  .gen-actions .btn { min-width: 0; }
}

/* ==========================================================================
   Stats / leaderboard page
   ========================================================================== */
.stats-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 16px 70px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--surface-elevated), var(--surface));
  border: 1px solid var(--grid-line-bold);
}
.profile-identity { display: flex; align-items: center; gap: 14px; }
.profile-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #06131A;
  flex-shrink: 0;
}
.profile-identity h2 { font-size: 18px; margin: 0 0 2px; }
.profile-identity p { margin: 0; font-size: 12px; color: var(--text-dim); }
#profile-form { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 220px; }
#profile-form input {
  flex: 1;
  min-width: 160px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--grid-line-bold);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}
#profile-form input:focus { outline: none; border-color: var(--accent); }

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-tile {
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  text-align: center;
}
.stat-tile strong { display: block; font-family: var(--font-display); font-size: 26px; }
.stat-tile span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }

.panel {
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 24px;
}
.panel h3 { font-size: 16px; margin-bottom: 4px; }
.panel .panel-sub { font-size: 12px; color: var(--text-dim); margin-bottom: 18px; }

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
}
.leaderboard-row:last-child { border-bottom: none; }
.lb-diff { font-weight: 600; }
.lb-time { font-family: var(--font-display); color: var(--accent); }

.history-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  color: var(--text-secondary);
}
.history-row:last-child { border-bottom: none; }
.hist-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 4px 8px;
  border-radius: 999px;
}
.hist-badge.win { background: rgba(94,234,212,0.15); color: var(--accent); }
.hist-badge.loss { background: rgba(248,113,113,0.15); color: var(--error); }
.hist-date { color: var(--text-dim); text-align: right; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .stat-tiles { grid-template-columns: 1fr 1fr; }
  .history-row { grid-template-columns: auto 1fr auto; }
  .history-row span:nth-child(4), .history-row span:nth-child(5) { display: none; }
}
