:root {
  --bg: #08111a;
  --bg-2: #122433;
  --panel: rgba(7, 16, 26, 0.82);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #eef5ff;
  --muted: #a8bad0;
  --accent: #6ee7c8;
  --accent-2: #ff9f6e;
  --accent-3: #f5d66f;
  --danger: #ff7f7f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  --board-light: #d8bb88;
  --board-light-2: #f3e4c7;
  --board-light-glow: rgba(255, 255, 255, 0.26);
  --board-dark: #7b5434;
  --board-dark-1: #8a623f;
  --board-dark-2: #52331d;
  --board-dark-glow: rgba(255, 255, 255, 0.08);
  --board-frame-1: #ac8357;
  --board-frame-mid-1: #7f5b37;
  --board-frame-mid-2: #5a371e;
  --board-frame-2: #4a2c17;
  --board-edge: rgba(42, 24, 10, 0.72);
  --board-stage-sheen: rgba(255, 246, 224, 0.14);
  --piece-white: #f7f1e3;
  --piece-white-outline: #caa266;
  --piece-black: #10161d;
  --piece-black-text: #dbe4f0;
  --piece-black-rim: rgba(211, 222, 235, 0.28);
  --square-size: min(10.8vw, 74px);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(244, 208, 145, 0.12), transparent 26%),
    radial-gradient(circle at top right, rgba(110, 231, 200, 0.1), transparent 24%),
    radial-gradient(circle at bottom, rgba(255, 159, 110, 0.08), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, #03070d 100%);
}

body.focus-mode {
  overflow: hidden;
}

button,
input,
select,
summary {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  position: relative;
  width: min(1580px, calc(100vw - 12px));
  margin: 0 auto;
  min-height: 100vh;
  height: auto;
  display: block;
  padding: 8px 0 16px;
}

.page-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.page-shell[data-focus-mode="true"]::after {
  opacity: 1;
  background:
    radial-gradient(circle at center, rgba(136, 182, 255, 0.1), transparent 24%),
    radial-gradient(circle at center, rgba(6, 11, 19, 0.16), rgba(2, 5, 9, 0.88) 64%);
  backdrop-filter: blur(16px);
  z-index: 30;
}

.page-shell[data-board-theme="marble"] {
  --board-light: #dde3ee;
  --board-light-2: #fbfdff;
  --board-light-glow: rgba(255, 255, 255, 0.34);
  --board-dark: #7b8597;
  --board-dark-1: #97a0b2;
  --board-dark-2: #566072;
  --board-dark-glow: rgba(255, 255, 255, 0.14);
  --board-frame-1: #d8dbe1;
  --board-frame-mid-1: #b6bcc8;
  --board-frame-mid-2: #7b8394;
  --board-frame-2: #464e5f;
  --board-edge: rgba(47, 57, 72, 0.74);
  --board-stage-sheen: rgba(255, 255, 255, 0.18);
  --piece-white: #fffefb;
  --piece-white-outline: #b7c0ce;
  --piece-black: #0f141c;
  --piece-black-text: #dee7f0;
  --piece-black-rim: rgba(228, 236, 247, 0.28);
}

.page-shell[data-board-theme="midnight"] {
  --board-light: #8192c3;
  --board-light-2: #c7d1f5;
  --board-light-glow: rgba(255, 255, 255, 0.26);
  --board-dark: #1f2947;
  --board-dark-1: #33426c;
  --board-dark-2: #121a31;
  --board-dark-glow: rgba(173, 195, 255, 0.14);
  --board-frame-1: #46557f;
  --board-frame-mid-1: #26314e;
  --board-frame-mid-2: #171d31;
  --board-frame-2: #0d1220;
  --board-edge: rgba(9, 13, 23, 0.88);
  --board-stage-sheen: rgba(196, 211, 255, 0.16);
  --piece-white: #f8fbff;
  --piece-white-outline: #8d9fd4;
  --piece-black: #050911;
  --piece-black-text: #dbe5ff;
  --piece-black-rim: rgba(214, 226, 255, 0.22);
}

.page-shell[data-board-theme="emerald"] {
  --board-light: #cdd5a1;
  --board-light-2: #eff4d3;
  --board-light-glow: rgba(255, 255, 255, 0.22);
  --board-dark: #2f6543;
  --board-dark-1: #4e8c61;
  --board-dark-2: #1f4630;
  --board-dark-glow: rgba(233, 255, 240, 0.08);
  --board-frame-1: #a78354;
  --board-frame-mid-1: #755128;
  --board-frame-mid-2: #553414;
  --board-frame-2: #2c1a0b;
  --board-edge: rgba(33, 21, 10, 0.84);
  --board-stage-sheen: rgba(255, 245, 220, 0.13);
  --piece-white: #fffdf1;
  --piece-white-outline: #b99758;
  --piece-black: #09160f;
  --piece-black-text: #dff1e6;
  --piece-black-rim: rgba(216, 240, 226, 0.2);
}

.page-shell[data-board-theme="rosewood"] {
  --board-light: #ead6b7;
  --board-light-2: #fff2dd;
  --board-light-glow: rgba(255, 255, 255, 0.22);
  --board-dark: #7b3342;
  --board-dark-1: #9b4a5d;
  --board-dark-2: #52202c;
  --board-dark-glow: rgba(255, 230, 234, 0.1);
  --board-frame-1: #b27a58;
  --board-frame-mid-1: #7f4730;
  --board-frame-mid-2: #5f2f22;
  --board-frame-2: #371810;
  --board-edge: rgba(49, 19, 14, 0.8);
  --board-stage-sheen: rgba(255, 241, 225, 0.14);
  --piece-white: #fff6ec;
  --piece-white-outline: #b67b52;
  --piece-black: #220d13;
  --piece-black-text: #f2d9e1;
  --piece-black-rim: rgba(242, 217, 225, 0.24);
}

.page-shell[data-board-theme="onyx"] {
  --board-light: #d4d9e3;
  --board-light-2: #f7f9fc;
  --board-light-glow: rgba(255, 255, 255, 0.28);
  --board-dark: #2a313d;
  --board-dark-1: #465060;
  --board-dark-2: #141920;
  --board-dark-glow: rgba(214, 226, 240, 0.12);
  --board-frame-1: #7f8796;
  --board-frame-mid-1: #525a68;
  --board-frame-mid-2: #303640;
  --board-frame-2: #14181e;
  --board-edge: rgba(10, 13, 18, 0.82);
  --board-stage-sheen: rgba(241, 247, 255, 0.12);
  --piece-white: #ffffff;
  --piece-white-outline: #8e97a8;
  --piece-black: #020305;
  --piece-black-text: #ecf3ff;
  --piece-black-rim: rgba(220, 230, 242, 0.22);
}

.page-shell[data-board-theme="sandstone"] {
  --board-light: #e2caa5;
  --board-light-2: #fff1dc;
  --board-light-glow: rgba(255, 255, 255, 0.2);
  --board-dark: #8a6540;
  --board-dark-1: #ab8052;
  --board-dark-2: #5d4126;
  --board-dark-glow: rgba(255, 240, 217, 0.08);
  --board-frame-1: #c89865;
  --board-frame-mid-1: #926137;
  --board-frame-mid-2: #6a411f;
  --board-frame-2: #382111;
  --board-edge: rgba(58, 32, 14, 0.8);
  --board-stage-sheen: rgba(255, 241, 214, 0.14);
  --piece-white: #fff9f0;
  --piece-white-outline: #bd8651;
  --piece-black: #1b120d;
  --piece-black-text: #f2dcc7;
  --piece-black-rim: rgba(244, 220, 192, 0.24);
}

.page-shell[data-board-theme="storm"] {
  --board-light: #d4deea;
  --board-light-2: #fbfdff;
  --board-light-glow: rgba(255, 255, 255, 0.26);
  --board-dark: #4a5f74;
  --board-dark-1: #6a8299;
  --board-dark-2: #293745;
  --board-dark-glow: rgba(216, 228, 244, 0.1);
  --board-frame-1: #95a7bc;
  --board-frame-mid-1: #66788c;
  --board-frame-mid-2: #465465;
  --board-frame-2: #222c38;
  --board-edge: rgba(18, 26, 35, 0.82);
  --board-stage-sheen: rgba(239, 246, 255, 0.14);
  --piece-white: #fdfefe;
  --piece-white-outline: #91a4b9;
  --piece-black: #06090d;
  --piece-black-text: #ebf2fb;
  --piece-black-rim: rgba(227, 236, 248, 0.24);
}

.topbar,
.topbar-status,
.topbar-controls,
.rail-buttons,
.layout,
.invite-header,
.invite-row,
.board-header,
.board-footer,
.sidebar-header,
.player-head,
.promotion-options,
.board-actions {
  display: flex;
  gap: 12px;
}

.topbar,
.invite-header,
.board-header,
.board-footer,
.sidebar-header,
.player-head,
.board-actions {
  justify-content: space-between;
  align-items: center;
}

.layout {
  min-height: 0;
  display: block;
  position: relative;
  overflow: visible;
}

.setup-column,
.sidebar {
  position: fixed;
  top: 78px;
  bottom: 16px;
  z-index: 35;
  width: min(320px, calc(100vw - 28px));
  max-height: calc(100vh - 94px);
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.setup-column {
  left: max(12px, calc((100vw - 1560px) / 2 + 12px));
}

.sidebar {
  right: max(12px, calc((100vw - 1560px) / 2 + 12px));
}

.board-column {
  min-width: 0;
  min-height: 0;
  width: min(100%, 1340px);
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.topbar,
.setup-column,
.sidebar,
.board-column,
.battle-strip {
  transition:
    opacity 220ms ease,
    transform 260ms cubic-bezier(.22, 1, .36, 1),
    filter 220ms ease;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.board-panel {
  min-height: 0;
  padding: 10px;
  display: grid;
  gap: 8px;
  background:
    radial-gradient(circle at top, rgba(255, 236, 196, 0.06), transparent 42%),
    linear-gradient(180deg, rgba(8, 17, 27, 0.94), rgba(5, 10, 17, 0.96));
}

.sidebar-panel {
  background:
    linear-gradient(180deg, rgba(11, 21, 32, 0.94), rgba(7, 14, 24, 0.96));
}

.hero,
.guide-panel,
.board-panel,
.sidebar-panel,
.promotion-card {
  padding: 14px;
}

.back-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.topbar {
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.topbar-controls {
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-status,
.rail-buttons {
  align-items: center;
  flex-wrap: wrap;
}

.rail-buttons button {
  min-width: 118px;
}

.eyebrow,
.label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  color: var(--muted);
}

h1,
h2,
.room-code,
.turn-text,
.winner-text {
  margin: 0;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 4.8rem);
  line-height: 0.92;
}

h2 {
  font-size: 1.25rem;
}

.lede,
.invite-help,
.status-text,
.engine-status,
.winner-text,
.mini-status,
.turn-text,
.guide-item p,
.legend-copy,
.player-color-label {
  color: var(--muted);
}

.status-pill {
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.92rem;
}

.status-pill[data-tone="online"] {
  background: rgba(110, 231, 200, 0.94);
  color: #041118;
}

.status-pill[data-tone="connecting"] {
  background: rgba(245, 214, 111, 0.96);
  color: #1d1204;
}

.status-pill[data-tone="error"] {
  background: rgba(255, 127, 127, 0.22);
  color: #fff;
}

.status-pill.ghost {
  background: rgba(255, 255, 255, 0.04);
}

.hero,
.field-grid,
.step-strip,
.guide-list,
.legend-list,
.player-cards,
.history-list {
  display: grid;
  gap: 12px;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rail-head {
  display: grid;
  gap: 10px;
}

.rail-copy {
  margin: 0;
  max-width: 30ch;
  color: var(--muted);
  line-height: 1.45;
}

.field-grid label,
.advanced-field {
  display: grid;
  gap: 8px;
}

.step-card,
.guide-item,
.player-card,
.history-list li,
.legend-item,
.control-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.step-card.active {
  border-color: rgba(110, 231, 200, 0.36);
  background: linear-gradient(135deg, rgba(110, 231, 200, 0.18), rgba(245, 214, 111, 0.08));
}

.step-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.step-card p,
.guide-item p {
  margin: 6px 0 0;
}

.step-number,
.inline-chip,
.capture-chip,
.piece-token,
.move-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
}

.step-number,
.inline-chip {
  min-width: 28px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.84rem;
}

.hero-actions {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.invite-row input {
  flex: 1 1 auto;
}

input,
select,
button {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

input {
  width: 100%;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(6, 12, 22, 0.9);
}

select {
  width: 100%;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(6, 12, 22, 0.9);
}

select option {
  color: #07131f;
}

button {
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

button:hover:not(.board-piece):not(.board-square) {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.26);
}

button.primary {
  color: #04111b;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 10px 24px rgba(110, 231, 200, 0.2);
}

button.secondary {
  background: rgba(255, 255, 255, 0.1);
}

button:disabled {
  opacity: 0.5;
  transform: none;
  cursor: not-allowed;
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--muted);
}

.advanced-field {
  margin-top: 12px;
}

.difficulty-field {
  align-content: start;
}

.time-control-field {
  align-content: start;
}

.field-note {
  margin: 8px 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--muted);
}

.theme-field,
.sound-profile-field,
.audio-card {
  align-content: start;
}

.audio-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.audio-card button[data-enabled="true"] {
  color: #04111b;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 10px 22px rgba(110, 231, 200, 0.16);
}

.audio-card button[data-enabled="false"] {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.difficulty-meter {
  position: relative;
  height: 10px;
  margin-top: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.difficulty-meter::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(20% - 1px),
    rgba(255, 255, 255, 0.1) calc(20% - 1px),
    rgba(255, 255, 255, 0.1) 20%
  );
  pointer-events: none;
}

.difficulty-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-3) 52%, var(--accent-2) 100%);
  box-shadow: 0 0 18px rgba(110, 231, 200, 0.3);
  transition: width 220ms ease;
}

.engine-status {
  margin: 0;
  min-height: 2.8em;
}

.board-footer {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 10px 14px;
  align-items: start;
  flex-wrap: wrap;
}

.board-actions {
  flex: 1 1 260px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.board-actions button {
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.88rem;
}

.clock-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 6px 0 0;
}

.clock-strip[data-timed="false"] {
  grid-template-columns: minmax(0, 1fr);
}

.clock-strip[data-timed="false"] .clock-card.white,
.clock-strip[data-timed="false"] .clock-card.black {
  display: none;
}

.clock-strip[data-timed="false"] .clock-card.center {
  padding-block: 8px;
}

.clock-card {
  padding: 7px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 24px rgba(0, 0, 0, 0.16);
}

.clock-card.center {
  text-align: center;
}

.clock-value,
.clock-meta {
  margin: 0;
}

.clock-value {
  margin-top: 2px;
  font-size: clamp(1rem, 1.65vw, 1.38rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.clock-value.preset {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.clock-meta {
  margin-top: 2px;
  min-height: 1.1em;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.clock-card.active-clock {
  border-color: rgba(110, 231, 200, 0.34);
  background:
    linear-gradient(180deg, rgba(110, 231, 200, 0.18), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 34px rgba(110, 231, 200, 0.12);
}

.clock-card.low-clock {
  border-color: rgba(255, 127, 127, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 127, 127, 0.18), rgba(255, 255, 255, 0.03));
}

.clock-card.flagged-clock {
  border-color: rgba(255, 127, 127, 0.48);
  box-shadow:
    inset 0 0 0 1px rgba(255, 127, 127, 0.16),
    0 18px 36px rgba(255, 127, 127, 0.08);
}

.focus-tools {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.focus-hint {
  margin: 0;
  max-width: 240px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
  text-align: right;
}

.control-card p {
  margin: 8px 0 0;
}

.room-code {
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  font-weight: 800;
}

.turn-text,
.winner-text {
  font-size: 0.9rem;
  line-height: 1.25;
}

.board-header {
  gap: 8px 12px;
}

.board-header > div {
  min-width: 0;
}

.board-stage {
  position: relative;
  display: flex;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  min-width: 0;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 10px 12px;
  margin: 2px auto 0;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(circle at center, rgba(255, 243, 217, 0.06), transparent 46%),
    linear-gradient(180deg, rgba(10, 16, 27, 0.88), rgba(6, 10, 17, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.22);
}

.board-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.03), transparent 52%);
  pointer-events: none;
}

.board-grid {
  --square-size: min(10.4vw, 94px);
  flex: 0 0 auto;
  position: relative;
  width: calc(var(--square-size) * 8);
  height: calc(var(--square-size) * 8);
  border-radius: 0;
  overflow: visible;
  border: 1px solid var(--board-edge);
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 225, 0.1),
    inset 0 14px 20px rgba(255, 255, 255, 0.04),
    0 18px 48px rgba(0, 0, 0, 0.3);
  touch-action: none;
  transition:
    width 220ms cubic-bezier(.22, 1, .36, 1),
    height 220ms cubic-bezier(.22, 1, .36, 1),
    box-shadow 180ms ease;
}

.board-grid::before,
.board-grid::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.board-grid::before {
  inset: -14px;
  border-radius: 0;
  z-index: -2;
  background:
    linear-gradient(145deg, var(--board-frame-1), var(--board-frame-mid-1) 28%, var(--board-frame-mid-2) 62%, var(--board-frame-2) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -8px 20px rgba(31, 17, 8, 0.36),
    0 24px 56px rgba(0, 0, 0, 0.3);
}

.board-grid::after {
  inset: -8px;
  border-radius: 0;
  z-index: -1;
  border: 1px solid rgba(255, 236, 210, 0.18);
  background:
    radial-gradient(circle at top, var(--board-stage-sheen), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12));
}

.board-grid:focus-visible {
  outline: 4px solid rgba(110, 231, 200, 0.7);
  outline-offset: 6px;
}

.result-overlay {
  position: absolute;
  inset: -8px;
  z-index: 14;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at center, rgba(5, 10, 18, 0.2), rgba(2, 5, 10, 0.72) 58%, rgba(2, 5, 10, 0.88) 100%);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  pointer-events: none;
}

.result-overlay.hidden {
  display: none;
}

.result-overlay-card {
  display: grid;
  gap: 10px;
  place-items: center;
  text-align: center;
  padding: 26px 28px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.12), transparent 46%),
    linear-gradient(180deg, rgba(8, 14, 24, 0.94), rgba(4, 7, 12, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 28px 80px rgba(0, 0, 0, 0.48);
}

.result-overlay-kicker {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(221, 233, 255, 0.72);
}

.result-overlay-title {
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  line-height: 0.92;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-overlay-subtitle {
  margin: 0;
  max-width: 26ch;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(228, 236, 255, 0.78);
}

.result-overlay[data-tone="win"] .result-overlay-title {
  color: #8fffe1;
  text-shadow:
    0 0 18px rgba(68, 255, 205, 0.44),
    0 0 42px rgba(68, 255, 205, 0.34),
    0 0 96px rgba(68, 255, 205, 0.26);
}

.result-overlay[data-tone="win"] .result-overlay-card {
  border-color: rgba(102, 255, 215, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(201, 255, 239, 0.16),
    0 0 0 1px rgba(102, 255, 215, 0.08),
    0 28px 80px rgba(0, 0, 0, 0.5),
    0 0 48px rgba(68, 255, 205, 0.12);
}

.result-overlay[data-tone="lose"] .result-overlay-title {
  color: #ff7da7;
  text-shadow:
    0 0 18px rgba(255, 82, 143, 0.42),
    0 0 42px rgba(255, 82, 143, 0.32),
    0 0 96px rgba(255, 82, 143, 0.22);
}

.result-overlay[data-tone="lose"] .result-overlay-card {
  border-color: rgba(255, 125, 167, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 211, 224, 0.14),
    0 0 0 1px rgba(255, 125, 167, 0.08),
    0 28px 80px rgba(0, 0, 0, 0.5),
    0 0 48px rgba(255, 82, 143, 0.12);
}

.result-overlay[data-tone="neutral"] .result-overlay-title {
  color: #dce8ff;
  text-shadow:
    0 0 18px rgba(158, 194, 255, 0.28),
    0 0 42px rgba(158, 194, 255, 0.18);
}

.page-shell[data-focus-mode="true"] .topbar,
.page-shell[data-focus-mode="true"] .setup-column,
.page-shell[data-focus-mode="true"] .sidebar,
.page-shell[data-focus-mode="true"] .battle-strip {
  opacity: 0;
  filter: blur(12px);
  pointer-events: none;
  user-select: none;
}

.page-shell[data-focus-mode="true"] .topbar {
  transform: translateY(-14px);
}

.page-shell[data-focus-mode="true"] .setup-column {
  transform: translateX(-20px);
}

.page-shell[data-focus-mode="true"] .sidebar {
  transform: translateX(20px);
}

.page-shell[data-focus-mode="true"] .board-column {
  position: fixed;
  top: 18px;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1380px, calc(100vw - 28px));
  gap: 0;
  z-index: 40;
}

.page-shell[data-focus-mode="true"] .board-panel {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: 16px;
  border-radius: 32px;
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.page-shell[data-focus-mode="true"] .board-header {
  align-items: start;
}

.page-shell[data-focus-mode="true"] .focus-tools {
  display: flex;
}

.page-shell[data-focus-mode="true"] .board-stage {
  min-height: 0;
  margin-top: 0;
  padding: 12px;
  border-radius: 30px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -8px 20px rgba(31, 17, 8, 0.36),
    0 24px 64px rgba(0, 0, 0, 0.36);
}

.page-shell[data-focus-mode="true"] .board-grid {
  --square-size: min(calc((100vw - 112px) / 8), calc((100vh - 264px) / 8), 128px);
}

.page-shell[data-setup-collapsed="true"] .setup-column {
  display: none;
}

.page-shell[data-sidebar-collapsed="true"] .sidebar {
  display: none;
}

.page-shell[data-setup-collapsed="true"] .board-grid,
.page-shell[data-sidebar-collapsed="true"] .board-grid {
  --square-size: min(10.8vw, 96px);
}

.page-shell[data-setup-collapsed="true"][data-sidebar-collapsed="true"] .board-grid {
  --square-size: min(11.8vw, 104px);
}

.page-shell[data-focus-mode="true"] .clock-strip {
  margin-top: 10px;
}

.page-shell[data-focus-mode="true"] .board-footer {
  align-items: end;
}

.footer-captures {
  flex: 1 1 300px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.capture-lane {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.board-squares,
.board-piece-layer {
  position: absolute;
  inset: 0;
}

.board-piece-layer {
  pointer-events: none;
}

.board-squares {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}

.board-square {
  position: relative;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  box-shadow: none;
}

.board-square.light {
  background:
    radial-gradient(circle at 28% 24%, var(--board-light-glow), transparent 42%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 36%),
    linear-gradient(145deg, var(--board-light-2), var(--board-light));
}

.board-square.dark {
  background:
    radial-gradient(circle at 28% 22%, var(--board-dark-glow), transparent 38%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.03), transparent 30%),
    linear-gradient(145deg, var(--board-dark-1), var(--board-dark) 48%, var(--board-dark-2));
}

.board-square.last-move {
  box-shadow:
    inset 0 0 0 999px rgba(245, 214, 111, 0.22),
    inset 0 0 0 2px rgba(255, 239, 187, 0.24);
}

.board-square.selected {
  box-shadow:
    inset 0 0 0 4px rgba(110, 231, 200, 0.9),
    inset 0 0 32px rgba(110, 231, 200, 0.18);
}

.board-square.focused {
  box-shadow:
    inset 0 0 0 4px rgba(255, 159, 110, 0.9),
    inset 0 0 28px rgba(255, 159, 110, 0.16);
}

.board-square.check {
  box-shadow:
    inset 0 0 0 4px rgba(255, 127, 127, 0.92),
    inset 0 0 28px rgba(255, 127, 127, 0.18);
  animation: kingPulse 1.1s ease-in-out infinite;
}

.board-square:hover {
  transform: none;
  filter: brightness(1.03);
}

.square-label {
  position: absolute;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.82;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.18);
}

.square-label.file {
  right: 7px;
  bottom: 5px;
}

.square-label.rank {
  top: 5px;
  left: 7px;
}

.square-label.dark-label {
  color: rgba(247, 240, 223, 0.82);
}

.square-label.light-label {
  color: rgba(21, 33, 45, 0.66);
}

.move-dot,
.move-ring {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.move-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(34, 21, 9, 0.26);
  box-shadow:
    0 0 0 5px rgba(255, 246, 225, 0.16),
    0 8px 10px rgba(0, 0, 0, 0.12);
}

.move-ring {
  width: 64%;
  height: 64%;
  border-radius: 50%;
  border: 5px solid rgba(255, 159, 110, 0.88);
  box-shadow: inset 0 0 0 1px rgba(255, 237, 220, 0.32);
}

.board-piece {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--square-size);
  height: var(--square-size);
  padding: 2px;
  border: none;
  border-radius: 0;
  background: transparent;
  pointer-events: auto;
  transform: translate(var(--x, 0), var(--y, 0));
  transition:
    transform 280ms cubic-bezier(.18, .92, .22, 1.12),
    opacity 160ms ease,
    filter 180ms ease;
  z-index: 2;
  touch-action: none;
  transform-origin: center bottom;
  will-change: transform, filter, opacity;
}

.board-piece::before {
  content: "";
  position: absolute;
  inset: 20px 14px 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  opacity: 0;
  transform: scale(0.84);
  transition: opacity 150ms ease, transform 150ms ease;
  display: none;
}

.board-piece:hover::before,
.board-piece.active::before {
  opacity: 1;
  transform: scale(1);
}

.board-piece:hover {
  transform: translate(var(--x, 0), var(--y, 0));
}

.board-piece.active {
  filter: drop-shadow(0 12px 20px rgba(110, 231, 200, 0.3));
}

.board-piece.moved {
  filter: drop-shadow(0 12px 18px rgba(245, 214, 111, 0.28));
}

.board-piece.drag-source {
  opacity: 0.22;
}

.piece-face {
  position: relative;
  isolation: isolate;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: calc(var(--square-size) * 0.74);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  background: transparent;
  box-shadow: none;
  transform: translateY(-5px);
  transition:
    font-size 220ms cubic-bezier(.22, 1, .36, 1),
    transform 180ms ease,
    filter 180ms ease,
    text-shadow 180ms ease;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.16));
}

.piece-face::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 54%;
  height: 14%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.42), transparent 72%);
  z-index: -2;
  opacity: 0.85;
}

.piece-face::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18%;
  width: 56%;
  height: 18%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.26), transparent 72%);
  z-index: -1;
  opacity: 0;
  display: none;
}

.board-piece.white .piece-face,
.drag-ghost.white .piece-face {
  color: var(--piece-white);
  -webkit-text-stroke: 1px rgba(96, 69, 31, 0.42);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.98),
    0 2px 0 rgba(228, 212, 179, 0.98),
    0 10px 12px rgba(0, 0, 0, 0.28),
    -1px 0 0 rgba(201, 176, 128, 0.95),
    1px 0 0 rgba(201, 176, 128, 0.95),
    0 -1px 0 rgba(255, 255, 255, 0.98);
}

.board-piece.black .piece-face,
.drag-ghost.black .piece-face {
  color: var(--piece-black);
  -webkit-text-stroke: 1px rgba(218, 227, 238, 0.24);
  text-shadow:
    0 1px 0 rgba(199, 209, 221, 0.22),
    0 -1px 0 rgba(8, 10, 13, 0.98),
    0 9px 12px rgba(0, 0, 0, 0.42),
    -1px 0 0 rgba(15, 18, 24, 0.96),
    1px 0 0 rgba(170, 182, 196, 0.2);
}

.board-piece.white .piece-face::before,
.drag-ghost.white .piece-face::before {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.98), rgba(255, 250, 238, 0.95) 30%, rgba(244, 225, 183, 0.98) 62%, rgba(202, 162, 102, 0.96));
  border: 1px solid rgba(146, 104, 45, 0.24);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.58),
    0 8px 14px rgba(0, 0, 0, 0.18);
}

.board-piece.black .piece-face::before,
.drag-ghost.black .piece-face::before {
  background:
    radial-gradient(circle at 34% 26%, rgba(101, 118, 138, 0.98), rgba(32, 42, 54, 0.98) 44%, rgba(10, 14, 19, 0.99) 78%);
  border: 1px solid var(--piece-black-rim);
  box-shadow:
    inset 0 1px 5px rgba(255, 255, 255, 0.12),
    0 10px 15px rgba(0, 0, 0, 0.26);
}

.page-shell[data-piece-style="marble"] .piece-face {
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: calc(var(--square-size) * 0.595);
  letter-spacing: 0.01em;
  transform: translateY(-2px);
}

.page-shell[data-piece-style="marble"] .piece-face::before {
  inset: 12px 11px 10px;
  border-radius: 22px;
}

.page-shell[data-piece-style="marble"] .board-piece.white .piece-face,
.page-shell[data-piece-style="marble"] .drag-ghost.white .piece-face {
  color: #fffefd;
  -webkit-text-stroke: 1px rgba(103, 116, 137, 0.32);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.98),
    0 3px 0 rgba(211, 218, 229, 0.94),
    0 10px 12px rgba(0, 0, 0, 0.2),
    -1px 0 0 rgba(196, 204, 216, 0.88),
    1px 0 0 rgba(196, 204, 216, 0.88);
}

.page-shell[data-piece-style="marble"] .board-piece.black .piece-face,
.page-shell[data-piece-style="marble"] .drag-ghost.black .piece-face {
  color: #101723;
  -webkit-text-stroke: 1px rgba(216, 225, 238, 0.36);
  text-shadow:
    0 1px 0 rgba(231, 238, 247, 0.2),
    0 -1px 0 rgba(5, 8, 13, 0.98),
    0 10px 13px rgba(0, 0, 0, 0.28),
    -1px 0 0 rgba(17, 22, 30, 0.96),
    1px 0 0 rgba(201, 211, 225, 0.18);
}

.page-shell[data-piece-style="marble"] .board-piece.white .piece-face::before,
.page-shell[data-piece-style="marble"] .drag-ghost.white .piece-face::before {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 1), rgba(242, 246, 251, 0.98) 42%, rgba(209, 216, 226, 0.98));
  border: 1px solid rgba(129, 140, 160, 0.28);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.7),
    inset 0 -4px 8px rgba(184, 193, 205, 0.34),
    0 10px 16px rgba(0, 0, 0, 0.14);
}

.page-shell[data-piece-style="marble"] .board-piece.black .piece-face::before,
.page-shell[data-piece-style="marble"] .drag-ghost.black .piece-face::before {
  background:
    linear-gradient(165deg, rgba(152, 163, 180, 0.98), rgba(56, 67, 83, 0.98) 36%, rgba(17, 25, 37, 1));
  border: 1px solid rgba(228, 236, 247, 0.24);
  box-shadow:
    inset 0 1px 4px rgba(255, 255, 255, 0.16),
    inset 0 -4px 8px rgba(0, 0, 0, 0.3),
    0 10px 16px rgba(0, 0, 0, 0.22);
}

.page-shell[data-piece-style="midnight"] .piece-face {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Arial Unicode MS", sans-serif;
  font-size: calc(var(--square-size) * 0.585);
  letter-spacing: 0.02em;
  transform: translateY(-1px);
}

.page-shell[data-piece-style="midnight"] .piece-face::before {
  inset: 13px 10px 9px;
  border-radius: 22px;
}

.page-shell[data-piece-style="midnight"] .board-piece.white .piece-face,
.page-shell[data-piece-style="midnight"] .drag-ghost.white .piece-face {
  color: #f2f8ff;
  -webkit-text-stroke: 1px rgba(111, 159, 255, 0.56);
  text-shadow:
    0 0 8px rgba(148, 205, 255, 0.36),
    0 1px 0 rgba(255, 255, 255, 0.98),
    0 10px 12px rgba(0, 0, 0, 0.26);
}

.page-shell[data-piece-style="midnight"] .board-piece.black .piece-face,
.page-shell[data-piece-style="midnight"] .drag-ghost.black .piece-face {
  color: #060d18;
  -webkit-text-stroke: 1px rgba(136, 186, 255, 0.44);
  text-shadow:
    0 0 10px rgba(72, 114, 220, 0.2),
    0 1px 0 rgba(202, 222, 255, 0.18),
    0 -1px 0 rgba(0, 0, 0, 0.98),
    0 12px 14px rgba(0, 0, 0, 0.34);
}

.page-shell[data-piece-style="midnight"] .board-piece.white .piece-face::before,
.page-shell[data-piece-style="midnight"] .drag-ghost.white .piece-face::before {
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 1), rgba(206, 238, 255, 0.98) 38%, rgba(119, 173, 255, 0.94));
  border: 1px solid rgba(167, 212, 255, 0.36);
  box-shadow:
    inset 0 1px 8px rgba(255, 255, 255, 0.52),
    0 0 16px rgba(106, 169, 255, 0.28),
    0 10px 18px rgba(0, 0, 0, 0.24);
}

.page-shell[data-piece-style="midnight"] .board-piece.black .piece-face::before,
.page-shell[data-piece-style="midnight"] .drag-ghost.black .piece-face::before {
  background:
    radial-gradient(circle at 34% 28%, rgba(53, 86, 147, 0.98), rgba(12, 22, 46, 0.99) 42%, rgba(3, 8, 18, 1));
  border: 1px solid rgba(114, 171, 255, 0.3);
  box-shadow:
    inset 0 1px 5px rgba(255, 255, 255, 0.14),
    0 0 14px rgba(53, 109, 255, 0.2),
    0 12px 18px rgba(0, 0, 0, 0.3);
}

.page-shell[data-piece-style="emerald"] .piece-face {
  font-family: Cambria, "Palatino Linotype", Georgia, serif;
  font-size: calc(var(--square-size) * 0.605);
  transform: translateY(-2px);
}

.page-shell[data-piece-style="emerald"] .piece-face::before {
  inset: 13px 10px 10px;
  border-radius: 18px;
}

.page-shell[data-piece-style="emerald"] .board-piece.white .piece-face,
.page-shell[data-piece-style="emerald"] .drag-ghost.white .piece-face {
  color: #fff8e8;
  -webkit-text-stroke: 1px rgba(117, 86, 30, 0.42);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.98),
    0 3px 0 rgba(221, 197, 149, 0.96),
    0 10px 12px rgba(0, 0, 0, 0.24),
    -1px 0 0 rgba(185, 149, 76, 0.94),
    1px 0 0 rgba(185, 149, 76, 0.94);
}

.page-shell[data-piece-style="emerald"] .board-piece.black .piece-face,
.page-shell[data-piece-style="emerald"] .drag-ghost.black .piece-face {
  color: #09140d;
  -webkit-text-stroke: 1px rgba(214, 197, 139, 0.26);
  text-shadow:
    0 1px 0 rgba(218, 202, 150, 0.18),
    0 -1px 0 rgba(0, 0, 0, 0.98),
    0 11px 13px rgba(0, 0, 0, 0.34);
}

.page-shell[data-piece-style="emerald"] .board-piece.white .piece-face::before,
.page-shell[data-piece-style="emerald"] .drag-ghost.white .piece-face::before {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.98), rgba(255, 248, 228, 0.97) 34%, rgba(209, 176, 103, 0.98));
  border: 1px solid rgba(120, 89, 28, 0.28);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.54),
    inset 0 -3px 8px rgba(196, 155, 75, 0.24),
    0 10px 16px rgba(0, 0, 0, 0.18);
}

.page-shell[data-piece-style="emerald"] .board-piece.black .piece-face::before,
.page-shell[data-piece-style="emerald"] .drag-ghost.black .piece-face::before {
  background:
    radial-gradient(circle at 34% 28%, rgba(74, 107, 79, 0.98), rgba(20, 36, 25, 0.99) 42%, rgba(8, 16, 11, 1));
  border: 1px solid rgba(191, 161, 90, 0.24);
  box-shadow:
    inset 0 1px 5px rgba(255, 243, 209, 0.12),
    0 10px 16px rgba(0, 0, 0, 0.24);
}

.page-shell[data-piece-style="regal"] .piece-face {
  font-family: "Book Antiqua", Georgia, serif;
  font-size: calc(var(--square-size) * 0.61);
  letter-spacing: 0.01em;
  transform: translateY(-2px);
}

.page-shell[data-piece-style="regal"] .piece-face::before {
  inset: 12px 10px 10px;
  border-radius: 14px;
}

.page-shell[data-piece-style="regal"] .board-piece.white .piece-face,
.page-shell[data-piece-style="regal"] .drag-ghost.white .piece-face {
  color: #fff5ec;
  -webkit-text-stroke: 1px rgba(135, 79, 43, 0.42);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.98),
    0 3px 0 rgba(229, 198, 162, 0.96),
    0 10px 14px rgba(0, 0, 0, 0.22),
    -1px 0 0 rgba(193, 147, 96, 0.92),
    1px 0 0 rgba(193, 147, 96, 0.92);
}

.page-shell[data-piece-style="regal"] .board-piece.black .piece-face,
.page-shell[data-piece-style="regal"] .drag-ghost.black .piece-face {
  color: #2d1219;
  -webkit-text-stroke: 1px rgba(245, 216, 224, 0.28);
  text-shadow:
    0 1px 0 rgba(243, 223, 228, 0.18),
    0 -1px 0 rgba(0, 0, 0, 0.96),
    0 11px 13px rgba(0, 0, 0, 0.32);
}

.page-shell[data-piece-style="regal"] .board-piece.white .piece-face::before,
.page-shell[data-piece-style="regal"] .drag-ghost.white .piece-face::before {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.99), rgba(255, 241, 227, 0.98) 36%, rgba(224, 177, 123, 0.98));
  border: 1px solid rgba(146, 92, 52, 0.26);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.58),
    inset 0 -3px 8px rgba(196, 140, 86, 0.24),
    0 10px 16px rgba(0, 0, 0, 0.18);
}

.page-shell[data-piece-style="regal"] .board-piece.black .piece-face::before,
.page-shell[data-piece-style="regal"] .drag-ghost.black .piece-face::before {
  background:
    radial-gradient(circle at 32% 24%, rgba(134, 59, 80, 0.96), rgba(64, 18, 31, 0.98) 44%, rgba(20, 7, 12, 1));
  border: 1px solid rgba(246, 216, 226, 0.2);
  box-shadow:
    inset 0 1px 5px rgba(255, 233, 239, 0.14),
    0 10px 16px rgba(0, 0, 0, 0.24);
}

.page-shell[data-piece-style="onyx"] .piece-face {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Arial Unicode MS", sans-serif;
  font-size: calc(var(--square-size) * 0.6);
  letter-spacing: 0.01em;
  transform: translateY(-2px);
}

.page-shell[data-piece-style="onyx"] .piece-face::before {
  inset: 12px 10px 10px;
  border-radius: 12px;
}

.page-shell[data-piece-style="onyx"] .board-piece.white .piece-face,
.page-shell[data-piece-style="onyx"] .drag-ghost.white .piece-face {
  color: #fbfdff;
  -webkit-text-stroke: 1px rgba(125, 139, 162, 0.38);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.98),
    0 3px 0 rgba(215, 223, 235, 0.94),
    0 10px 13px rgba(0, 0, 0, 0.18);
}

.page-shell[data-piece-style="onyx"] .board-piece.black .piece-face,
.page-shell[data-piece-style="onyx"] .drag-ghost.black .piece-face {
  color: #020408;
  -webkit-text-stroke: 1px rgba(221, 229, 240, 0.34);
  text-shadow:
    0 1px 0 rgba(234, 242, 252, 0.18),
    0 -1px 0 rgba(0, 0, 0, 0.98),
    0 10px 14px rgba(0, 0, 0, 0.34);
}

.page-shell[data-piece-style="onyx"] .board-piece.white .piece-face::before,
.page-shell[data-piece-style="onyx"] .drag-ghost.white .piece-face::before {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 1), rgba(231, 237, 245, 0.98) 42%, rgba(176, 186, 201, 0.98));
  border: 1px solid rgba(114, 128, 148, 0.24);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.62),
    inset 0 -4px 8px rgba(186, 196, 208, 0.28),
    0 10px 15px rgba(0, 0, 0, 0.16);
}

.page-shell[data-piece-style="onyx"] .board-piece.black .piece-face::before,
.page-shell[data-piece-style="onyx"] .drag-ghost.black .piece-face::before {
  background:
    linear-gradient(165deg, rgba(115, 128, 146, 0.96), rgba(33, 38, 46, 0.99) 34%, rgba(4, 6, 10, 1));
  border: 1px solid rgba(232, 239, 248, 0.16);
  box-shadow:
    inset 0 1px 4px rgba(255, 255, 255, 0.12),
    inset 0 -4px 8px rgba(0, 0, 0, 0.32),
    0 10px 15px rgba(0, 0, 0, 0.24);
}

.board-piece .piece-face,
.drag-ghost .piece-face {
  color: currentColor !important;
  -webkit-text-fill-color: currentColor !important;
  background: none !important;
  background-image: none !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
}

.board-piece .piece-face::before,
.drag-ghost .piece-face::before {
  top: auto !important;
  left: 50% !important;
  bottom: 8px !important;
  inset: auto !important;
  width: 54% !important;
  height: 14% !important;
  transform: translateX(-50%) !important;
  border-radius: 50% !important;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.42), transparent 72%) !important;
  border: none !important;
  box-shadow: none !important;
  opacity: 0.62 !important;
}

.board-piece.white .piece-face,
.drag-ghost.white .piece-face {
  color: #fdf7ee !important;
  -webkit-text-stroke: 1.18px rgba(112, 76, 33, 0.52);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 0 rgba(229, 208, 169, 0.96),
    0 8px 10px rgba(0, 0, 0, 0.18) !important;
}

.board-piece.black .piece-face,
.drag-ghost.black .piece-face {
  color: #111820 !important;
  -webkit-text-stroke: 1.12px rgba(231, 237, 246, 0.2);
  text-shadow:
    0 1px 0 rgba(216, 225, 238, 0.12),
    0 -1px 0 rgba(0, 0, 0, 0.98),
    0 8px 10px rgba(0, 0, 0, 0.22) !important;
}

.board-piece:hover .piece-face,
.board-piece.active .piece-face {
  transform: translateY(-6px) scale(1.03);
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.18));
}

.board-piece .piece-face {
  font-size: calc(var(--square-size) * 0.78) !important;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.14)) !important;
}

.page-shell[data-piece-style="marble"] .piece-face,
.page-shell[data-piece-style="porcelain"] .piece-face {
  font-size: calc(var(--square-size) * 0.79) !important;
}

.page-shell[data-piece-style="midnight"] .piece-face,
.page-shell[data-piece-style="steel"] .piece-face,
.page-shell[data-piece-style="onyx"] .piece-face {
  font-size: calc(var(--square-size) * 0.745) !important;
}

.page-shell[data-piece-style="regal"] .board-piece.white .piece-face,
.page-shell[data-piece-style="regal"] .drag-ghost.white .piece-face,
.page-shell[data-piece-style="porcelain"] .board-piece.white .piece-face,
.page-shell[data-piece-style="porcelain"] .drag-ghost.white .piece-face {
  color: #fff6ea !important;
  -webkit-text-stroke: 1.12px rgba(146, 92, 52, 0.38);
}

.page-shell[data-piece-style="regal"] .board-piece.black .piece-face,
.page-shell[data-piece-style="regal"] .drag-ghost.black .piece-face {
  color: #34131d !important;
  -webkit-text-stroke: 1.05px rgba(245, 220, 228, 0.2);
}

.page-shell[data-piece-style="marble"] .board-piece.white .piece-face,
.page-shell[data-piece-style="marble"] .drag-ghost.white .piece-face,
.page-shell[data-piece-style="onyx"] .board-piece.white .piece-face,
.page-shell[data-piece-style="onyx"] .drag-ghost.white .piece-face,
.page-shell[data-piece-style="steel"] .board-piece.white .piece-face,
.page-shell[data-piece-style="steel"] .drag-ghost.white .piece-face {
  color: #fbfdff !important;
  -webkit-text-stroke: 1.08px rgba(116, 130, 151, 0.34);
}

.page-shell[data-piece-style="marble"] .board-piece.black .piece-face,
.page-shell[data-piece-style="marble"] .drag-ghost.black .piece-face,
.page-shell[data-piece-style="onyx"] .board-piece.black .piece-face,
.page-shell[data-piece-style="onyx"] .drag-ghost.black .piece-face,
.page-shell[data-piece-style="steel"] .board-piece.black .piece-face,
.page-shell[data-piece-style="steel"] .drag-ghost.black .piece-face {
  color: #111821 !important;
  -webkit-text-stroke: 1.02px rgba(228, 235, 245, 0.2);
}

.page-shell[data-piece-style="midnight"] .board-piece.white .piece-face,
.page-shell[data-piece-style="midnight"] .drag-ghost.white .piece-face {
  color: #eef8ff !important;
  -webkit-text-stroke: 1.08px rgba(108, 160, 255, 0.42);
}

.page-shell[data-piece-style="midnight"] .board-piece.black .piece-face,
.page-shell[data-piece-style="midnight"] .drag-ghost.black .piece-face {
  color: #0c1118 !important;
  -webkit-text-stroke: 1.02px rgba(150, 196, 255, 0.22);
}

.page-shell[data-piece-style="emerald"] .board-piece.white .piece-face,
.page-shell[data-piece-style="emerald"] .drag-ghost.white .piece-face {
  color: #fff8e8 !important;
  -webkit-text-stroke: 1.08px rgba(126, 93, 35, 0.4);
}

.page-shell[data-piece-style="emerald"] .board-piece.black .piece-face,
.page-shell[data-piece-style="emerald"] .drag-ghost.black .piece-face {
  color: #0d1710 !important;
  -webkit-text-stroke: 1.02px rgba(213, 196, 142, 0.18);
}

.page-shell[data-piece-style="marble"] .board-piece.white .piece-face,
.page-shell[data-piece-style="marble"] .drag-ghost.white .piece-face {
  background-image: linear-gradient(180deg, #ffffff 0%, #eef3f8 48%, #c9d2de 76%, #8a96a9 100%);
  -webkit-text-stroke: 0.9px rgba(111, 125, 147, 0.34);
}

.page-shell[data-piece-style="marble"] .board-piece.black .piece-face,
.page-shell[data-piece-style="marble"] .drag-ghost.black .piece-face {
  background-image: linear-gradient(180deg, #9daabe 0%, #4f6074 42%, #111a25 84%);
  -webkit-text-stroke: 0.9px rgba(233, 240, 250, 0.26);
}

.page-shell[data-piece-style="midnight"] .board-piece.white .piece-face,
.page-shell[data-piece-style="midnight"] .drag-ghost.white .piece-face {
  background-image: linear-gradient(180deg, #f8fdff 0%, #d9f0ff 42%, #89c0ff 72%, #4478d3 100%);
  -webkit-text-stroke: 0.95px rgba(114, 164, 255, 0.56);
  text-shadow:
    0 0 12px rgba(146, 208, 255, 0.3),
    0 12px 16px rgba(0, 0, 0, 0.2);
}

.page-shell[data-piece-style="midnight"] .board-piece.black .piece-face,
.page-shell[data-piece-style="midnight"] .drag-ghost.black .piece-face {
  background-image: linear-gradient(180deg, #7aa0ec 0%, #2b4068 38%, #070d18 82%);
  -webkit-text-stroke: 0.95px rgba(147, 196, 255, 0.42);
  text-shadow:
    0 0 10px rgba(74, 116, 220, 0.24),
    0 12px 16px rgba(0, 0, 0, 0.26);
}

.page-shell[data-piece-style="emerald"] .board-piece.white .piece-face,
.page-shell[data-piece-style="emerald"] .drag-ghost.white .piece-face {
  background-image: linear-gradient(180deg, #fffdf3 0%, #f6ebc9 44%, #d9b16d 74%, #916726 100%);
}

.page-shell[data-piece-style="emerald"] .board-piece.black .piece-face,
.page-shell[data-piece-style="emerald"] .drag-ghost.black .piece-face {
  background-image: linear-gradient(180deg, #78947d 0%, #31493a 42%, #08110c 82%);
}

.page-shell[data-piece-style="regal"] .board-piece.white .piece-face,
.page-shell[data-piece-style="regal"] .drag-ghost.white .piece-face {
  background-image: linear-gradient(180deg, #fff9f3 0%, #ffe7d2 40%, #ddb184 70%, #b06c32 100%);
}

.page-shell[data-piece-style="regal"] .board-piece.black .piece-face,
.page-shell[data-piece-style="regal"] .drag-ghost.black .piece-face {
  background-image: linear-gradient(180deg, #b66a84 0%, #5a2133 42%, #1c0710 82%);
}

.page-shell[data-piece-style="onyx"] .board-piece.white .piece-face,
.page-shell[data-piece-style="onyx"] .drag-ghost.white .piece-face {
  background-image: linear-gradient(180deg, #ffffff 0%, #edf2f7 50%, #c0cad8 78%, #7c889a 100%);
}

.page-shell[data-piece-style="onyx"] .board-piece.black .piece-face,
.page-shell[data-piece-style="onyx"] .drag-ghost.black .piece-face {
  background-image: linear-gradient(180deg, #99a7b8 0%, #414c59 40%, #030508 84%);
}

.page-shell[data-piece-style="porcelain"] .piece-face {
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: calc(var(--square-size) * 0.63);
  letter-spacing: 0.01em;
  transform: translateY(-3px) scale(1.01);
}

.page-shell[data-piece-style="porcelain"] .board-piece.white .piece-face,
.page-shell[data-piece-style="porcelain"] .drag-ghost.white .piece-face {
  background-image: linear-gradient(180deg, #ffffff 0%, #fffaf1 40%, #f0ddba 72%, #c18942 100%);
  -webkit-text-stroke: 0.92px rgba(156, 108, 55, 0.34);
}

.page-shell[data-piece-style="porcelain"] .board-piece.black .piece-face,
.page-shell[data-piece-style="porcelain"] .drag-ghost.black .piece-face {
  background-image: linear-gradient(180deg, #b8c0cc 0%, #4e4a4f 34%, #110c0d 82%);
  -webkit-text-stroke: 0.92px rgba(246, 227, 196, 0.24);
}

.page-shell[data-piece-style="steel"] .piece-face {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Arial Unicode MS", sans-serif;
  font-size: calc(var(--square-size) * 0.615);
  letter-spacing: 0.01em;
  transform: translateY(-3px);
}

.page-shell[data-piece-style="steel"] .board-piece.white .piece-face,
.page-shell[data-piece-style="steel"] .drag-ghost.white .piece-face {
  background-image: linear-gradient(180deg, #ffffff 0%, #e8eef6 42%, #b8c5d6 70%, #72839a 100%);
  -webkit-text-stroke: 0.92px rgba(109, 123, 143, 0.34);
}

.page-shell[data-piece-style="steel"] .board-piece.black .piece-face,
.page-shell[data-piece-style="steel"] .drag-ghost.black .piece-face {
  background-image: linear-gradient(180deg, #c7d1dd 0%, #596675 38%, #091018 84%);
  -webkit-text-stroke: 0.92px rgba(226, 234, 244, 0.22);
}

.piece-ghost {
  opacity: 0;
}

.board-piece.spawn-animating .piece-face {
  animation: pieceSpawn 320ms cubic-bezier(.22, 1, .36, 1) both;
}

.board-piece.move-animating {
  z-index: 5;
}

.board-piece.move-animating .piece-face {
  animation: pieceTravel 360ms cubic-bezier(.18, .92, .22, 1.06) both;
}

.board-piece.move-animating::before {
  animation: pieceAura 360ms ease-out both;
}

.board-piece.capture-animating {
  z-index: 4;
  pointer-events: none;
  animation: pieceCapture 220ms ease-out both;
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--square-size);
  height: var(--square-size);
  padding: 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
  z-index: 60;
  transform: translate(-9999px, -9999px);
}

.drag-ghost .piece-face {
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.34));
}

.capture-row {
  min-height: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.capture-row.compact {
  gap: 4px;
}

.capture-chip,
.piece-token {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid rgba(255, 235, 204, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  font-size: 0.86rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.capture-chip.white {
  color: var(--piece-white);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 2px 0 rgba(203, 181, 140, 0.9);
}

.capture-chip.black {
  color: var(--piece-black);
  text-shadow:
    0 1px 0 rgba(224, 231, 239, 0.2),
    0 -1px 0 rgba(0, 0, 0, 0.96);
}

.player-card {
  display: grid;
  gap: 8px;
}

.player-card.active-seat {
  border-color: rgba(245, 214, 111, 0.28);
  background: linear-gradient(180deg, rgba(245, 214, 111, 0.1), rgba(255, 255, 255, 0.02));
}

.player-head {
  align-items: start;
}

.player-name {
  font-size: 0.98rem;
  font-weight: 700;
}

.player-color-label {
  margin-top: 4px;
}

.inline-chip.turn-chip {
  background: rgba(110, 231, 200, 0.18);
  color: #c5fff0;
}

.inline-chip.empty-chip {
  background: rgba(255, 255, 255, 0.08);
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.player-cards {
  min-height: 0;
  max-height: 240px;
  overflow: auto;
}

.sidebar-panel {
  min-height: 0;
  display: block;
}

.history-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.move-index {
  min-width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
}

.legend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.legend-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.promotion-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 8, 14, 0.72);
  padding: 24px;
  z-index: 30;
}

.promotion-modal.hidden {
  display: none;
}

.promotion-card {
  width: min(520px, 100%);
}

.promotion-options {
  margin-top: 18px;
  flex-wrap: wrap;
}

.promotion-choice {
  min-width: 110px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 140%);
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(5, 14, 24, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
  transition: transform 180ms ease;
  z-index: 40;
}

.toast.visible {
  transform: translate(-50%, 0);
}

@keyframes kingPulse {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.25); }
}

@keyframes pieceSpawn {
  0% {
    transform: translateY(10px) scale(0.82);
    opacity: 0;
    filter: saturate(0.88);
  }
  65% {
    transform: translateY(-6px) scale(1.05);
    opacity: 1;
    filter: saturate(1.08);
  }
  100% {
    transform: translateY(-3px) scale(1);
    opacity: 1;
    filter: none;
  }
}

@keyframes pieceTravel {
  0% {
    transform: translateY(-3px) scale(1);
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.16));
  }
  36% {
    transform: translateY(-15px) scale(1.1);
    filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.22));
  }
  72% {
    transform: translateY(1px) scale(0.97);
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.18));
  }
  100% {
    transform: translateY(-3px) scale(1);
    filter: none;
  }
}

@keyframes pieceAura {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1.18);
  }
  100% {
    opacity: 0;
    transform: scale(1.32);
  }
}

@keyframes pieceCapture {
  0% {
    opacity: 1;
    transform: translate(var(--x, 0), var(--y, 0)) scale(1);
    filter: saturate(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--x, 0), calc(var(--y, 0) - 12px)) scale(0.72);
    filter: saturate(1.35) blur(1px);
  }
}

.page-shell {
  --piece-svg-white-filter: sepia(0.08) saturate(0.92) brightness(1.05) contrast(1.02) drop-shadow(0 10px 10px rgba(57, 36, 14, 0.18));
  --piece-svg-black-filter: sepia(0.08) saturate(0.68) brightness(0.76) contrast(1.12) drop-shadow(0 10px 10px rgba(0, 0, 0, 0.22));
  --piece-svg-white-filter-hover: sepia(0.08) saturate(0.95) brightness(1.08) contrast(1.03) drop-shadow(0 12px 12px rgba(57, 36, 14, 0.2));
  --piece-svg-black-filter-hover: sepia(0.08) saturate(0.7) brightness(0.8) contrast(1.14) drop-shadow(0 12px 12px rgba(0, 0, 0, 0.24));
}

.piece-face.piece-face-svg {
  width: 100%;
  height: 100%;
  display: flex !important;
  align-items: flex-end;
  justify-content: center;
  padding: 2px 1px 0;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  background: none !important;
  filter: none !important;
  transform: translateY(-2px) !important;
  isolation: isolate;
}

.piece-face.piece-face-svg::before,
.piece-face.piece-face-svg::after {
  content: none !important;
  display: none !important;
}

.piece-face.piece-face-svg .piece-fallback {
  display: none;
}

.piece-face.piece-face-svg .piece-art {
  width: 88%;
  height: 88%;
  display: block;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  user-select: none;
  transform-origin: center bottom;
  transition:
    transform 180ms ease,
    filter 180ms ease,
    opacity 140ms ease;
  will-change: transform, filter;
}

.piece-face.piece-face-sprite .piece-art-sprite {
  background-repeat: no-repeat;
  background-size: var(--sprite-size-x) var(--sprite-size-y);
  background-position: var(--sprite-pos-x) var(--sprite-pos-y);
}

.board-piece.white .piece-face.piece-face-svg .piece-art,
.drag-ghost.white .piece-face.piece-face-svg .piece-art {
  filter: var(--piece-svg-white-filter);
}

.board-piece.black .piece-face.piece-face-svg .piece-art,
.drag-ghost.black .piece-face.piece-face-svg .piece-art {
  filter: var(--piece-svg-black-filter);
}

.piece-face.piece-face-svg[data-piece-type="king"] .piece-art,
.piece-face.piece-face-svg[data-piece-type="queen"] .piece-art {
  width: 92%;
  height: 92%;
}

.piece-face.piece-face-svg[data-piece-type="rook"] .piece-art,
.piece-face.piece-face-svg[data-piece-type="bishop"] .piece-art {
  width: 86%;
  height: 86%;
}

.piece-face.piece-face-svg[data-piece-type="knight"] .piece-art {
  width: 90%;
  height: 90%;
}

.piece-face.piece-face-svg[data-piece-type="pawn"] .piece-art {
  width: 73%;
  height: 73%;
}

.board-piece:hover .piece-face.piece-face-svg .piece-art,
.board-piece.active .piece-face.piece-face-svg .piece-art {
  transform: translateY(-2px) scale(1.04);
}

.board-piece.white:hover .piece-face.piece-face-svg .piece-art,
.board-piece.white.active .piece-face.piece-face-svg .piece-art {
  filter: var(--piece-svg-white-filter-hover);
}

.board-piece.black:hover .piece-face.piece-face-svg .piece-art,
.board-piece.black.active .piece-face.piece-face-svg .piece-art {
  filter: var(--piece-svg-black-filter-hover);
}

.board-piece.moved .piece-face.piece-face-svg .piece-art {
  transform: translateY(-1px) scale(1.025);
}

.page-shell[data-piece-style="marble"],
.page-shell[data-piece-style="porcelain"] {
  --piece-svg-white-filter: saturate(0.78) brightness(1.08) contrast(1.03) drop-shadow(0 10px 10px rgba(42, 50, 67, 0.16));
  --piece-svg-black-filter: saturate(0.5) brightness(0.74) contrast(1.16) drop-shadow(0 10px 10px rgba(13, 17, 26, 0.22));
  --piece-svg-white-filter-hover: saturate(0.8) brightness(1.11) contrast(1.04) drop-shadow(0 12px 12px rgba(42, 50, 67, 0.18));
  --piece-svg-black-filter-hover: saturate(0.52) brightness(0.78) contrast(1.18) drop-shadow(0 12px 12px rgba(13, 17, 26, 0.24));
}

.page-shell[data-piece-style="midnight"] {
  --piece-svg-white-filter: hue-rotate(188deg) saturate(1.08) brightness(1.06) contrast(1.04) drop-shadow(0 0 9px rgba(95, 164, 255, 0.2)) drop-shadow(0 10px 10px rgba(10, 18, 34, 0.2));
  --piece-svg-black-filter: hue-rotate(188deg) saturate(1.04) brightness(0.66) contrast(1.16) drop-shadow(0 0 10px rgba(67, 124, 255, 0.14)) drop-shadow(0 10px 10px rgba(0, 0, 0, 0.24));
  --piece-svg-white-filter-hover: hue-rotate(188deg) saturate(1.12) brightness(1.1) contrast(1.05) drop-shadow(0 0 12px rgba(110, 184, 255, 0.24)) drop-shadow(0 12px 12px rgba(10, 18, 34, 0.22));
  --piece-svg-black-filter-hover: hue-rotate(188deg) saturate(1.08) brightness(0.7) contrast(1.18) drop-shadow(0 0 12px rgba(67, 124, 255, 0.16)) drop-shadow(0 12px 12px rgba(0, 0, 0, 0.26));
}

.page-shell[data-piece-style="emerald"] {
  --piece-svg-white-filter: sepia(0.18) saturate(1.02) brightness(1.05) contrast(1.02) drop-shadow(0 10px 10px rgba(55, 42, 18, 0.18));
  --piece-svg-black-filter: hue-rotate(14deg) saturate(0.92) brightness(0.74) contrast(1.12) drop-shadow(0 10px 10px rgba(8, 25, 16, 0.24));
  --piece-svg-white-filter-hover: sepia(0.22) saturate(1.06) brightness(1.08) contrast(1.03) drop-shadow(0 12px 12px rgba(55, 42, 18, 0.2));
  --piece-svg-black-filter-hover: hue-rotate(14deg) saturate(0.96) brightness(0.78) contrast(1.14) drop-shadow(0 12px 12px rgba(8, 25, 16, 0.26));
}

.page-shell[data-piece-style="regal"] {
  --piece-svg-white-filter: sepia(0.22) saturate(1.06) brightness(1.07) contrast(1.03) drop-shadow(0 10px 10px rgba(70, 30, 34, 0.16));
  --piece-svg-black-filter: hue-rotate(-12deg) saturate(0.96) brightness(0.74) contrast(1.12) drop-shadow(0 10px 10px rgba(22, 6, 13, 0.24));
  --piece-svg-white-filter-hover: sepia(0.24) saturate(1.08) brightness(1.1) contrast(1.04) drop-shadow(0 12px 12px rgba(70, 30, 34, 0.18));
  --piece-svg-black-filter-hover: hue-rotate(-12deg) saturate(1) brightness(0.78) contrast(1.14) drop-shadow(0 12px 12px rgba(22, 6, 13, 0.26));
}

.page-shell[data-piece-style="onyx"],
.page-shell[data-piece-style="steel"] {
  --piece-svg-white-filter: saturate(0.42) brightness(1.06) contrast(1.08) drop-shadow(0 10px 10px rgba(24, 32, 43, 0.16));
  --piece-svg-black-filter: saturate(0.4) brightness(0.7) contrast(1.22) drop-shadow(0 10px 10px rgba(0, 0, 0, 0.26));
  --piece-svg-white-filter-hover: saturate(0.44) brightness(1.09) contrast(1.1) drop-shadow(0 12px 12px rgba(24, 32, 43, 0.18));
  --piece-svg-black-filter-hover: saturate(0.42) brightness(0.74) contrast(1.24) drop-shadow(0 12px 12px rgba(0, 0, 0, 0.28));
}

@media (max-width: 1260px) {
  .layout {
    display: block;
  }

  .board-column {
    width: min(100%, 1120px);
  }

  .page-shell[data-setup-collapsed="true"] .setup-column,
  .page-shell[data-sidebar-collapsed="true"] .sidebar {
    display: none;
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100vw, calc(100vw - 18px));
    min-height: auto;
    height: auto;
    display: block;
    padding-top: 14px;
  }

  .layout {
    display: block;
    overflow: visible;
  }

  .setup-column,
  .sidebar {
    position: static;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    width: auto;
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .board-column {
    display: grid;
    width: auto;
  }

  .board-panel,
  .sidebar-panel {
    display: block;
    min-height: auto;
  }

  .topbar,
  .topbar-controls,
  .topbar-status,
  .board-header,
  .board-footer,
  .invite-header,
  .invite-row,
  .board-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .field-grid,
  .hero-actions {
    grid-template-columns: 1fr;
  }

  .rail-head {
    gap: 8px;
  }

  .clock-strip {
    grid-template-columns: 1fr;
  }

  .board-stage {
    padding: 12px;
    border-radius: 22px;
  }

  .board-stage::before {
    inset: 0;
    border-radius: inherit;
  }

  .board-grid {
    --square-size: min(11.5vw, 54px);
  }

  .page-shell[data-setup-collapsed="true"] .board-grid,
  .page-shell[data-sidebar-collapsed="true"] .board-grid,
  .page-shell[data-setup-collapsed="true"][data-sidebar-collapsed="true"] .board-grid {
    --square-size: min(11.5vw, 54px);
  }

  .page-shell[data-focus-mode="true"] .board-column {
    top: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }

  .page-shell[data-focus-mode="true"] .board-panel {
    padding: 14px;
    border-radius: 24px;
  }

  .page-shell[data-focus-mode="true"] .clock-strip {
    margin-top: 12px;
  }

  .page-shell[data-focus-mode="true"] .focus-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .page-shell[data-focus-mode="true"] .focus-hint {
    max-width: none;
    text-align: left;
  }

  .page-shell[data-focus-mode="true"] .board-stage {
    padding: 12px;
    border-radius: 22px;
  }

  .page-shell[data-focus-mode="true"] .board-grid {
    --square-size: min(calc((100vw - 44px) / 8), calc((100vh - 258px) / 8), 82px);
  }

  .footer-captures {
    grid-template-columns: 1fr;
  }
}
