﻿:root {
  --font-brand: "Cinzel", serif;
  --font-display: "Cormorant Garamond", serif;
  --font-ui: "Inter", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background:
    linear-gradient(135deg, rgba(19, 27, 34, 0.04), transparent 32%),
    linear-gradient(315deg, rgba(113, 87, 52, 0.08), transparent 38%),
    #f7f5f0;
  color: #1a1a1a;
  padding: 20px;
  min-height: 100vh;
}
.aether-chess {
  --board-light: #eeeed2;
  --board-dark: #769656;
  --piece-white: #f5f5f5;
  --piece-black: #1e1e1e;
  --piece-outline: transparent;
  --piece-shadow: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
  --legal-dot: rgba(30, 30, 30, 0.22);
  --last-move: rgba(200, 180, 80, 0.35);
  --selected-glow: rgba(200, 180, 80, 0.5);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
}
.aether-chess.theme-classic { --board-light: #eeeed2; --board-dark: #769656; }
.aether-chess.theme-walnut { --board-light: #efd8b1; --board-dark: #8b5a33; }
.aether-chess.theme-midnight { --board-light: #b8c2cc; --board-dark: #344154; }
.aether-chess.theme-marble { --board-light: #ececea; --board-dark: #9aa4a8; }
.aether-chess.piece-style-classic,
.piece-style-classic {
  --piece-white: #f5f5f5;
  --piece-black: #1e1e1e;
  --piece-outline: transparent;
  --piece-shadow: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
}
.aether-chess.piece-style-modern,
.piece-style-modern {
  --piece-white: #ffffff;
  --piece-black: #202735;
  --piece-outline: rgba(255,255,255,0.28);
  --piece-shadow: drop-shadow(0 3px 2px rgba(0,0,0,0.28));
}
.aether-chess.piece-style-royal,
.piece-style-royal {
  --piece-white: #fff3c4;
  --piece-black: #211607;
  --piece-outline: rgba(139,98,30,0.32);
  --piece-shadow: drop-shadow(0 3px 3px rgba(73,45,12,0.34));
}

.home-screen {
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  padding: 36px 0;
  animation: view-in 0.35s ease-out;
}
.home-screen.hidden { display: none; }
.game-view {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: view-in 0.35s ease-out;
}
.game-view.active { display: flex; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.home-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}
.logo-mark {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  color: #f7f5f0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 18px 34px rgba(26, 26, 26, 0.18);
}
.home-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 8vw, 76px);
  line-height: 0.92;
  font-weight: 700;
  color: #161616;
  letter-spacing: 0;
}
.home-subtitle {
  margin-top: 8px;
  font-size: 14px;
  letter-spacing: 0;
  color: #777;
  text-transform: uppercase;
}
.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 720px;
}
.setup-wide { grid-column: 1 / -1; }
.setup-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.setup-field.hidden { display: none; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0;
}
.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 6px;
  border: 1px solid #ded8ca;
  border-radius: 8px;
  background: rgba(255,255,255,0.7);
}
.segment,
.setup-theme,
.setup-select,
.start-btn {
  min-height: 44px;
  border-radius: 8px;
  font: inherit;
}
.segment {
  border: 0;
  background: transparent;
  color: #555;
  font-weight: 600;
  cursor: pointer;
  padding: 0 14px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.segment.active {
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 8px 18px rgba(26,26,26,0.14);
}
.setup-select,
.setup-theme {
  width: 100%;
  border: 1px solid #ded8ca;
  background: rgba(255,255,255,0.78);
  color: #1a1a1a;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}
.setup-select:disabled {
  color: #aaa;
  background: rgba(245,245,245,0.8);
  cursor: not-allowed;
}
.setup-theme { text-align: left; }
.start-btn {
  width: min(100%, 720px);
  border: 0;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(26,26,26,0.18);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.start-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.start-btn:active { transform: translateY(0); }

@media (max-width: 640px) {
  body { padding: 16px; }
  .home-screen { min-height: calc(100vh - 32px); gap: 24px; padding: 18px 0; }
  .home-brand { align-items: flex-start; gap: 14px; }
  .logo-mark { width: 48px; height: 48px; font-size: 26px; }
  .setup-grid { grid-template-columns: 1fr; }
  .segmented { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .play-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "opponent"
      "board"
      "player"
      "actions"
      "hint"
      "history";
    gap: 10px;
  }
  .seat-panel {
    grid-template-columns: minmax(0, 1fr) minmax(80px, auto);
    grid-template-areas:
      "info timer"
      "captures captures";
    align-items: center;
    padding: 10px 12px;
    gap: 8px 12px;
  }
  .seat-info { grid-area: info; }
  .seat-timer { grid-area: timer; min-width: 96px; }
  .seat-captures { grid-area: captures; min-height: 24px; }
  .board-perspective { width: min(100%, 58vh, 680px); }
  .action-bar { grid-template-columns: repeat(4, 1fr); }
  .history-area:not([open]) .history-scroll { display: none; }
  .history-scroll { max-height: 180px; }
}

@media (max-width: 560px) {
  body { padding: 10px; }
  .aether-chess { gap: 10px; }
  .game-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 8px;
  }
  .header-center { justify-content: flex-start; }
  .header-right { justify-content: space-between; }
  .icon-btn { min-width: 42px; width: auto; padding: 0 10px; }
  .seat-name { font-size: 16px; }
  .seat-meta { font-size: 13px; }
  .timer { padding: 9px 10px; }
  .timer-name { font-size: 12px; }
  .timer-time { font-size: 18px; }
  .board-perspective { width: min(100%, calc(100vh - 310px)); min-width: 280px; }
  .action-bar { grid-template-columns: repeat(2, 1fr); }
  .action-btn { min-height: 40px; font-size: 14px; }
  .history-area { max-height: 220px; }
  .history-area[open] .history-scroll { max-height: 140px; }
  .captured-piece { width: 20px; height: 20px; }
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
  flex-wrap: wrap;
  gap: 12px;
}
.header-left { display: flex; flex-direction: column; gap: 2px; }
.game-title { font-size: 20px; font-weight: 600; line-height: 1.2; color: #1a1a1a; }
.game-subtitle { font-size: 12px; color: #999; }
.header-center { flex: 1; display: flex; justify-content: center; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  font-size: 14px;
  font-weight: 500;
  color: #666;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2a9d3f; transition: background 0.3s ease;
}
.status-dot.check { background: #c53e3e; animation: pulse-dot 1s ease-in-out infinite; }
.status-dot.over { background: #999; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.header-right { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid #e5e5e5;
  background: #fff; color: #666; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all 0.15s ease; padding: 0;
}
.icon-btn:hover { background: #f5f5f5; color: #1a1a1a; border-color: #1a1a1a; }
.icon-btn:active { transform: scale(0.95); }
.icon-btn.active-mode { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.icon-btn:disabled {
  cursor: default;
  opacity: 0.75;
}
.icon-btn:disabled:hover {
  background: #fff;
  color: #666;
  border-color: #e5e5e5;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(320px, 1fr) minmax(180px, 220px);
  grid-template-areas:
    "opponent board history"
    "player board history"
    "actions board history"
    "hint board history";
  gap: 16px;
  align-items: stretch;
}
.opponent-seat { grid-area: opponent; }
.player-seat { grid-area: player; }
.board-column { grid-area: board; }
.action-bar { grid-area: actions; }
.hint-message { grid-area: hint; }
.history-area { grid-area: history; }
.analysis-panel { grid-area: history; }

.board-column { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.board-perspective {
  perspective: none;
  width: min(100%, 72vh, 680px);
  max-width: 680px;
}
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  width: 100%;
  transform: none;
  transform-style: flat;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
  transition: transform 0.4s ease;
  position: relative;
}
.chess-board:hover { transform: none; }
.square {
  position: relative; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background-color 0.15s ease; overflow: hidden;
}
.square::before {
  content: ''; position: absolute; inset: 0; opacity: 0;
  transition: opacity 0.15s ease; pointer-events: none;
}
.square.selected::before { background: var(--selected-glow); opacity: 1; }
.square.last-move::before { background: var(--last-move); opacity: 1; }
.square.hint-from::before,
.square.hint-to::before {
  background: rgba(43, 120, 210, 0.32);
  opacity: 1;
}
.square.hint-to::after {
  content: '';
  position: absolute;
  inset: 12%;
  border: 3px solid rgba(43, 120, 210, 0.68);
  border-radius: 50%;
  pointer-events: none;
}
.square.check::before {
  background: rgba(200, 50, 50, 0.25); opacity: 1;
  animation: pulse-check 1.2s ease-in-out infinite;
}
@keyframes pulse-check { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.7; } }
.square.legal::after {
  content: ''; position: absolute; width: 26%; height: 26%;
  background: var(--legal-dot); border-radius: 50%; top: 37%; left: 37%; pointer-events: none;
}
.square.legal.capture::after {
  width: 88%; height: 88%; background: transparent;
  border: 3px solid rgba(200, 50, 50, 0.3); border-radius: 50%;
  top: 6%; left: 6%;
}
.square.hint-to::after {
  content: '';
  position: absolute;
  inset: 12%;
  width: auto;
  height: auto;
  top: 12%;
  left: 12%;
  background: transparent;
  border: 3px solid rgba(43, 120, 210, 0.68);
  border-radius: 50%;
  pointer-events: none;
}

.piece {
  width: 82%; height: 82%; pointer-events: none;
  transition: transform 0.12s ease, filter 0.12s ease;
  z-index: 2; position: relative;
}
.piece.dragging { opacity: 0.2; }
.piece-ghost {
  position: fixed; width: 60px; height: 60px; pointer-events: none;
  z-index: 1000; transform: scale(1.15);
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.35)); transition: none;
}

.coord-labels {
  display: flex; justify-content: space-around; width: 100%; max-width: 680px;
  padding: 0 2px; font-size: 11px; color: #999; font-variant-numeric: tabular-nums;
}
.coord-labels span { width: 12.5%; text-align: center; }

.seat-panel {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid #e0d9ca;
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
}
.seat-info { min-width: 0; }
.seat-name {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.15;
}
.seat-meta {
  margin-top: 3px;
  font-size: 13px;
  color: #777;
  line-height: 1.25;
}
.seat-captures {
  min-height: 34px;
  display: flex;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 3px;
}
.timer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-radius: 8px; background: #f5f5f5;
  border: 1px solid #e5e5e5; transition: all 0.3s ease;
}
.timer.active { background: #fff; border-color: #1a1a1a; box-shadow: 0 0 0 2px #1a1a1a; }
.timer.warning { border-color: #c53e3e; color: #c53e3e; animation: timer-pulse 1s ease-in-out infinite; }
@keyframes timer-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(197,62,62,0); } 50% { box-shadow: 0 0 0 3px rgba(197,62,62,0.15); } }
.timer-name { font-size: 13px; font-weight: 500; color: #666; display: inline-flex; align-items: center; gap: 6px; }
.timer-icon { width: 16px; height: 16px; opacity: 0.78; }
.timer-time { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }

.captured-piece { width: 22px; height: 22px; opacity: 0.7; }

.action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: end;
}
.action-btn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid #ded8ca;
  background: rgba(255,255,255,0.82);
  color: #1a1a1a;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.action-btn:hover { background: #fff; border-color: #1a1a1a; }
.action-btn:active { transform: scale(0.98); }
.hint-message {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(43, 120, 210, 0.1);
  color: #245f9f;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  visibility: hidden;
}
.hint-message.show { visibility: visible; }

.history-area {
  border: 1px solid #e5e5e5; border-radius: 8px; overflow: hidden;
  background: rgba(255,255,255,0.78);
  min-width: 0;
  max-height: 100%;
}
.history-title {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #777;
  border-bottom: 1px solid #e5e5e5;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-title .ui-icon { width: 18px; height: 18px; }
.history-title::-webkit-details-marker { display: none; }
.history-scroll { overflow-y: auto; padding: 8px; max-height: 520px; }
.history-list { display: grid; grid-template-columns: 28px 1fr 1fr; gap: 2px 6px; font-size: 13px; align-items: center; }
.history-num { color: #999; text-align: right; font-variant-numeric: tabular-nums; }
.history-move { padding: 3px 8px; border-radius: 4px; cursor: default; font-weight: 500; color: #1a1a1a; }
.history-move.current { background: #1a1a1a; color: #fff; }

.analysis-panel {
  display: none;
  border: 1px solid #e5e0d5;
  border-radius: 8px;
  background: rgba(255,255,255,0.86);
  padding: 12px;
  min-width: 0;
  align-self: start;
}
.analysis-panel.show { display: block; }
.analysis-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.analysis-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
}
.analysis-counter {
  margin-top: 3px;
  color: #777;
  font-size: 13px;
  font-weight: 600;
}
.analysis-close {
  border: 1px solid #ded8ca;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.analysis-close .ui-icon { width: 18px; height: 18px; }
.analysis-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.analysis-verdict {
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}
.analysis-lines {
  display: grid;
  gap: 5px;
  color: #555;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.promotion-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; backdrop-filter: blur(2px);
}
.promotion-modal.show { display: flex; }
.promotion-box { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); text-align: center; min-width: 240px; }
.promotion-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: #1a1a1a; }
.promotion-pieces { display: flex; gap: 12px; justify-content: center; }
.promo-btn { width: 56px; height: 56px; border-radius: 10px; border: 2px solid #e5e5e5; background: #f5f5f5; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 8px; transition: all 0.15s ease; }
.promo-btn:hover { border-color: #1a1a1a; background: #fff; transform: translateY(-2px); }
.promo-btn:active { transform: translateY(0); }

.gameover-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; backdrop-filter: blur(3px);
}
.gameover-modal.show { display: flex; }
.gameover-box {
  width: min(92vw, 420px);
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  text-align: left;
  animation: modal-in 0.3s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.result-kicker {
  font-size: 12px;
  font-weight: 700;
  color: #8a7450;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 8px;
}
.gameover-title { font-size: 34px; line-height: 1; font-weight: 700; margin-bottom: 8px; color: #1a1a1a; }
.gameover-msg { font-size: 15px; color: #666; margin-bottom: 20px; }
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}
.result-stat {
  border: 1px solid #e5e0d5;
  border-radius: 8px;
  padding: 12px;
  background: #faf8f3;
}
.result-wide { grid-column: 1 / -1; }
.result-label {
  display: block;
  color: #888;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.result-stat strong {
  display: block;
  font-size: 16px;
  color: #1a1a1a;
}
.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.gameover-btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid #ded8ca;
  background: #fff;
  color: #1a1a1a;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.gameover-btn .ui-icon { width: 21px; height: 21px; }
.gameover-btn.primary {
  border-color: #1a1a1a;
  background: #1a1a1a;
  color: #fff;
}
.gameover-btn:hover { opacity: 0.86; }
.gameover-btn:active { transform: scale(0.97); }

.settings-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(18, 18, 18, 0.38);
  z-index: 2100;
  backdrop-filter: blur(3px);
}
.settings-modal.show { display: flex; }
.settings-box {
  width: min(94vw, 560px);
  max-height: min(88vh, 720px);
  overflow-y: auto;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e6dfd0;
  box-shadow: 0 28px 90px rgba(0,0,0,0.26);
  padding: 22px;
  animation: modal-in 0.25s ease-out;
}
.settings-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.settings-kicker,
.settings-label {
  font-size: 12px;
  font-weight: 700;
  color: #8a7450;
  text-transform: uppercase;
  letter-spacing: 0;
}
.settings-title {
  margin-top: 4px;
  font-size: 26px;
  line-height: 1.05;
  font-weight: 700;
  color: #171717;
}
.settings-close {
  border: 1px solid #ded8ca;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.settings-close .ui-icon { width: 18px; height: 18px; }
.settings-section { display: grid; gap: 10px; margin-bottom: 18px; }
.settings-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.theme-option,
.piece-option {
  min-width: 0;
  border: 1px solid #e2dccf;
  border-radius: 8px;
  background: #fbfaf6;
  color: #1a1a1a;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px;
  display: grid;
  gap: 8px;
  justify-items: start;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.theme-option:hover,
.piece-option:hover {
  border-color: #1a1a1a;
  transform: translateY(-1px);
}
.theme-option.active,
.piece-option.active {
  border-color: #1a1a1a;
  box-shadow: 0 0 0 2px #1a1a1a;
  background: #fff;
}
.theme-preview {
  width: 100%;
  aspect-ratio: 1.55;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background-size: 50% 50%;
}
.preview-classic {
  background-image:
    linear-gradient(45deg, #eeeed2 25%, transparent 25%),
    linear-gradient(-45deg, #eeeed2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eeeed2 75%),
    linear-gradient(-45deg, transparent 75%, #eeeed2 75%);
  background-color: #769656;
}
.preview-walnut {
  background-image:
    linear-gradient(45deg, #efd8b1 25%, transparent 25%),
    linear-gradient(-45deg, #efd8b1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #efd8b1 75%),
    linear-gradient(-45deg, transparent 75%, #efd8b1 75%);
  background-color: #8b5a33;
}
.preview-midnight {
  background-image:
    linear-gradient(45deg, #b8c2cc 25%, transparent 25%),
    linear-gradient(-45deg, #b8c2cc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #b8c2cc 75%),
    linear-gradient(-45deg, transparent 75%, #b8c2cc 75%);
  background-color: #344154;
}
.preview-marble {
  background-image:
    linear-gradient(45deg, #ececea 25%, transparent 25%),
    linear-gradient(-45deg, #ececea 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececea 75%),
    linear-gradient(-45deg, transparent 75%, #ececea 75%);
  background-color: #9aa4a8;
}
.piece-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.piece-preview {
  width: 100%;
  min-height: 58px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.08);
  background: linear-gradient(135deg, var(--board-light) 0 50%, var(--board-dark) 50% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px;
}
.piece-preview .piece {
  width: 38px;
  height: 38px;
}
.settings-live-preview {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}
.preview-board {
  width: min(100%, 230px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 16px 34px rgba(0,0,0,0.13);
}
.preview-board span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-board span:nth-child(8n+1),
.preview-board span:nth-child(8n+3),
.preview-board span:nth-child(8n+6),
.preview-board span:nth-child(8n+8) { background: var(--board-light); }
.preview-board span:nth-child(8n+2),
.preview-board span:nth-child(8n+4),
.preview-board span:nth-child(8n+5),
.preview-board span:nth-child(8n+7) { background: var(--board-dark); }
.preview-board .piece {
  width: 80%;
  height: 80%;
}

.particle { position: fixed; width: 5px; height: 5px; border-radius: 50%; pointer-events: none; z-index: 1500; animation: particle-burst 0.5s ease-out forwards; }
@keyframes particle-burst { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; } }

.history-scroll::-webkit-scrollbar { width: 4px; }
.history-scroll::-webkit-scrollbar-track { background: transparent; }
.history-scroll::-webkit-scrollbar-thumb { background: #e5e5e5; border-radius: 2px; }

button,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

.ui-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  vertical-align: middle;
  pointer-events: none;
}

button:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(26,26,26,0.75);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.segment,
.setup-theme,
.setup-select,
.start-btn,
.icon-btn,
.action-btn,
.gameover-btn,
.settings-close,
.theme-option,
.piece-option,
.promo-btn,
.analysis-close {
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.12s ease,
    opacity 0.16s ease;
}

.start-btn,
.gameover-btn.primary {
  box-shadow: 0 12px 24px rgba(26,26,26,0.16);
}

.start-btn:hover,
.gameover-btn.primary:hover {
  opacity: 1;
  background: #262626;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(26,26,26,0.18);
}

.start-btn:active,
.gameover-btn:active,
.action-btn:active,
.icon-btn:active,
.segment:active,
.setup-theme:active,
.promo-btn:active,
.settings-close:active,
.theme-option:active,
.piece-option:active {
  transform: translateY(1px) scale(0.99);
}

.icon-btn,
.action-btn,
.gameover-btn,
.settings-close,
.analysis-close,
.setup-theme,
.setup-select {
  min-height: 44px;
}

.icon-btn {
  min-width: 44px;
  height: 44px;
  background: #fffdfa;
  border-color: #ded8ca;
}

.icon-btn .ui-icon {
  width: 22px;
  height: 22px;
}

.header-right .icon-btn {
  width: auto;
  padding: 0 10px;
  gap: 6px;
}

.header-right .icon-btn span {
  line-height: 1;
}

.icon-btn:hover,
.action-btn:hover,
.settings-close:hover,
.analysis-close:hover,
.setup-theme:hover,
.setup-select:hover,
.gameover-btn:hover {
  opacity: 1;
  background: #fff;
  border-color: #92846d;
  box-shadow: 0 4px 10px rgba(31,28,22,0.06);
}

.action-btn {
  background: #fffdfa;
  color: #222;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-btn .ui-icon {
  width: 20px;
  height: 20px;
}

.action-btn:hover {
  color: #111;
}

.status-pill {
  min-height: 36px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.status-dot.thinking {
  background: #9a7a35;
  animation: thinking-pulse 1.1s ease-in-out infinite;
}

@keyframes thinking-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.55; }
  50% { transform: scale(1.18); opacity: 1; }
}

.chess-board {
  box-shadow: 0 16px 34px rgba(0,0,0,0.13), 0 2px 6px rgba(0,0,0,0.08);
  will-change: contents;
}

.square {
  min-width: 0;
  min-height: 0;
}

.square:hover .piece {
  transform: translateY(-1px);
}

.square.last-move-from::before {
  background: rgba(180, 152, 58, 0.22);
}

.square.last-move-to::before {
  background: rgba(220, 191, 84, 0.34);
}

.piece-arrived {
  animation: piece-arrive 0.18s ease-out;
}

@keyframes piece-arrive {
  from { transform: scale(0.94); }
  to { transform: scale(1); }
}

.square.check::before {
  background: rgba(183, 43, 43, 0.26);
  animation: check-glow 1.35s ease-in-out infinite;
}

@keyframes check-glow {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 0.72; }
}

.square.legal::after {
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.square.legal:hover::after {
  transform: scale(1.08);
}

.timer {
  min-height: 50px;
  background: #f7f6f2;
}

.timer.active {
  background: #fff;
  border-color: #272727;
  box-shadow: inset 0 0 0 1px #272727;
}

.timer.warning {
  background: #fff7f5;
  border-color: #b83232;
  color: #a82e2e;
  animation: timer-warning 1.15s ease-in-out infinite;
}

@keyframes timer-warning {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(184,50,50,0.25); }
  50% { box-shadow: inset 0 0 0 2px rgba(184,50,50,0.45); }
}

.captured-piece {
  animation: captured-in 0.18s ease-out;
}

@keyframes captured-in {
  from { opacity: 0; transform: translateY(3px) scale(0.92); }
  to { opacity: 0.7; transform: translateY(0) scale(1); }
}

.particle {
  width: 4px;
  height: 4px;
  opacity: 0.72;
  animation: particle-burst 0.42s ease-out forwards;
}

.promotion-modal.show,
.gameover-modal.show,
.settings-modal.show {
  animation: overlay-in 0.16s ease-out;
}

.promotion-box,
.gameover-box,
.settings-box {
  box-shadow: 0 20px 54px rgba(0,0,0,0.22);
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.home-screen,
.game-view {
  animation-duration: 0.26s;
}

.game-view.active .game-header,
.game-view.active .play-layout {
  animation: view-in 0.28s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 980px) {
  .play-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "opponent"
      "board"
      "player"
      "actions"
      "hint"
      "history";
    gap: 10px;
  }
  .seat-panel {
    grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
    grid-template-areas:
      "info timer"
      "captures captures";
    align-items: center;
    padding: 10px 12px;
    gap: 8px 12px;
  }
  .seat-info { grid-area: info; }
  .seat-timer { grid-area: timer; }
  .seat-captures { grid-area: captures; min-height: 24px; }
  .board-perspective { width: min(100%, 58vh, 680px); }
  .action-bar { grid-template-columns: repeat(4, 1fr); }
  .history-area:not([open]) .history-scroll { display: none; }
  .history-scroll { max-height: 180px; }
  .analysis-panel { grid-area: history; }
  .analysis-controls { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 981px) {
  .aether-chess { max-width: 1120px; }
  .play-layout {
    grid-template-columns: minmax(178px, 210px) minmax(420px, 1fr) minmax(190px, 230px);
    gap: 18px;
  }
  .board-perspective {
    width: min(100%, 70vh, 720px);
    max-width: 720px;
  }
  .seat-panel {
    padding: 16px;
  }
}

@media (max-width: 560px) {
  body { padding: 10px; }
  .aether-chess { gap: 10px; }
  .game-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 8px;
  }
  .header-center { justify-content: flex-start; }
  .header-right { justify-content: space-between; }
  .icon-btn { min-width: 42px; width: auto; padding: 0 10px; }
  .seat-name { font-size: 16px; }
  .seat-meta { font-size: 13px; }
  .timer { padding: 9px 10px; }
  .timer-name { font-size: 12px; }
  .timer-time { font-size: 18px; }
  .board-perspective { width: min(100%, max(280px, calc(100vh - 310px))); }
  .action-bar { grid-template-columns: repeat(2, 1fr); }
  .action-btn { min-height: 40px; font-size: 14px; }
  .history-area { max-height: 220px; }
  .history-area[open] .history-scroll { max-height: 140px; }
  .analysis-controls { grid-template-columns: repeat(2, 1fr); }
  .captured-piece { width: 20px; height: 20px; }
  .settings-box { padding: 18px; }
  .settings-options,
  .piece-options { grid-template-columns: 1fr 1fr; }
  .settings-title { font-size: 23px; }
}

@media (max-width: 430px) {
  body { padding: 8px; }
  .aether-chess { gap: 8px; }
  .home-screen { gap: 20px; }
  .home-title { font-size: clamp(38px, 13vw, 54px); }
  .home-subtitle { font-size: 12px; }
  .setup-grid { gap: 10px; }
  .segment,
  .setup-theme,
  .setup-select,
  .start-btn {
    min-height: 48px;
  }
  .game-title { font-size: 18px; }
  .status-pill {
    width: 100%;
    justify-content: center;
    padding: 7px 12px;
  }
  .header-right {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }
  .icon-btn {
    width: 100%;
    min-width: 0;
  }
  .play-layout { gap: 8px; }
  .seat-panel {
    padding: 9px 10px;
    grid-template-columns: minmax(0, 1fr) minmax(94px, auto);
  }
  .seat-name { font-size: 15px; }
  .seat-meta { font-size: 12px; }
  .seat-captures { min-height: 20px; }
  .timer {
    min-height: 44px;
    padding: 8px 9px;
  }
  .timer-time { font-size: 17px; }
  .timer-name { font-size: 11px; }
  .board-perspective {
    width: min(100%, max(304px, calc(100vh - 318px)));
  }
  .coord-labels { font-size: 10px; }
  .action-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .action-btn {
    min-height: 44px;
    font-size: 13px;
    padding: 0 6px;
  }
  .history-title { min-height: 44px; }
  .history-area[open] .history-scroll { max-height: 118px; }
  .settings-options,
  .piece-options { gap: 8px; }
}

@media (max-width: 380px) {
  .logo-mark { width: 44px; height: 44px; font-size: 24px; }
  .home-brand { gap: 10px; }
  .board-perspective {
    width: min(100%, max(296px, calc(100vh - 326px)));
  }
  .action-btn { font-size: 12px; }
  .captured-piece { width: 18px; height: 18px; }
  .settings-box { padding: 14px; }
  .theme-option,
  .piece-option { padding: 8px; font-size: 12px; }
}

/* Premium reference-style Home screen */
.aether-chess.home-active {
  max-width: none;
  width: 100%;
  min-height: calc(100vh - 40px);
}

.home-screen {
  --home-ink: #242321;
  --home-muted: #766c60;
  --home-gold: #caa46a;
  --home-gold-strong: #b58139;
  --home-walnut: #332820;
  --home-ivory: #f5ecdf;
  min-height: calc(100vh - 40px);
  width: min(100%, 1860px);
  margin: 0 auto;
  padding: 12px clamp(18px, 3.2vw, 64px) 18px;
  gap: clamp(16px, 2.1vw, 28px);
  justify-content: flex-start;
  background:
    radial-gradient(circle at 57% 8%, rgba(255,255,255,0.72), transparent 28%),
    radial-gradient(circle at 14% 18%, rgba(255,255,255,0.55), transparent 24%),
    linear-gradient(115deg, rgba(70,42,20,0.10), transparent 38%),
    linear-gradient(180deg, #f7efe4 0%, #f1e4d5 58%, #35251d 100%);
  border-radius: 0;
  overflow: hidden;
  position: relative;
}

.home-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.22), transparent 16%),
    radial-gradient(circle at 66% 22%, rgba(202,164,106,0.18), transparent 20%),
    radial-gradient(circle at 45% 58%, rgba(255,255,255,0.22), transparent 24%);
  opacity: 0.86;
}

.home-screen.hidden { display: none; }

.home-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 53fr) minmax(520px, 47fr);
  gap: clamp(22px, 3.4vw, 58px);
  align-items: start;
  min-height: min(760px, calc(100vh - 178px));
}

.home-left {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr);
  gap: clamp(18px, 2.2vw, 34px);
  padding-top: 8px;
}

.home-brand {
  gap: 26px;
  align-items: center;
}

.logo-mark {
  width: clamp(82px, 6.6vw, 126px);
  height: clamp(82px, 6.6vw, 126px);
  border-radius: 19px;
  color: #d5af72;
  background:
    radial-gradient(circle at 35% 24%, rgba(255,255,255,0.14), transparent 36%),
    linear-gradient(145deg, #30302e, #191a19 70%);
  border: 2px solid #c99c57;
  box-shadow: 0 3px 0 #6d4a24, 0 16px 28px rgba(24,17,12,0.22);
  font-size: clamp(58px, 4.7vw, 86px);
  line-height: 1;
  position: relative;
}

.logo-mark span {
  position: absolute;
  top: 8px;
  font-size: 20px;
  line-height: 1;
  color: #e3bd7d;
}

.home-title {
  font-size: clamp(56px, 5.2vw, 98px);
  line-height: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  font-weight: 600;
  color: var(--home-ink);
  text-shadow: 0 1px 0 rgba(255,255,255,0.65);
}

.home-subtitle {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  color: #8b642f;
  font-size: clamp(15px, 1.05vw, 23px);
  letter-spacing: 0.34em;
  font-family: var(--font-display);
}

.home-subtitle span {
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #b88c51, transparent);
}

.home-copy {
  text-align: center;
  width: min(100%, 820px);
  padding-top: clamp(6px, 2vw, 24px);
}

.home-copy h2 {
  font-family: var(--font-display);
  font-size: clamp(68px, 6.8vw, 138px);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: 0;
  color: #292827;
  text-shadow: 0 2px 0 rgba(255,255,255,0.45);
}

.home-copy p {
  margin-top: 18px;
  font-family: var(--font-display);
  color: #986f3e;
  font-size: clamp(24px, 2vw, 38px);
  line-height: 1.1;
}

.home-divider {
  margin: 28px auto 0;
  width: min(460px, 62%);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  color: var(--home-gold);
}

.home-divider span {
  height: 1px;
  background: linear-gradient(90deg, transparent, #b98d52);
}

.home-divider span:last-child {
  background: linear-gradient(90deg, #b98d52, transparent);
}

.home-divider i,
.panel-crown i {
  font-style: normal;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.home-divider i svg,
.panel-crown i svg,
.logo-mark span svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-hero-art {
  position: relative;
  min-height: 330px;
  align-self: end;
  margin-left: clamp(-34px, -2vw, -12px);
  margin-right: clamp(-16px, -1vw, 0px);
  border-radius: 10px 10px 0 0;
  filter: drop-shadow(0 20px 32px rgba(37,22,13,0.28));
}

.home-hero-art img {
  display: block;
  width: 100%;
  height: min(48vh, 520px);
  min-height: 330px;
  object-fit: cover;
  object-position: center 58%;
  border-radius: 10px 10px 0 0;
  mask-image: linear-gradient(90deg, #000 0 80%, rgba(0,0,0,0.38) 96%, transparent 100%);
}

.home-hero-art::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 44%;
  border-radius: inherit;
  background: linear-gradient(180deg, transparent, rgba(34,22,15,0.26) 55%, rgba(36,23,16,0.74));
  pointer-events: none;
}

.hero-plaque {
  position: absolute;
  right: 9%;
  bottom: 8%;
  z-index: 1;
  padding: 8px 34px;
  border: 1px solid rgba(204,163,95,0.65);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(101,69,35,0.72), rgba(53,34,20,0.82));
  color: #e8c88f;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: clamp(11px, 1vw, 17px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.home-right {
  min-width: 0;
  display: grid;
  gap: 28px;
  padding-top: clamp(4px, 1vw, 18px);
}

.home-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: clamp(22px, 3vw, 58px);
  padding-right: clamp(8px, 1.2vw, 24px);
}

.home-tool {
  border: 0;
  background: transparent;
  color: #4f463c;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 84px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.home-tool-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,248,239,0.72);
  border: 1px solid rgba(124,93,58,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 8px 20px rgba(52,35,22,0.08);
}

.home-tool svg,
.home-mode svg,
.home-card svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-tool:hover .home-tool-icon {
  border-color: rgba(190,143,74,0.64);
  color: #231f1b;
  transform: translateY(-1px);
}

.new-game-panel {
  position: relative;
  padding: clamp(86px, 6vw, 112px) clamp(28px, 3vw, 48px) clamp(28px, 2.4vw, 44px);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255,251,245,0.94), rgba(246,238,226,0.94)),
    #f7efe4;
  border: 1px solid rgba(183,143,84,0.38);
  box-shadow:
    inset 0 0 0 9px rgba(255,255,255,0.32),
    inset 0 0 0 11px rgba(97,65,34,0.16),
    0 18px 36px rgba(45,31,21,0.15);
}

.new-game-panel::before {
  content: '';
  position: absolute;
  inset: 22px 18px;
  border-radius: 22px;
  border: 2px solid rgba(107,70,34,0.5);
  box-shadow: inset 0 0 0 2px rgba(233,190,119,0.44);
  pointer-events: none;
}

.panel-crown {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  height: 66px;
  width: min(520px, 64%);
  border-radius: 0 0 34px 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  background: linear-gradient(180deg, #2d2d2b, #1b1c1b);
  color: #ead09f;
  border: 1px solid rgba(216,169,96,0.78);
  box-shadow: 0 10px 18px rgba(36,25,16,0.18);
  text-transform: uppercase;
  font-family: var(--font-display);
  font-size: clamp(20px, 1.6vw, 30px);
  letter-spacing: 0.08em;
}

.panel-crown span {
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c99c57);
}

.panel-crown span:last-child {
  background: linear-gradient(90deg, #c99c57, transparent);
}

.home-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 34px;
}

.home-mode,
.home-choice {
  min-width: 0;
  border: 1px solid rgba(129,100,67,0.24);
  background: rgba(255,250,242,0.72);
  color: #282522;
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 10px rgba(43,29,18,0.05);
}

.home-mode {
  min-height: 78px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: clamp(15px, 1vw, 20px);
  letter-spacing: 0.02em;
}

.home-mode.active,
.home-choice.active {
  color: #fff7e8;
  border-color: #d5a353;
  background:
    radial-gradient(circle at 72% 12%, rgba(255,215,143,0.18), transparent 34%),
    linear-gradient(180deg, #30302e, #181918);
  box-shadow:
    inset 0 0 0 1px rgba(255,220,148,0.34),
    0 0 0 1px rgba(74,46,19,0.52),
    0 8px 16px rgba(42,28,17,0.18);
}

.home-option-group {
  display: grid;
  gap: 14px;
  margin-bottom: 34px;
  position: relative;
  z-index: 1;
}

.home-option-group.hidden { display: none; }

.new-game-panel .field-label {
  color: #302c28;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.045em;
}

.home-choice-grid {
  display: grid;
  gap: 8px;
}

.difficulty-grid { grid-template-columns: repeat(5, 1fr); }
.side-grid { grid-template-columns: repeat(3, 1fr); }
.time-grid { grid-template-columns: repeat(4, 1fr); }

.home-choice {
  min-height: 72px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 8px;
  color: #332d27;
  font-size: 14px;
  letter-spacing: 0.03em;
}

.home-choice strong {
  color: #6d6258;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.home-choice.active strong {
  color: #e7c98c;
}

.home-piece-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}

.home-piece-icon .piece {
  width: 34px;
  height: 34px;
}

.home-choice.active .home-piece-icon .piece {
  color: #e7c98c !important;
}

.side-grid .home-choice,
.time-grid .home-choice {
  min-height: 68px;
  grid-template-columns: auto auto;
  justify-content: center;
  gap: 12px;
}

.start-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 84px;
  border-radius: 13px;
  border: 2px solid #c99c57;
  background:
    radial-gradient(circle at 88% 50%, rgba(228,181,92,0.18), transparent 20%),
    linear-gradient(180deg, #302c28, #171717);
  color: #efd29d;
  font-family: var(--font-display);
  font-size: clamp(25px, 1.8vw, 34px);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vw, 120px);
  box-shadow: inset 0 0 0 1px rgba(255,224,162,0.4), 0 10px 18px rgba(42,28,17,0.22);
}

.start-btn .cta-arrow {
  width: 26px;
  height: 26px;
}

.home-cards {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 2vw, 32px);
  padding: 0 clamp(30px, 4.2vw, 88px);
}

.home-card {
  min-height: 130px;
  border-radius: 16px;
  border: 1px solid rgba(214,166,92,0.34);
  background:
    radial-gradient(circle at 100% 0%, rgba(255,217,155,0.12), transparent 36%),
    linear-gradient(145deg, rgba(44,36,29,0.94), rgba(31,27,24,0.9));
  color: #e4c07f;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 24px 32px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(34,22,14,0.16);
}

.home-card svg {
  width: 44px;
  height: 44px;
  stroke: #d8b371;
}

.home-card strong {
  display: block;
  color: #f3e7d3;
  font-size: clamp(17px, 1.15vw, 23px);
  text-transform: uppercase;
  letter-spacing: 0.045em;
  margin-bottom: 8px;
}

.home-card small {
  display: block;
  color: rgba(255,246,232,0.82);
  font-size: clamp(14px, 0.95vw, 18px);
  line-height: 1.25;
}

.home-card i {
  font-style: normal;
  color: #dcb978;
  font-size: 42px;
  line-height: 1;
}

.home-tool:hover,
.home-mode:hover,
.home-choice:hover,
.home-card:hover {
  transform: translateY(-1px);
}

.home-mode:active,
.home-choice:active,
.home-card:active {
  transform: translateY(1px);
}

@media (max-width: 1280px) {
  .home-shell {
    grid-template-columns: minmax(0, 1fr) minmax(460px, 0.9fr);
    gap: 28px;
  }
  .home-copy h2 { font-size: clamp(58px, 6vw, 92px); }
  .home-title { font-size: clamp(46px, 5vw, 72px); }
  .new-game-panel { padding-left: 28px; padding-right: 28px; }
  .home-choice { font-size: 12px; }
}

@media (max-width: 980px) {
  .home-screen {
    overflow: visible;
    padding: 18px;
  }
  .home-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .home-left {
    grid-template-rows: auto auto auto;
    gap: 20px;
  }
  .home-right {
    gap: 18px;
  }
  .home-toolbar {
    order: -1;
    justify-content: center;
  }
  .home-copy {
    text-align: left;
  }
  .home-divider {
    margin-left: 0;
    width: min(380px, 72%);
  }
  .home-hero-art {
    margin: 0;
    min-height: 240px;
  }
  .home-hero-art img {
    height: 280px;
    min-height: 240px;
    mask-image: linear-gradient(180deg, #000 0 76%, rgba(0,0,0,0.55) 92%, transparent 100%);
  }
  .home-cards {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 12px;
  }
  .home-card {
    min-height: 96px;
  }
}

@media (max-width: 768px) {
  .home-screen {
    min-height: calc(100vh - 20px);
    padding: 14px 12px 18px;
  }
  .home-brand {
    gap: 14px;
  }
  .logo-mark {
    width: 62px;
    height: 62px;
    border-radius: 13px;
    font-size: 42px;
  }
  .logo-mark span { font-size: 14px; top: 7px; }
  .home-title {
    font-size: clamp(31px, 10vw, 46px);
    letter-spacing: 0.06em;
  }
  .home-subtitle {
    margin-top: 8px;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 0.2em;
  }
  .home-subtitle span { width: 15px; }
  .home-copy h2 {
    font-size: clamp(44px, 14vw, 72px);
  }
  .home-copy p {
    margin-top: 8px;
    font-size: clamp(21px, 6vw, 30px);
  }
  .home-divider {
    margin-top: 16px;
  }
  .home-hero-art img {
    height: clamp(210px, 40vh, 300px);
    object-position: center 56%;
  }
  .hero-plaque {
    right: 5%;
    bottom: 8%;
    padding: 7px 18px;
    font-size: 10px;
  }
  .home-toolbar {
    gap: 12px;
    justify-content: space-between;
    padding-right: 0;
  }
  .home-tool {
    min-width: 0;
    font-size: 11px;
    gap: 7px;
  }
  .home-tool-icon {
    width: 50px;
    height: 50px;
  }
  .home-tool svg {
    width: 24px;
    height: 24px;
  }
  .new-game-panel {
    padding: 72px 14px 18px;
    border-radius: 22px;
  }
  .new-game-panel::before {
    inset: 14px 10px;
    border-radius: 17px;
  }
  .panel-crown {
    top: 14px;
    width: min(330px, 78%);
    height: 48px;
    font-size: 17px;
  }
  .panel-crown span { width: 26px; }
  .home-mode-row {
    margin-bottom: 22px;
  }
  .home-mode {
    min-height: 58px;
    gap: 8px;
    font-size: 13px;
  }
  .home-mode svg {
    width: 24px;
    height: 24px;
  }
  .home-option-group {
    gap: 10px;
    margin-bottom: 22px;
  }
  .new-game-panel .field-label {
    font-size: 13px;
  }
  .difficulty-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }
  .side-grid,
  .time-grid {
    grid-template-columns: 1fr 1fr;
  }
  .home-choice {
    min-height: 58px;
    padding: 6px 3px;
    font-size: 10px;
    border-radius: 9px;
  }
  .home-choice strong {
    font-size: 22px;
  }
  .home-piece-icon,
  .home-piece-icon .piece {
    width: 26px;
    height: 26px;
  }
  .side-grid .home-choice,
  .time-grid .home-choice {
    min-height: 52px;
    gap: 8px;
  }
  .start-btn {
    min-height: 62px;
    border-radius: 11px;
    font-size: 20px;
    gap: 18px;
  }
  .home-card {
    min-height: 86px;
    padding: 18px;
    gap: 16px;
    border-radius: 13px;
  }
  .home-card svg {
    width: 34px;
    height: 34px;
  }
  .home-card strong {
    font-size: 15px;
    margin-bottom: 4px;
  }
  .home-card small {
    font-size: 13px;
  }
}

@media (max-width: 430px) {
  .home-screen {
    padding-left: 10px;
    padding-right: 10px;
  }
  .home-shell {
    gap: 16px;
  }
  .home-hero-art img {
    height: 220px;
  }
  .difficulty-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .difficulty-grid .home-choice {
    min-height: 54px;
  }
.home-choice span {
    font-size: 10px;
  }
}

/* Reusable icon asset integration */
.logo-crown {
  position: absolute;
  top: 6px;
  width: 16px;
  height: 16px;
}

.home-divider > .ui-icon,
.panel-crown > .ui-icon {
  width: 22px;
  height: 22px;
}

.home-tool .ui-icon {
  width: 24px;
  height: 24px;
}

.home-mode .ui-icon {
  width: 24px;
  height: 24px;
}

.home-choice > .ui-icon {
  width: 24px;
  height: 24px;
}

.home-card > .ui-icon:first-child {
  width: 36px;
  height: 36px;
}

.home-card .arrow-icon {
  width: 24px;
  height: 24px;
  opacity: 0.88;
}

@media (max-width: 768px) {
  .logo-crown { width: 13px; height: 13px; top: 6px; }
  .home-tool .ui-icon,
  .home-mode .ui-icon,
  .home-choice > .ui-icon { width: 21px; height: 21px; }
  .home-card > .ui-icon:first-child { width: 32px; height: 32px; }
}

/* Home composition corrective pass */
.aether-chess.home-active {
  min-height: 100vh;
  background: #f3eadc;
}

.home-screen {
  width: min(100%, 1480px);
  min-height: calc(100vh - 40px);
  padding: clamp(18px, 2.2vw, 34px) clamp(18px, 2.6vw, 38px);
  gap: clamp(18px, 2vw, 26px);
  border-radius: 0;
  overflow: visible;
  background:
    radial-gradient(circle at 82% 12%, rgba(255,255,255,0.82), transparent 30%),
    radial-gradient(circle at 18% 18%, rgba(255,255,255,0.65), transparent 24%),
    linear-gradient(180deg, #f7efe5 0%, #efe1cf 74%, #dfceb9 100%);
}

.home-shell {
  grid-template-columns: minmax(0, 52fr) minmax(540px, 48fr);
  gap: clamp(28px, 3vw, 48px);
  min-height: 0;
  align-items: center;
}

.home-left {
  grid-template-rows: auto auto minmax(360px, 1fr);
  gap: clamp(18px, 2vw, 28px);
  padding-top: 0;
  align-self: stretch;
}

.home-brand {
  gap: 18px;
}

.logo-mark {
  width: clamp(64px, 5vw, 72px);
  height: clamp(64px, 5vw, 72px);
  border-radius: 14px;
  font-size: clamp(43px, 3.8vw, 52px);
  box-shadow: 0 2px 0 #6d4a24, 0 10px 18px rgba(24,17,12,0.18);
}

.logo-mark span {
  top: 6px;
  font-size: 13px;
}

.home-title {
  font-size: clamp(32px, 3.1vw, 42px);
  letter-spacing: 0.105em;
  line-height: 0.94;
}

.home-subtitle {
  margin-top: 8px;
  gap: 10px;
  font-size: clamp(10px, 0.9vw, 14px);
  letter-spacing: 0.32em;
}

.home-subtitle span {
  width: 22px;
}

.home-copy {
  width: min(100%, 720px);
  padding-top: clamp(10px, 2vh, 26px);
}

.home-copy h2 {
  font-size: clamp(48px, 5vw, 76px);
  line-height: 0.98;
}

.home-copy p {
  margin-top: 12px;
  font-size: clamp(22px, 2.05vw, 32px);
}

.home-divider {
  margin-top: 20px;
  width: min(360px, 56%);
}

.home-hero-art {
  min-height: 360px;
  margin: 0;
  align-self: end;
  border-radius: 24px;
  overflow: hidden;
  filter: drop-shadow(0 18px 28px rgba(43,28,17,0.2));
}

.home-hero-art img {
  width: 100%;
  height: clamp(390px, 45vh, 500px);
  min-height: 360px;
  border-radius: 24px;
  object-fit: cover;
  object-position: center 56%;
  mask-image: linear-gradient(90deg, #000 0 82%, rgba(0,0,0,0.72) 93%, transparent 100%);
}

.home-hero-art::after {
  height: 36%;
  background: linear-gradient(180deg, transparent, rgba(50,30,16,0.46));
}

.hero-plaque {
  display: none;
}

.home-right {
  gap: 18px;
  padding-top: 0;
  align-self: center;
}

.home-toolbar {
  gap: 30px;
  padding-right: 8px;
  margin-bottom: 2px;
}

.home-tool {
  min-width: 72px;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.075em;
}

.home-tool-icon {
  width: 52px;
  height: 52px;
}

.home-tool svg,
.home-mode svg,
.home-card svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.9;
}

.new-game-panel {
  width: min(100%, 610px);
  justify-self: end;
  padding: 76px 34px 30px;
  border-radius: 26px;
  box-shadow:
    inset 0 0 0 7px rgba(255,255,255,0.28),
    inset 0 0 0 9px rgba(99,66,34,0.14),
    0 16px 32px rgba(45,31,21,0.14);
}

.new-game-panel::before {
  inset: 16px 14px;
  border-radius: 20px;
}

.panel-crown {
  top: 16px;
  height: 52px;
  width: min(390px, 62%);
  border-radius: 0 0 26px 26px;
  font-size: clamp(18px, 1.5vw, 23px);
}

.panel-crown i {
  width: 18px;
  height: 18px;
}

.panel-crown span {
  width: 34px;
}

.home-mode-row {
  gap: 10px;
  margin-bottom: 26px;
}

.home-mode {
  min-height: 62px;
  border-radius: 11px;
  gap: 12px;
  font-size: 15px;
}

.home-option-group {
  gap: 11px;
  margin-bottom: 25px;
}

.new-game-panel .field-label {
  font-size: 13px;
  letter-spacing: 0.06em;
}

.home-choice-grid {
  gap: 10px;
}

.home-choice {
  min-height: 56px;
  border-radius: 10px;
  gap: 5px;
  padding: 8px 7px;
  font-size: 12px;
  line-height: 1.1;
}

.side-grid .home-choice,
.time-grid .home-choice {
  min-height: 56px;
  gap: 9px;
}

.home-ui-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #655b51;
}

.home-ui-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-choice.active .home-ui-icon {
  color: #e9cb91;
}

.home-piece-icon {
  display: none;
}

.start-btn {
  min-height: 66px;
  border-radius: 12px;
  font-size: clamp(17px, 1.35vw, 20px);
  letter-spacing: 0.115em;
  gap: clamp(16px, 4vw, 72px);
}

.start-btn .cta-arrow {
  width: 24px;
  height: 24px;
}

.home-cards {
  width: 100%;
  padding: 0;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-card {
  min-height: 92px;
  border-radius: 14px;
  padding: 18px 24px;
  gap: 18px;
  box-shadow: 0 10px 20px rgba(34,22,14,0.12);
}

.home-card svg {
  width: 36px;
  height: 36px;
}

.home-card strong {
  font-size: clamp(15px, 1vw, 18px);
  margin-bottom: 5px;
}

.home-card small {
  font-size: clamp(13px, 0.9vw, 15px);
}

.home-card i {
  font-size: 34px;
}

@media (min-width: 1600px) {
  .home-screen {
    width: min(100%, 1500px);
  }
}

@media (max-width: 1180px) {
  .home-shell {
    grid-template-columns: minmax(0, 1fr) minmax(500px, 0.92fr);
    gap: 24px;
  }
  .new-game-panel {
    padding-left: 24px;
    padding-right: 24px;
  }
  .home-choice {
    font-size: 11px;
  }
}

@media (max-width: 1099px) {
  .home-shell {
    grid-template-columns: minmax(0, 1fr) minmax(430px, 0.9fr);
  }
  .home-title {
    font-size: clamp(28px, 3vw, 34px);
  }
  .home-copy h2 {
    font-size: clamp(44px, 5vw, 58px);
  }
  .home-copy p {
    font-size: clamp(20px, 2vw, 26px);
  }
  .difficulty-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .home-hero-art img {
    height: 370px;
  }
}

@media (max-width: 768px) {
  .aether-chess.home-active {
    min-height: 100vh;
  }
  .home-screen {
    min-height: 100vh;
    padding: 14px 12px 18px;
    gap: 14px;
  }
  .home-shell {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .home-left {
    gap: 14px;
  }
  .home-brand {
    gap: 12px;
  }
  .logo-mark {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    font-size: 36px;
  }
  .home-title {
    font-size: clamp(26px, 8.5vw, 36px);
  }
  .home-subtitle {
    margin-top: 5px;
    font-size: 9px;
    letter-spacing: 0.18em;
  }
  .home-copy {
    padding-top: 0;
  }
  .home-copy h2 {
    font-size: clamp(40px, 12vw, 58px);
  }
  .home-copy p {
    font-size: clamp(19px, 5.5vw, 26px);
  }
  .home-divider {
    margin-top: 12px;
    width: min(280px, 74%);
  }
  .home-hero-art {
    min-height: 210px;
    border-radius: 18px;
  }
  .home-hero-art img {
    height: clamp(220px, 34vh, 300px);
    min-height: 210px;
    border-radius: 18px;
    mask-image: linear-gradient(180deg, #000 0 86%, rgba(0,0,0,0.6) 96%, transparent 100%);
  }
  .home-toolbar {
    gap: 8px;
  }
  .home-tool-icon {
    width: 46px;
    height: 46px;
  }
  .home-tool {
    font-size: 10px;
  }
  .new-game-panel {
    width: 100%;
    justify-self: stretch;
    padding: 64px 14px 16px;
    border-radius: 20px;
  }
  .panel-crown {
    height: 43px;
    top: 12px;
    font-size: 15px;
  }
  .home-mode {
    min-height: 50px;
    font-size: 12px;
  }
  .home-option-group {
    margin-bottom: 18px;
  }
  .difficulty-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .side-grid,
  .time-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .home-choice,
  .side-grid .home-choice,
  .time-grid .home-choice {
    min-height: 48px;
    font-size: 11px;
  }
  .start-btn {
    min-height: 58px;
    font-size: 16px;
  }
  .home-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .home-card {
    min-height: 78px;
    padding: 14px 16px;
  }
}

@media (max-width: 390px) {
  .home-screen {
    padding-left: 9px;
    padding-right: 9px;
  }
  .home-hero-art img {
    height: 205px;
  }
  .home-toolbar {
    gap: 5px;
  }
  .home-tool-icon {
    width: 42px;
    height: 42px;
  }
  .home-mode-row {
    grid-template-columns: 1fr;
  }
  .difficulty-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .home-choice,
  .side-grid .home-choice,
  .time-grid .home-choice {
    min-height: 46px;
  }
  .home-card small {
    font-size: 12px;
  }
}

/* Gameplay presentation polish. Engine, move state, and board coordinates stay untouched. */
.aether-chess.game-active {
  --game-ink: #221f1b;
  --game-muted: #756b5e;
  --game-line: rgba(96, 74, 45, 0.18);
  --game-gold: #c49a56;
  --game-gold-soft: rgba(196, 154, 86, 0.22);
  --game-panel: rgba(255, 252, 246, 0.86);
  max-width: min(100%, 1240px);
  min-height: calc(100vh - 40px);
  justify-content: flex-start;
}

.aether-chess.game-active .game-view {
  gap: clamp(12px, 1.7vw, 20px);
}

.aether-chess.game-active .game-header {
  padding: 14px clamp(14px, 2vw, 22px);
  border: 1px solid var(--game-line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.86), rgba(247,239,226,0.74)),
    radial-gradient(circle at 10% 0%, rgba(196,154,86,0.14), transparent 34%);
  box-shadow: 0 16px 36px rgba(44, 35, 24, 0.08), inset 0 1px 0 rgba(255,255,255,0.75);
}

.aether-chess.game-active .game-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 28px);
  color: var(--game-ink);
  letter-spacing: 0;
}

.aether-chess.game-active .game-subtitle {
  color: var(--game-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aether-chess.game-active .status-pill {
  min-height: 40px;
  padding: 8px 18px;
  border-color: rgba(196, 154, 86, 0.34);
  background: rgba(255, 249, 239, 0.84);
  color: var(--game-ink);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 8px 18px rgba(60, 42, 22, 0.06);
}

.aether-chess.game-active .status-dot {
  background: #3f8f5e;
  box-shadow: 0 0 0 4px rgba(63,143,94,0.12);
}

.aether-chess.game-active .status-dot.check {
  background: #b93732;
  box-shadow: 0 0 0 4px rgba(185,55,50,0.14);
}

.aether-chess.game-active .icon-btn {
  min-width: 42px;
  height: 42px;
  border-radius: 12px;
  border-color: rgba(96,74,45,0.2);
  background: rgba(255,252,246,0.78);
  color: var(--game-ink);
  gap: 7px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.74);
}

.aether-chess.game-active .icon-btn:hover {
  border-color: rgba(196,154,86,0.7);
  background: #fffaf0;
  transform: translateY(-1px);
}

.aether-chess.game-active .icon-btn:active {
  transform: translateY(0) scale(0.98);
}

.aether-chess.game-active .icon-btn.active-mode {
  border-color: #c49a56;
  background: linear-gradient(180deg, #2f2d29, #171717);
  color: #f6e3bd;
  box-shadow: inset 0 0 0 1px rgba(255,223,160,0.18), 0 10px 20px rgba(24,20,15,0.16);
}

.aether-chess.game-active .play-layout {
  grid-template-columns: minmax(198px, 230px) minmax(460px, 1fr) minmax(206px, 250px);
  gap: clamp(14px, 1.8vw, 22px);
  align-items: center;
}

.aether-chess.game-active .board-column {
  gap: 10px;
  align-self: center;
}

.aether-chess.game-active .board-perspective {
  width: min(100%, calc(100vh - 174px), 760px);
  max-width: 760px;
  padding: clamp(9px, 1.2vw, 15px);
  border-radius: clamp(18px, 2vw, 26px);
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(135deg, rgba(255,235,186,0.55), rgba(91,58,30,0.18) 28%, rgba(32,27,22,0.34) 72%, rgba(255,246,220,0.46)),
    linear-gradient(180deg, #6d4423, #2b1d14);
  box-shadow:
    0 32px 64px rgba(30, 22, 14, 0.24),
    0 9px 18px rgba(37, 26, 16, 0.16),
    inset 0 1px 0 rgba(255, 237, 191, 0.72),
    inset 0 -6px 12px rgba(24, 17, 11, 0.28);
}

.aether-chess.game-active .board-perspective::before,
.aether-chess.game-active .board-perspective::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.aether-chess.game-active .board-perspective::before {
  inset: -7px;
  border-radius: inherit;
  border: 1px solid rgba(196, 154, 86, 0.36);
  background: radial-gradient(circle at 50% 0%, rgba(255,244,211,0.5), transparent 45%);
}

.aether-chess.game-active .board-perspective::after {
  left: 6%;
  right: 6%;
  bottom: -13px;
  height: 22px;
  border-radius: 0 0 28px 28px;
  background: linear-gradient(180deg, rgba(79, 49, 25, 0.72), rgba(25, 18, 13, 0.28));
  filter: blur(0.2px);
}

.aether-chess.game-active .chess-board {
  border-radius: 12px;
  border: 1px solid rgba(255, 240, 196, 0.55);
  box-shadow:
    0 2px 0 rgba(255, 238, 190, 0.54),
    0 18px 34px rgba(24, 18, 12, 0.22),
    inset 0 0 0 1px rgba(54, 36, 19, 0.28);
  background: #4d311d;
}

.aether-chess.game-active .square {
  transition: background-color 0.16s ease, filter 0.16s ease;
}

.aether-chess.game-active .square:nth-child(odd) {
  box-shadow: inset 0 0 18px rgba(255,255,255,0.05);
}

.aether-chess.game-active .square:nth-child(even) {
  box-shadow: inset 0 0 18px rgba(0,0,0,0.05);
}

.aether-chess.game-active .square:hover {
  filter: brightness(1.035);
}

.aether-chess.game-active .square.selected::before {
  background: radial-gradient(circle, rgba(250, 218, 132, 0.48), rgba(196,154,86,0.28));
}

.aether-chess.game-active .square.last-move-from::before {
  background: rgba(117, 92, 41, 0.24);
}

.aether-chess.game-active .square.last-move-to::before {
  background: rgba(238, 199, 91, 0.36);
}

.aether-chess.game-active .square.legal::after {
  width: 24%;
  height: 24%;
  top: 38%;
  left: 38%;
  background: rgba(33, 30, 26, 0.28);
  box-shadow: 0 1px 3px rgba(255,255,255,0.18), inset 0 0 0 1px rgba(255,255,255,0.18);
}

.aether-chess.game-active .square.legal.capture::after,
.aether-chess.game-active .square.hint-to::after {
  border-width: 3px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22);
}

.aether-chess.game-active .square.hint-from::before,
.aether-chess.game-active .square.hint-to::before {
  background: rgba(55, 111, 162, 0.3);
}

.aether-chess.game-active .square.check::before {
  background: radial-gradient(circle, rgba(200, 48, 38, 0.45), rgba(200, 48, 38, 0.18) 58%, transparent);
}

.aether-chess.game-active .piece {
  width: 84%;
  height: 84%;
  transition: transform 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
}

.aether-chess.game-active .square:hover .piece {
  transform: translateY(-2px) scale(1.012);
}

.aether-chess.game-active .piece-arrived {
  animation: piece-arrive-premium 0.2s ease-out;
}

@keyframes piece-arrive-premium {
  from { transform: translateY(-4px) scale(0.96); filter: brightness(1.08); }
  to { transform: translateY(0) scale(1); filter: brightness(1); }
}

.aether-chess.game-active .coord-labels {
  max-width: 760px;
  padding: 0 clamp(12px, 1.2vw, 18px);
  color: rgba(67, 54, 40, 0.62);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aether-chess.game-active .seat-panel,
.aether-chess.game-active .history-area,
.aether-chess.game-active .analysis-panel {
  border-color: var(--game-line);
  background:
    linear-gradient(180deg, rgba(255,253,248,0.94), rgba(246,239,229,0.78));
  box-shadow: 0 15px 34px rgba(42, 33, 22, 0.08), inset 0 1px 0 rgba(255,255,255,0.78);
}

.aether-chess.game-active .seat-panel {
  border-radius: 16px;
  padding: 16px;
  gap: 13px;
}

.aether-chess.game-active .seat-name {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--game-ink);
  font-weight: 700;
}

.aether-chess.game-active .seat-meta {
  color: var(--game-muted);
  font-weight: 600;
}

.aether-chess.game-active .seat-captures {
  min-height: 38px;
  padding: 7px;
  border-radius: 12px;
  background: rgba(84, 62, 35, 0.055);
  border: 1px dashed rgba(96,74,45,0.18);
}

.aether-chess.game-active .captured-piece {
  width: 23px;
  height: 23px;
  opacity: 0.76;
}

.aether-chess.game-active .timer {
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 14px;
  border-color: rgba(96,74,45,0.18);
  background: rgba(255,255,255,0.64);
  gap: 10px;
}

.aether-chess.game-active .timer.active {
  border-color: rgba(196,154,86,0.82);
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px rgba(196,154,86,0.45), 0 8px 18px rgba(196,154,86,0.12);
}

.aether-chess.game-active .timer.warning {
  background: #fff4ef;
  border-color: #b83932;
  color: #a8322d;
}

.aether-chess.game-active .timer-name {
  color: var(--game-muted);
  font-weight: 700;
  white-space: nowrap;
}

.aether-chess.game-active .timer-time {
  color: var(--game-ink);
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 700;
  margin-left: auto;
}

.aether-chess.game-active .action-bar {
  gap: 10px;
}

.aether-chess.game-active .action-btn {
  min-height: 48px;
  border-radius: 14px;
  border-color: rgba(96,74,45,0.18);
  background: rgba(255,253,248,0.9);
  color: var(--game-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 7px 16px rgba(38, 30, 20, 0.06);
}

.aether-chess.game-active .action-btn:hover {
  border-color: rgba(196,154,86,0.76);
  background: #fffaf0;
  color: #181512;
  transform: translateY(-1px);
}

.aether-chess.game-active .action-btn:active {
  transform: translateY(0) scale(0.985);
}

.aether-chess.game-active .hint-message {
  border: 1px solid rgba(55,111,162,0.18);
  background: rgba(238, 246, 255, 0.82);
  color: #285c8e;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

.aether-chess.game-active .history-area {
  border-radius: 16px;
}

.aether-chess.game-active .history-title {
  padding: 14px 15px;
  background: rgba(247, 241, 232, 0.86);
  color: var(--game-muted);
  border-bottom-color: rgba(96,74,45,0.14);
}

.aether-chess.game-active .history-scroll {
  max-height: min(56vh, 560px);
}

.aether-chess.game-active .history-move {
  border-radius: 8px;
  transition: background 0.14s ease, color 0.14s ease;
}

.aether-chess.game-active .history-move.current {
  background: linear-gradient(180deg, #302d28, #181716);
  color: #f5dfb4;
}

@media (max-width: 1080px) {
  .aether-chess.game-active .play-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "opponent"
      "board"
      "player"
      "actions"
      "hint"
      "history";
    align-items: stretch;
  }

  .aether-chess.game-active .board-perspective {
    width: min(100%, calc(100vh - 278px), 720px);
    justify-self: center;
  }

  .aether-chess.game-active .seat-panel {
    grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
    grid-template-areas:
      "info timer"
      "captures captures";
    align-items: center;
  }

  .aether-chess.game-active .action-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .aether-chess.game-active .history-area:not([open]) .history-scroll {
    display: none;
  }
}

@media (max-width: 560px) {
  .aether-chess.game-active {
    min-height: calc(100vh - 20px);
  }

  .aether-chess.game-active .game-header {
    border-radius: 15px;
    padding: 11px;
  }

  .aether-chess.game-active .header-right {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aether-chess.game-active .icon-btn {
    min-height: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 12px;
  }

  .aether-chess.game-active .play-layout {
    gap: 9px;
  }

  .aether-chess.game-active .seat-panel {
    border-radius: 14px;
    padding: 10px;
    gap: 8px 10px;
    grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
  }

  .aether-chess.game-active .seat-name {
    font-size: 16px;
  }

  .aether-chess.game-active .seat-captures {
    min-height: 26px;
    padding: 5px;
  }

  .aether-chess.game-active .captured-piece {
    width: 19px;
    height: 19px;
  }

  .aether-chess.game-active .timer {
    min-height: 45px;
    padding: 8px 9px;
    border-radius: 12px;
  }

  .aether-chess.game-active .timer-time {
    font-size: 18px;
  }

  .aether-chess.game-active .board-perspective {
    width: min(100%, max(288px, calc(100vh - 330px)));
    padding: 8px;
    border-radius: 18px;
  }

  .aether-chess.game-active .chess-board {
    border-radius: 9px;
  }

  .aether-chess.game-active .coord-labels {
    font-size: 10px;
  }

  .aether-chess.game-active .action-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .aether-chess.game-active .action-btn {
    min-height: 44px;
    border-radius: 12px;
    font-size: 13px;
  }

  .aether-chess.game-active .history-scroll {
    max-height: 128px;
  }
}

@media (max-width: 390px) {
  .aether-chess.game-active .board-perspective {
    width: min(100%, max(280px, calc(100vh - 340px)));
  }

  .aether-chess.game-active .timer-name {
    font-size: 10px;
    gap: 4px;
  }

  .aether-chess.game-active .timer-time {
    font-size: 17px;
  }

  .aether-chess.game-active .action-btn {
    min-height: 42px;
    font-size: 12px;
    gap: 6px;
  }

  .aether-chess.game-active .action-btn .ui-icon {
    width: 18px;
    height: 18px;
  }
}

/* Premium match-screen layout */
.aether-chess.game-active {
  max-width: min(100%, 1360px);
}

.aether-chess.game-active .game-header {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto minmax(280px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}

.aether-chess.game-active .header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.aether-chess.game-active .game-brand {
  min-width: 0;
}

.aether-chess.game-active .home-back-btn {
  width: auto;
  min-width: 86px;
  flex: 0 0 auto;
  padding: 0 14px;
}

.aether-chess.game-active .home-back-btn .ui-icon {
  width: 19px;
  height: 19px;
}

.aether-chess.game-active .game-title {
  white-space: nowrap;
}

.aether-chess.game-active .header-center {
  justify-content: center;
  min-width: 0;
}

.aether-chess.game-active .match-mode-chip {
  width: auto;
  min-width: 158px;
  padding: 0 18px;
  justify-self: center;
  letter-spacing: 0;
}

.aether-chess.game-active .header-right {
  justify-content: flex-end;
  min-width: 0;
}

.aether-chess.game-active .header-right .icon-btn {
  width: auto;
  padding: 0 13px;
}

.aether-chess.game-active .play-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(560px, 760px) minmax(260px, 320px);
  grid-template-areas:
    "opponent history"
    "board history"
    "player history"
    "actions history"
    "hint history";
  justify-content: center;
  align-items: start;
  gap: 8px 22px;
}

.aether-chess.game-active .board-column {
  align-items: center;
  justify-content: center;
}

.aether-chess.game-active .board-perspective {
  width: min(100%, 58vw, calc(100vh - 390px), 760px);
  min-width: 0;
  max-width: 760px;
}

.aether-chess.game-active .seat-panel {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(160px, 1.2fr) minmax(132px, auto);
  grid-template-areas: "info captures timer";
  align-items: center;
  min-height: 56px;
  padding: 8px 12px;
  gap: 10px;
  border-radius: 18px;
}

.aether-chess.game-active .opponent-seat,
.aether-chess.game-active .player-seat {
  width: min(100%, 760px);
  justify-self: center;
}

.aether-chess.game-active .opponent-seat {
  margin-bottom: -2px;
}

.aether-chess.game-active .player-seat {
  margin-top: -2px;
}

.aether-chess.game-active .seat-info {
  grid-area: info;
}

.aether-chess.game-active .seat-captures {
  grid-area: captures;
  min-height: 28px;
  align-items: center;
}

.aether-chess.game-active .seat-timer {
  grid-area: timer;
  min-width: 132px;
}

.aether-chess.game-active .seat-name {
  font-size: 18px;
}

.aether-chess.game-active .seat-meta {
  font-size: 12px;
}

.aether-chess.game-active .action-bar {
  width: min(100%, 760px);
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(96,74,45,0.16);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,253,248,0.88), rgba(241,232,218,0.66));
  box-shadow: 0 16px 34px rgba(42,33,22,0.08), inset 0 1px 0 rgba(255,255,255,0.72);
}

.aether-chess.game-active .action-btn {
  min-height: 40px;
  border-radius: 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fffaf2;
}

@media (min-width: 1181px) and (max-height: 940px) {
  .aether-chess.game-active {
    --playable-board-size: 540px;
  }

  .aether-chess.game-active .play-layout {
    gap: 6px 22px;
  }

  .aether-chess.game-active .timer {
    min-height: 42px;
    padding: 8px 10px;
  }
}

@media (min-width: 1181px) and (max-height: 940px) {
  .aether-chess.game-active .game-header {
    padding: 8px 14px;
  }

  .aether-chess.game-active .icon-btn {
    height: 36px;
    min-width: 36px;
  }

  .aether-chess.game-active .game-title {
    font-size: 24px;
  }

  .aether-chess.game-active .game-subtitle {
    font-size: 11px;
  }

  .aether-chess.game-active .seat-panel {
    min-height: 48px;
    padding: 6px 10px;
  }

  .aether-chess.game-active .seat-name {
    font-size: 16px;
  }

  .aether-chess.game-active .seat-meta {
    font-size: 11px;
  }

  .aether-chess.game-active .seat-captures {
    min-height: 22px;
  }

  .aether-chess.game-active .timer-time {
    font-size: 21px;
  }

  .aether-chess.game-active .action-btn {
    min-height: 36px;
  }
}

.aether-chess.game-active .action-btn.danger-action {
  color: #7f2d28;
  border-color: rgba(127,45,40,0.22);
}

.aether-chess.game-active .action-btn.danger-action:hover {
  color: #6c241f;
  border-color: rgba(127,45,40,0.42);
  background: #fff5f1;
}

.aether-chess.game-active .hint-message {
  width: min(100%, 760px);
  justify-self: center;
}

.aether-chess.game-active .history-area {
  position: sticky;
  top: 14px;
  min-height: 0;
  max-height: calc(100vh - 128px);
  align-self: start;
}

.aether-chess.game-active .history-title {
  min-height: 54px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.aether-chess.game-active .sidebar-status-card {
  padding: 12px;
  border-bottom: 1px solid rgba(96,74,45,0.12);
  background: rgba(255,250,241,0.56);
}

.aether-chess.game-active .sidebar-status-card .status-pill {
  width: 100%;
  justify-content: center;
  min-height: 42px;
  padding: 8px 12px;
}

.aether-chess.game-active .sidebar-info-line {
  margin-top: 9px;
  color: var(--game-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.aether-chess.game-active .history-scroll {
  max-height: calc(100vh - 260px);
  padding: 10px;
}

.aether-chess.game-active .history-list {
  grid-template-columns: 30px 1fr 1fr;
  gap: 4px 6px;
}

.aether-chess.game-active .analysis-panel.show {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 128px);
  overflow: auto;
}

@media (max-width: 1180px) {
  .aether-chess.game-active .game-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "left right"
      "center center";
  }

  .aether-chess.game-active .header-left { grid-area: left; }
  .aether-chess.game-active .header-center { grid-area: center; }
  .aether-chess.game-active .header-right { grid-area: right; }

  .aether-chess.game-active .play-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "opponent"
      "board"
      "player"
      "actions"
      "hint"
      "history";
    max-width: 840px;
    margin: 0 auto;
  }

  .aether-chess.game-active .board-perspective {
    width: min(100%, calc(100vh - 310px), 760px);
  }

  .aether-chess.game-active .history-area,
  .aether-chess.game-active .analysis-panel.show {
    position: static;
    max-height: none;
  }

  .aether-chess.game-active .history-scroll {
    max-height: 220px;
  }
}

@media (max-width: 720px) {
  .aether-chess.game-active .game-header {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "center"
      "right";
    gap: 8px;
    padding: 11px;
  }

  .aether-chess.game-active .header-left {
    justify-content: flex-start;
    gap: 10px;
  }

  .aether-chess.game-active .home-back-btn {
    width: 48px;
    min-width: 48px;
    padding: 0 10px;
  }

  .aether-chess.game-active .home-back-btn span {
    display: none;
  }

  .aether-chess.game-active .header-right {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .aether-chess.game-active .header-right .icon-btn,
  .aether-chess.game-active .match-mode-chip {
    width: 100%;
    min-width: 0;
  }

  .aether-chess.game-active .match-mode-chip {
    min-height: 44px;
  }

  .aether-chess.game-active .play-layout {
    grid-template-areas:
      "board"
      "opponent"
      "player"
      "actions"
      "hint"
      "history";
    gap: 10px;
  }

  .aether-chess.game-active .board-perspective {
    width: min(100%, max(300px, calc(100vh - 430px)));
    padding: 8px;
  }

  .aether-chess.game-active .seat-panel {
    grid-template-columns: minmax(0, 1fr) minmax(124px, auto);
    grid-template-areas:
      "info timer"
      "captures captures";
    min-height: 0;
    padding: 10px;
    gap: 8px 10px;
  }

  .aether-chess.game-active .seat-captures {
    min-height: 30px;
  }

  .aether-chess.game-active .action-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 7px;
    gap: 7px;
    border-radius: 16px;
  }

  .aether-chess.game-active .action-btn {
    min-height: 48px;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    letter-spacing: 0;
    text-transform: none;
  }

  .aether-chess.game-active .action-btn .ui-icon {
    width: 20px;
    height: 20px;
  }

  .aether-chess.game-active .history-area:not([open]) .sidebar-status-card,
  .aether-chess.game-active .history-area:not([open]) .history-scroll {
    display: none;
  }

  .aether-chess.game-active .history-title {
    min-height: 48px;
  }
}

@media (max-width: 390px) {
  .aether-chess.game-active .game-title {
    font-size: 19px;
  }

  .aether-chess.game-active .game-subtitle {
    font-size: 10px;
  }

  .aether-chess.game-active .board-perspective {
    width: min(100%, max(288px, calc(100vh - 440px)));
  }

  .aether-chess.game-active .seat-panel {
    grid-template-columns: minmax(0, 1fr) minmax(122px, auto);
  }

  .aether-chess.game-active .action-btn {
    font-size: 9px;
  }
}

/* Premium 2D walnut board presentation */
.aether-chess.game-active.theme-classic,
.aether-chess.game-active.theme-walnut {
  --board-light: #ead7aa;
  --board-dark: #8a5a31;
}

.aether-chess.game-active.theme-midnight {
  --board-light: #c8c0ad;
  --board-dark: #48505c;
}

.aether-chess.game-active.theme-marble {
  --board-light: #e8e3da;
  --board-dark: #9b9285;
}

.aether-chess.game-active .coord-labels {
  display: none;
}

.aether-chess.game-active .board-perspective {
  --frame-pad: clamp(18px, 2.3vw, 30px);
  padding: var(--frame-pad);
  border-radius: 18px;
  perspective: none;
  transform: none;
  transform-style: flat;
  background:
    linear-gradient(135deg, rgba(255,238,191,0.2), transparent 42%, rgba(39,24,12,0.18)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 14px),
    linear-gradient(180deg, #7f512b, #4d301b);
  box-shadow:
    0 18px 42px rgba(37, 28, 19, 0.18),
    0 4px 12px rgba(37, 28, 19, 0.12),
    inset 0 0 0 1px rgba(255, 229, 171, 0.38);
}

.aether-chess.game-active .board-perspective::before {
  inset: calc(var(--frame-pad) - 7px);
  z-index: 0;
  border-radius: 12px;
  border: 1px solid rgba(219, 182, 105, 0.72);
  background: transparent;
  box-shadow:
    inset 0 0 0 1px rgba(84, 51, 25, 0.32),
    0 0 0 1px rgba(255, 245, 213, 0.22);
}

.aether-chess.game-active .board-perspective::after {
  left: 8%;
  right: 8%;
  bottom: -8px;
  height: 14px;
  border-radius: 999px;
  background: rgba(42, 30, 20, 0.18);
  filter: blur(9px);
  z-index: -1;
}

.aether-chess.game-active .chess-board {
  position: relative;
  z-index: 1;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  border-radius: 10px;
  border: 0;
  overflow: hidden;
  transform: none;
  transform-origin: center center;
  box-shadow:
    0 0 0 1px rgba(64, 38, 18, 0.7),
    0 0 0 4px rgba(219, 182, 105, 0.26),
    0 8px 18px rgba(34, 24, 16, 0.16),
    inset 0 0 0 1px rgba(255, 244, 204, 0.2);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.08), transparent 34%, rgba(0,0,0,0.08)),
    #4b2b16;
}

.aether-chess.game-active .square {
  overflow: hidden;
  box-shadow:
    inset 1px 1px 0 rgba(255,255,255,0.16),
    inset -1px -1px 0 rgba(40,25,13,0.16);
}

.aether-chess.game-active .square:nth-child(odd) {
  background-image:
    linear-gradient(135deg, rgba(255,255,255,0.22), transparent 34%, rgba(111,73,35,0.08)),
    repeating-linear-gradient(88deg, rgba(85,51,24,0.045) 0 1px, transparent 1px 11px);
}

.aether-chess.game-active .square:nth-child(even) {
  background-image:
    linear-gradient(135deg, rgba(255,224,165,0.16), transparent 36%, rgba(33,20,11,0.14)),
    repeating-linear-gradient(92deg, rgba(255,236,190,0.05) 0 1px, transparent 1px 10px);
}

.aether-chess.game-active .square::before {
  z-index: 1;
}

.aether-chess.game-active .square::after {
  z-index: 3;
}

.aether-chess.game-active .piece {
  z-index: 4;
}

.piece-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  aspect-ratio: 1 / 1;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: var(--piece-shadow);
}

.aether-chess.game-active .piece-img {
  filter: drop-shadow(0 8px 5px rgba(30, 19, 10, 0.26));
}

.captured-piece img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.aether-chess.game-active .frame-labels {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  user-select: none;
  font-family: var(--font-display);
  font-size: clamp(9px, 1.15vw, 13px);
  line-height: 1;
  font-weight: 700;
  color: rgba(255, 232, 181, 0.76);
  text-shadow: 0 1px 2px rgba(20, 12, 7, 0.62);
}

.aether-chess.game-active .file-frame-labels {
  left: var(--frame-pad);
  right: var(--frame-pad);
  bottom: max(4px, calc(var(--frame-pad) * 0.26));
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  text-align: center;
}

.aether-chess.game-active .rank-frame-labels {
  top: var(--frame-pad);
  bottom: var(--frame-pad);
  left: max(5px, calc(var(--frame-pad) * 0.28));
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  align-items: center;
}

@media (max-width: 720px) {
  .aether-chess.game-active .board-perspective {
    --frame-pad: clamp(12px, 3.4vw, 18px);
    border-radius: 20px;
  }

  .aether-chess.game-active .chess-board {
    border-radius: 10px;
    transform: none;
  }

  .aether-chess.game-active .frame-labels {
    font-size: 9px;
  }
}

/* Board usability repair: the real .chess-board owns the playable size. */
.aether-chess.game-active {
  --playable-board-size: clamp(560px, min(62vw, calc(100vh - 340px)), 680px);
}

.aether-chess.game-active .play-layout {
  grid-template-columns: minmax(calc(var(--playable-board-size) + 56px), calc(var(--playable-board-size) + 96px)) minmax(280px, 320px);
  justify-content: center;
  align-items: start;
  gap: 10px 22px;
}

.aether-chess.game-active .opponent-seat,
.aether-chess.game-active .player-seat,
.aether-chess.game-active .action-bar,
.aether-chess.game-active .hint-message {
  width: min(100%, calc(var(--playable-board-size) + 56px));
}

.aether-chess.game-active .board-column {
  width: min(100%, calc(var(--playable-board-size) + 56px));
  justify-self: center;
}

.aether-chess.game-active .board-perspective {
  --frame-pad: clamp(18px, 2vw, 28px);
  box-sizing: content-box;
  width: min(var(--playable-board-size), calc(100% - (var(--frame-pad) * 2)));
  max-width: none;
  padding: var(--frame-pad);
  perspective: none;
  transform: none;
  transform-style: flat;
}

.aether-chess.game-active .chess-board {
  width: 100%;
  height: auto;
  max-width: none;
  aspect-ratio: 1 / 1;
  transform: none;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
}

.aether-chess.game-active .square {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
}

.aether-chess.game-active .piece {
  width: 88%;
  height: 88%;
}

.aether-chess.game-active .piece-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.aether-chess.game-active .file-frame-labels {
  left: var(--frame-pad);
  right: var(--frame-pad);
}

.aether-chess.game-active .rank-frame-labels {
  top: var(--frame-pad);
  bottom: var(--frame-pad);
}

@media (max-width: 1180px) {
  .aether-chess.game-active {
    --playable-board-size: min(680px, calc(100vw - 72px));
  }

  .aether-chess.game-active .play-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: calc(var(--playable-board-size) + 56px);
  }
}

@media (max-width: 720px) {
  .aether-chess.game-active {
    --playable-board-size: calc(100vw - 44px);
  }

  .aether-chess.game-active .board-column,
  .aether-chess.game-active .opponent-seat,
  .aether-chess.game-active .player-seat,
  .aether-chess.game-active .action-bar,
  .aether-chess.game-active .hint-message {
    width: 100%;
  }

  .aether-chess.game-active .board-perspective {
    --frame-pad: 10px;
    width: min(var(--playable-board-size), calc(100% - (var(--frame-pad) * 2)));
    padding: var(--frame-pad);
    border-radius: 18px;
  }

  .aether-chess.game-active .chess-board {
    width: 100%;
    height: auto;
  }

  .aether-chess.game-active .piece {
    width: 90%;
    height: 90%;
  }
}

@media (max-width: 390px) {
  .aether-chess.game-active {
    --playable-board-size: calc(100vw - 40px);
  }

  .aether-chess.game-active .board-perspective {
    --frame-pad: 8px;
    width: calc(var(--playable-board-size) + 16px);
  }
}

/* Final 2D board lock: no perspective, no scale, no frame-driven shrink. */
.aether-chess.game-active {
  --playable-board-size: clamp(560px, min(62vw, calc(100vh - 330px)), 680px);
  --board-frame-pad: clamp(18px, 1.75vw, 24px);
}

.aether-chess.game-active .play-layout {
  grid-template-columns:
    minmax(calc(var(--playable-board-size) + (var(--board-frame-pad) * 2)), calc(var(--playable-board-size) + 72px))
    minmax(280px, 320px);
}

.aether-chess.game-active .board-column,
.aether-chess.game-active .opponent-seat,
.aether-chess.game-active .player-seat,
.aether-chess.game-active .action-bar,
.aether-chess.game-active .hint-message {
  width: min(100%, calc(var(--playable-board-size) + (var(--board-frame-pad) * 2)));
}

.aether-chess.game-active .board-perspective {
  --frame-pad: var(--board-frame-pad);
  box-sizing: content-box;
  width: min(var(--playable-board-size), calc(100% - (var(--frame-pad) * 2)));
  max-width: none;
  padding: var(--frame-pad);
  perspective: none;
  transform: none;
  transform-style: flat;
}

.aether-chess.game-active .chess-board {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  transform: none;
  transform-style: flat;
}

.aether-chess.game-active .piece {
  width: 78%;
  height: 78%;
}

@media (min-width: 1181px) and (max-height: 940px) {
  .aether-chess.game-active {
    --playable-board-size: 548px;
  }
}

@media (max-width: 1180px) {
  .aether-chess.game-active {
    --playable-board-size: min(680px, calc(100vw - 72px));
    --board-frame-pad: 18px;
  }

  .aether-chess.game-active .play-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: calc(var(--playable-board-size) + (var(--board-frame-pad) * 2));
  }
}

@media (max-width: 720px) {
  .aether-chess.game-active {
    --playable-board-size: calc(100vw - 44px);
    --board-frame-pad: 10px;
  }

  .aether-chess.game-active .board-column,
  .aether-chess.game-active .opponent-seat,
  .aether-chess.game-active .player-seat,
  .aether-chess.game-active .action-bar,
  .aether-chess.game-active .hint-message {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .aether-chess.game-active {
    --playable-board-size: calc(100vw - 40px);
    --board-frame-pad: 8px;
  }
}

/* Definitive premium 2D board sizing: frame and playable grid share one box. */
.aether-chess.game-active {
  --playable-board-size: clamp(560px, min(62vw, calc(100vh - 330px)), 680px);
  --board-frame-pad: clamp(18px, 1.75vw, 24px);
}

.aether-chess.game-active .play-layout {
  grid-template-columns:
    minmax(calc(var(--playable-board-size) + (var(--board-frame-pad) * 2)), calc(var(--playable-board-size) + 72px))
    minmax(280px, 320px);
}

.aether-chess.game-active .board-column,
.aether-chess.game-active .opponent-seat,
.aether-chess.game-active .player-seat,
.aether-chess.game-active .action-bar,
.aether-chess.game-active .hint-message {
  width: min(100%, calc(var(--playable-board-size) + (var(--board-frame-pad) * 2)));
}

.aether-chess.game-active .board-perspective {
  --frame-pad: var(--board-frame-pad);
  width: calc(var(--playable-board-size) + (var(--frame-pad) * 2));
  max-width: 100%;
  padding: var(--frame-pad);
  perspective: none;
  transform: none;
  transform-style: flat;
}

.aether-chess.game-active .chess-board {
  width: min(var(--playable-board-size), 100%);
  height: auto;
  aspect-ratio: 1 / 1;
  transform: none;
  transform-style: flat;
}

.aether-chess.game-active .piece {
  width: 78%;
  height: 78%;
}

@media (min-width: 1181px) and (max-height: 940px) {
  .aether-chess.game-active {
    --playable-board-size: 548px;
  }
}

@media (max-width: 1180px) {
  .aether-chess.game-active {
    --playable-board-size: min(680px, calc(100vw - 72px));
    --board-frame-pad: 18px;
  }

  .aether-chess.game-active .play-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: calc(var(--playable-board-size) + (var(--board-frame-pad) * 2));
  }
}

@media (max-width: 720px) {
  .aether-chess.game-active {
    --playable-board-size: calc(100vw - 44px);
    --board-frame-pad: 10px;
  }

  .aether-chess.game-active .board-column,
  .aether-chess.game-active .opponent-seat,
  .aether-chess.game-active .player-seat,
  .aether-chess.game-active .action-bar,
  .aether-chess.game-active .hint-message {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .aether-chess.game-active {
    --playable-board-size: calc(100vw - 40px);
    --board-frame-pad: 8px;
  }
}

@media (min-width: 1181px) and (max-height: 940px) {
  .aether-chess.game-active {
    --playable-board-size: 548px;
  }

  .aether-chess.game-active .play-layout {
    gap: 5px 22px;
  }
}

/* Final premium 2D gameplay surface */
.aether-chess.game-active {
  --playable-board-size: clamp(560px, min(62vw, calc(100vh - 330px)), 680px);
  --board-frame-pad: clamp(18px, 1.75vw, 24px);
  --game-ink: #211d18;
  --game-muted: #7a6e60;
  --game-line: rgba(93, 67, 37, 0.18);
  --game-gold: #c79a52;
  --board-light: #ead8aa;
  --board-dark: #8b5b31;
}

.aether-chess.game-active .play-layout {
  grid-template-columns:
    minmax(calc(var(--playable-board-size) + (var(--board-frame-pad) * 2)), calc(var(--playable-board-size) + 72px))
    minmax(280px, 320px);
  gap: 8px 22px;
  justify-content: center;
}

.aether-chess.game-active .board-column,
.aether-chess.game-active .opponent-seat,
.aether-chess.game-active .player-seat,
.aether-chess.game-active .action-bar,
.aether-chess.game-active .hint-message {
  width: min(100%, calc(var(--playable-board-size) + (var(--board-frame-pad) * 2)));
}

.aether-chess.game-active .board-perspective {
  --frame-pad: var(--board-frame-pad);
  box-sizing: content-box;
  width: min(var(--playable-board-size), calc(100% - (var(--frame-pad) * 2)));
  max-width: none;
  padding: var(--frame-pad);
  border-radius: 16px;
  perspective: none;
  transform: none;
  transform-style: flat;
  background:
    linear-gradient(135deg, rgba(255, 235, 184, 0.18), transparent 50%, rgba(39, 24, 12, 0.14)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 13px),
    #604024;
  box-shadow:
    0 18px 38px rgba(45, 34, 23, 0.16),
    0 5px 14px rgba(45, 34, 23, 0.12),
    inset 0 0 0 1px rgba(255, 228, 170, 0.34);
}

.aether-chess.game-active .board-perspective::before {
  inset: calc(var(--frame-pad) - 6px);
  border-radius: 12px;
  border: 1px solid rgba(215, 176, 95, 0.62);
  box-shadow: inset 0 0 0 1px rgba(79, 49, 24, 0.24);
}

.aether-chess.game-active .board-perspective::after {
  left: 9%;
  right: 9%;
  bottom: -7px;
  height: 12px;
  border-radius: 999px;
  background: rgba(45, 33, 22, 0.18);
  filter: blur(9px);
}

.aether-chess.game-active .chess-board {
  width: 100%;
  height: auto;
  max-width: none;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  transform: none;
  border-radius: 9px;
  box-shadow:
    0 0 0 1px rgba(61, 39, 20, 0.68),
    0 0 0 3px rgba(215, 176, 95, 0.24),
    0 9px 18px rgba(33, 24, 16, 0.14);
}

.aether-chess.game-active .square {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  background-image:
    linear-gradient(135deg, rgba(255,255,255,0.08), transparent 44%, rgba(0,0,0,0.05)),
    repeating-linear-gradient(90deg, rgba(90,58,28,0.035) 0 1px, transparent 1px 12px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
}

.aether-chess.game-active .piece {
  width: 78%;
  height: 78%;
  transition: transform 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
}

.aether-chess.game-active .piece-img {
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 5px 4px rgba(28, 18, 10, 0.22));
}

.aether-chess.game-active .piece.dragging,
.aether-chess.game-active .piece-ghost {
  filter: drop-shadow(0 10px 14px rgba(20, 14, 9, 0.28));
}

.aether-chess.game-active .square:hover .piece {
  transform: translateY(-1px);
}

.aether-chess.game-active .piece-arrived {
  animation: piece-arrive-2d 0.16s ease-out;
}

@keyframes piece-arrive-2d {
  from { transform: translateY(-2px) scale(0.97); }
  to { transform: translateY(0) scale(1); }
}

.aether-chess.game-active .square.selected::before {
  background: rgba(220, 178, 82, 0.34);
  opacity: 1;
}

.aether-chess.game-active .square.last-move-from::before,
.aether-chess.game-active .square.last-move-to::before {
  background: rgba(235, 200, 102, 0.28);
  opacity: 1;
}

.aether-chess.game-active .square.legal::after {
  width: 22%;
  height: 22%;
  top: 39%;
  left: 39%;
  background: rgba(31, 27, 22, 0.34);
  border-radius: 50%;
  box-shadow: none;
}

.aether-chess.game-active .square.legal.capture::after {
  width: 82%;
  height: 82%;
  top: 9%;
  left: 9%;
  background: transparent;
  border: 2px solid rgba(151, 44, 38, 0.42);
  border-radius: 50%;
}

.aether-chess.game-active .square.check::before {
  background: radial-gradient(circle, rgba(190, 45, 39, 0.34), rgba(190, 45, 39, 0.12) 62%, transparent);
  opacity: 1;
}

.aether-chess.game-active .frame-labels {
  color: rgba(255, 232, 180, 0.82);
  font-size: 12px;
}

.aether-chess.game-active .seat-panel {
  min-height: 54px;
  padding: 8px 12px;
  border-radius: 12px;
  grid-template-columns: minmax(130px, 0.85fr) minmax(120px, 1fr) minmax(124px, auto);
  gap: 10px;
}

.aether-chess.game-active .seat-name {
  font-size: 17px;
}

.aether-chess.game-active .seat-meta {
  font-size: 12px;
}

.aether-chess.game-active .seat-captures {
  min-height: 26px;
  padding: 5px 7px;
  background: rgba(84, 62, 35, 0.045);
}

.aether-chess.game-active .timer {
  min-height: 44px;
  padding: 8px 11px;
  border-radius: 11px;
}

.aether-chess.game-active .timer-time {
  font-size: 22px;
}

.aether-chess.game-active .action-bar {
  min-height: 56px;
  padding: 7px;
  gap: 8px;
  border-radius: 14px;
}

.aether-chess.game-active .action-btn {
  min-height: 44px;
  border-radius: 11px;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--game-ink);
  background: #fffaf2;
}

.aether-chess.game-active .action-btn:hover {
  border-color: rgba(199,154,82,0.75);
  background: #fff6e7;
}

.aether-chess.game-active .action-btn:active {
  transform: translateY(1px);
}

.aether-chess.game-active .history-area {
  width: 100%;
  border-radius: 13px;
}

.aether-chess.game-active .history-columns,
.aether-chess.game-active .history-list {
  display: grid;
  grid-template-columns: 34px 1fr 1fr;
  gap: 4px 7px;
}

.aether-chess.game-active .history-columns {
  padding: 9px 12px 0;
  color: var(--game-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.aether-chess.game-active .history-empty {
  grid-column: 1 / -1;
  padding: 18px 10px 20px;
  color: var(--game-muted);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.aether-chess.game-active .history-move.current {
  background: #2a251f;
  color: #f4dba9;
}

@media (min-width: 1181px) and (max-height: 940px) {
  .aether-chess.game-active {
    --playable-board-size: 548px;
  }
}

@media (max-width: 1180px) {
  .aether-chess.game-active {
    --playable-board-size: min(680px, calc(100vw - 72px));
    --board-frame-pad: 18px;
  }

  .aether-chess.game-active .play-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: calc(var(--playable-board-size) + (var(--board-frame-pad) * 2));
  }
}

@media (max-width: 720px) {
  .aether-chess.game-active {
    --playable-board-size: calc(100vw - 44px);
    --board-frame-pad: 10px;
  }

  .aether-chess.game-active .board-perspective {
    --frame-pad: 10px;
    width: min(var(--playable-board-size), calc(100% - (var(--frame-pad) * 2)));
    padding: var(--frame-pad);
    border-radius: 14px;
  }

  .aether-chess.game-active .board-column,
  .aether-chess.game-active .opponent-seat,
  .aether-chess.game-active .player-seat,
  .aether-chess.game-active .action-bar,
  .aether-chess.game-active .hint-message {
    width: 100%;
  }

  .aether-chess.game-active .piece {
    width: 78%;
    height: 78%;
  }

  .aether-chess.game-active .seat-panel {
    grid-template-columns: minmax(0, 1fr) minmax(126px, auto);
    grid-template-areas:
      "info timer"
      "captures captures";
    min-height: 0;
    padding: 9px 10px;
  }

  .aether-chess.game-active .action-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .aether-chess.game-active .action-btn {
    min-height: 46px;
    font-size: 10px;
    letter-spacing: 0;
    text-transform: none;
  }

  .aether-chess.game-active .history-area:not([open]) .history-columns,
  .aether-chess.game-active .history-area:not([open]) .sidebar-status-card,
  .aether-chess.game-active .history-area:not([open]) .history-scroll {
    display: none;
  }
}

@media (max-width: 390px) {
  .aether-chess.game-active {
    --playable-board-size: calc(100vw - 40px);
    --board-frame-pad: 8px;
  }

  .aether-chess.game-active .board-perspective {
    --frame-pad: 8px;
    width: min(var(--playable-board-size), calc(100% - (var(--frame-pad) * 2)));
  }
}

/* Home layout structure: balanced desktop grid and clear section rhythm. */
.aether-chess.home-active {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
}

.aether-chess.home-active .home-screen {
  width: 100%;
  max-width: min(1480px, calc(100vw - 40px));
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  padding: clamp(40px, 4vw, 56px) clamp(24px, 3.2vw, 48px);
  gap: clamp(34px, 4vw, 52px);
  justify-content: start;
}

.aether-chess.home-active .home-shell {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
  gap: clamp(48px, 4.4vw, 64px);
  align-items: center;
  min-height: auto;
}

.aether-chess.home-active .home-left,
.aether-chess.home-active .home-right {
  min-width: 0;
  width: 100%;
}

.aether-chess.home-active .home-left {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(22px, 2.3vw, 34px);
  align-self: stretch;
}

.aether-chess.home-active .home-right {
  display: flex;
  flex-direction: column;
  align-self: center;
  gap: clamp(18px, 2vw, 26px);
}

.aether-chess.home-active .home-toolbar {
  justify-content: flex-end;
  width: 100%;
  gap: clamp(18px, 2.4vw, 34px);
  padding-right: 0;
}

.aether-chess.home-active .new-game-panel {
  width: 100%;
  max-width: 640px;
  justify-self: stretch;
  align-self: center;
  margin-left: auto;
  padding: clamp(72px, 5.2vw, 82px) clamp(28px, 3vw, 40px) clamp(28px, 3vw, 36px);
}

.aether-chess.home-active .home-mode-row {
  margin-bottom: clamp(24px, 2.4vw, 32px);
}

.aether-chess.home-active .home-option-group {
  margin-bottom: clamp(24px, 2.4vw, 32px);
}

.aether-chess.home-active .home-choice-grid {
  gap: clamp(10px, 1vw, 14px);
}

.aether-chess.home-active .home-choice {
  min-height: clamp(56px, 4.4vw, 64px);
}

.aether-chess.home-active .home-hero-art {
  width: 100%;
  min-height: 0;
  align-self: end;
}

.aether-chess.home-active .home-hero-art img {
  width: 100%;
  height: clamp(360px, 39vw, 520px);
  min-height: 0;
  max-height: min(520px, calc(100vh - 360px));
}

.aether-chess.home-active .home-cards {
  width: 100%;
  margin-top: clamp(6px, 1.4vw, 18px);
  padding-top: clamp(12px, 2vw, 26px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.2vw, 28px);
}

.aether-chess.home-active .home-card {
  min-width: 0;
  min-height: clamp(88px, 7vw, 106px);
}

@media (max-width: 1180px) {
  .aether-chess.home-active .home-screen {
    max-width: min(1120px, calc(100vw - 28px));
    padding: clamp(30px, 4vw, 44px) clamp(18px, 3vw, 32px);
  }

  .aether-chess.home-active .home-shell {
    grid-template-columns: minmax(0, 50fr) minmax(0, 50fr);
    gap: clamp(28px, 3.5vw, 44px);
  }

  .aether-chess.home-active .new-game-panel {
    max-width: none;
    padding-left: clamp(22px, 2.4vw, 30px);
    padding-right: clamp(22px, 2.4vw, 30px);
  }

  .aether-chess.home-active .home-hero-art img {
    height: clamp(300px, 36vw, 420px);
    max-height: none;
  }
}

@media (max-width: 1100px) {
  .aether-chess.home-active .home-screen {
    max-width: min(820px, calc(100vw - 24px));
    padding: clamp(28px, 4vw, 42px) clamp(14px, 3vw, 28px) 34px;
    gap: clamp(28px, 4vw, 38px);
  }

  .aether-chess.home-active .home-shell {
    grid-template-columns: 1fr;
    gap: clamp(26px, 4vw, 38px);
    align-items: start;
  }

  .aether-chess.home-active .home-left {
    gap: 18px;
  }

  .aether-chess.home-active .home-right {
    gap: 18px;
  }

  .aether-chess.home-active .home-toolbar {
    justify-content: center;
  }

  .aether-chess.home-active .new-game-panel {
    width: 100%;
    margin-left: 0;
  }

  .aether-chess.home-active .home-hero-art img {
    height: clamp(220px, 42vw, 340px);
  }

  .aether-chess.home-active .home-cards {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-top: 8px;
  }
}

@media (min-width: 1101px) {
  .aether-chess.home-active .home-right {
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .aether-chess.home-active .home-screen {
    max-width: calc(100vw - 16px);
    padding: 20px 8px 28px;
    gap: 24px;
  }

  .aether-chess.home-active .home-shell {
    gap: 22px;
  }

  .aether-chess.home-active .home-toolbar {
    gap: 10px;
  }

  .aether-chess.home-active .new-game-panel {
    padding: 62px 14px 18px;
  }

  .aether-chess.home-active .home-mode-row,
  .aether-chess.home-active .home-option-group {
    margin-bottom: 18px;
  }

  .aether-chess.home-active .home-choice-grid {
    gap: 9px;
  }

  .aether-chess.home-active .home-hero-art img {
    height: clamp(190px, 58vw, 250px);
  }
}

/* Home visual hierarchy: quiet supporting UI, strong headline and selected states. */
.aether-chess.home-active .home-screen {
  --home-ink: #211f1c;
  --home-muted: #7a6e60;
  --home-gold: #c69a55;
  --home-walnut: #4b3424;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.46), transparent 26%),
    linear-gradient(180deg, #f7efe4 0%, #efe1cf 72%, #dfceb9 100%);
}

.aether-chess.home-active .home-screen::before {
  opacity: 0.22;
  background: linear-gradient(90deg, rgba(255,255,255,0.28), transparent 20%);
}

.aether-chess.home-active .home-brand {
  gap: clamp(12px, 1.4vw, 18px);
}

.aether-chess.home-active .logo-mark {
  width: clamp(58px, 4.2vw, 72px);
  height: clamp(58px, 4.2vw, 72px);
  border-radius: 13px;
  border: 1px solid rgba(78, 54, 30, 0.28);
  background: #242321;
  color: #d1a86b;
  font-size: clamp(38px, 3vw, 50px);
  box-shadow: 0 8px 16px rgba(37, 25, 16, 0.12);
}

.aether-chess.home-active .logo-crown {
  width: 14px;
  height: 14px;
}

.aether-chess.home-active .home-title {
  font-size: clamp(34px, 3.1vw, 48px);
  line-height: 0.96;
  letter-spacing: 0.09em;
  font-weight: 600;
  color: var(--home-ink);
  text-shadow: none;
}

.aether-chess.home-active .home-subtitle {
  margin-top: 7px;
  gap: 9px;
  color: rgba(75, 52, 36, 0.58);
  font-size: clamp(9px, 0.72vw, 12px);
  letter-spacing: 0.26em;
}

.aether-chess.home-active .home-subtitle span {
  width: 18px;
  background: rgba(198, 154, 85, 0.42);
}

.aether-chess.home-active .home-copy {
  text-align: center;
}

.aether-chess.home-active .home-copy h2 {
  font-size: clamp(68px, 6.9vw, 128px);
  line-height: 0.94;
  font-weight: 500;
  color: #242220;
  text-shadow: none;
}

.aether-chess.home-active .home-copy p {
  margin-top: 14px;
  color: rgba(95, 65, 39, 0.8);
  font-size: clamp(20px, 1.75vw, 30px);
}

.aether-chess.home-active .home-divider {
  margin-top: 20px;
  width: min(330px, 50%);
  gap: 10px;
  color: rgba(198,154,85,0.7);
}

.aether-chess.home-active .home-divider > .ui-icon {
  width: 16px;
  height: 16px;
  opacity: 0.72;
}

.aether-chess.home-active .home-hero-art {
  filter: drop-shadow(0 14px 22px rgba(43,28,17,0.16));
}

.aether-chess.home-active .home-hero-art img {
  border-radius: 18px;
}

.aether-chess.home-active .home-toolbar {
  color: rgba(54, 43, 34, 0.78);
}

.aether-chess.home-active .home-tool {
  min-width: 62px;
  gap: 7px;
  color: rgba(54, 43, 34, 0.74);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.aether-chess.home-active .home-tool-icon {
  width: 46px;
  height: 46px;
  background: rgba(255,248,239,0.48);
  border-color: rgba(75, 52, 36, 0.12);
  box-shadow: none;
}

.aether-chess.home-active .home-tool:hover .home-tool-icon {
  border-color: rgba(198,154,85,0.38);
  transform: none;
}

.aether-chess.home-active .new-game-panel {
  background: rgba(255, 250, 242, 0.78);
  border: 1px solid rgba(75, 52, 36, 0.13);
  box-shadow: 0 12px 28px rgba(43, 28, 17, 0.10);
}

.aether-chess.home-active .new-game-panel::before {
  border: 1px solid rgba(75, 52, 36, 0.16);
  box-shadow: none;
}

.aether-chess.home-active .panel-crown {
  height: 46px;
  width: min(360px, 58%);
  border-radius: 0 0 22px 22px;
  border: 0;
  background: #242321;
  color: #e1c28c;
  box-shadow: none;
  font-size: clamp(15px, 1.1vw, 19px);
  letter-spacing: 0.07em;
}

.aether-chess.home-active .panel-crown span {
  width: 28px;
  opacity: 0.55;
}

.aether-chess.home-active .panel-crown > .ui-icon {
  width: 15px;
  height: 15px;
  opacity: 0.82;
}

.aether-chess.home-active .new-game-panel .field-label {
  color: rgba(33, 31, 28, 0.68);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.075em;
}

.aether-chess.home-active .home-mode,
.aether-chess.home-active .home-choice {
  border-color: rgba(75, 52, 36, 0.11);
  background: rgba(255, 250, 242, 0.55);
  color: rgba(42, 37, 32, 0.72);
  box-shadow: none;
}

.aether-chess.home-active .home-mode {
  min-height: 58px;
  font-size: clamp(13px, 0.95vw, 16px);
}

.aether-chess.home-active .home-choice {
  color: rgba(42, 37, 32, 0.68);
  font-size: 11px;
  font-weight: 700;
}

.aether-chess.home-active .home-mode .ui-icon,
.aether-chess.home-active .home-choice > .ui-icon {
  opacity: 0.72;
}

.aether-chess.home-active .home-mode.active,
.aether-chess.home-active .home-choice.active {
  color: #fff6e6;
  border-color: rgba(198,154,85,0.82);
  background: #242321;
  box-shadow: inset 0 0 0 1px rgba(225,194,140,0.24);
}

.aether-chess.home-active .home-mode.active .ui-icon,
.aether-chess.home-active .home-choice.active > .ui-icon {
  opacity: 1;
}

.aether-chess.home-active .start-btn {
  border: 1px solid rgba(198,154,85,0.72);
  background: #242321;
  color: #e9ce9a;
  box-shadow: 0 10px 18px rgba(36, 27, 18, 0.14);
}

.aether-chess.home-active .home-card {
  border-color: rgba(75,52,36,0.12);
  background: rgba(36,35,33,0.88);
  color: rgba(233,206,154,0.86);
  box-shadow: none;
}

.aether-chess.home-active .home-card > .ui-icon:first-child {
  opacity: 0.78;
}

.aether-chess.home-active .home-card strong {
  color: rgba(255,248,236,0.9);
  font-size: clamp(14px, 0.95vw, 17px);
}

.aether-chess.home-active .home-card small {
  color: rgba(255,248,236,0.66);
}

@media (max-width: 1100px) {
  .aether-chess.home-active .home-copy h2 {
    font-size: clamp(52px, 10vw, 86px);
  }

  .aether-chess.home-active .home-title {
    font-size: clamp(30px, 5vw, 42px);
  }
}

@media (max-width: 520px) {
  .aether-chess.home-active .logo-mark {
    width: 48px;
    height: 48px;
    font-size: 32px;
  }

  .aether-chess.home-active .home-title {
    font-size: clamp(25px, 7.8vw, 34px);
  }

  .aether-chess.home-active .home-subtitle {
    font-size: 8px;
    letter-spacing: 0.18em;
  }

  .aether-chess.home-active .home-copy h2 {
    font-size: clamp(42px, 13vw, 62px);
  }

  .aether-chess.home-active .home-copy p {
    font-size: clamp(18px, 5vw, 23px);
  }

  .aether-chess.home-active .home-divider {
    width: min(250px, 70%);
  }

  .aether-chess.home-active .panel-crown {
    width: min(280px, 72%);
  }
}

/* New Game panel polish: spacious groups, quiet options, crisp selected state. */
.aether-chess.home-active .new-game-panel {
  padding: clamp(68px, 4.8vw, 78px) clamp(20px, 2vw, 28px) clamp(20px, 2vw, 26px);
  border-radius: 22px;
  background: rgba(255, 250, 242, 0.88);
  border: 1px solid rgba(75, 52, 36, 0.12);
  box-shadow: 0 12px 24px rgba(43, 28, 17, 0.09);
}

.aether-chess.home-active .new-game-panel::before {
  inset: 14px;
  border-radius: 17px;
  border-color: rgba(75, 52, 36, 0.11);
}

.aether-chess.home-active .panel-crown {
  top: 14px;
  height: 42px;
  width: min(320px, 58%);
  border-radius: 0 0 18px 18px;
  font-size: clamp(14px, 1vw, 17px);
}

.aether-chess.home-active .home-mode-row,
.aether-chess.home-active .home-option-group {
  gap: 10px;
  margin-bottom: 22px;
}

.aether-chess.home-active .home-option-group {
  display: grid;
}

.aether-chess.home-active .new-game-panel .field-label {
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.08em;
  margin-bottom: 0;
}

.aether-chess.home-active .home-choice-grid {
  gap: 10px;
}

.aether-chess.home-active .home-mode,
.aether-chess.home-active .home-choice,
.aether-chess.home-active .side-grid .home-choice,
.aether-chess.home-active .time-grid .home-choice {
  min-height: 50px;
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(75, 52, 36, 0.14);
  background: rgba(255, 253, 248, 0.78);
  color: #292521;
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.aether-chess.home-active .home-mode {
  min-height: 52px;
  gap: 10px;
  font-size: 14px;
}

.aether-chess.home-active .home-choice {
  place-items: center;
  gap: 5px;
}

.aether-chess.home-active .difficulty-grid .home-choice {
  grid-template-columns: auto auto;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
}

.aether-chess.home-active .side-grid .home-choice,
.aether-chess.home-active .time-grid .home-choice {
  grid-template-columns: auto auto;
  gap: 8px;
  justify-content: center;
}

.aether-chess.home-active .home-mode .ui-icon,
.aether-chess.home-active .home-choice > .ui-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.aether-chess.home-active .home-choice span,
.aether-chess.home-active .home-mode span {
  line-height: 1.1;
}

.aether-chess.home-active .home-mode.active,
.aether-chess.home-active .home-choice.active {
  background: #242321;
  color: #fff8ea;
  border-color: rgba(198, 154, 85, 0.72);
  box-shadow: 0 6px 12px rgba(36, 27, 18, 0.13);
}

.aether-chess.home-active .home-mode.active .ui-icon,
.aether-chess.home-active .home-choice.active > .ui-icon {
  opacity: 1;
}

.aether-chess.home-active .start-btn {
  min-height: 62px;
  border-radius: 11px;
  border: 1px solid rgba(198, 154, 85, 0.74);
  background: #242321;
  color: #f3d9a7;
  font-size: clamp(17px, 1.25vw, 21px);
  letter-spacing: 0.08em;
  box-shadow: 0 8px 14px rgba(36, 27, 18, 0.14);
}

.aether-chess.home-active .start-btn .ui-icon {
  width: 20px;
  height: 20px;
}

@media (max-width: 1100px) {
  .aether-chess.home-active .new-game-panel {
    padding: 66px 18px 22px;
  }
}

@media (max-width: 520px) {
  .aether-chess.home-active .new-game-panel {
    padding: 62px 14px 18px;
  }

  .aether-chess.home-active .panel-crown {
    width: min(280px, 74%);
  }

  .aether-chess.home-active .home-mode-row,
  .aether-chess.home-active .home-option-group {
    margin-bottom: 20px;
  }

  .aether-chess.home-active .home-choice-grid {
    gap: 10px;
  }

  .aether-chess.home-active .home-mode,
  .aether-chess.home-active .home-choice,
  .aether-chess.home-active .side-grid .home-choice,
  .aether-chess.home-active .time-grid .home-choice {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 11px;
  }

  .aether-chess.home-active .difficulty-grid .home-choice {
    padding: 10px 8px;
  }

  .aether-chess.home-active .start-btn {
    min-height: 58px;
  }
}

/* Home motion polish: subtle 2D entrance and responsive button feedback. */
.aether-chess.home-active .home-brand,
.aether-chess.home-active .home-copy h2,
.aether-chess.home-active .home-copy p,
.aether-chess.home-active .home-divider,
.aether-chess.home-active .home-hero-art,
.aether-chess.home-active .new-game-panel,
.aether-chess.home-active .home-card {
  animation-fill-mode: both;
  animation-timing-function: ease-out;
}

.aether-chess.home-active .home-brand {
  animation-name: home-rise-in;
  animation-duration: 360ms;
  animation-delay: 30ms;
}

.aether-chess.home-active .home-copy h2 {
  animation-name: home-fade-in;
  animation-duration: 420ms;
  animation-delay: 110ms;
}

.aether-chess.home-active .home-copy p,
.aether-chess.home-active .home-divider {
  animation-name: home-fade-in;
  animation-duration: 380ms;
  animation-delay: 180ms;
}

.aether-chess.home-active .home-hero-art {
  animation-name: home-hero-in;
  animation-duration: 460ms;
  animation-delay: 170ms;
}

.aether-chess.home-active .home-hero-art img {
  animation: home-hero-breathe 12s ease-in-out 900ms infinite alternate;
  transform-origin: center center;
}

.aether-chess.home-active .new-game-panel {
  animation-name: home-rise-in;
  animation-duration: 420ms;
  animation-delay: 280ms;
}

.aether-chess.home-active .home-card {
  animation-name: home-rise-in;
  animation-duration: 360ms;
}

.aether-chess.home-active .home-card:nth-child(1) { animation-delay: 360ms; }
.aether-chess.home-active .home-card:nth-child(2) { animation-delay: 420ms; }
.aether-chess.home-active .home-card:nth-child(3) { animation-delay: 480ms; }

.aether-chess.home-active .home-tool,
.aether-chess.home-active .home-tool-icon,
.aether-chess.home-active .home-mode,
.aether-chess.home-active .home-choice,
.aether-chess.home-active .start-btn,
.aether-chess.home-active .home-card {
  transition:
    transform 160ms ease-out,
    background-color 180ms ease-out,
    border-color 180ms ease-out,
    color 180ms ease-out,
    box-shadow 180ms ease-out,
    opacity 180ms ease-out;
}

.aether-chess.home-active .home-tool:hover,
.aether-chess.home-active .home-mode:hover,
.aether-chess.home-active .home-choice:hover,
.aether-chess.home-active .start-btn:hover,
.aether-chess.home-active .home-card:hover {
  transform: translateY(-1px);
}

.aether-chess.home-active .home-tool:hover .home-tool-icon,
.aether-chess.home-active .home-mode:hover,
.aether-chess.home-active .home-choice:hover {
  border-color: rgba(198, 154, 85, 0.34);
  box-shadow: 0 4px 9px rgba(36, 27, 18, 0.08);
}

.aether-chess.home-active .start-btn:hover {
  border-color: rgba(198, 154, 85, 0.9);
  box-shadow: 0 10px 18px rgba(36, 27, 18, 0.18);
}

.aether-chess.home-active .home-card:hover {
  border-color: rgba(198, 154, 85, 0.28);
  box-shadow: 0 8px 14px rgba(36, 27, 18, 0.12);
}

.aether-chess.home-active .home-tool:active,
.aether-chess.home-active .home-mode:active,
.aether-chess.home-active .home-choice:active,
.aether-chess.home-active .start-btn:active,
.aether-chess.home-active .home-card:active {
  transform: scale(0.98);
}

.aether-chess.home-active .home-mode.active,
.aether-chess.home-active .home-choice.active {
  transition:
    transform 160ms ease-out,
    background-color 180ms ease-out,
    border-color 180ms ease-out,
    color 180ms ease-out,
    box-shadow 180ms ease-out;
}

@keyframes home-rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes home-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes home-hero-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes home-hero-breathe {
  from { transform: scale(1); }
  to { transform: scale(1.012); }
}

@media (prefers-reduced-motion: reduce) {
  .aether-chess.home-active .home-brand,
  .aether-chess.home-active .home-copy h2,
  .aether-chess.home-active .home-copy p,
  .aether-chess.home-active .home-divider,
  .aether-chess.home-active .home-hero-art,
  .aether-chess.home-active .home-hero-art img,
  .aether-chess.home-active .new-game-panel,
  .aether-chess.home-active .home-card {
    animation: none !important;
  }
}

/* Home interaction feedback: instant selection pulse and guarded start state. */
.aether-chess.home-active .home-mode.selection-pop .ui-icon,
.aether-chess.home-active .home-choice.selection-pop > .ui-icon {
  animation: setup-icon-pop 160ms ease-out;
}

.aether-chess.home-active .home-mode.selection-pop,
.aether-chess.home-active .home-choice.selection-pop {
  border-color: rgba(198, 154, 85, 0.86);
}

.aether-chess.home-active .start-btn.is-starting {
  cursor: progress;
  border-color: rgba(198, 154, 85, 0.92);
  box-shadow: 0 7px 12px rgba(36, 27, 18, 0.16);
}

.aether-chess.home-active .start-btn:disabled {
  opacity: 0.92;
}

.aether-chess.home-active .start-btn:disabled:hover {
  transform: none;
}

@keyframes setup-icon-pop {
  0% {
    transform: scale(0.96);
  }
  55% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aether-chess.home-active .home-mode.selection-pop .ui-icon,
  .aether-chess.home-active .home-choice.selection-pop > .ui-icon {
    animation: none !important;
  }
}

/* Home to gameplay transition: short 2D fade/slide with no page flash. */
.aether-chess.view-transitioning {
  pointer-events: none;
}

.home-screen.is-exiting .home-brand,
.home-screen.is-exiting .home-copy,
.home-screen.is-exiting .home-hero-art,
.home-screen.is-exiting .home-right,
.home-screen.is-exiting .home-cards {
  animation: home-view-exit 150ms ease-out both;
}

.home-screen.is-exiting .home-hero-art,
.home-screen.is-exiting .home-right {
  animation-delay: 30ms;
}

.home-screen.is-exiting .home-cards {
  animation-delay: 55ms;
}

.game-view.active.is-entering {
  animation: game-view-enter 200ms ease-out both;
}

.chess-board:focus {
  outline: none;
}

.chess-board:focus-visible {
  outline: 2px solid rgba(198, 154, 85, 0.62);
  outline-offset: 6px;
}

@keyframes home-view-exit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes game-view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-screen.is-exiting .home-brand,
  .home-screen.is-exiting .home-copy,
  .home-screen.is-exiting .home-hero-art,
  .home-screen.is-exiting .home-right,
  .home-screen.is-exiting .home-cards,
  .game-view.active.is-entering {
    animation: none !important;
  }
}

/* Responsive restructuring pass: adapt layout instead of shrinking desktop UI. */
@media (min-width: 1200px) {
  .aether-chess.home-active .home-screen {
    max-width: min(1480px, calc(100vw - 40px));
    padding: clamp(40px, 4vw, 56px) clamp(24px, 3.2vw, 48px);
  }

  .aether-chess.home-active .home-shell {
    grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
    gap: clamp(48px, 4.4vw, 64px);
  }

  .aether-chess.home-active .home-hero-art img {
    height: clamp(360px, 39vw, 520px);
  }

  .aether-chess.home-active .home-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) and (max-width: 1199px) {
  .aether-chess.home-active .home-screen {
    max-width: min(1160px, calc(100vw - 32px));
    padding: clamp(28px, 3.4vw, 42px) clamp(18px, 2.8vw, 32px);
    gap: clamp(26px, 3vw, 38px);
  }

  .aether-chess.home-active .home-shell {
    grid-template-columns: minmax(0, 50fr) minmax(0, 50fr);
    gap: clamp(24px, 3vw, 36px);
    align-items: center;
  }

  .aether-chess.home-active .home-copy h2 {
    font-size: clamp(58px, 6vw, 82px);
  }

  .aether-chess.home-active .home-copy p {
    font-size: clamp(19px, 1.8vw, 25px);
  }

  .aether-chess.home-active .home-hero-art img {
    height: clamp(280px, 32vw, 380px);
  }

  .aether-chess.home-active .new-game-panel {
    max-width: none;
    padding: 64px 18px 22px;
  }

  .aether-chess.home-active .difficulty-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aether-chess.home-active .time-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aether-chess.home-active .home-mode,
  .aether-chess.home-active .home-choice,
  .aether-chess.home-active .side-grid .home-choice,
  .aether-chess.home-active .time-grid .home-choice {
    min-height: 48px;
    font-size: 12px;
  }

  .aether-chess.home-active .home-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (min-width: 769px) and (max-width: 959px) {
  .aether-chess.home-active .home-screen {
    max-width: min(820px, calc(100vw - 32px));
    padding: 30px 20px 36px;
  }

  .aether-chess.home-active .home-shell {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .aether-chess.home-active .home-toolbar {
    justify-content: center;
  }

  .aether-chess.home-active .home-hero-art img {
    height: clamp(260px, 38vw, 340px);
  }

  .aether-chess.home-active .difficulty-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aether-chess.home-active .time-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aether-chess.home-active .home-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .aether-chess.home-active .home-screen {
    max-width: 100%;
    min-height: 100vh;
    padding: 16px;
    gap: 24px;
    overflow-x: hidden;
  }

  .aether-chess.home-active .home-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .aether-chess.home-active .home-left,
  .aether-chess.home-active .home-right {
    display: contents;
  }

  .aether-chess.home-active .home-brand {
    order: 1;
    align-items: center;
  }

  .aether-chess.home-active .home-toolbar {
    order: 2;
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .aether-chess.home-active .home-toolbar::-webkit-scrollbar {
    display: none;
  }

  .aether-chess.home-active .home-copy {
    order: 3;
    width: 100%;
    text-align: left;
    padding-top: 2px;
  }

  .aether-chess.home-active .home-copy h2 {
    font-size: clamp(42px, 13vw, 64px);
    line-height: 0.96;
  }

  .aether-chess.home-active .home-copy p {
    font-size: clamp(18px, 5vw, 24px);
  }

  .aether-chess.home-active .home-divider {
    margin-left: 0;
    width: min(260px, 78%);
  }

  .aether-chess.home-active .home-hero-art {
    order: 4;
    margin: 0;
  }

  .aether-chess.home-active .home-hero-art img {
    height: clamp(210px, 56vw, 320px);
    width: 100%;
    object-position: center 58%;
  }

  .aether-chess.home-active .home-right {
    order: 5;
  }

  .aether-chess.home-active .new-game-panel {
    order: 5;
    width: 100%;
    padding: 62px 14px 18px;
  }

  .aether-chess.home-active .home-mode-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aether-chess.home-active .difficulty-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aether-chess.home-active .side-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aether-chess.home-active .time-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aether-chess.home-active .home-mode,
  .aether-chess.home-active .home-choice,
  .aether-chess.home-active .side-grid .home-choice,
  .aether-chess.home-active .time-grid .home-choice {
    min-height: 48px;
    padding: 10px 8px;
    font-size: 14px;
  }

  .aether-chess.home-active .home-mode .ui-icon,
  .aether-chess.home-active .home-choice > .ui-icon {
    width: 18px;
    height: 18px;
  }

  .aether-chess.home-active .start-btn {
    width: 100%;
    min-height: 58px;
  }

  .aether-chess.home-active .home-cards {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0;
    margin-top: 0;
  }

  .aether-chess.home-active .home-card {
    min-height: 76px;
    padding: 14px 16px;
  }
}

@media (max-width: 430px) {
  .aether-chess.home-active .home-screen {
    padding: 16px;
  }

  .aether-chess.home-active .difficulty-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aether-chess.home-active .side-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aether-chess.home-active .side-grid .home-choice:last-child {
    grid-column: 1 / -1;
  }

  .aether-chess.home-active .home-mode,
  .aether-chess.home-active .home-choice,
  .aether-chess.home-active .side-grid .home-choice,
  .aether-chess.home-active .time-grid .home-choice {
    min-height: 46px;
    font-size: 14px;
  }
}

/* Premium startup and match loading */
.aether-chess.is-booting {
  visibility: hidden;
}

.app-loader,
.match-loader {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  color: #24211d;
  background:
    radial-gradient(circle at 50% 18%, rgba(202, 161, 94, 0.16), transparent 32%),
    linear-gradient(135deg, #f6efe3 0%, #efe1cd 48%, #dbc5a8 100%);
}

.app-loader {
  opacity: 1;
  transition: opacity 320ms ease-out, visibility 320ms ease-out;
}

.app-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-loader.is-gone {
  display: none;
}

.loader-card {
  width: min(420px, 92vw);
  display: grid;
  justify-items: center;
  gap: clamp(10px, 2vw, 16px);
  text-align: center;
  animation: loader-card-enter 420ms ease-out both;
}

.loader-logo {
  position: relative;
  width: clamp(76px, 17vw, 108px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(190, 140, 64, 0.64);
  border-radius: 22px;
  color: #d9b977;
  background: linear-gradient(145deg, #302a22, #171614);
  box-shadow: 0 18px 34px rgba(61, 39, 19, 0.2), inset 0 0 0 1px rgba(255, 240, 198, 0.14);
  font-family: var(--font-display);
  font-size: clamp(42px, 9vw, 64px);
  line-height: 1;
}

.loader-logo .ui-icon {
  position: absolute;
  top: 14%;
  width: 28%;
  height: 28%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28));
}

.loader-logo span {
  transform: translateY(5%);
}

.loader-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 8vw, 56px);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
}

.loader-subtitle {
  font-size: clamp(11px, 2.4vw, 13px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #8b6538;
}

.loader-board {
  position: relative;
  width: clamp(120px, 28vw, 168px);
  aspect-ratio: 4 / 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid rgba(113, 74, 33, 0.28);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(74, 48, 24, 0.14);
}

.loader-board span:nth-child(odd) {
  background: linear-gradient(145deg, #8e5c31, #5d371d);
}

.loader-board span:nth-child(even) {
  background: linear-gradient(145deg, #f3dfbd, #d4ad70);
}

.loader-board img {
  position: absolute;
  left: 51%;
  bottom: 7%;
  width: 34%;
  height: 72%;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 8px 8px rgba(30, 22, 14, 0.24));
  animation: loader-piece-enter 600ms ease-out both 140ms;
}

.loader-text {
  min-height: 18px;
  font-size: clamp(13px, 2.6vw, 15px);
  color: #695747;
}

.loader-progress {
  width: min(260px, 70vw);
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(81, 55, 30, 0.14);
}

.loader-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8a5a2f, #d5b36c, #9b6a35);
  transition: width 180ms ease-out;
}

.match-loader {
  z-index: 2500;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(211, 174, 103, 0.18), transparent 30%),
    rgba(244, 235, 222, 0.92);
  transition: opacity 220ms ease-out, visibility 220ms ease-out;
}

.match-loader.show {
  opacity: 1;
  visibility: visible;
}

.match-loader-card {
  width: min(340px, 88vw);
  padding: 26px 28px 24px;
  text-align: center;
  border: 1px solid rgba(166, 119, 54, 0.28);
  border-radius: 18px;
  background: linear-gradient(145deg, #fff9ee, #eadcc7);
  box-shadow: 0 24px 54px rgba(65, 41, 20, 0.18);
  transform: translateY(8px);
  transition: transform 260ms ease-out;
}

.match-loader.show .match-loader-card {
  transform: translateY(0);
}

.match-loader-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 6vw, 34px);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.match-loader-text {
  margin-top: 8px;
  font-size: 14px;
  color: #695747;
}

.match-loader-meta {
  margin-top: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8a6638;
}

.match-loader-line {
  height: 3px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(81, 55, 30, 0.13);
}

.match-loader-line span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7b4d27, #d7b86f);
  animation: match-loader-line 520ms ease-in-out infinite alternate;
}

@keyframes loader-card-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loader-piece-enter {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes match-loader-line {
  from {
    transform: translateX(-12%);
  }
  to {
    transform: translateX(150%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-loader,
  .loader-card,
  .loader-board img,
  .match-loader,
  .match-loader-card,
  .loader-progress span {
    animation: none !important;
    transition: opacity 180ms ease-out, visibility 180ms ease-out !important;
    transform: none !important;
  }

  .match-loader-line span {
    animation: none !important;
    width: 100%;
    transform: none;
  }
}

/* Premium game lobby home */
.aether-chess.home-active .home-screen {
  width: min(100%, 1480px);
  max-width: min(1480px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  padding: clamp(14px, 1.8vw, 28px);
  gap: clamp(18px, 2vw, 30px);
  justify-content: start;
  color: #f8efdf;
  background:
    radial-gradient(circle at 22% 20%, rgba(204, 157, 82, 0.18), transparent 32%),
    linear-gradient(135deg, #f3e6d3 0%, #dfc6a6 42%, #6e4323 100%);
  border: 1px solid rgba(96, 62, 31, 0.18);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(45, 30, 16, 0.18);
  overflow: hidden;
}

.aether-chess.home-active .home-screen::before {
  opacity: 0.16;
}

.aether-chess.home-active .lobby-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.aether-chess.home-active .home-brand {
  gap: 12px;
}

.aether-chess.home-active .logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 29px;
  box-shadow: 0 10px 22px rgba(30, 21, 14, 0.2);
}

.aether-chess.home-active .logo-crown {
  width: 15px;
  height: 15px;
}

.aether-chess.home-active .home-title {
  color: #241f1a;
  font-size: clamp(20px, 1.7vw, 28px);
  letter-spacing: 0.08em;
  line-height: 1;
}

.aether-chess.home-active .home-subtitle {
  margin-top: 4px;
  color: rgba(72, 48, 30, 0.56);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.aether-chess.home-active .home-toolbar {
  order: initial;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.aether-chess.home-active .player-rating,
.aether-chess.home-active .home-tool {
  min-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(55, 38, 24, 0.14);
  border-radius: 999px;
  background: rgba(255, 247, 234, 0.62);
  color: #2c2621;
  box-shadow: 0 6px 14px rgba(42, 29, 17, 0.08);
}

.aether-chess.home-active .player-rating {
  padding: 0 14px;
  font-weight: 700;
  font-size: 13px;
}

.aether-chess.home-active .home-tool .ui-icon,
.aether-chess.home-active .player-rating .ui-icon {
  width: 21px;
  height: 21px;
}

.aether-chess.home-active .lobby-shell {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(390px, 0.84fr);
  gap: clamp(22px, 2.4vw, 36px);
  align-items: stretch;
}

.aether-chess.home-active .lobby-hero {
  position: relative;
  min-height: clamp(430px, 56vh, 640px);
  overflow: hidden;
  border-radius: 26px;
  background: #211813;
  box-shadow: 0 28px 60px rgba(34, 23, 14, 0.28);
}

.aether-chess.home-active .lobby-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 44% 58%;
  transform-origin: center;
  animation: lobby-hero-zoom 11s ease-in-out infinite alternate;
}

.aether-chess.home-active .lobby-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(24, 18, 14, 0.82) 0%, rgba(24, 18, 14, 0.54) 42%, transparent 78%),
    linear-gradient(0deg, rgba(20, 15, 12, 0.58) 0%, transparent 46%);
}

.aether-chess.home-active .lobby-hero-content {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: inherit;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: clamp(26px, 4vw, 56px);
}

.aether-chess.home-active .home-copy {
  order: initial;
  width: min(620px, 100%);
  padding: 0;
  text-align: left;
}

.aether-chess.home-active .home-copy h2 {
  color: #fff4df;
  font-size: clamp(50px, 5.4vw, 94px);
  line-height: 0.9;
  text-transform: uppercase;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.34);
}

.aether-chess.home-active .home-copy p {
  margin-top: 14px;
  color: rgba(255, 235, 201, 0.88);
  font-family: var(--font-display);
  font-size: clamp(20px, 2.1vw, 34px);
}

.aether-chess.home-active .lobby-play-now {
  width: min(340px, 100%);
  min-height: 66px;
  margin-top: clamp(24px, 3vw, 38px);
  padding: 0 26px;
  justify-content: center;
  gap: 14px;
  font-size: clamp(18px, 1.6vw, 24px);
  letter-spacing: 0.12em;
}

.aether-chess.home-active .continue-status {
  margin-top: 14px;
  color: rgba(255, 238, 208, 0.72);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aether-chess.home-active .next-match-card {
  position: relative;
  width: 100%;
  max-width: none;
  justify-self: stretch;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 2.4vw, 34px);
  border-radius: 24px;
  background: rgba(255, 249, 239, 0.93);
  border: 1px solid rgba(54, 37, 24, 0.14);
  box-shadow: 0 20px 44px rgba(43, 28, 17, 0.18);
  animation: home-rise-in 420ms ease-out both 180ms;
}

.aether-chess.home-active .next-match-card::before,
.aether-chess.home-active .panel-crown {
  display: none;
}

.aether-chess.home-active .match-kicker {
  color: rgba(35, 30, 25, 0.62);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.aether-chess.home-active .opponent-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(63, 43, 28, 0.12);
  border-radius: 18px;
  background: linear-gradient(145deg, #26221e, #171614);
  color: #fff3dd;
}

.aether-chess.home-active .opponent-card.hidden {
  display: none;
}

.aether-chess.home-active .opponent-icon {
  width: 42px;
  height: 42px;
}

.aether-chess.home-active .opponent-card strong,
.aether-chess.home-active .opponent-card span {
  display: block;
}

.aether-chess.home-active .opponent-card strong {
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.aether-chess.home-active .opponent-card span {
  margin-top: 4px;
  color: rgba(255, 230, 191, 0.72);
  font-size: 13px;
}

.aether-chess.home-active .difficulty-change {
  margin-left: auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(213, 174, 103, 0.42);
  border-radius: 999px;
  background: rgba(255, 246, 225, 0.08);
  color: #e8ca88;
  font-weight: 700;
}

.aether-chess.home-active .difficulty-popover {
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: -4px 0 18px;
}

.aether-chess.home-active .difficulty-popover.open {
  display: grid;
}

.aether-chess.home-active .home-option-group {
  margin: 0 0 20px;
}

.aether-chess.home-active .field-label,
.aether-chess.home-active .new-game-panel .field-label {
  margin-bottom: 10px;
  color: rgba(35, 30, 25, 0.64);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.aether-chess.home-active .side-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.aether-chess.home-active .time-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.aether-chess.home-active .home-choice {
  min-height: 50px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(65, 45, 31, 0.13);
  color: #28231e;
  font-size: 13px;
  font-weight: 700;
}

.aether-chess.home-active .home-choice .ui-icon {
  width: 19px;
  height: 19px;
}

.aether-chess.home-active .home-choice.active {
  background: #24211d;
  border-color: rgba(211, 171, 97, 0.82);
  color: #fff4df;
  box-shadow: 0 8px 18px rgba(37, 27, 18, 0.18);
}

.aether-chess.home-active .match-start-btn {
  margin-top: auto;
  min-height: 66px;
  justify-content: center;
  gap: 13px;
  font-size: clamp(17px, 1.4vw, 22px);
  letter-spacing: 0.11em;
}

.aether-chess.home-active .start-btn {
  background: linear-gradient(145deg, #2a2723, #151413);
  border-color: rgba(213, 174, 103, 0.72);
  color: #f6d995;
  box-shadow: 0 14px 28px rgba(35, 24, 15, 0.22), inset 0 0 0 1px rgba(255, 238, 190, 0.08);
}

.aether-chess.home-active .start-btn:hover {
  border-color: rgba(232, 194, 112, 0.94);
  box-shadow: 0 18px 34px rgba(35, 24, 15, 0.28), inset 0 0 0 1px rgba(255, 238, 190, 0.12);
}

.aether-chess.home-active .start-btn:hover .cta-arrow {
  transform: translateX(4px);
}

.aether-chess.home-active .mode-cards {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.5vw, 22px);
  margin: 0;
  padding: 0;
}

.aether-chess.home-active .mode-card {
  min-height: 112px;
  border-radius: 20px;
  border-color: rgba(255, 233, 196, 0.18);
  background: rgba(31, 27, 23, 0.9);
  box-shadow: 0 14px 30px rgba(31, 21, 14, 0.16);
}

.aether-chess.home-active .mode-card.active {
  border-color: rgba(215, 176, 103, 0.56);
}

.aether-chess.home-active .mode-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(31, 21, 14, 0.22);
}

.aether-chess.home-active .mode-card > .ui-icon:first-child {
  width: 42px;
  height: 42px;
}

.aether-chess.home-active .mode-card strong {
  font-size: clamp(16px, 1.2vw, 21px);
  letter-spacing: 0.04em;
}

.aether-chess.home-active .mode-card small {
  color: rgba(255, 240, 215, 0.68);
}

.aether-chess.home-active .progress-strip {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 238, 202, 0.18);
  border-radius: 18px;
  background: rgba(32, 27, 23, 0.58);
  color: rgba(255, 244, 224, 0.86);
}

.aether-chess.home-active .progress-strip span,
.aether-chess.home-active .progress-strip strong {
  display: block;
}

.aether-chess.home-active .progress-strip > div:first-child span {
  color: rgba(255, 226, 178, 0.62);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.aether-chess.home-active .progress-strip strong {
  margin-top: 4px;
  font-size: 15px;
}

.aether-chess.home-active .progress-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.aether-chess.home-active .progress-steps span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 238, 202, 0.14);
  border-radius: 999px;
  color: rgba(255, 244, 224, 0.58);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.aether-chess.home-active .progress-steps span.active {
  border-color: rgba(215, 176, 103, 0.72);
  background: rgba(215, 176, 103, 0.14);
  color: #f6d995;
}

@keyframes lobby-hero-zoom {
  from { transform: scale(1); }
  to { transform: scale(1.018); }
}

@media (min-width: 769px) and (max-width: 1199px) {
  .aether-chess.home-active .home-screen {
    max-width: min(1120px, calc(100vw - 24px));
  }

  .aether-chess.home-active .lobby-shell {
    grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
    gap: 18px;
  }

  .aether-chess.home-active .lobby-hero {
    min-height: clamp(430px, 54vh, 570px);
  }

  .aether-chess.home-active .time-grid,
  .aether-chess.home-active .difficulty-popover {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Beginner move assistance */
.hint-area {
  grid-area: hint;
  width: min(100%, 760px);
  justify-self: center;
  display: grid;
  gap: 8px;
}

.assist-prompt {
  display: none;
  justify-self: center;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 4px;
  border: 1px solid rgba(196, 154, 86, 0.34);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: 0 12px 26px rgba(45, 32, 18, 0.12), inset 0 1px 0 rgba(255,255,255,0.75);
  animation: assist-prompt-in 200ms ease-out both;
}

.assist-prompt.show {
  display: inline-flex;
}

.assist-prompt-main,
.assist-prompt-dismiss {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: #2b241d;
  font-family: var(--font-ui);
}

.assist-prompt-main {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.assist-prompt-main .ui-icon {
  width: 20px;
  height: 20px;
}

.assist-prompt-dismiss {
  width: 36px;
  display: grid;
  place-items: center;
  border-left: 1px solid rgba(77, 54, 32, 0.12);
  opacity: 0.72;
}

.assist-prompt-dismiss .ui-icon {
  width: 16px;
  height: 16px;
}

.assist-prompt-main:hover,
.assist-prompt-dismiss:hover {
  color: #8a612b;
}

.hide-hint-button #btnHint {
  display: none !important;
}

.hint-message.show {
  display: grid;
  gap: 2px;
}

.hint-message strong {
  font-weight: 700;
}

.hint-message span {
  color: rgba(92, 68, 38, 0.76);
  font-size: 12px;
}

.aether-chess.game-active .square.hint-from::before {
  opacity: 1;
  border: 3px solid rgba(229, 186, 94, 0.92);
  background: rgba(229, 186, 94, 0.16);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.34), 0 0 18px rgba(229, 186, 94, 0.32);
}

.aether-chess.game-active .square.hint-to::before {
  opacity: 1;
  background: radial-gradient(circle, rgba(229, 186, 94, 0.36), rgba(229, 186, 94, 0.1) 58%, transparent 72%);
}

.aether-chess.game-active .square.hint-to::after {
  width: 44%;
  height: 44%;
  top: 28%;
  left: 28%;
  border: 3px solid rgba(229, 186, 94, 0.9);
  background: rgba(255, 235, 178, 0.18);
  box-shadow: 0 0 16px rgba(229, 186, 94, 0.32), inset 0 0 0 1px rgba(255,255,255,0.35);
}

.settings-choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.settings-choice {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(75, 52, 36, 0.13);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.68);
  color: #29241f;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 170ms ease, background-color 170ms ease;
}

.settings-choice:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 159, 83, 0.42);
  box-shadow: 0 8px 16px rgba(45, 30, 18, 0.1);
}

.settings-choice.active {
  border-color: rgba(201, 159, 83, 0.78);
  background: #24211d;
  color: #f7ecd8;
  box-shadow: 0 10px 20px rgba(45, 30, 18, 0.14);
}

@keyframes assist-prompt-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .hint-area {
    width: 100%;
  }

  .assist-prompt {
    justify-self: stretch;
    width: 100%;
  }

  .assist-prompt-main {
    flex: 1;
    justify-content: center;
  }

  .settings-choice-group {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .assist-prompt,
  .settings-choice {
    animation: none !important;
    transition: none !important;
  }
}

/* Loading screen final polish */
body:has(.aether-chess.is-booting) {
  overflow: hidden;
}

.aether-chess.is-booting {
  max-height: 100vh;
  overflow: hidden;
}

.app-loader {
  inline-size: 100vw;
  block-size: 100vh;
  overflow: hidden;
  padding: clamp(18px, 4vw, 44px);
  background:
    radial-gradient(circle at 50% 36%, rgba(229, 197, 132, 0.18), transparent 28%),
    radial-gradient(circle at 18% 18%, rgba(94, 61, 30, 0.08), transparent 28%),
    linear-gradient(145deg, #f8f1e6 0%, #eadcc6 56%, #d7bd99 100%);
}

.loader-card {
  width: min(88vw, 520px);
  max-height: calc(100vh - 48px);
  align-content: center;
  gap: clamp(14px, 2.4vh, 22px);
  padding: 0;
  transform-origin: center;
}

.loader-brand-full {
  width: clamp(260px, 38vw, 430px);
  max-width: min(86vw, 430px);
  filter:
    drop-shadow(0 14px 24px rgba(68, 43, 20, 0.14))
    drop-shadow(0 1px 0 rgba(255, 249, 229, 0.5));
}

.loader-text {
  min-height: auto;
  color: rgba(54, 43, 34, 0.72);
  font-size: clamp(13px, 1.05vw, 15px);
  font-weight: 500;
}

.loader-progress {
  position: relative;
  width: min(240px, 54vw);
  height: 3px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(78, 50, 25, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.loader-progress::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 248, 222, 0.42);
  pointer-events: none;
}

.loader-progress span {
  background: linear-gradient(90deg, #7a4d25, #d6b76b 54%, #8a5a2f);
  box-shadow: 0 0 14px rgba(207, 165, 83, 0.34);
}

@media (max-width: 480px) {
  .loader-card {
    width: min(90vw, 360px);
    gap: 14px;
  }

  .loader-brand-full {
    width: min(76vw, 300px);
  }

  .loader-progress {
    width: min(220px, 62vw);
  }
}

@media (max-height: 620px) and (min-width: 769px) {
  .loader-card {
    gap: 12px;
  }

  .loader-brand-full {
    width: clamp(300px, 34vw, 390px);
  }
}

@media (max-width: 768px) {
  .aether-chess.home-active .home-screen {
    max-width: 100%;
    min-height: 100vh;
    padding: 14px;
    border-radius: 0;
    gap: 16px;
  }

  .aether-chess.home-active .lobby-header {
    order: 1;
  }

  .aether-chess.home-active .player-rating {
    display: none;
  }

  .aether-chess.home-active .home-title {
    font-size: 20px;
  }

  .aether-chess.home-active .home-subtitle {
    display: none;
  }

  .aether-chess.home-active .home-toolbar {
    gap: 8px;
  }

  .aether-chess.home-active .home-tool {
    width: 44px;
    height: 44px;
  }

  .aether-chess.home-active .lobby-shell {
    order: 2;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .aether-chess.home-active .lobby-hero {
    min-height: clamp(360px, 68vh, 560px);
    border-radius: 22px;
  }

  .aether-chess.home-active .lobby-hero-content {
    padding: 22px;
  }

  .aether-chess.home-active .home-copy h2 {
    font-size: clamp(42px, 14vw, 66px);
  }

  .aether-chess.home-active .home-copy p {
    font-size: clamp(18px, 6vw, 26px);
  }

  .aether-chess.home-active .lobby-play-now {
    width: 100%;
    min-height: 64px;
  }

  .aether-chess.home-active .next-match-card {
    border-radius: 22px;
    padding: 18px;
  }

  .aether-chess.home-active .side-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aether-chess.home-active .time-grid,
  .aether-chess.home-active .difficulty-popover {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aether-chess.home-active .home-choice,
  .aether-chess.home-active .start-btn {
    min-height: 44px;
    font-size: 14px;
  }

  .aether-chess.home-active .match-start-btn {
    min-height: 60px;
  }

  .aether-chess.home-active .mode-cards {
    order: 3;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .aether-chess.home-active .mode-card {
    min-height: 88px;
    padding: 16px;
  }

  .aether-chess.home-active .progress-strip {
    order: 4;
    align-items: flex-start;
    flex-direction: column;
  }

  .aether-chess.home-active .progress-steps {
    justify-content: flex-start;
  }
}

@media (max-width: 380px) {
  .aether-chess.home-active .home-screen {
    padding: 10px;
  }

  .aether-chess.home-active .logo-mark {
    width: 42px;
    height: 42px;
  }

  .aether-chess.home-active .lobby-hero {
    min-height: 340px;
  }

  .aether-chess.home-active .side-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aether-chess.home-active .side-grid .home-choice:last-child {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aether-chess.home-active .lobby-hero-img {
    animation: none !important;
  }
}

/* Premium extracted chess-piece assets */
.piece {
  overflow: visible;
}

.piece-img,
.premium-piece-ui {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  aspect-ratio: 1 / 1;
}

.aether-chess.game-active .piece {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.aether-chess.game-active .piece-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: none;
}

.aether-chess.game-active .piece-ghost .piece-img,
.aether-chess.game-active .piece.dragging .piece-img {
  filter: drop-shadow(0 10px 14px rgba(20, 14, 9, 0.24));
}

.aether-chess.home-active .premium-piece-ui {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.aether-chess.home-active .opponent-icon.premium-piece-ui {
  width: 54px;
  height: 54px;
}

.aether-chess.home-active .difficulty-popover .premium-piece-ui {
  width: 30px;
  height: 30px;
}

.loader-board img {
  object-fit: contain;
  object-position: center;
}

@media (max-width: 768px) {
  .aether-chess.game-active .piece {
    width: 100%;
    height: 100%;
  }

  .aether-chess.home-active .difficulty-popover .premium-piece-ui {
    width: 28px;
    height: 28px;
  }
}

/* Compact premium game-lobby refinement */
.aether-chess.home-active .home-screen {
  max-width: min(1480px, calc(100vw - 24px));
  min-height: calc(100vh - 24px);
  padding: clamp(18px, 1.75vw, 26px);
  gap: clamp(14px, 1.5vw, 22px);
  border-radius: 24px;
}

.aether-chess.home-active .lobby-header {
  gap: 12px;
}

.aether-chess.home-active .home-brand {
  gap: 10px;
}

.aether-chess.home-active .logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 25px;
}

.aether-chess.home-active .logo-crown {
  width: 13px;
  height: 13px;
}

.aether-chess.home-active .home-title {
  font-size: clamp(24px, 1.75vw, 30px);
}

.aether-chess.home-active .home-subtitle {
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.14em;
}

.aether-chess.home-active .player-rating,
.aether-chess.home-active .home-tool {
  min-width: 40px;
  height: 40px;
}

.aether-chess.home-active .player-rating {
  padding: 0 12px;
  font-size: 12px;
}

.aether-chess.home-active .home-tool .ui-icon,
.aether-chess.home-active .player-rating .ui-icon {
  width: 18px;
  height: 18px;
}

.aether-chess.home-active .lobby-shell {
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  gap: clamp(18px, 2vw, 28px);
}

.aether-chess.home-active .lobby-hero {
  min-height: clamp(330px, 30vw, 480px);
  aspect-ratio: 1.72 / 1;
  border-radius: 22px;
}

.aether-chess.home-active .lobby-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 18%, rgba(255, 226, 171, 0.08) 46%, transparent 72%);
  opacity: 0.52;
  transform: translateX(-18%);
  animation: lobby-light-sweep 12s ease-in-out infinite alternate;
}

.aether-chess.home-active .lobby-hero::after {
  z-index: 0;
}

.aether-chess.home-active .lobby-hero-img {
  object-position: 45% 58%;
  animation-duration: 13s;
}

.aether-chess.home-active .lobby-hero-content {
  z-index: 2;
  padding: clamp(22px, 3vw, 40px);
}

.aether-chess.home-active .home-copy h2 {
  font-size: clamp(42px, 4.5vw, 68px);
  line-height: 0.92;
}

.aether-chess.home-active .home-copy p {
  margin-top: 8px;
  font-size: clamp(18px, 1.6vw, 22px);
}

.aether-chess.home-active .lobby-play-now {
  width: min(300px, 100%);
  min-height: 56px;
  margin-top: 18px;
  padding: 0 20px;
  gap: 11px;
  border-radius: 13px;
  font-size: clamp(15px, 1.2vw, 18px);
}

.aether-chess.home-active .continue-status {
  margin-top: 10px;
  font-size: 11px;
}

.aether-chess.home-active .next-match-card {
  padding: clamp(20px, 1.8vw, 24px);
  border-radius: 22px;
}

.aether-chess.home-active .match-kicker,
.aether-chess.home-active .field-label,
.aether-chess.home-active .new-game-panel .field-label {
  font-size: 10px;
  letter-spacing: 0.12em;
}

.aether-chess.home-active .opponent-card {
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
}

.aether-chess.home-active .opponent-card strong {
  font-size: 16px;
}

.aether-chess.home-active .opponent-card span {
  margin-top: 2px;
  font-size: 12px;
}

.aether-chess.home-active .opponent-icon.premium-piece-ui {
  width: 44px;
  height: 44px;
}

.aether-chess.home-active .difficulty-change {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.aether-chess.home-active .home-option-group {
  margin-bottom: 16px;
}

.aether-chess.home-active .field-label,
.aether-chess.home-active .new-game-panel .field-label {
  margin-bottom: 8px;
}

.aether-chess.home-active .home-choice {
  min-height: 42px;
  padding: 8px 9px;
  border-radius: 11px;
  font-size: 12px;
}

.aether-chess.home-active .home-choice .ui-icon,
.aether-chess.home-active .home-choice > .ui-icon {
  width: 17px;
  height: 17px;
}

.aether-chess.home-active .difficulty-popover {
  gap: 8px;
  margin: -2px 0 14px;
}

.aether-chess.home-active .difficulty-popover .premium-piece-ui {
  width: 24px;
  height: 24px;
}

.aether-chess.home-active .match-start-btn {
  min-height: 54px;
  border-radius: 13px;
  gap: 11px;
  font-size: clamp(15px, 1.1vw, 18px);
}

.aether-chess.home-active .start-btn .ui-icon {
  width: 18px;
  height: 18px;
}

.aether-chess.home-active .mode-cards {
  gap: clamp(12px, 1.2vw, 18px);
}

.aether-chess.home-active .mode-card {
  min-height: 74px;
  padding: 13px 18px;
  border-radius: 16px;
  opacity: 1;
  animation: none;
  border-color: rgba(232, 205, 158, 0.22);
  background: linear-gradient(145deg, rgba(36, 31, 26, 0.96), rgba(24, 21, 18, 0.94));
}

.aether-chess.home-active .mode-card > .ui-icon:first-child {
  width: 32px;
  height: 32px;
  transition: transform 160ms ease-out;
}

.aether-chess.home-active .mode-card:hover > .ui-icon:first-child {
  transform: translateY(-1px) scale(1.04);
}

.aether-chess.home-active .mode-card strong {
  font-size: clamp(14px, 0.95vw, 16px);
}

.aether-chess.home-active .mode-card small {
  margin-top: 3px;
  font-size: clamp(11px, 0.8vw, 13px);
}

.aether-chess.home-active .progress-strip {
  min-height: 58px;
  padding: 10px 14px;
  border-radius: 14px;
}

.aether-chess.home-active .progress-strip > div:first-child span {
  font-size: 10px;
}

.aether-chess.home-active .progress-strip strong {
  margin-top: 2px;
  font-size: 13px;
}

.aether-chess.home-active .progress-steps {
  position: relative;
  gap: 6px;
}

.aether-chess.home-active .progress-steps::before {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  height: 1px;
  background: rgba(255, 238, 202, 0.16);
}

.aether-chess.home-active .progress-steps span {
  position: relative;
  z-index: 1;
  padding: 6px 9px;
  background: rgba(32, 27, 23, 0.78);
  font-size: 10px;
}

@keyframes lobby-light-sweep {
  from { transform: translateX(-20%); opacity: 0.28; }
  to { transform: translateX(16%); opacity: 0.52; }
}

@media (min-width: 1200px) and (max-height: 820px) {
  .aether-chess.home-active .home-screen {
    padding: 18px 22px;
    gap: 14px;
  }

  .aether-chess.home-active .lobby-hero {
    min-height: clamp(315px, 28vw, 400px);
  }

  .aether-chess.home-active .home-copy h2 {
    font-size: clamp(40px, 4.1vw, 60px);
  }

  .aether-chess.home-active .mode-card {
    min-height: 68px;
  }

  .aether-chess.home-active .progress-strip {
    min-height: 54px;
  }
}

@media (min-width: 769px) and (max-width: 1199px) {
  .aether-chess.home-active .home-screen {
    padding: 18px;
    gap: 16px;
  }

  .aether-chess.home-active .lobby-shell {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.92fr);
    gap: 16px;
  }

  .aether-chess.home-active .lobby-hero {
    min-height: clamp(300px, 34vw, 390px);
  }
}

@media (max-width: 768px) {
  .aether-chess.home-active .home-screen {
    padding: 12px;
    gap: 13px;
  }

  .aether-chess.home-active .logo-mark {
    width: 40px;
    height: 40px;
  }

  .aether-chess.home-active .home-brand {
    order: 0;
  }

  .aether-chess.home-active .home-toolbar {
    order: 1;
  }

  .aether-chess.home-active .lobby-shell {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .aether-chess.home-active .lobby-hero {
    min-height: clamp(280px, 48vh, 360px);
    aspect-ratio: auto;
  }

  .aether-chess.home-active .lobby-hero-content {
    padding: 18px;
  }

  .aether-chess.home-active .home-copy h2 {
    font-size: clamp(36px, 12vw, 54px);
  }

  .aether-chess.home-active .home-copy p {
    margin-top: 6px;
    font-size: clamp(17px, 5vw, 22px);
  }

  .aether-chess.home-active .lobby-play-now,
  .aether-chess.home-active .match-start-btn {
    min-height: 52px;
  }

  .aether-chess.home-active .next-match-card {
    padding: 16px;
  }

  .aether-chess.home-active .home-choice {
    min-height: 44px;
    font-size: 12px;
  }

  .aether-chess.home-active .mode-card {
    min-height: 72px;
    padding: 12px 14px;
  }

  .aether-chess.home-active .progress-strip {
    min-height: 62px;
    gap: 10px;
  }
}

@media (max-width: 380px) {
  .aether-chess.home-active .home-screen {
    padding: 10px;
  }

  .aether-chess.home-active .lobby-hero {
    min-height: 260px;
  }

  .aether-chess.home-active .mode-card {
    min-height: 68px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aether-chess.home-active .lobby-hero::before {
    animation: none !important;
  }
}

@media (max-width: 768px) {
  .aether-chess.home-active .opponent-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 10px 12px;
    margin-top: 12px;
    margin-bottom: 12px;
  }

  .aether-chess.home-active .opponent-icon.premium-piece-ui {
    width: 40px;
    height: 40px;
  }

  .aether-chess.home-active .opponent-card strong {
    font-size: 14px;
  }

  .aether-chess.home-active .opponent-card span {
    font-size: 11px;
  }

  .aether-chess.home-active .difficulty-change {
    min-height: 34px;
    padding: 0 10px;
  }

  .aether-chess.home-active .side-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aether-chess.home-active .side-grid .home-choice:last-child {
    grid-column: auto;
  }

  .aether-chess.home-active .home-option-group {
    margin-bottom: 12px;
  }

  .aether-chess.home-active .progress-strip {
    min-height: 70px;
    gap: 8px;
  }

  .aether-chess.home-active .progress-steps {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .aether-chess.home-active .progress-steps::before {
    display: none;
  }

  .aether-chess.home-active .progress-steps span {
    padding: 6px 3px;
    text-align: center;
    font-size: 9px;
  }
}

/* Settings UX */
.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.settings-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(83, 58, 38, 0.14);
  border-radius: 999px;
  background: rgba(255, 249, 239, 0.72);
  color: #27221e;
}

.settings-close .ui-icon {
  width: 18px;
  height: 18px;
}

.settings-modal {
  background: rgba(20, 16, 12, 0.46);
  backdrop-filter: blur(3px);
}

.settings-modal.show {
  display: flex;
  animation: settings-backdrop-in 180ms ease-out both;
}

.settings-box {
  width: min(900px, 94vw);
  max-height: min(88vh, 760px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 22px;
  border-radius: 20px;
  border: 1px solid rgba(92, 63, 38, 0.18);
  background:
    radial-gradient(circle at 18% 0%, rgba(215, 177, 105, 0.16), transparent 34%),
    linear-gradient(145deg, #fff8ed, #eadbc4);
  box-shadow: 0 28px 82px rgba(26, 18, 12, 0.32);
  color: #26221d;
  animation: settings-panel-in 220ms ease-out both;
}

.settings-box .settings-panel {
  min-height: 0;
}

.settings-head {
  margin: 0;
  padding-bottom: 2px;
}

.settings-kicker {
  color: rgba(38, 34, 29, 0.68);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.settings-title {
  margin-top: 5px;
  color: #251f19;
  font-family: var(--font-display);
  font-size: clamp(21px, 1.9vw, 28px);
  line-height: 1.08;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(87, 58, 34, 0.14);
  scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(38, 34, 29, 0.66);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.settings-tab.active {
  border-color: rgba(201, 159, 83, 0.58);
  background: #24211d;
  color: #fff4df;
}

.settings-panel {
  display: none;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 4px;
}

.settings-panel.active {
  display: block;
  flex: 1 1 auto;
  animation: settings-content-in 150ms ease-out both;
}

.settings-section {
  margin: 0 0 12px;
}

.settings-label {
  margin-bottom: 10px;
  color: rgba(38, 34, 29, 0.66);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.settings-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.piece-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.theme-option,
.piece-option {
  position: relative;
  min-width: 0;
  min-height: 62px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(75, 52, 36, 0.14);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.68);
  color: #29241f;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  box-shadow: none;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 170ms ease, background-color 170ms ease;
}

.theme-option::after,
.piece-option::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.8);
  background: #c99f53;
  box-shadow: inset 0 0 0 4px #24211d;
  transition: opacity 160ms ease, transform 160ms ease;
}

.theme-option:hover,
.piece-option:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 159, 83, 0.42);
  box-shadow: 0 10px 18px rgba(45, 30, 18, 0.12);
}

.theme-option.active,
.piece-option.active {
  border-color: rgba(201, 159, 83, 0.84);
  background: rgba(255, 250, 240, 0.94);
  box-shadow: 0 10px 20px rgba(45, 30, 18, 0.13);
}

.theme-option.active::after,
.piece-option.active::after {
  opacity: 1;
  transform: scale(1);
}

.theme-preview {
  width: 100%;
  aspect-ratio: 1.95;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(48, 31, 18, 0.16);
  background-size: 50% 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.theme-preview::before {
  content: '';
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  background-image:
    linear-gradient(45deg, var(--mini-light) 25%, transparent 25%),
    linear-gradient(-45deg, var(--mini-light) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--mini-light) 75%),
    linear-gradient(-45deg, transparent 75%, var(--mini-light) 75%);
  background-position: 0 0, 0 50%, 50% -50%, -50% 0;
  background-size: 50% 50%;
  background-color: var(--mini-dark);
}

.preview-classic { --mini-light: #f0ddb6; --mini-dark: #99653a; }
.preview-walnut { --mini-light: #d9b37a; --mini-dark: #6d3e1f; }
.preview-midnight { --mini-light: #8190a0; --mini-dark: #202936; }
.preview-marble { --mini-light: #f2efe6; --mini-dark: #8b8f8c; }

.piece-preview {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: visible;
  border: 1px solid rgba(75, 52, 36, 0.12);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--board-light) 0 50%, var(--board-dark) 50% 100%);
}

.piece-preview .piece {
  width: 38px;
  height: 38px;
  overflow: visible;
}

.piece-style-modern .piece-img {
  filter: grayscale(0.68) contrast(1.18) saturate(0.7) brightness(0.98) drop-shadow(0 4px 3px rgba(18, 16, 14, 0.18));
}

.piece-style-royal .piece-img {
  filter: sepia(0.5) saturate(1.55) brightness(1.08) drop-shadow(0 5px 5px rgba(133, 83, 25, 0.32));
}

.piece-preview.piece-style-modern {
  background: linear-gradient(135deg, #d9dde1 0 50%, #5d6872 50% 100%);
}

.piece-preview.piece-style-royal {
  background: linear-gradient(135deg, #f3dfaa 0 50%, #7d4f25 50% 100%);
}

.settings-live-preview {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding-top: 2px;
}

.preview-board,
.live-preview-board {
  width: min(100%, 108px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(75, 52, 36, 0.16);
  box-shadow: 0 14px 28px rgba(45, 30, 18, 0.14);
  background: var(--board-light);
}

.theme-classic.live-preview-board { --preview-light: #f0ddb6; --preview-dark: #99653a; }
.theme-walnut.live-preview-board { --preview-light: #d9b37a; --preview-dark: #6d3e1f; }
.theme-midnight.live-preview-board { --preview-light: #8190a0; --preview-dark: #202936; }
.theme-marble.live-preview-board { --preview-light: #f2efe6; --preview-dark: #8b8f8c; }

.live-preview-board span {
  display: grid;
  place-items: center;
  background: var(--preview-light, var(--board-light));
}

.live-preview-board span:nth-child(8n+2),
.live-preview-board span:nth-child(8n+4),
.live-preview-board span:nth-child(8n+5),
.live-preview-board span:nth-child(8n+7) {
  background: var(--preview-dark, var(--board-dark));
}

.live-preview-board .piece {
  width: 88%;
  height: 88%;
  overflow: visible;
}

.preview-fade {
  animation: preview-crossfade 180ms ease-out both;
}

.settings-list {
  display: grid;
  gap: 10px;
}

.settings-toggle {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 14px;
  border: 1px solid rgba(75, 52, 36, 0.13);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.58);
  color: #29241f;
  font-weight: 700;
}

.settings-toggle strong {
  min-width: 44px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(75, 52, 36, 0.08);
  color: rgba(38, 34, 29, 0.62);
  font-size: 12px;
  text-align: center;
}

.settings-toggle.active strong {
  background: #24211d;
  color: #f3d78f;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0;
}

.settings-done {
  min-width: 118px;
  min-height: 44px;
  border: 1px solid rgba(201, 159, 83, 0.72);
  border-radius: 999px;
  background: #24211d;
  color: #f5d994;
  font-weight: 700;
}

.hide-legal-moves .square.legal::after,
.hide-legal-moves .square.legal.capture::after {
  display: none !important;
}

.hide-last-move .square.last-move::before {
  opacity: 0 !important;
}

.hide-coordinates .frame-labels,
.hide-coordinates .file-frame-labels,
.hide-coordinates .rank-frame-labels {
  display: none !important;
}

.reduce-piece-animation .piece-arrived,
.user-reduce-motion .piece-arrived {
  animation: none !important;
}

.high-contrast-indicators .square.selected::before,
.high-contrast-indicators .square.check::before,
.high-contrast-indicators .square.hint-from::before,
.high-contrast-indicators .square.hint-to::before {
  opacity: 0.9 !important;
}

.large-coordinates .frame-labels,
.large-coordinates .file-frame-labels,
.large-coordinates .rank-frame-labels {
  font-size: 13px !important;
  font-weight: 700 !important;
}

@keyframes settings-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes settings-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes settings-content-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes preview-crossfade {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  .settings-modal {
    align-items: stretch;
    padding: 10px;
  }

  .settings-box {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 16px;
    border-radius: 18px;
  }

  .settings-head {
    position: sticky;
    top: -16px;
    z-index: 2;
    padding-top: 2px;
    background: linear-gradient(145deg, #fff8ed, #eadbc4);
  }

  .settings-options,
  .compact-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .piece-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-option,
  .piece-option,
  .settings-toggle {
    min-height: 44px;
  }

  .theme-preview {
    aspect-ratio: 1.65;
  }

  .settings-tabs {
    margin-left: -2px;
    margin-right: -2px;
  }

  .live-preview-board {
    width: min(100%, 210px);
  }

  .settings-panel {
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .settings-modal.show,
  .settings-box,
  .settings-panel.active,
  .preview-fade,
  .theme-option,
  .piece-option,
  .settings-tab {
    animation: none !important;
    transition: none !important;
  }
}

/* Official Aether Chess branding assets */
.brand-logo,
.game-logo,
.loader-brand-full {
  display: block;
  object-fit: contain;
  object-position: left center;
  max-width: 100%;
  height: auto;
  flex-shrink: 0;
}

.home-brand {
  min-width: 0;
  align-items: center;
}

.brand-logo-horizontal {
  width: clamp(220px, 18vw, 280px);
}

.brand-logo-mark {
  display: none;
  width: 48px;
  height: 56px;
  object-position: center;
}

.aether-chess.home-active .brand-logo-horizontal {
  animation: home-brand-in 460ms ease-out both;
}

.loader-card {
  width: min(92vw, 600px);
  gap: clamp(14px, 2.2vw, 22px);
}

.loader-brand-full {
  width: clamp(280px, 52vw, 520px);
  margin-inline: auto;
  object-position: center;
  filter: drop-shadow(0 10px 20px rgba(70, 43, 18, 0.16));
}

.loader-text {
  margin-top: 0;
}

.game-brand {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 2px;
}

.game-logo-horizontal {
  width: clamp(170px, 15vw, 220px);
}

.game-logo-mark {
  display: none;
  width: 38px;
  height: 44px;
  object-position: center;
}

.game-subtitle {
  min-width: 0;
}

@media (max-width: 768px) {
  .brand-logo-horizontal {
    width: clamp(184px, 45vw, 230px);
  }

  .game-logo-horizontal {
    width: clamp(136px, 34vw, 176px);
  }
}

@media (max-width: 360px) {
  .brand-logo-horizontal,
  .game-logo-horizontal {
    display: none;
  }

  .brand-logo-mark,
  .game-logo-mark {
    display: block;
  }
}

@media (min-width: 769px) and (max-width: 1199px) {
  .aether-chess.home-active .home-screen {
    max-width: min(100%, 980px);
  }

  .aether-chess.home-active .lobby-shell {
    /* grid-template-columns: 1fr; */
    gap: 18px;
  }

  .aether-chess.home-active .lobby-hero {
    min-height: clamp(360px, 48vh, 460px);
  }

  .aether-chess.home-active .lobby-hero-content {
    width: 100%;
    pointer-events: none;
  }

  .aether-chess.home-active .lobby-play-now {
    pointer-events: auto;
  }

  .aether-chess.home-active .next-match-card {
    max-width: none;
  }
}

/* Typography system */
body,
button,
input,
select,
textarea,
.aether-chess {
  font-family: var(--font-ui);
}

.loader-title,
.loader-subtitle,
.match-loader-title,
.settings-kicker,
.home-subtitle {
  font-family: var(--font-brand);
  font-weight: 600;
}

.home-copy h2,
.new-game-panel::before,
.match-kicker,
.promotion-title,
.gameover-title,
.result-title,
.analysis-title {
  font-family: var(--font-display);
  font-weight: 700;
}

.home-copy h2 {
  font-size: clamp(46px, 5vw, 72px);
  line-height: 0.95;
}

.home-copy p,
.loader-text,
.match-loader-text,
.match-loader-meta,
.field-label,
.settings-label,
.seat-name,
.seat-meta,
.history-title,
.history-head,
.history-num,
.history-move,
.status-pill,
.hint-message,
.game-subtitle,
.settings-tab,
.settings-toggle,
.theme-option,
.piece-option,
.home-choice,
.home-card,
.mode-card,
.start-btn,
.icon-btn,
.home-tool,
.difficulty-change,
.result-reason,
.result-meta,
.analysis-copy {
  font-family: var(--font-ui);
}

.home-copy p {
  font-size: clamp(15px, 1.2vw, 18px);
  font-weight: 500;
  line-height: 1.35;
}

.aether-chess.home-active .home-copy p {
  font-family: var(--font-ui);
  font-size: clamp(15px, 1.2vw, 18px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
}

.field-label,
.settings-label,
.match-kicker,
.history-head {
  font-size: clamp(11px, 0.85vw, 13px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-choice,
.theme-option,
.piece-option,
.settings-tab,
.settings-toggle,
.icon-btn,
.home-tool,
.difficulty-change,
.start-btn,
.home-card,
.mode-card {
  font-size: clamp(13px, 0.95vw, 15px);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.start-btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(14px, 1.05vw, 16px);
  letter-spacing: 0.04em;
}

.seat-name,
.gameover-title,
.result-title {
  font-family: var(--font-display);
  font-weight: 700;
}

.seat-name {
  font-size: clamp(18px, 1.5vw, 24px);
}

.gameover-title,
.result-title,
.analysis-title {
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.05;
}

.settings-kicker {
  font-family: var(--font-display);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.settings-title {
  font-family: var(--font-ui);
  font-size: clamp(14px, 1.1vw, 16px);
  font-weight: 500;
  line-height: 1.35;
}

.timer-time,
.player-rating span,
.history-num,
.result-stat strong,
.analysis-index,
.score,
.rating,
[id^="time"] {
  font-family: var(--font-ui);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer-time {
  font-size: clamp(26px, 2.4vw, 36px);
  letter-spacing: 0;
}

.aether-chess.game-active .timer-time {
  font-family: var(--font-ui);
  font-size: clamp(26px, 2.4vw, 36px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.frame-labels,
.file-frame-labels,
.rank-frame-labels,
.square-index,
.coords,
.coordinates {
  font-family: var(--font-ui);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.history-title,
.history-move,
.seat-meta,
.settings-toggle,
.theme-option,
.piece-option,
.home-choice {
  line-height: 1.25;
}

@media (max-width: 768px) {
  .home-copy h2 {
    font-size: clamp(44px, 13vw, 58px);
  }

  .gameover-title,
  .result-title,
  .analysis-title {
    font-size: clamp(26px, 8vw, 34px);
  }

  .settings-kicker {
    font-size: clamp(28px, 8vw, 34px);
  }

  .timer-time {
    font-size: clamp(23px, 7vw, 30px);
  }

  .aether-chess.game-active .timer-time {
    font-size: clamp(23px, 7vw, 30px);
  }

  .home-choice,
  .theme-option,
  .piece-option,
  .settings-tab,
  .settings-toggle,
  .icon-btn,
  .home-tool,
  .difficulty-change {
    font-size: clamp(13px, 3.5vw, 14px);
  }
}

/* Compact PC / tablet-landscape gameplay: keep the board usable on short desktop viewports. */
@media (min-width: 769px) and (max-width: 1180px) and (max-height: 700px) {
  body {
    padding: 12px;
  }

  .aether-chess.game-active {
    --playable-board-size: clamp(380px, calc(100vh - 220px), 500px);
    --board-frame-pad: 14px;
    gap: 10px;
  }

  .aether-chess.game-active .game-header {
    grid-template-columns: minmax(220px, 1fr) auto minmax(250px, 1fr);
    grid-template-areas: "left center right";
    padding: 8px 10px;
    gap: 10px;
  }

  .aether-chess.game-active .header-left { grid-area: left; }
  .aether-chess.game-active .header-center { grid-area: center; }
  .aether-chess.game-active .header-right { grid-area: right; }

  .aether-chess.game-active .game-logo-horizontal {
    width: clamp(142px, 18vw, 176px);
  }

  .aether-chess.game-active .game-subtitle {
    font-size: 10px;
  }

  .aether-chess.game-active .home-back-btn {
    min-width: 44px;
    padding: 0 10px;
  }

  .aether-chess.game-active .home-back-btn span {
    display: none;
  }

  .aether-chess.game-active .icon-btn,
  .aether-chess.game-active .match-mode-chip {
    min-height: 38px;
    height: 38px;
    padding: 0 11px;
    font-size: 12px;
  }

  .aether-chess.game-active .play-layout {
    max-width: calc(var(--playable-board-size) + (var(--board-frame-pad) * 2));
    gap: 6px;
  }

  .aether-chess.game-active .board-perspective {
    --frame-pad: var(--board-frame-pad);
    padding: var(--board-frame-pad);
  }

  .aether-chess.game-active .seat-panel {
    min-height: 50px;
    padding: 7px 10px;
    grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
    grid-template-areas: "info timer";
  }

  .aether-chess.game-active .seat-name {
    font-size: 16px;
  }

  .aether-chess.game-active .seat-meta {
    font-size: 11px;
  }

  .aether-chess.game-active .seat-captures {
    display: none;
  }

  .aether-chess.game-active .timer {
    min-height: 40px;
    padding: 7px 10px;
  }

  .aether-chess.game-active .timer-time {
    font-size: 24px;
  }

  .aether-chess.game-active .action-bar {
    padding: 5px;
  }

  .aether-chess.game-active .action-btn {
    min-height: 40px;
  }
}

/* Loading screen final cascade lock */
.app-loader .loader-card {
  width: min(88vw, 520px);
  max-height: calc(100vh - 48px);
  gap: clamp(14px, 2.4vh, 22px);
}

.app-loader .loader-brand-full {
  width: clamp(260px, 38vw, 430px);
  max-width: min(86vw, 430px);
}

@media (max-width: 480px) {
  .app-loader .loader-card {
    width: min(90vw, 360px);
    gap: 14px;
  }

  .app-loader .loader-brand-full {
    width: min(76vw, 300px);
  }
}

@media (max-height: 620px) and (min-width: 769px) {
  .app-loader .loader-card {
    gap: 12px;
  }

  .app-loader .loader-brand-full {
    width: clamp(300px, 34vw, 390px);
  }
}


