/* ═══════════════════════════════════════════════════════════════
   Chess Pass & Play — Design System v2.0
   Aligned with SuperChess Frontend Design Tokens
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts (Poppins headings + Inter body, matching SuperChess) ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Poppins:wght@600;700;800&display=swap');

/* ═══ ROOT DESIGN TOKENS (Dark — Default) ═══ */
:root {
  /* Brand Colors — SuperChess aligned */
  --orange: #FF6D1F;
  --orange-light: #FF8B4A;
  --orange-dark: #E55A0D;
  --brand: #FF6D1F;
  --brand-dark: #E55A0D;
  --brand-light: #FF8B4A;
  --brand-glow: rgba(255, 109, 31, 0.4);

  /* Surfaces — Dark theme */
  --bg: #1D1D1D;
  --bg-app: #1D1D1D;
  --bg-elevated: #252525;
  --card: rgba(40, 40, 40, 0.6);
  --card-solid: #282828;
  --card-elevated: rgba(50, 50, 50, 0.6);
  --card-border: rgba(255, 255, 255, 0.1);
  --card-border-strong: rgba(255, 255, 255, 0.15);

  /* Text */
  --text: #F5F5F5;
  --text-sub: #CCCCCC;
  --text-muted: #888888;

  /* Setup Cards */
  --sc-bg: var(--card);
  --sc-border: var(--card-border);
  --sc-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  --sc-surface: rgba(255, 255, 255, 0.03);
  --sc-surface-hover: rgba(255, 255, 255, 0.06);
  --sc-accent: var(--orange);
  --sc-accent-glow: rgba(255, 109, 31, 0.25);
  --sc-text: var(--text);
  --sc-text-sub: var(--text-sub);
  --sc-divider: var(--card-border);
  --sc-selected-bg: rgba(255, 109, 31, 0.1);
  --sc-selected-border: var(--orange);
  --sc-input-bg: rgba(0, 0, 0, 0.25);
  --sc-input-border: var(--card-border);

  /* Shadows */
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-inset: inset 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-glow-orange: 0 4px 20px rgba(255, 109, 31, 0.35);

  /* Board */
  --sq-light: #F0D9B5;
  --sq-dark: #B58863;
  --sq-selected: #f59e0b;
  --sq-highlight: #dca052;
  --sq-last-from: rgba(245, 158, 11, 0.35);
  --sq-last-to: rgba(245, 158, 11, 0.5);

  /* Semantic */
  --green: #10B981;
  --red: #EF4444;
  --blue: #3B82F6;
  --yellow: #F59E0B;

  /* Layout */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --radius-full: 9999px;
  --gap: 16px;
  --header-height: 60px;

  /* Typography */
  --font-heading: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
}

/* ═══ LIGHT THEME ═══ */
body.light {
  --bg: #FAF3E1;
  --bg-app: #FAF3E1;
  --bg-elevated: #F5E7C6;
  --card: rgba(255, 255, 255, 0.6);
  --card-solid: #FFFFFF;
  --card-elevated: rgba(255, 255, 255, 0.75);
  --card-border: rgba(34, 34, 34, 0.12);
  --card-border-strong: rgba(34, 34, 34, 0.18);
  --text: #222222;
  --text-sub: #555555;
  --text-muted: #999999;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.06);
  --sc-bg: var(--card);
  --sc-border: var(--card-border);
  --sc-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --sc-surface: rgba(0, 0, 0, 0.02);
  --sc-surface-hover: rgba(0, 0, 0, 0.04);
  --sc-input-bg: rgba(0, 0, 0, 0.04);
  --sc-text: var(--text);
  --sc-text-sub: var(--text-sub);
  --sc-divider: var(--card-border);
}

body.light .mode-btn { color: var(--text-sub); }
body.light .mode-btn.on { color: #FFFFFF; }
body.light .toggle-opt { color: var(--text-sub); }
body.light .toggle-opt.on { color: #FFFFFF; }
body.light .timer-box { background: var(--bg-elevated); }
body.light .mpb-timer { background: rgba(0, 0, 0, 0.06); border-color: var(--card-border); }
body.light .eval-bar { background: #D5D0C8; }
body.light .eval-fill { background: #3D3D3D; }
body.light .mctrl-btn { background: var(--card-solid); border-color: var(--card-border); }
body.light .ctrl-btn { background: rgba(0, 0, 0, 0.04); border-color: var(--card-border); color: var(--text); }
body.light .ctrl-btn:hover { background: rgba(0, 0, 0, 0.08); }
body.light .ctrl-btn.primary { color: var(--orange); border-color: rgba(255, 109, 31, 0.3); background: rgba(255, 109, 31, 0.05); }
body.light .ctrl-btn.primary:hover { background: rgba(255, 109, 31, 0.1); }
body.light .ctrl-btn.danger { color: var(--red); border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.05); }
body.light .ctrl-btn.danger:hover { background: rgba(239, 68, 68, 0.1); }
body.light .toast-notification { background: var(--card-solid); color: var(--text); border: 1px solid var(--orange); }
body.light .superchess-banner { background: linear-gradient(135deg, #FFF8F0, #FFF4E8); color: var(--text); }
body.light .superchess-banner h4 { color: var(--text); }
body.light .superchess-banner p { color: var(--text-sub); }

/* Board Themes */
body.board-theme-tournament { --sq-light: #EEEEEE; --sq-dark: #769656; }
body.board-theme-ice { --sq-light: #E0E8F0; --sq-dark: #68849E; }
body.board-theme-slate { --sq-light: #D2D6DC; --sq-dark: #4F5E70; }

/* ═══ RESET ═══ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg);
  color: var(--text);
  transition: background-color 0.25s ease, color 0.25s ease;
}

html {
  font-family: var(--font-body);
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessibility Scales */
body.font-scale-large { font-size: 18px; }
body.font-scale-xlarge { font-size: 20px; }
body.large-ui { --gap: 20px; --radius-lg: 20px; --radius-md: 16px; }

body.high-contrast {
  --card: #000000;
  --card-border: #FFFFFF;
  --text: #FFFFFF;
  --text-sub: #EEEEEE;
  --sq-light: #FFFFFF;
  --sq-dark: #000000;
  --sq-selected: rgba(255, 255, 0, 0.8);
  --sq-last-from: rgba(0, 255, 255, 0.6);
  --sq-last-to: rgba(0, 255, 255, 0.8);
}

body.reduced-motion * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Focus */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--orange);
  color: #FFF;
  padding: 10px 20px;
  border-radius: 0 0 8px 8px;
  z-index: 9999;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 109, 31, 0.3); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 109, 31, 0.5); }

/* ═══ HEADER ═══ */
.site-header {
  height: var(--header-height);
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 500;
  width: 100%;
}
.header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 109, 31, 0.3);
  color: #FFF;
}
.brand-logo svg { width: 20px; height: 20px; }
.brand-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.brand-badge {
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--orange-dark);
  color: #FFFFFF;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Link to all of Pass and Play Games (computers only: phones and tablets get the compact header) */
.games-link {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.games-link:hover { transform: translateY(-1px); border-color: var(--orange); }
.games-link svg { flex-shrink: 0; }

/* Header icon buttons */
.icon-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-sub);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.icon-btn:hover {
  background: rgba(255, 109, 31, 0.08);
  border-color: rgba(255, 109, 31, 0.3);
  color: var(--orange);
}
.icon-btn svg { width: 18px; height: 18px; }

/* Backwards compat for existing class names */
.theme-btn, .settings-trigger-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-sub);
  font-size: 1.1rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.theme-btn:hover, .settings-trigger-btn:hover {
  background: rgba(255, 109, 31, 0.08);
  border-color: rgba(255, 109, 31, 0.3);
  color: var(--orange);
}
.theme-btn svg, .settings-trigger-btn svg { width: 18px; height: 18px; }

/* Install Button */
.install-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border: none;
  color: #FFF;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.78rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(255, 109, 31, 0.3);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.install-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 109, 31, 0.4);
}
.install-btn:active { transform: scale(0.96); }
.install-btn.hidden { display: none; }
.install-btn svg { width: 16px; height: 16px; }
.install-label { font-size: 0.75rem; letter-spacing: 0.3px; }

@media (max-width: 520px) {
  .install-label { display: none; }
  .install-btn { padding: 7px 10px; border-radius: var(--radius-sm); }
}

/* Install Guide Modal */
.install-guide-content { text-align: left; }
.install-guide-content h2 { text-align: center; margin-bottom: 4px; }
.install-guide-content .install-hero { font-size: 48px; text-align: center; margin: 8px 0 12px; }
.install-guide-content .install-subtitle { text-align: center; font-size: 0.85rem; color: var(--text-sub); margin-bottom: 16px; line-height: 1.4; }
.install-platform-badge { display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 109, 31, 0.1); color: var(--orange); padding: 3px 10px; border-radius: var(--radius-full); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.install-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.install-step { display: flex; align-items: flex-start; gap: 10px; background: var(--sc-surface); border: 1px solid var(--card-border); border-radius: var(--radius-md); padding: 10px 12px; }
.install-benefits { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.benefit-chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.2); color: var(--green); padding: 4px 10px; border-radius: var(--radius-full); font-size: 0.7rem; font-weight: 700; }

/* ═══ PAGE SHELL & LAYOUT ═══ */
.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: var(--gap);
  min-height: calc(100vh - var(--header-height) - 2 * var(--gap));
  align-items: start;
}

/* Side Panels */
.layout-side {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--gap);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: calc(var(--header-height) + var(--gap));
  box-shadow: var(--shadow);
}
.layout-side.right-panel {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
}

/* ═══ PLAYER CARDS ═══ */
.player-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--sc-surface);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  position: relative;
  transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s, transform 0.2s;
}
.player-card.active-turn {
  border-color: var(--orange);
  box-shadow: 0 0 16px rgba(255, 109, 31, 0.3), inset 0 0 0 1px rgba(255, 109, 31, 0.1);
  background: rgba(255, 109, 31, 0.06);
  transform: scale(1.01);
}

.player-name.name-active,
.mpb-name.name-active {
  color: var(--orange) !important;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(255, 109, 31, 0.6);
  animation: active-name-pulse 1.5s infinite alternate;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.player-name.name-active::before,
.mpb-name.name-active::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: var(--orange);
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px var(--orange);
  animation: turn-dot-pulse 0.8s infinite alternate;
}

.mpb-color-swatch {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.mpb-swatch-dark { color: #888; }
.mpb-swatch-light { color: #ccc; }

.player-left { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  font-family: var(--font-heading);
}
.avatar.p1 { background: rgba(255, 109, 31, 0.15); color: var(--orange); }
.avatar.p2 { background: rgba(104, 132, 158, 0.15); color: #68849E; }

.player-info { display: flex; flex-direction: column; }
.player-name { font-weight: 700; font-size: 0.9rem; font-family: var(--font-heading); }
.player-color { font-size: 0.72rem; color: var(--text-sub); display: flex; align-items: center; gap: 4px; }
.player-color svg { width: 10px; height: 10px; }

.player-right { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }

.timer-box {
  background: var(--bg);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.95rem;
  border: 1px solid var(--card-border);
}
.timer-box svg { width: 14px; height: 14px; color: var(--text-sub); }
.timer-box.urgent { color: var(--red); animation: timer-pulse 1s infinite alternate; }

.eval-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  opacity: 0;
  transition: opacity 0.2s;
}
.eval-badge.pos { background: rgba(16, 185, 129, 0.12); color: var(--green); }
.eval-badge.neg { background: rgba(239, 68, 68, 0.12); color: var(--red); }

/* Captured */
.captured-tray { display: flex; flex-wrap: wrap; gap: 2px; min-height: 20px; margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--card-border); }
.captured-piece-mini { width: 16px; height: 16px; display: inline-block; }
.captured-piece-mini svg { width: 100%; height: 100%; }

.turn-badge-container { position: absolute; right: 12px; top: 12px; }
.your-turn-badge {
  font-size: 0.6rem;
  font-weight: 800;
  background: var(--orange);
  color: #FFF;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  animation: pulse-turn 1.5s infinite;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-heading);
}

/* Eval Bar */
.eval-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  border: 1px solid var(--card-border);
}
.eval-lbl { color: var(--text-sub); font-weight: 600; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px; }
.eval-bar { height: 6px; background: #222; border-radius: var(--radius-full); overflow: hidden; position: relative; }
.eval-fill { height: 100%; background: #E8E8E8; width: 50%; transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.eval-score { font-weight: 700; text-align: center; font-size: 0.72rem; font-family: var(--font-mono); }

/* ═══ CONTROLS ═══ */
.controls-vertical {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.ctrl-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.ctrl-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.ctrl-btn.primary { background: rgba(255, 109, 31, 0.08); border-color: rgba(255, 109, 31, 0.25); color: var(--orange); }
.ctrl-btn.primary:hover { background: rgba(255, 109, 31, 0.15); }
.ctrl-btn.danger { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.25); color: var(--red); }
.ctrl-btn.danger:hover { background: rgba(239, 68, 68, 0.15); }

/* ═══ CENTER LAYOUT ═══ */
.layout-center { display: flex; flex-direction: column; align-items: center; gap: var(--gap); width: 100%; }

/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 3px;
  border-radius: var(--radius-sm);
}
.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-sub);
  padding: 7px 20px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mode-btn svg { width: 14px; height: 14px; }
.mode-btn.on { background: var(--orange); color: #FFF; box-shadow: 0 2px 8px rgba(255, 109, 31, 0.3); }

/* ═══ CHESSBOARD ═══ */
.board-wrap-container {
  background: transparent;
  border: none;
  padding: 0 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.board-wrap { display: flex; flex-direction: column; position: relative; }
.board-inner { display: flex; position: relative; }
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: clamp(280px, 80vw, 560px);
  height: clamp(280px, 80vw, 560px);
  border-radius: var(--radius-xs);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.05);
  position: relative;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.board.flipped { transform: rotate(180deg); }

/* Squares */
.sq {
  width: 100%; height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.sq.light { background-color: var(--sq-light); }
.sq.dark { background-color: var(--sq-dark); }
.sq.selected { background-color: var(--sq-selected) !important; }
.sq.last-move-from { background-color: var(--sq-last-from) !important; }
.sq.last-move-to { background-color: var(--sq-last-to) !important; }
.sq.check { box-shadow: inset 0 0 14px var(--red); animation: check-pulse 1.2s infinite; }
.sq.cursor { outline: 3px solid cyan; outline-offset: -3px; z-index: 10; }

.sq.hint::after { content: ''; width: 24%; height: 24%; background: rgba(0, 0, 0, 0.2); border-radius: var(--radius-full); position: absolute; }
.sq.hint-capture::after { content: ''; width: 80%; height: 80%; border: 4px solid rgba(0, 0, 0, 0.15); border-radius: var(--radius-full); position: absolute; }

.in-board-coord { position: absolute; font-size: calc(8px + 0.5vw); font-weight: 700; font-family: var(--font-body); pointer-events: none; z-index: 1; user-select: none; }
.board:not(.flipped) .in-board-rank { top: 3px; left: 3px; }
.board:not(.flipped) .in-board-file { bottom: 2px; right: 3px; }

/* Flipped board adjustments */
.board.flipped .in-board-coord { transform: rotate(180deg); }
.board.flipped .in-board-rank { bottom: 3px; right: 3px; }
.board.flipped .in-board-file { top: 2px; left: 3px; }

.sq.light .in-board-coord { color: var(--sq-dark); opacity: 0.8; }
.sq.dark .in-board-coord { color: var(--sq-light); opacity: 0.8; }

/* Pieces */
.piece { width: 90%; height: 90%; display: flex; align-items: center; justify-content: center; z-index: 2; transition: transform 0.1s ease-out; cursor: grab; }
.piece.dragging { cursor: grabbing; transform: scale(1.15); filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5)); }
.piece svg { width: 100%; height: 100%; }
.board.flipped .piece { transform: rotate(180deg); }
.board.flipped .piece.dragging { transform: rotate(180deg) scale(1.15); }

/* Face-to-Face Mode: the top player's pieces face them (on a turned board that means not counter-rotating) */
.face-to-face-mode .board:not(.flipped) .piece.b { transform: rotate(180deg); }
.face-to-face-mode .board:not(.flipped) .piece.b.dragging { transform: rotate(180deg) scale(1.15); }
.face-to-face-mode .board.flipped .piece.w { transform: none; }
.face-to-face-mode .board.flipped .piece.w.dragging { transform: scale(1.15); }
.rank-labels, .board-label-row { transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.face-to-face-mode.flipped-labels .rank-labels,
.face-to-face-mode.flipped-labels .board-label-row { transform: rotate(180deg); }
.face-to-face-mode .mobile-opponent-bar { transform: rotate(180deg); }

/* Board Labels */
.rank-labels { display: flex; flex-direction: column; justify-content: space-around; padding: 0 4px; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); font-family: var(--font-mono); }
.board-label-row { display: flex; justify-content: space-around; padding: 4px 0 0 16px; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); font-family: var(--font-mono); }
.coord-label { flex: 1; text-align: center; }

/* ═══ PASS BUTTON ═══ */
.pass-row { display: flex; align-items: center; width: 100%; max-width: 560px; margin-top: 6px; }
.pass-btn {
  flex-grow: 1;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border: none;
  color: #FFF;
  padding: 14px 20px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 109, 31, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.2s;
  letter-spacing: 0.2px;
}
.pass-btn:hover { filter: brightness(1.08); box-shadow: 0 6px 20px rgba(255, 109, 31, 0.4); transform: translateY(-1px); }
.pass-btn:active { transform: scale(0.97); }
.pass-color-indicator { font-size: 1.2rem; line-height: 1; }
.pass-arrow { opacity: 0.7; display: flex; align-items: center; }
.pass-arrow svg { width: 16px; height: 16px; }

/* Review Banner */
.review-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 109, 31, 0.08);
  border: 1px solid rgba(255, 109, 31, 0.25);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.82rem;
  width: 100%;
}
.review-banner-label { color: var(--orange); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.review-banner-label svg { width: 16px; height: 16px; }

/* ═══ MOVE HISTORY PANEL ═══ */
.move-history { 
  display: flex; 
  flex-direction: column; 
  min-height: 120px; 
  max-height: 280px; 
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--gap);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.move-history-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-sub);
}
.moves-grid {
  display: grid;
  grid-template-columns: 36px 1fr 1fr;
  gap: 4px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 4px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}
.empty-history {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.move-num { color: var(--text-muted); font-weight: 600; }
.move-cell {
  background: var(--sc-surface);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.15s;
}
.move-cell:hover { background: rgba(255, 255, 255, 0.06); }
.move-cell.active-history { background: rgba(255, 109, 31, 0.15); font-weight: 700; color: var(--orange); }

.keyboard-shortcuts-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: center;
  padding-top: 8px;
  margin-top: auto;
}

/* ═══ SETUP VIEW ═══ */
#setupView {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 4px 0;
}

/* Settings Cards */
.settings-card {
  background: var(--sc-bg);
  border: 1px solid var(--sc-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  box-shadow: var(--sc-shadow);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  backdrop-filter: blur(8px);
}
.settings-card:hover { box-shadow: var(--sc-shadow), 0 0 0 1px var(--sc-border); }

.settings-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}
.settings-card__header:hover { background: var(--sc-surface-hover); }

.settings-card__icon {
  width: 40px; height: 40px; min-width: 40px;
  background: var(--sc-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px var(--sc-accent-glow);
}
.settings-card__icon svg { width: 22px; height: 22px; fill: #fff; }
.settings-card__titles { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.settings-card__title { font-weight: 700; font-size: 0.95rem; color: var(--sc-text); line-height: 1.2; font-family: var(--font-heading); }
.settings-card__subtitle { font-size: 0.72rem; color: var(--sc-text-sub); font-weight: 400; }

.settings-card__divider { border: none; height: 1px; background: var(--sc-divider); margin: 0 16px; }

.settings-card__body { padding: 10px 16px 14px; max-height: 600px; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease; opacity: 1; }

.settings-card__status { text-align: center; color: var(--sc-text-sub); font-size: 0.82rem; margin-bottom: 12px; font-weight: 500; }
.settings-card__section-label { text-transform: uppercase; font-weight: 700; font-size: 0.65rem; letter-spacing: 1.5px; color: var(--sc-text-sub); margin-bottom: 10px; margin-top: 2px; font-family: var(--font-heading); }
.settings-card__options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 2px; }

.option-card {
  background: var(--sc-surface);
  border: 1.5px solid var(--sc-border);
  border-radius: var(--radius-md);
  padding: 14px 12px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  outline: none;
  position: relative;
}
.option-card:hover { border-color: var(--sc-accent); background: var(--sc-surface-hover); transform: translateY(-1px); }
.option-card:active { transform: scale(0.98); }
.option-card.selected { background: var(--sc-selected-bg); border-color: var(--sc-selected-border); box-shadow: 0 0 12px var(--sc-accent-glow); }
.option-card.selected .option-card__title { color: var(--sc-accent); }

.option-card__icons { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--sc-text-sub); margin-bottom: 2px; height: 36px; }
.option-card.selected .option-card__icons { color: var(--sc-accent); }
.option-card__icons svg { width: 24px; height: 24px; fill: var(--sc-text-sub); }
.option-card.selected .option-card__icons svg { fill: var(--sc-accent); }
.option-card__title { font-weight: 700; font-size: 0.85rem; color: var(--sc-text); line-height: 1.2; transition: color 0.2s ease; font-family: var(--font-body); }
.option-card__desc { font-size: 0.7rem; color: var(--sc-text-sub); line-height: 1.4; margin: 0; }

/* Setup Rows */
.settings-card .setup-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0; }
.settings-card .setup-row:last-child { margin-bottom: 0; }
.settings-card .setup-key { font-weight: 600; font-size: 0.82rem; color: var(--sc-text-sub); }
.settings-card .setup-input { background: var(--sc-input-bg); border: 1.5px solid var(--sc-input-border); color: var(--sc-text); padding: 7px 10px; border-radius: var(--radius-sm); font-family: var(--font-body); font-weight: 600; text-align: right; max-width: 150px; outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.settings-card .setup-input:focus { border-color: var(--sc-accent); box-shadow: 0 0 0 3px var(--sc-accent-glow); }

.settings-card .toggle-row { display: flex; background: var(--sc-input-bg); padding: 2px; border-radius: var(--radius-sm); border: 1.5px solid var(--sc-input-border); gap: 2px; }
.settings-card .toggle-opt { background: transparent; border: none; color: var(--sc-text-sub); padding: 5px 10px; font-family: var(--font-body); font-weight: 600; font-size: 0.76rem; border-radius: 6px; cursor: pointer; transition: all 0.2s ease; }
.settings-card .toggle-opt:hover { background: rgba(255, 109, 31, 0.08); color: var(--sc-text); }
.settings-card .toggle-opt.on { background: var(--sc-accent); color: #FFF; box-shadow: 0 1px 4px var(--sc-accent-glow); }

/* Start Button */
.start-game-btn {
  width: 100%;
  max-width: 520px;
  background: var(--sc-accent);
  border: none;
  color: #FFF;
  padding: 14px 24px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--sc-accent-glow);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  letter-spacing: 0.2px;
  margin-top: 8px;
}
.start-game-btn:hover { filter: brightness(1.08); box-shadow: 0 6px 20px var(--sc-accent-glow); transform: translateY(-1px); }
.start-game-btn:active { transform: scale(0.98); }
.start-game-btn svg { width: 16px; height: 16px; }

/* ═══ COLOR REVEAL ═══ */
.color-reveal-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; animation: reveal-fade-in 0.3s ease; }
.color-reveal-overlay.fade-out { animation: reveal-fade-out 0.4s ease forwards; }
.color-reveal-card { background: var(--card-solid); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 32px 40px; text-align: center; max-width: 420px; width: 90%; box-shadow: var(--shadow-lg); animation: reveal-card-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.color-reveal-title { font-family: var(--font-heading); font-size: 1.2rem; font-weight: 700; color: var(--orange); margin-bottom: 24px; letter-spacing: 0.3px; }
.color-reveal-players { display: flex; align-items: center; justify-content: center; gap: 24px; }
.color-reveal-player { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.color-reveal-piece { font-size: 3rem; line-height: 1; animation: reveal-piece-flip 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3)); }
.color-reveal-name { font-weight: 700; font-size: 0.95rem; color: var(--text); font-family: var(--font-heading); }
.color-reveal-label { font-size: 0.72rem; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 1px; background: var(--card-border); padding: 3px 12px; border-radius: var(--radius-full); }
.color-reveal-vs { font-size: 1rem; font-weight: 700; color: var(--text-muted); }
.color-reveal-btn { margin-top: 24px; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); border: none; color: #FFF; padding: 12px 32px; font-family: var(--font-heading); font-weight: 700; font-size: 0.95rem; border-radius: var(--radius-full); cursor: pointer; box-shadow: 0 4px 14px rgba(255, 109, 31, 0.3); transition: transform 0.15s, filter 0.2s; }
.color-reveal-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.color-reveal-btn:active { transform: scale(0.97); }

/* ═══ MODALS ═══ */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { background: var(--card-solid); border: 1px solid var(--card-border); border-radius: var(--radius-lg); width: 100%; max-width: 400px; padding: var(--gap); box-shadow: var(--shadow-lg); animation: modal-enter 0.25s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; }
.modal-content h2 { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; color: var(--orange); }
.modal-content h3 { font-size: 1.1rem; margin: 12px 0; font-family: var(--font-heading); }
.modal-content p { color: var(--text-sub); margin-bottom: 20px; font-size: 0.9rem; line-height: 1.5; }
.game-over-art { font-size: 48px; margin: 12px 0; }
.modal-buttons { display: flex; gap: 10px; justify-content: center; }
.modal-btn { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--card-border); color: var(--text); padding: 10px 20px; font-family: var(--font-body); font-weight: 600; font-size: 0.85rem; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; }
.modal-btn.confirm { background: var(--orange); border-color: var(--orange); color: #FFF; }
.modal-btn.danger { background: var(--red); border-color: var(--red); color: #FFF; }
.modal-btn:hover { transform: translateY(-1px); }

/* Promotion */
.promotion-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.promo-choice-btn { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border); border-radius: var(--radius-md); padding: 12px 6px; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.promo-choice-btn:hover { background: rgba(255, 109, 31, 0.12); border-color: var(--orange); transform: translateY(-2px); }
.promo-choice-btn svg { width: 48px; height: 48px; }
.promo-label { font-size: 0.62rem; font-weight: 700; color: var(--text-sub); text-transform: uppercase; }

/* Settings Panel */
.settings-panel { position: fixed; top: 0; right: -320px; width: min(320px, 100vw); max-width: 100vw; height: 100vh; background: var(--card-solid); border-left: 1px solid var(--card-border); z-index: 900; display: flex; flex-direction: column; transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--shadow-lg); pointer-events: none; }
.settings-panel.open { right: 0; pointer-events: auto; }
.settings-header { height: var(--header-height); border-bottom: 1px solid var(--card-border); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--gap); }
.settings-header h2 { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; color: var(--orange); }
.close-btn { background: transparent; border: none; color: var(--text-sub); font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-full); transition: all 0.2s; }
.close-btn:hover { background: rgba(239, 68, 68, 0.1); color: var(--red); }
.close-btn svg { width: 16px; height: 16px; }

.settings-body { overflow-y: auto; padding: var(--gap); display: flex; flex-direction: column; gap: var(--gap); }
.settings-section { display: flex; flex-direction: column; gap: 12px; }
.settings-section h3 { font-family: var(--font-heading); font-size: 0.78rem; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--card-border); padding-bottom: 6px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.settings-row .setting-lbl { color: var(--text); }
.settings-row select { background: var(--bg); border: 1px solid var(--card-border); color: var(--text); padding: 4px 8px; border-radius: var(--radius-sm); font-family: var(--font-body); font-weight: 600; outline: none; }
.settings-row input[type="range"] { accent-color: var(--orange); width: 100px; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--card-border); transition: .2s; border-radius: var(--radius-full); }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%; }
input:checked + .slider { background-color: var(--orange); }
input:checked + .slider:before { transform: translateX(20px); }

/* ═══ PRIVACY OVERLAY ═══ */
.privacy-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(29, 29, 29, 0.92); backdrop-filter: blur(20px); z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.privacy-card { background: var(--card-solid); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 30px; width: 100%; max-width: 360px; text-align: center; box-shadow: var(--shadow-lg); animation: scale-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.privacy-icon { margin-bottom: var(--gap); display: flex; align-items: center; justify-content: center; }
.privacy-icon svg { width: 56px; height: 56px; color: var(--orange); }
.privacy-card h2 { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; color: var(--orange); }
.privacy-card p { color: var(--text-sub); margin-bottom: 24px; font-size: 0.9rem; }

/* ═══ SEO CONTENT ═══ */
.content-col { max-width: 800px; margin: 40px auto 0; display: flex; flex-direction: column; }
.content-col > * { margin-bottom: 32px; }
.content-col > *:last-child { margin-bottom: 0; }

.seo-hero { text-align: center; }
.seo-hero h1 { font-family: var(--font-heading); font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; letter-spacing: -0.5px; color: var(--orange); margin-bottom: 12px; }
.seo-hero p { font-size: 1rem; color: var(--text-sub); line-height: 1.6; }

.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.hero-tag { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; background: var(--card); border: 1px solid var(--card-border); padding: 5px 12px; border-radius: var(--radius-full); display: flex; align-items: center; gap: 5px; letter-spacing: 0.3px; }
.hero-tag svg { width: 12px; height: 12px; color: var(--green); }

.rating-hero { background: var(--card); border: 1px solid var(--card-border); padding: var(--gap); border-radius: var(--radius-md); text-align: center; }
.rating-big { font-family: var(--font-heading); font-size: 2.8rem; font-weight: 800; color: var(--orange); line-height: 1; }
.rating-stars { color: #F59E0B; font-size: 1.2rem; margin: 6px 0; letter-spacing: 2px; }
.rating-count { font-size: 0.75rem; color: var(--text-sub); }

.section-title { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: var(--gap); letter-spacing: -0.3px; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.feat { background: var(--card); border: 1px solid var(--card-border); padding: 20px var(--gap); border-radius: var(--radius-md); text-align: center; transition: transform 0.2s, box-shadow 0.2s; }
.feat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.feat-icon { margin-bottom: 8px; display: flex; align-items: center; justify-content: center; }
.feat-icon svg { width: 28px; height: 28px; color: var(--orange); }
.feat-title { font-family: var(--font-heading); font-size: 0.92rem; font-weight: 700; margin-bottom: 6px; }
.feat-desc { font-size: 0.78rem; color: var(--text-sub); line-height: 1.5; }

.content-card { background: var(--card); border: 1px solid var(--card-border); padding: 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 32px; }
.content-card h2 { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; border-bottom: 1px solid var(--card-border); padding-bottom: 8px; }
.content-card h3 { font-family: var(--font-heading); font-weight: 700; }

.howto-step { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.howto-step:last-of-type { margin-bottom: var(--gap); }
.step-num { width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--orange); color: #FFF; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; flex-shrink: 0; font-family: var(--font-heading); }
.step-text { font-size: 0.88rem; line-height: 1.5; color: var(--text-sub); }
.step-text strong { color: var(--text); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--card-border); padding: 14px 0; cursor: pointer; }
.faq-item:last-child { border-bottom: none; }
.faq-q { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 0.9rem; }
.faq-arrow { color: var(--text-muted); transition: transform 0.2s; display: flex; }
.faq-arrow svg { width: 14px; height: 14px; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, margin-top 0.3s ease; font-size: 0.82rem; color: var(--text-sub); line-height: 1.5; }
.faq-a p { padding-top: 10px; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-item.open .faq-a { max-height: 800px; }

/* Articles */
.articles-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.article-link { background: var(--card); border: 1px solid var(--card-border); padding: 16px; border-radius: var(--radius-md); text-decoration: none; color: inherit; font-weight: 600; font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; transition: transform 0.2s, border-color 0.2s; }
.article-link:hover { transform: translateY(-2px); border-color: var(--orange); }
.article-link svg { width: 18px; height: 18px; color: var(--text-sub); margin-bottom: 2px; }
.article-link small { font-weight: 400; font-size: 0.72rem; color: var(--text-sub); }

/* Reviews */
.review-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.review-card { background: var(--sc-surface); border: 1px solid var(--card-border); padding: 16px; border-radius: var(--radius-md); display: flex; flex-direction: column; gap: 6px; }
.review-stars { color: #F59E0B; font-size: 0.8rem; letter-spacing: 1px; }
.review-text { font-size: 0.78rem; line-height: 1.5; color: var(--text-sub); font-style: italic; flex-grow: 1; }
.review-name { font-weight: 700; font-size: 0.78rem; margin-top: 4px; }
.review-source { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Author Box */
.author-box { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 24px; display: flex; gap: 20px; align-items: center; margin-bottom: 32px; }
.author-avatar { background: linear-gradient(135deg, rgba(255, 109, 31, 0.15), rgba(255, 109, 31, 0.05)); width: 56px; height: 56px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid rgba(255, 109, 31, 0.2); }
.author-avatar svg { width: 28px; height: 28px; color: var(--orange); }
.author-info h3 { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.author-info p { font-size: 0.82rem; line-height: 1.5; color: var(--text-sub); margin-bottom: 8px; }
.author-creds { display: flex; gap: 6px; flex-wrap: wrap; }
.cred-tag { font-size: 0.62rem; font-weight: 700; background: var(--bg); border: 1px solid var(--card-border); padding: 3px 8px; border-radius: var(--radius-full); color: var(--text-sub); text-decoration: none; }
.cred-tag:hover { border-color: var(--orange); color: var(--orange); }

/* Share */
.share-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.share-btn { background: var(--sc-surface); border: 1px solid var(--card-border); color: var(--text); padding: 10px; font-family: var(--font-body); font-weight: 600; font-size: 0.8rem; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.share-btn svg { width: 14px; height: 14px; }
.share-btn:hover { background: rgba(255, 109, 31, 0.08); border-color: rgba(255, 109, 31, 0.25); color: var(--orange); }
#cpConf { display: none; text-align: center; font-size: 0.78rem; color: var(--green); font-weight: 700; margin-top: 10px; }

/* ═══ FOOTER ═══ */
.site-footer { background: var(--bg); border-top: 1px solid var(--card-border); padding: 40px 20px; text-align: center; margin-top: 40px; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.footer-icon { margin-bottom: 8px; }
.footer-icon svg { width: 28px; height: 28px; color: var(--orange); }
.footer-brand { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; color: var(--orange); margin-bottom: 4px; }
.footer-tagline { font-size: 0.78rem; color: var(--text-sub); margin-bottom: 20px; max-width: 500px; }
.footer-links { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }
.footer-link { color: var(--text-sub); text-decoration: none; font-size: 0.82rem; font-weight: 600; transition: color 0.2s; }
.footer-link:hover { color: var(--orange); }
.footer-kw { font-size: 0.68rem; color: var(--text-muted); max-width: 800px; line-height: 1.6; margin-bottom: 20px; }
.footer-copy { font-size: 0.72rem; color: var(--text-muted); }

/* ═══ TOAST ═══ */
.toast-notification { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--card-solid); color: var(--text); border: 1px solid var(--orange); padding: 12px 24px; border-radius: var(--radius-full); z-index: 2000; box-shadow: var(--shadow-lg); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); pointer-events: none; font-weight: 600; font-size: 0.85rem; }
.toast-notification.show { transform: translateX(-50%) translateY(0); }

/* ═══ PASS AND PLAY GAMES (sister site) ═══ */
/* Logo mark: their dark variant by default, light variant on the light theme. Never swap the dot colours */
.ppg-mark { flex-shrink: 0; }
.ppg-mark__frame { fill: #F1F2F4; }
.ppg-mark__face { fill: #1E1F24; }
.ppg-mark__a { fill: #FF7A63; }
.ppg-mark__b { fill: #6EA2FF; }
body.light .ppg-mark__frame { fill: #1E1F24; }
body.light .ppg-mark__face { fill: #FFFFFF; }
body.light .ppg-mark__a { fill: #E04A32; }
body.light .ppg-mark__b { fill: #2F6FDB; }

/* SuperChess for Android: the official Google Play badge, unmodified (Google's brand rules), with the
   install referrer tagged per placement (utm_source=chess_pass_and_play) */
.play-badge { display: inline-flex; flex-shrink: 0; border-radius: 8px; transition: transform 0.2s ease; }
.play-badge:hover { transform: translateY(-1px); }
.play-badge img { display: block; height: 40px; width: auto; }
.superchess-banner__app { font-size: 0.72rem; color: var(--text-sub); margin-top: 6px; }
.footer-family__play img { height: 40px; }
.superchess-banner .play-badge { margin-top: 8px; }
/* Homepage app section: Chess Pass & Play for Android. The QR code shows on computers (and iPhones, via JS) */
.app-section { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-color: rgba(255, 109, 31, 0.3); background: rgba(255, 109, 31, 0.03); }
.app-section__main { display: flex; align-items: flex-start; gap: 18px; min-width: 0; }
.app-section__icon { width: 72px; height: 72px; flex-shrink: 0; border-radius: 18px; box-shadow: var(--shadow); }
.app-section__text { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.app-section__eyebrow { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--orange); }
.content-card.app-section h2 { font-size: 1.25rem; margin: 0; padding: 0; border: none; }
.app-section__text p { font-size: 0.86rem; color: var(--text-sub); line-height: 1.6; max-width: 520px; }
.app-section__play { margin-top: 6px; }
.app-section__qr { display: none; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.app-section__qr img { width: 132px; height: 132px; padding: 6px; background: #FFFFFF; border-radius: 10px; border: 1px solid var(--card-border); }
.app-section__qr small { font-size: 0.72rem; font-weight: 600; color: var(--text-sub); max-width: 150px; text-align: center; line-height: 1.4; }
@media (min-width: 900px) { .app-section__qr { display: flex; } }
.app-section--qr .app-section__qr { display: flex; }
@media (max-width: 600px) {
  .app-section { flex-direction: column; align-items: stretch; }
  .app-section__main { flex-direction: column; align-items: center; text-align: center; }
  .app-section__text { align-items: center; }
}

/* Footer: sister sites */
.footer-family { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; margin-bottom: 20px; }
.footer-family__label { width: 100%; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-muted); }
/* Same height and corner radius as the Google Play badge beside them (the badge itself can't be reshaped) */
.footer-family__link {
  display: inline-flex; align-items: center; gap: 8px; text-align: left; text-decoration: none; color: var(--text);
  height: 40px; padding: 0 12px 0 10px; border-radius: 7px; border: 1px solid var(--card-border); background: var(--card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.footer-family__link:hover { transform: translateY(-1px); border-color: var(--orange); }
.footer-family__link span { display: flex; flex-direction: column; }
.footer-family__link strong { font-size: 0.76rem; line-height: 1.2; }
.footer-family__link small { font-size: 0.64rem; color: var(--text-sub); }
.footer-family__logo { width: 18px; height: 18px; flex-shrink: 0; object-fit: contain; }

/* ═══ SUPERCHESS BANNER ═══ */
.superchess-banner {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.superchess-banner h4 { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--text); line-height: 1.2; }
.superchess-banner p { font-size: 0.82rem; color: var(--text-sub); margin: 0; line-height: 1.4; font-weight: 500; }
.superchess-banner .accent-text { font-size: 0.82rem; color: var(--orange); font-weight: 700; margin: 4px 0 8px; }
.superchess-banner-buttons { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 220px; }
.superchess-banner-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.82rem; text-decoration: none; transition: all 0.2s ease; font-family: var(--font-body); }
.superchess-banner-btn svg { width: 16px; height: 16px; }
.superchess-banner-btn.primary { background: var(--orange); color: #ffffff; border: 1px solid var(--orange); box-shadow: 0 2px 8px rgba(255, 109, 31, 0.25); }
.superchess-banner-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255, 109, 31, 0.35); }
.superchess-banner-btn.secondary { background: var(--sc-surface); color: var(--text); border: 1px solid var(--card-border); }
.superchess-banner-btn.secondary:hover { background: var(--sc-surface-hover); border-color: var(--card-border-strong); transform: translateY(-1px); }

/* Pro CTA */
.pro-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #1e3a5f, #2563eb, #3b82f6);
  background-size: 200% 200%;
  animation: proShimmer 3.5s ease infinite;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.2px;
}
.pro-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(37, 99, 235, 0.45); }
.pro-cta:active { transform: scale(0.98); }
/* Under the board: Pro and the app side by side, as wide as the old promo */
.board-ctas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 90%; margin: 16px auto 0; }
.board-ctas .pro-cta--board { margin: 0; padding: 14px 10px; gap: 8px; font-size: 0.88rem; white-space: nowrap; }
.app-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 10px;
  background: linear-gradient(135deg, #15803d, #16a34a, #22c55e); border: 1px solid rgba(134, 239, 172, 0.35);
  border-radius: var(--radius-md); color: #FFF; font-family: var(--font-heading); font-weight: 700; font-size: 0.88rem;
  text-decoration: none; white-space: nowrap; box-shadow: 0 4px 16px rgba(22, 163, 74, 0.3); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.app-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(22, 163, 74, 0.45); }
.app-cta:active { transform: scale(0.98); }
/* Under the board: Play Online opens Pass and Play Games' online rooms */
.online-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 10px;
  background: linear-gradient(135deg, var(--orange-dark), var(--orange), var(--orange-light)); border: 1px solid rgba(255, 190, 150, 0.4);
  border-radius: var(--radius-md); color: #FFF; font-family: var(--font-heading); font-weight: 700; font-size: 0.88rem;
  text-decoration: none; white-space: nowrap; box-shadow: 0 4px 16px rgba(255, 109, 31, 0.3); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.online-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(255, 109, 31, 0.45); }
.online-cta:active { transform: scale(0.98); }
.board-ctas svg { flex-shrink: 0; }
.pro-badge.new-badge { background: #FFF; color: var(--orange-dark); border-color: rgba(255, 255, 255, 0.6); box-shadow: none; }
.board-ctas .cta-lines { display: flex; align-items: center; gap: 8px; }
.board-ctas .cta-lines small { font-size: 0.68rem; font-weight: 600; opacity: 0.85; }
@media (min-width: 601px) { .board-ctas .cta-lines small { display: none; } }
/* Phones: label on top, the FREE pill / "For Android" under it, so both fit half the width */
@media (max-width: 600px) {
  .board-ctas { max-width: 100%; }
  .board-ctas .pro-cta--board, .app-cta, .online-cta { padding: 10px 8px; gap: 6px; font-size: 0.82rem; }
  .board-ctas svg { width: 16px; height: 16px; flex-shrink: 0; }
  .board-ctas .cta-lines { flex-direction: column; align-items: flex-start; gap: 3px; line-height: 1.15; }
  .board-ctas .pro-badge { font-size: 0.58rem; padding: 1px 7px; }
}
@media (max-width: 380px) { .board-ctas .pro-cta--board, .app-cta, .online-cta { font-size: 0.78rem; padding: 10px 6px; } }
/* Game over: get the app */
.modal-btn.app-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; text-decoration: none; background: linear-gradient(135deg, #16a34a, #22c55e); border-color: #16a34a; color: #FFF; }
.modal-btn.app-btn:hover { filter: brightness(1.06); }
.pro-badge { font-size: 0.65rem; font-weight: 800; background: linear-gradient(135deg, #22c55e, #16a34a); border: 1px solid rgba(255,255,255,0.2); padding: 2px 10px; border-radius: var(--radius-full); letter-spacing: 0.6px; box-shadow: 0 1px 6px rgba(34,197,94,0.3); color: #fff; }

@keyframes proShimmer { 0%{background-position:0% 50%} 50%{background-position:100% 50%} 100%{background-position:0% 50%} }

/* ═══ FEEDBACK ═══ */
.feedback-floating-btn { position: fixed; bottom: 20px; right: 20px; z-index: 990; display: flex; align-items: center; gap: 6px; background: var(--card); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--card-border); color: var(--text); padding: 10px 16px; border-radius: var(--radius-full); font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); transition: all 0.2s ease; user-select: none; -webkit-tap-highlight-color: transparent; }
.feedback-floating-btn:hover { background: var(--card-solid); border-color: var(--orange); color: var(--orange); transform: translateY(-2px); box-shadow: var(--shadow-glow-orange); }
.feedback-floating-btn:active { transform: translateY(0) scale(0.97); }
.feedback-floating-btn svg { width: 16px; height: 16px; }

.feedback-modal-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px); z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 16px; animation: feedback-fade-in 0.2s ease-out; }
.feedback-modal-card { background: var(--card-solid); border: 1px solid var(--card-border); border-radius: var(--radius-lg); width: 100%; max-width: 440px; padding: 24px; box-shadow: var(--shadow-lg); animation: modal-enter 0.25s cubic-bezier(0.4, 0, 0.2, 1); text-align: left; position: relative; }
.feedback-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.feedback-modal-title { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; color: var(--orange); margin: 0; display: flex; align-items: center; gap: 8px; }
.feedback-modal-title svg { width: 20px; height: 20px; }
.feedback-close-btn { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border); color: var(--text-sub); width: 30px; height: 30px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; padding: 0; }
.feedback-close-btn svg { width: 14px; height: 14px; }
.feedback-close-btn:hover { background: rgba(239, 68, 68, 0.1); border-color: var(--red); color: var(--red); }
.feedback-modal-subtitle { color: var(--text-sub); font-size: 0.88rem; line-height: 1.5; margin-bottom: 18px; }
.feedback-form { display: flex; flex-direction: column; gap: 16px; }
.feedback-field-group { display: flex; flex-direction: column; gap: 6px; }
.feedback-label { font-size: 0.78rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; }
.feedback-textarea { width: 100%; min-height: 120px; background: var(--bg); border: 1px solid var(--card-border); border-radius: var(--radius-sm); color: var(--text); padding: 12px; font-family: var(--font-body); font-size: 0.92rem; line-height: 1.5; resize: vertical; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.feedback-textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 109, 31, 0.15); }
.feedback-textarea::placeholder { color: var(--text-muted); }
.feedback-status-msg { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; line-height: 1.4; }
.feedback-status-msg.error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--red); color: var(--red); }
.feedback-status-msg.success { background: rgba(16, 185, 129, 0.1); border: 1px solid var(--green); color: var(--green); }
.feedback-modal-actions { display: flex; justify-content: flex-end; }
.feedback-submit-btn { background: var(--orange); border: 1px solid var(--orange); color: #ffffff; padding: 11px 24px; font-family: var(--font-body); font-weight: 700; font-size: 0.9rem; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s ease; width: 100%; display: flex; align-items: center; justify-content: center; }
.feedback-submit-btn:hover:not(:disabled) { background: var(--orange-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255, 109, 31, 0.3); }
.feedback-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ═══ ANIMATIONS ═══ */
@keyframes active-name-pulse { from { text-shadow: 0 0 4px rgba(255, 109, 31, 0.3); } to { text-shadow: 0 0 12px rgba(255, 109, 31, 0.7), 0 0 20px rgba(255, 109, 31, 0.4); } }
@keyframes turn-dot-pulse { from { transform: scale(0.7); opacity: 0.5; box-shadow: 0 0 4px var(--orange); } to { transform: scale(1.2); opacity: 1; box-shadow: 0 0 10px var(--orange); } }
@keyframes timer-pulse { from { box-shadow: 0 0 4px rgba(239, 68, 68, 0.2); } to { box-shadow: 0 0 12px rgba(239, 68, 68, 0.4), inset 0 0 6px rgba(239, 68, 68, 0.15); } }
@keyframes pulse-turn { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.85; } 100% { transform: scale(1); opacity: 1; } }
@keyframes check-pulse { 0% { box-shadow: inset 0 0 10px rgba(239, 68, 68, 0.3); } 50% { box-shadow: inset 0 0 18px rgba(239, 68, 68, 0.7); } 100% { box-shadow: inset 0 0 10px rgba(239, 68, 68, 0.3); } }
@keyframes modal-enter { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes scale-up { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes reveal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes reveal-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes reveal-card-pop { from { opacity: 0; transform: scale(0.8) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes reveal-piece-flip { 0% { opacity: 0; transform: rotateY(90deg) scale(0.5); } 50% { opacity: 1; transform: rotateY(-10deg) scale(1.1); } 100% { transform: rotateY(0) scale(1); } }
@keyframes feedback-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ═══ MOBILE BARS (hidden on desktop) ═══ */
.mobile-player-bar { display: none; }
.mobile-controls { display: none; }
.mobile-history-drawer { display: none; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .app-layout { grid-template-columns: 1fr; max-width: 600px; margin: 0 auto; }
  .layout-side.left-panel { display: none; }
  .layout-side.right-panel { display: none; }
  .layout-center { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; max-width: 580px; margin: 0 auto; }
  #gameView { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; }

  .mobile-player-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--card);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    transition: all 0.3s ease;
    opacity: 0.85;
    width: 100%;
  }
  .mobile-opponent-bar { margin-bottom: 6px; }
  .mobile-current-bar { margin-top: 6px; margin-bottom: 6px; }
  .mobile-player-bar.active-turn {
    border-color: var(--orange);
    box-shadow: 0 4px 16px rgba(255, 109, 31, 0.25), inset 0 0 0 1px rgba(255, 109, 31, 0.15);
    background-color: var(--card);
    background-image: linear-gradient(rgba(255, 109, 31, 0.08), rgba(255, 109, 31, 0.08));
    opacity: 1;
    transform: scale(1.01);
  }
  .face-to-face-mode .mobile-opponent-bar.active-turn { transform: rotate(180deg) scale(1.01); }
  .mobile-captured-tray { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; justify-content: flex-start; padding: 0; border: none; min-height: auto; font-size: 0.82rem; }

  .mpb-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
  .mpb-name-row { display: flex; align-items: center; gap: 6px; }
  .mpb-avatar { width: 28px; height: 28px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.72rem; flex-shrink: 0; }
  .mpb-avatar.p1 { background: rgba(255, 109, 31, 0.15); color: var(--orange); }
  .mpb-avatar.p2 { background: rgba(104, 132, 158, 0.15); color: #68849E; }
  .mpb-color-swatch { font-size: 1.2rem; line-height: 1; flex-shrink: 0; width: 22px; text-align: center; }
  .mpb-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; color: var(--text); }
  .mpb-timer { background: rgba(0, 0, 0, 0.3); border: 1px solid var(--card-border); color: var(--text); padding: 4px 12px; border-radius: var(--radius-sm); font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 4px; font-size: 1rem; flex-shrink: 0; }
  .mpb-timer svg { width: 14px; height: 14px; color: var(--text-muted); }
  .mpb-timer.urgent { color: var(--red); animation: timer-pulse 1s infinite alternate; }

  .mobile-controls { display: flex; gap: 8px; justify-content: center; margin: 6px 0 2px; padding: 0; width: 100%; }
  .mctrl-btn { flex: 1; max-width: 54px; height: 44px; background: var(--card); border: 1px solid var(--card-border); color: var(--text-sub); border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; -webkit-tap-highlight-color: transparent; }
  .mctrl-btn svg { width: 20px; height: 20px; stroke: currentColor; }
  .mctrl-btn:hover, .mctrl-btn:focus-visible { color: var(--orange); border-color: rgba(255, 109, 31, 0.25); background: rgba(255, 109, 31, 0.06); }
  .mctrl-btn:active { transform: scale(0.92); color: var(--orange); }

  .mobile-history-drawer { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-md); padding: 12px; margin-top: 4px; max-height: 200px; overflow: hidden; display: flex; flex-direction: column; width: 100%; }
  .mobile-history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .mobile-history-header h3 { font-family: var(--font-heading); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-sub); }
  .mobile-moves-grid { overflow-y: auto; flex-grow: 1; max-height: 160px; }

  .board-wrap-container { padding: 2px 0; width: 100%; display: flex; flex-direction: column; align-items: center; }
  .board-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; }

  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .articles-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
}

/* Mobile Portrait */
@media (max-width: 520px) {
  :root { --gap: 10px; }
  .page-shell { padding: 8px; }
  .brand-name { display: none; }
  .site-header { --header-height: 52px; height: var(--header-height); }

  .board { width: min(calc(100vw - 48px), 54dvh); height: min(calc(100vw - 48px), 54dvh); max-width: 100%; aspect-ratio: 1 / 1; }
  .board-wrap-container { padding: 0 4px; }

  .mobile-player-bar { padding: 8px 12px; border-radius: var(--radius-sm); }
  .mpb-name { font-size: 1.05rem; max-width: 160px; }
  .mpb-timer { font-size: 0.95rem; padding: 4px 10px; }

  .mobile-controls { display: flex; gap: clamp(4px, 1.5vw, 8px); justify-content: center; margin: 6px 0 2px; width: 100%; padding: 0; }
  .mctrl-btn { flex: 1; max-width: clamp(38px, 12vw, 48px); height: 42px; border-radius: var(--radius-sm); }
  .mctrl-btn svg { width: 18px; height: 18px; }

  .pass-row { max-width: 100%; }
  .pass-btn { padding: 14px 18px; font-size: 1rem; }

  .features-grid { grid-template-columns: 1fr; }
  .share-row { grid-template-columns: repeat(2, 1fr); }
  .faq-q { font-size: 0.82rem; }

  .settings-card .setup-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .settings-card .setup-input { text-align: left; max-width: 100%; width: 100%; }
  .settings-card .toggle-row { width: 100%; }
  .settings-card .toggle-opt { flex: 1; text-align: center; }
  .settings-card__header { padding: 10px 14px; gap: 10px; }
  .settings-card__icon { width: 36px; height: 36px; min-width: 36px; border-radius: 8px; }
  .settings-card__icon svg { width: 18px; height: 18px; }
  .settings-card__title { font-size: 0.88rem; }
  .settings-card__body { padding: 8px 14px 12px; }
  .settings-card__divider { margin: 0 14px; }
  .start-game-btn { padding: 14px 18px; font-size: 0.95rem; }
  .settings-panel { width: 100vw; max-width: none; right: -100vw; border-left: none; }
}

/* Ultra-small */
@media (max-width: 375px) {
  .board { width: min(calc(100vw - 56px), 50dvh); height: min(calc(100vw - 56px), 50dvh); }
  .board-wrap-container { padding: 0 2px; }
  .mpb-name { font-size: 0.95rem; max-width: 130px; }
  .mpb-color { display: none; }
  .mctrl-btn { max-width: 38px; height: 38px; }
  .mctrl-btn svg { width: 16px; height: 16px; }
  .pass-btn { font-size: 0.92rem; padding: 12px 16px; }
}

/* Tablet Landscape */
@media (min-width: 768px) and (max-width: 1024px) {
  .board { width: clamp(320px, 55vw, 480px); height: clamp(320px, 55vw, 480px); }
  .mctrl-btn { max-width: 56px; height: 44px; }
}

/* Desktop */
@media (min-width: 1025px) {
  .board { width: clamp(360px, 32vw, 560px); height: clamp(360px, 32vw, 560px); }
}

/* Responsive Feedback */
@media (max-width: 600px) {
  .feedback-floating-btn { bottom: 12px; right: 8px; padding: 8px 12px; font-size: 0.78rem; z-index: 400; }
  .feedback-modal-card { padding: 18px; max-height: 90vh; overflow-y: auto; }
}

/* ═══════════════════════════════════════════════════════════════
   PASS & PLAY APP (index.html)
   Play / Setup tabs, compact header, settings cards, action bar,
   pass screen and confirm dialogs. Scoped to .app-header, #main-game
   and new classes, so the other pages sharing this file are unaffected.
   ═══════════════════════════════════════════════════════════════ */

#main-game [hidden] { display: none !important; }

/* ── Play / Setup tabs ── */
.mode-btn { white-space: nowrap; }
.mode-btn:focus-visible,
.time-tile:focus-visible,
.theme-tile:focus-visible,
.option-card:focus-visible,
.toggle-opt:focus-visible,
.mctrl-btn:focus-visible,
.ctrl-btn:focus-visible,
.modal-btn:focus-visible,
.pass-ready-btn:focus-visible,
.start-game-btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.mode-btn:not(.on):hover { color: var(--orange); }
.header-mode-toggle { display: none; }
.page-mode-toggle { align-self: center; }

/* ── Board ── */
#main-game .board-wrap-container { padding: 0; }
@media (min-width: 1025px) {
  #main-game .board {
    --board-size: min(600px, calc(100vw - 620px), calc(100vh - 200px));
    width: max(360px, var(--board-size));
    height: max(360px, var(--board-size));
  }
  /* Setup / Settings use the full width: three cards side by side */
  .app-layout.is-setup { grid-template-columns: minmax(0, 1fr); }
  .app-layout.is-setup .layout-side { display: none; }
  /* Side panels start level with the board's top edge (below the Play / Settings toggle) */
  .page-mode-toggle { height: 38px; align-items: center; }
  .app-layout:not(.is-setup) .layout-side { margin-top: calc(38px + var(--gap)); }
}

/* ── Desktop player cards: same layout, less height ── */
#main-game .player-card { padding: 10px 12px; gap: 6px; }
#main-game .player-right { margin-top: 0; }
#main-game .player-card .captured-tray { min-height: 0; margin-top: 0; }
#main-game .player-card .captured-tray:empty { display: none; }
/* "YOUR TURN" sits on the card's top border, so it never covers the name; long names end with … */
#main-game .turn-badge-container { top: -9px; right: 10px; }
#main-game .player-left,
#main-game .player-info { min-width: 0; }
#main-game .player-name,
#main-game .player-name.name-active { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#main-game .player-name.name-active::before { margin-right: 6px; vertical-align: 2px; }

/* ── Evaluation bar (optional) ── */
/* The score sits next to the side that is ahead (as in SuperChess) */
#main-game .eval-wrap {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "w sw . sb b" "bar bar bar bar bar";
  align-items: center;
  gap: 4px 6px;
  padding: 6px 10px;
  background: var(--card);
}
#main-game .eval-wrap > .eval-lbl:first-child { grid-area: w; }
#main-game .eval-wrap > .eval-bar { grid-area: bar; }
#main-game .eval-wrap > .eval-lbl:nth-child(3) { grid-area: b; }
#main-game .eval-wrap > .eval-score { grid-area: sw; }
#main-game .eval-wrap.black-ahead > .eval-score { grid-area: sb; }
#main-game .mobile-eval { display: none; }
body.light #main-game .eval-bar { background: #3D3D3D; }
body.light #main-game .eval-fill { background: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }

/* ── Desktop actions ── */
#main-game .controls-vertical { margin-top: 0; }
#main-game .ctrl-wide { grid-column: 1 / -1; }
#main-game .ctrl-btn { min-height: 38px; }
#main-game .ctrl-btn.warning { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.28); color: var(--yellow); }
#main-game .ctrl-btn.warning:hover { background: rgba(245, 158, 11, 0.15); }
#main-game .ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
body.light #main-game .ctrl-btn.warning { color: #B45309; border-color: rgba(180, 83, 9, 0.3); background: rgba(245, 158, 11, 0.08); }

/* ── Settings view ── */
#main-game #setupView { max-width: 560px; gap: 12px; padding: 0 0 4px; }
@media (min-width: 1025px) { #main-game #setupView { max-width: 1240px; } }

.settings-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 109, 31, 0.08);
  border: 1px solid rgba(255, 109, 31, 0.25);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
}
.settings-notice__icon { display: flex; color: var(--orange); flex-shrink: 0; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; width: 100%; align-items: start; }
@media (min-width: 600px) and (max-width: 1199px) {
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid #appearanceCard { grid-column: 1 / -1; }
  /* Board theme | other options side by side while the card spans both columns */
  #setupView #appearanceCard .settings-card__body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}
@media (min-width: 600px) and (max-width: 1024px) {
  .app-layout.is-setup,
  .app-layout.is-setup .layout-center,
  #main-game #setupView { max-width: 960px; }
}
@media (min-width: 1200px) {
  .settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
  .settings-grid #appearanceCard { grid-column: auto; }
}

#setupView .settings-card { max-width: none; }
#setupView .settings-card__header { cursor: default; }
#setupView .settings-card__header:hover { background: none; }
#setupView .settings-card__body { max-height: none; overflow: visible; display: flex; flex-direction: column; gap: 16px; padding: 14px 16px 16px; }

.setting-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.setting-block__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
#setupView .setup-key { font-family: var(--font-heading); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--sc-text-sub); }

/* Rules that can't change mid-game: greyed with a chip on the 3-card layout, hidden below it */
.locked-chip {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--sc-text-sub);
  background: var(--sc-surface-hover);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
}
.setting-block.is-locked .locked-chip { display: inline-flex; }
.setting-block.is-locked > :not(.setting-block__head) { opacity: 0.45; pointer-events: none; filter: grayscale(0.5); }
@media (max-width: 1199px) { #setupView .setting-block.is-locked { display: none; } }

/* Time control tiles */
.time-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.time-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 54px;
  padding: 6px 2px;
  background: var(--sc-surface);
  border: 1.5px solid var(--sc-border);
  border-radius: var(--radius-md);
  color: var(--sc-text);
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.time-tile b { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.time-tile small { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; color: var(--sc-text-sub); }
.time-tile svg { width: 20px; height: 20px; margin: 1px 0 2px; }
.time-tile:hover { border-color: var(--sc-accent); transform: translateY(-1px); }
.time-tile.on { background: var(--sc-selected-bg); border-color: var(--sc-selected-border); box-shadow: 0 0 12px var(--sc-accent-glow); color: var(--sc-accent); }
.time-tile.on small { color: var(--sc-accent); }

#setupView .toggle-row { width: 100%; }
#setupView .toggle-opt { flex: 1; padding: 8px 6px; font-size: 0.8rem; text-align: center; }

/* Players */
.names-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#setupView .setup-input { width: 100%; max-width: none; padding: 9px 12px; font-size: 0.9rem; text-align: left; }

/* Playing style: icon tiles like SuperChess (icon beside the text on phones, stacked from 600px) */
#setupView .play-style-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 0; }
#setupView .play-style-tiles .option-card {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 20px 8px 8px;
  text-align: left;
  border-width: 2px;
  color: inherit;
}
#setupView .play-style-tiles .option-card.selected { box-shadow: 0 4px 14px var(--sc-accent-glow); }
.option-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--sc-surface-hover);
  color: var(--sc-text-sub);
  transition: background-color 0.2s, color 0.2s;
}
.option-card__icon svg { width: 18px; height: 18px; }
.option-card.selected .option-card__icon { background: var(--sc-accent); color: #FFF; }
.option-card__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
#setupView .play-style-tiles .option-card__title { font-size: 0.8rem; }
#setupView .play-style-tiles .option-card__desc { font-size: 0.68rem; line-height: 1.3; }
.option-card__check { position: absolute; top: 4px; right: 4px; display: none; line-height: 0; color: var(--sc-accent); }
.option-card__check svg { width: 14px; height: 14px; }
.option-card.selected .option-card__check { display: block; }
@media (min-width: 600px) {
  #setupView .play-style-tiles { gap: 12px; }
  #setupView .play-style-tiles .option-card { flex-direction: column; align-items: center; gap: 6px; padding: 12px; text-align: center; }
  .option-card__icon { width: 40px; height: 40px; }
  .option-card__icon svg { width: 22px; height: 22px; }
  #setupView .play-style-tiles .option-card__title { font-size: 0.875rem; }
  #setupView .play-style-tiles .option-card__desc { font-size: 0.75rem; }
  .option-card__check { top: 6px; right: 6px; }
  .option-card__check svg { width: 18px; height: 18px; }
}
.option-card.is-disabled { opacity: 0.5; cursor: not-allowed; }
.option-card.is-disabled:hover { transform: none; border-color: var(--sc-border); background: var(--sc-surface); }

/* Board theme tiles */
.theme-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.theme-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px 7px;
  background: var(--sc-surface);
  border: 1.5px solid var(--sc-border);
  border-radius: var(--radius-md);
  color: var(--sc-text-sub);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.theme-swatch {
  width: 100%;
  max-width: 52px;
  aspect-ratio: 1;
  border-radius: 6px;
  background: conic-gradient(var(--l) 25%, var(--d) 0 50%, var(--l) 0 75%, var(--d) 0) 0 0 / 50% 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.theme-tile:hover { border-color: var(--sc-accent); transform: translateY(-1px); }
.theme-tile.on { background: var(--sc-selected-bg); border-color: var(--sc-selected-border); box-shadow: 0 0 12px var(--sc-accent-glow); color: var(--sc-accent); }

/* Option switches */
.option-switches { display: flex; flex-direction: column; }
.option-switch { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--sc-divider); cursor: pointer; }
.option-switch__icon { display: flex; flex-shrink: 0; color: var(--sc-text-sub); }
.option-switch__icon svg { width: 20px; height: 20px; }
.option-switch:first-child { padding-top: 2px; }
.option-switch:last-child { border-bottom: none; padding-bottom: 0; }
.option-switch__text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.option-switch__text strong { font-size: 0.86rem; font-weight: 600; color: var(--sc-text); }
.option-switch__text small { font-size: 0.72rem; line-height: 1.35; color: var(--sc-text-sub); }
.option-switch .switch { flex-shrink: 0; }
.switch input:focus-visible + .slider { outline: 2px solid var(--orange); outline-offset: 2px; }

/* Start / Resume: stays in reach while the cards scroll */
.start-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.start-bar .start-game-btn { margin-top: 0; }
#setupView .board-ctas,
#setupView .superchess-banner { width: 100%; max-width: 520px; }
#setupView .board-ctas { margin: 0; }

/* ── Confirm dialogs & modals: light dim + 2px blur, inset on phones ── */
.modal-backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); padding: 16px; }
.modal-card { max-width: 420px; padding: 22px 20px 18px; }
.modal-content h3:first-child { margin-top: 0; }
.modal-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.modal-btn.warning { background: var(--yellow); border-color: var(--yellow); color: #1D1D1D; }
.modal-buttons.confirm-buttons .modal-btn { flex: 1 1 0; min-width: 0; }
.modal-btn.confirm:hover, .modal-btn.danger:hover, .modal-btn.warning:hover { filter: brightness(1.08); }
@media (max-width: 520px) {
  .modal-card { padding: 20px 16px 16px; }
  .modal-btn { min-height: 48px; }
}

/* ── Pass device screen (keeps its heavy blur on purpose) ── */
.privacy-card { max-width: 380px; padding: 28px 24px 22px; }
.privacy-card h2 { font-size: 1.35rem; margin-bottom: 10px; overflow-wrap: anywhere; }
.privacy-card .pass-screen-text { margin-bottom: 14px; }
.pass-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  background: var(--sc-surface-hover);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
}
.pass-color-dot { width: 12px; height: 12px; border-radius: var(--radius-full); border: 1.5px solid #888; }
.pass-color-dot.w { background: #F5F5F5; }
.pass-color-dot.b { background: #1D1D1D; }
.pass-ready-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border: none;
  border-radius: var(--radius-md);
  color: #FFF;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 109, 31, 0.3);
  transition: transform 0.15s, filter 0.2s;
}
.pass-ready-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.pass-ready-btn:active { transform: scale(0.98); }
.pass-note { margin-top: 14px; font-size: 0.72rem; line-height: 1.45; color: var(--text-muted); }
.pass-note strong { color: var(--text-sub); font-weight: 600; }
/* "Don't show this again": a quiet row under the button, ticked only on purpose */
.pass-skip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 10px 14px;
  text-align: left;
  background: var(--sc-surface-hover);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.pass-skip:hover { border-color: rgba(255, 109, 31, 0.45); }
.pass-skip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pass-skip__box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  color: transparent;
  border: 2px solid var(--text-muted);
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pass-skip input:checked + .pass-skip__box { background: var(--orange); border-color: var(--orange); color: #FFF; }
.pass-skip input:focus-visible + .pass-skip__box { outline: 2px solid var(--orange); outline-offset: 2px; }
.pass-skip:has(input:checked) { border-style: solid; border-color: rgba(255, 109, 31, 0.55); }
.pass-skip__text { display: flex; flex-direction: column; gap: 2px; font-size: 0.82rem; font-weight: 600; color: var(--text); }
.pass-skip__text small { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); }

/* ── Drawer additions ── */
.settings-panel .drawer-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border: none;
  border-radius: var(--radius-full);
  color: #FFF;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.settings-panel .drawer-install-btn svg { width: 14px; height: 14px; }

/* ═══ Phones & tablets ═══ */
@media (max-width: 1024px) {
  /* Compact header: logo · Play/Setup toggle · settings (install & theme move to the settings panel) */
  .app-header .header-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
  .app-header .brand { min-width: 0; }
  .app-header .brand-badge { display: none; }
  .app-header .header-nav { justify-self: end; }
  .app-header .install-btn,
  .app-header .theme-btn,
  .app-header .games-link { display: none; }
  .app-header .header-mode-toggle { display: flex; }
  .app-header .mode-btn { padding: 7px 14px; font-size: 0.82rem; }
  .page-mode-toggle { display: none; }

  #main-game {
    --board-chrome: 236px;
    --board-size: min(560px, calc(100vw - 24px), calc(100vh - var(--board-chrome)));
  }
  @supports (height: 100dvh) {
    #main-game { --board-size: min(560px, calc(100vw - 24px), calc(100dvh - var(--board-chrome))); }
  }
  #main-game.show-eval { --board-chrome: 272px; }
  #main-game .board { width: max(240px, var(--board-size)); height: max(240px, var(--board-size)); }
  #main-game .board-wrap-container { width: auto; }

  #main-game #gameView { gap: 6px; }
  #main-game .mobile-eval {
    display: grid;
    grid-template-areas: "w sw bar sb b";
    gap: 6px;
    width: 100%;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
  }

  /* Player bars: same layout, less height (captured row only when it has pieces) */
  #main-game .mobile-player-bar { margin: 0; padding: 6px 10px; min-height: 44px; }
  #main-game .mpb-info { gap: 2px; }
  #main-game .mpb-avatar { width: 26px; height: 26px; font-size: 0.66rem; }
  #main-game .mpb-name { font-size: 1rem; }
  #main-game .mobile-captured-tray { padding-left: 32px; }
  #main-game .mobile-captured-tray:empty { display: none; }
  #main-game .mobile-captured-tray .captured-piece-mini { width: 14px; height: 14px; }
  #main-game .mpb-timer { padding: 4px 10px; font-size: 1rem; }
  /* Face to Face: the top player reads their bar from the other side */
  #gameView.is-f2f .mobile-opponent-bar { transform: rotate(180deg); }
  #gameView.is-f2f .mobile-opponent-bar.active-turn { transform: rotate(180deg) scale(1.01); }

  /* Actions: one row, icon + label */
  #main-game .mobile-controls { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0; }
  #main-game .mctrl-btn {
    flex-direction: column;
    gap: 3px;
    max-width: none;
    height: auto;
    min-height: 50px;
    padding: 6px 0;
    font-family: var(--font-body);
    font-size: 0.62rem;
    letter-spacing: -0.1px;
    font-weight: 600;
    color: var(--text-sub);
  }
  #main-game .mctrl-btn svg { width: 18px; height: 18px; }
  #main-game .mctrl-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
  #main-game .mctrl-btn.mctrl-primary { color: var(--orange); }
  #main-game .mctrl-btn.mctrl-warning { color: var(--yellow); }
  #main-game .mctrl-btn.mctrl-danger { color: var(--red); }
  #main-game .mctrl-btn[aria-expanded="true"] { color: var(--orange); border-color: rgba(255, 109, 31, 0.35); background: rgba(255, 109, 31, 0.08); }
  #main-game .mctrl-btn:disabled { opacity: 0.4; pointer-events: none; }
  body.light #main-game .mctrl-btn.mctrl-primary { color: #C2410C; }
  body.light #main-game .mctrl-btn.mctrl-warning { color: #B45309; }
  body.light #main-game .mctrl-btn.mctrl-danger { color: #DC2626; }

  #main-game .mobile-history-drawer { margin-top: 0; }
  /* Feedback moves into the settings panel here, so it never covers the Start bar or the actions */
  body.cpp-app .feedback-floating-btn { display: none; }
  #main-game .board-ctas { margin-top: 10px; }
}

@media (min-width: 600px) and (max-width: 1024px) {
  /* Room for header, both player bars (with their captured-piece rows) and the action bar */
  #main-game { --board-chrome: 292px; }
  #main-game.show-eval { --board-chrome: 328px; }
  #main-game .mctrl-btn { min-height: 56px; font-size: 0.74rem; }
  #main-game .mctrl-btn svg { width: 20px; height: 20px; }
}

@media (max-width: 600px) {
  .app-header .brand-name { display: none; }
}

@media (max-width: 520px) {
  #main-game { --board-chrome: 224px; }
  #main-game.show-eval { --board-chrome: 258px; }
  #main-game .mpb-name { font-size: 0.98rem; max-width: 170px; }
  #main-game .mpb-timer { font-size: 0.95rem; }
  .time-tiles { gap: 5px; }
  .time-tile { min-height: 50px; }
  .theme-tiles { gap: 6px; }
}

@media (max-width: 360px) {
  #main-game .mobile-controls { gap: 4px; }
  #main-game .mctrl-btn { font-size: 0.58rem; padding: 6px 1px; }
  .app-header .mode-btn { padding: 7px 10px; }
}
.privacy-card .pass-note { margin-bottom: 0; }

/* ═══ Phones: Settings is one card with a section per card (as in SuperChess) ═══ */
@media (max-width: 599px) {
  #main-game #setupView { gap: 10px; }
  #main-game .settings-grid {
    gap: 0;
    overflow: hidden;
    background: var(--sc-bg);
    border: 1px solid var(--sc-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--sc-shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  #setupView .settings-grid > .settings-card,
  #setupView .settings-grid > .settings-card:hover {
    overflow: visible;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  #setupView .settings-grid > .settings-card + .settings-card { border-top: 1px solid var(--sc-divider); }
  #setupView .settings-card__header { gap: 10px; padding: 12px 12px 0; }
  #setupView .settings-card__icon { width: 28px; height: 28px; min-width: 28px; border-radius: 6px; box-shadow: none; }
  #setupView .settings-card__icon svg { width: 16px; height: 16px; }
  #setupView .settings-card__title { font-size: 1rem; font-weight: 800; }
  #setupView .settings-card__subtitle,
  #setupView .settings-card__divider { display: none; }
  #setupView .settings-card__body { gap: 14px; padding: 12px; }
  #setupView .setting-block { gap: 6px; }
  .time-tile { min-height: 46px; padding: 4px 2px; }
  .time-tile b { font-size: 1.05rem; }
  .time-tile svg { width: 18px; height: 18px; }
  #setupView .toggle-opt { padding: 7px 4px; }
  #setupView .setup-input { padding: 8px 10px; }
  .theme-tile { padding: 6px 4px; gap: 4px; }
  .theme-swatch { max-width: 40px; }
  .option-switch { padding: 7px 0; }
  .settings-notice { padding: 8px 10px; font-size: 0.8rem; }
}
.pass-ready-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-panel .drawer-feedback-btn { background: var(--sc-surface-hover); color: var(--text); border: 1px solid var(--card-border); }

/* ── Turkish & Russian pages (/tr/, /ru/): generated by .dev/scripts/make-lang-pages.py ── */
/* Poppins has no Cyrillic letters, so Russian headings use Inter */
html[lang="ru"] { --font-heading: 'Inter', system-ui, sans-serif; }
/* Heading and intro above the game; like the content below the game, it steps aside once a game exists */
.lang-hero { max-width: 760px; margin: 0 auto; text-align: center; }
.lang-hero h1 { font-family: var(--font-heading); font-size: clamp(1.3rem, 3.4vw, 2rem); font-weight: 700; line-height: 1.25; letter-spacing: -0.3px; color: var(--orange); margin-bottom: 8px; text-wrap: balance; }
.lang-hero p { font-size: 0.95rem; line-height: 1.55; color: var(--text-sub); }
.lang-text p, .lang-text li { font-size: 0.92rem; line-height: 1.7; color: var(--text-sub); }
.lang-text p + p, .lang-text ul + p { margin-top: 10px; }
.lang-text ul { padding-left: 20px; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.lang-text h3 { font-size: 1rem; margin: 18px 0 6px; }
.lang-text strong { color: var(--text); }
.lang-text a { color: var(--orange); font-weight: 600; }
.lang-figure { margin: 16px auto 14px; text-align: center; }
.lang-figure img { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; border-radius: 10px; border: 1px solid var(--card-border); box-shadow: var(--shadow); }
.lang-figure figcaption { font-size: 0.78rem; color: var(--text-muted); margin: 8px auto 0; line-height: 1.5; max-width: 420px; }
/* Language links in the footer of every Turkish and Russian page */
.footer-langs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 20px; }
.footer-langs a { font-size: 0.78rem; font-weight: 600; color: var(--text-sub); text-decoration: none; padding: 5px 12px; border: 1px solid var(--card-border); border-radius: var(--radius-full); transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.footer-langs a:hover { transform: translateY(-1px); border-color: var(--orange); color: var(--orange); }
.footer-langs a[aria-current="page"] { color: var(--orange); border-color: rgba(255, 109, 31, 0.45); }
@media (max-width: 600px) {
  .lang-hero p { font-size: 0.88rem; }
  .lang-content .content-card { padding: 20px 16px; }
}
