/* ============================================================
   Crossword Master — International Tabletop Design System
   Warm Parchment & Tournament Emerald + Tactile Ivory Tiles
   ============================================================ */

:root {
  --bg-page: #f5f2eb;
  --bg-grad: radial-gradient(circle at 15% 10%, #fdfbf5 0%, #f1ece1 55%, #e7ece8 100%);
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-soft: #f1ede4;
  --bg-input: #ffffff;
  --border: rgba(100, 116, 139, 0.24);
  --border-strong: rgba(100, 116, 139, 0.42);
  --text-main: #1e293b;
  --text-muted: #64748b;

  --primary: #0f766e;
  --primary-hover: #0d625b;
  --primary-soft: rgba(15, 118, 110, 0.13);
  --accent: #d97706;
  --accent-soft: rgba(217, 119, 6, 0.14);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);

  /* Board colors */
  --board-frame: #134e4a;
  --board-grid-bg: #0f3d39;
  --cell-normal: #e8efe9;
  --cell-hover: #d1fae5;
  --cell-tw: #dc2626;
  --cell-dw: #ec4899;
  --cell-st: #f43f5e;
  --cell-tl: #2563eb;
  --cell-dl: #0ea5e9;

  /* Ivory Wood Tile */
  --tile-bg: linear-gradient(155deg, #fffdf5 0%, #f7e6c4 100%);
  --tile-border: #c9a66b;
  --tile-text: #271a0c;
  --tile-shadow: 0 3px 0 #a98245, 0 4px 8px rgba(0, 0, 0, 0.16);

  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.1);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --font-ui: 'Kanit', 'Segoe UI', Tahoma, sans-serif;
  --font-tile: 'Outfit', 'Kanit', sans-serif;
}

body.theme-dark {
  --bg-page: #0b1220;
  --bg-grad: radial-gradient(circle at 15% 10%, #111f35 0%, #0b1220 60%, #0e1d1c 100%);
  --bg-card: rgba(23, 33, 50, 0.92);
  --bg-soft: rgba(38, 52, 74, 0.72);
  --bg-input: #0f172a;
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(148, 163, 184, 0.36);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;

  --primary: #14b8a6;
  --primary-hover: #0d9488;
  --primary-soft: rgba(20, 184, 166, 0.16);

  --board-frame: #0f2928;
  --board-grid-bg: #081918;
  --cell-normal: #1e293b;
  --cell-hover: #134e4a;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 32px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text-main);
  background: var(--bg-page);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  overflow-x: hidden;
}

button, input, select { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small-text { font-size: 0.82rem; }

/* ==================== TOASTS ==================== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--primary);
  box-shadow: var(--shadow-md);
  border-radius: 12px;
  padding: 11px 15px;
  font-size: 0.92rem;
  font-weight: 500;
  animation: toastSlide 0.22s ease;
}

.toast.success { border-left-color: #16a34a; }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--accent); }

@keyframes toastSlide {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==================== TOPBAR ==================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 2px;
}

.brand-tile {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--tile-bg);
  border: 2px solid var(--tile-border);
  color: var(--tile-text);
  font-family: var(--font-tile);
  font-weight: 800;
  font-size: 1.25rem;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 3px 0 #a98245;
}

.brand-tile sub {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.58rem;
}

.brand-meta strong {
  display: block;
  font-family: var(--font-tile);
  font-size: 1.15rem;
  color: var(--primary);
}

.brand-meta small {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  cursor: pointer;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
}

/* ==================== BUTTONS & CARDS ==================== */
.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 16px 46px;
}

.screen { display: none; animation: fadeIn 0.24s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-lg { padding: 13px 28px; font-size: 1.04rem; border-radius: 14px; }
.btn-sm { padding: 7px 12px; font-size: 0.84rem; border-radius: 10px; }
.btn-xs { padding: 4px 10px; font-size: 0.78rem; border-radius: 8px; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.28);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-accent-soft {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-ghost {
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ==================== SETUP SCREEN ==================== */
.hero-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.hero-banner h1 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.22;
}

.highlight { color: var(--primary); }
.hero-banner p { margin: 0; max-width: 680px; line-height: 1.55; }

.hero-tiles {
  display: flex;
  gap: 8px;
}

.demo-tile {
  width: 50px;
  height: 54px;
  border-radius: 11px;
  background: var(--tile-bg);
  border: 2px solid var(--tile-border);
  color: var(--tile-text);
  font-family: var(--font-tile);
  font-size: 1.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: var(--tile-shadow);
}

.demo-tile sub {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 0.65rem;
}

.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.mode-card {
  text-align: left;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all 0.16s ease;
}

.mode-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.mode-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.14);
}

.mode-emoji { font-size: 2rem; line-height: 1; }
.mode-card h3 { margin: 0 0 5px; font-size: 1.08rem; }
.mode-card p { margin: 0; font-size: 0.86rem; color: var(--text-muted); line-height: 1.45; }

.setup-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.section-head h2 { margin: 0; font-size: 1.15rem; }

.quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.seat-card {
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.seat-card.team-a { border-top: 4px solid #ef4444; }
.seat-card.team-b { border-top: 4px solid #3b82f6; }

.seat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 600;
}

.team-pill-a { color: #dc2626; }
.team-pill-b { color: #2563eb; }

.rules-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.86rem; font-weight: 500; color: var(--text-muted); }

.text-input, .select-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-input);
  font-size: 0.92rem;
  outline: none;
}

.text-input:focus, .select-input:focus {
  border-color: var(--primary);
}

.setup-actions {
  display: flex;
  justify-content: flex-end;
}

/* ==================== GAME ARENA LAYOUT ==================== */
.arena-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(290px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.board-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.turn-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.turn-left, .turn-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.turn-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
}

.thinking-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  animation: pulseSoft 1s ease-in-out infinite;
}

@keyframes pulseSoft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.bag-pill {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

/* ==================== 15x15 TOURNAMENT BOARD ==================== */
.board-frame {
  background: var(--board-frame);
  border-radius: 16px;
  padding: 10px 12px 12px 6px;
  box-shadow: var(--shadow-md);
  user-select: none;
}

.board-col-headers {
  display: grid;
  grid-template-columns: 22px repeat(15, 1fr);
  gap: 2px;
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-tile);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

.board-body {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 4px;
}

.board-row-headers {
  display: grid;
  grid-template-rows: repeat(15, 1fr);
  gap: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-tile);
  font-size: 0.68rem;
  font-weight: 700;
  align-items: center;
  text-align: center;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 2px;
  background: var(--board-grid-bg);
  padding: 2px;
  border-radius: 8px;
  aspect-ratio: 1 / 1;
}

.board-cell {
  position: relative;
  border-radius: 4px;
  background: var(--cell-normal);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-family: var(--font-tile);
  font-size: clamp(0.48rem, 0.9vw, 0.68rem);
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  color: rgba(30, 41, 59, 0.45);
  transition: transform 0.1s ease, filter 0.12s ease;
  overflow: hidden;
}

.board-cell:hover {
  filter: brightness(1.06);
}

.board-cell.drag-over {
  outline: 2.5px solid #facc15;
  z-index: 5;
}

.board-cell.prem-TW { background: var(--cell-tw); color: #ffffff; }
.board-cell.prem-DW { background: var(--cell-dw); color: #ffffff; }
.board-cell.prem-ST { background: var(--cell-st); color: #ffffff; font-size: clamp(0.7rem, 1.3vw, 1.05rem); }
.board-cell.prem-TL { background: var(--cell-tl); color: #ffffff; }
.board-cell.prem-DL { background: var(--cell-dl); color: #ffffff; }

/* Tile rendered inside board cell */
.tile-piece {
  width: 94%;
  height: 94%;
  border-radius: 5px;
  background: var(--tile-bg);
  border: 1.5px solid var(--tile-border);
  color: var(--tile-text);
  display: grid;
  place-items: center;
  position: relative;
  font-family: var(--font-tile);
  font-weight: 800;
  font-size: clamp(0.76rem, 1.65vw, 1.18rem);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 2px 3px rgba(0, 0, 0, 0.25);
}

.tile-piece .tile-pts {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: clamp(0.42rem, 0.72vw, 0.58rem);
  font-weight: 700;
  opacity: 0.78;
}

.tile-piece.pending {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px #facc15, 0 3px 6px rgba(0, 0, 0, 0.28);
  cursor: grab;
}

.tile-piece.last-move {
  box-shadow: 0 0 0 2px #34d399;
}

.tile-piece.is-blank {
  background: linear-gradient(155deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #60a5fa;
  color: #1d4ed8;
}

/* ==================== RACK & ACTIONS ==================== */
.rack-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
}

.rack-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.move-preview {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.move-preview.valid {
  color: var(--primary);
  font-weight: 600;
}

.move-preview.invalid {
  color: var(--danger);
}

.rack-mini-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.leg {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  color: #ffffff;
}

.leg.tw { background: var(--cell-tw); }
.leg.dw { background: var(--cell-dw); }
.leg.tl { background: var(--cell-tl); }
.leg.dl { background: var(--cell-dl); }

.rack-wood {
  background: linear-gradient(180deg, #92400e 0%, #78350f 100%);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.32), 0 4px 10px rgba(0, 0, 0, 0.14);
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-rack {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.rack-tile {
  width: 52px;
  height: 54px;
  border-radius: 10px;
  background: var(--tile-bg);
  border: 2px solid var(--tile-border);
  color: var(--tile-text);
  font-family: var(--font-tile);
  font-size: 1.55rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
  box-shadow: var(--tile-shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
}

.rack-tile:hover { transform: translateY(-4px); }

.rack-tile.selected {
  transform: translateY(-7px) scale(1.06);
  border-color: #facc15;
  box-shadow: 0 0 0 3px #facc15, 0 8px 14px rgba(0, 0, 0, 0.32);
}

.rack-tile .tile-pts {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 0.68rem;
  font-weight: 700;
}

.rack-tile.blank-tile {
  background: linear-gradient(155deg, #eff6ff 0%, #bfdbfe 100%);
  border-color: #60a5fa;
  color: #1d4ed8;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* ==================== SIDEBAR ==================== */
.side-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-column h3 { margin: 0 0 10px; font-size: 1rem; }

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-title-row h3 { margin: 0; }

.team-bars {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.team-box {
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.team-box span { display: block; font-size: 0.8rem; font-weight: 600; }
.team-box strong { font-family: var(--font-tile); font-size: 1.65rem; }

.team-red { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.team-blue { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.team-vs { font-family: var(--font-tile); font-weight: 800; color: var(--text-muted); }

.players-scoreboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 2px solid transparent;
}

.player-row.active-turn {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.player-row-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.player-dot.team-a { background: #ef4444; }
.player-dot.team-b { background: #3b82f6; }

.player-row-meta strong { display: block; font-size: 0.95rem; }
.player-row-meta small { color: var(--text-muted); font-size: 0.78rem; }

.player-row-score {
  text-align: right;
}

.player-row-score strong {
  display: block;
  font-family: var(--font-tile);
  font-size: 1.35rem;
  color: var(--primary);
}

.player-clock {
  font-family: var(--font-tile);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.player-clock.low { color: var(--danger); font-weight: 700; }

.input-row {
  display: flex;
  gap: 8px;
}

.dict-result {
  margin-top: 8px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.move-history {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.84rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.history-item strong { color: var(--primary); }

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.modal-sm { max-width: 410px; }
.modal-card h2, .modal-card h3 { margin: 0 0 8px; }
.big-icon { font-size: 3rem; margin-bottom: 6px; }

.blank-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 14px 0 16px;
}

.blank-pick-btn {
  height: 40px;
  border-radius: 9px;
  border: 1.5px solid var(--tile-border);
  background: var(--tile-bg);
  color: var(--tile-text);
  font-family: var(--font-tile);
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
}

.blank-pick-btn:hover { transform: scale(1.06); }

.swap-rack-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
}

.swap-tile-btn {
  width: 48px;
  height: 50px;
  border-radius: 10px;
  background: var(--tile-bg);
  border: 2px solid var(--tile-border);
  color: var(--tile-text);
  font-family: var(--font-tile);
  font-weight: 800;
  font-size: 1.3rem;
  cursor: pointer;
  opacity: 0.65;
}

.swap-tile-btn.picked {
  opacity: 1;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  transform: translateY(-4px);
}

.modal-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.rules-list {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 18px;
}

.rule-row {
  display: flex;
  gap: 10px;
  background: var(--bg-soft);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.rule-row p { margin: 0; line-height: 1.45; }

.go-standings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
  text-align: left;
}

.go-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
}

.go-row.winner {
  background: var(--primary-soft);
  border: 2px solid var(--primary);
}

.go-best-word {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 980px) {
  .arena-layout { grid-template-columns: 1fr; }
  .mode-selector, .rules-options-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .rack-tile { width: 42px; height: 46px; font-size: 1.3rem; }
  .board-frame { padding: 6px 6px 8px 3px; }
  .board-col-headers, .board-body { grid-template-columns: 16px 1fr; }
  .board-col-headers { grid-template-columns: 16px repeat(15, 1fr); }
}

/* ==================== CONTEXTUAL TOURNAMENT BOARD VISUALS ==================== */
.hero-banner.has-hero-photo {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, rgba(15, 23, 42, 0.92) 0%, rgba(16, 48, 38, 0.84) 55%, rgba(15, 23, 42, 0.72) 100%),
    url('/images/games/crossword-hero.jpg') center/cover no-repeat !important;
  color: #f8fafc !important;
  border: 2px solid rgba(245, 158, 11, 0.55);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
}
.hero-banner.has-hero-photo h1,
.hero-banner.has-hero-photo .muted {
  color: #f1f5f9 !important;
}
.hero-visual-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.hero-photo-frame {
  margin: 0;
  width: min(300px, 100%);
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid rgba(251, 191, 36, 0.8);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.hero-photo-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
