/* THE CHESS ROOM · wood, leather, and warm brass. */
:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --ink: #f1e9d9;
  --sub: #aab8ac;
  --muted: #7c9389;
  --brass: #d1ac6c;
  --brass-light: #f1d9a2;
  --forest: #172522;
  --panel: #233832;
  --stroke: #43584e;
  --wood: #795035;
  --board-light: #ead6b0;
  --board-dark: #9f7958;
  background: #13221f;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 65% 36% at 50% 0%, #304f40 0%, transparent 82%),
    radial-gradient(ellipse 55% 40% at 100% 70%, #1d352e 0%, transparent 80%),
    #13221f;
}
button, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--brass-light); outline-offset: 3px;
}
.skip { position: absolute; left: -10000px; top: 8px; z-index: 30; }
.skip:focus { left: 12px; padding: 12px 18px; background: #fff5dc; color: #16241f; }
.masthead {
  border-bottom: 1px solid #7f957949;
  background: #10201cce;
  box-shadow: 0 8px 24px #08150e27;
}
.masthead-inner {
  max-width: 1200px; min-height: 76px; padding: 0 22px; margin: auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
}
.home-link { justify-self: start; text-decoration: none; color: #c4cdbe; font-size: 13px; font-weight: 600; }
.home-link span { color: var(--brass); padding-right: 6px; font-size: 17px; }
.home-link:hover { color: var(--brass-light); }
.wordmark { display: flex; align-items: center; gap: 10px; color: #ead8b6; font: 700 18px/1.1 Georgia, 'Times New Roman', serif; letter-spacing: .055em; }
.wordmark-mark { font: 35px/1 Georgia, serif; color: var(--brass); filter: drop-shadow(0 2px 2px #0007); }
.wordmark small { display: block; margin-top: 5px; color: #9daf9c; font: 600 9px/1 system-ui, sans-serif; letter-spacing: .24em; }
.masthead-right { justify-self: end; display: flex; gap: 9px; align-items: center; color: #a3bba7; font-size: 10px; letter-spacing: .13em; font-weight: 800; }
.live-dot { background: #91c89f; height: 7px; width: 7px; border-radius: 50%; box-shadow: 0 0 10px #a3ecc6a6; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 29px 22px 46px; }
.hero {
  position: relative; display: grid; grid-template-columns: 1fr 39%; overflow: hidden;
  min-height: 277px; border: 1px solid #527363; border-radius: 18px;
  background:
    radial-gradient(ellipse at 80% 56%, #56735a5d 0%, transparent 40%),
    linear-gradient(118deg, #2b463a, #1e342b 61%, #1a2b24);
  box-shadow: 0 18px 55px #07120e3d, inset 0 1px #c5c99a26;
}
.hero::before {
  content: ''; position: absolute; inset: 0; opacity: .22; pointer-events: none;
  background: repeating-linear-gradient(115deg, transparent 0 28px, #d3c69b0c 30px 31px, transparent 34px 62px);
}
.hero::after { content: ''; position: absolute; inset: 13px; border: 1px solid #c5b58a25; border-radius: 11px; pointer-events: none; }
.hero-copy { position: relative; z-index: 2; padding: 36px 20px 33px 46px; }
.eyebrow { margin: 0 0 17px; display: flex; align-items: center; gap: 10px; font-size: 10px; font-weight: 800; letter-spacing: .15em; color: #d3bf93; }
.eyebrow-line { display: inline-block; width: 22px; height: 1px; background: var(--brass); }
.hero h1 { font-size: clamp(30px, 3.3vw, 43px); font-weight: 800; letter-spacing: -.045em; line-height: 1.34; margin: 0 0 16px; color: #f5eedf; }
.hero h1 em { color: #e4bf7e; font-style: normal; }
.lead { color: #b6c8b6; font-size: 13px; line-height: 1.85; max-width: 500px; margin: 0; word-break: keep-all; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; color: #d4dbc5; font-size: 11px; font-weight: 600; }
.hero-icon { color: var(--brass); font-style: normal; margin-right: 5px; }
.hero-art { position: relative; min-height: 270px; z-index: 1; overflow: hidden; }
.hero-halo { position: absolute; width: 300px; height: 300px; border-radius: 50%; top: -56px; right: 30px; border: 1px solid #cbbd8666; background: radial-gradient(circle, #7890794a 0 30%, transparent 66%); box-shadow: inset 0 0 0 28px #cab8790b, inset 0 0 0 29px #cab87925; }
.hero-art img { position: absolute; object-fit: contain; user-select: none; pointer-events: none; filter: drop-shadow(15px 22px 10px #0008); }
.hero-king { z-index: 2; width: 205px; height: 250px; top: 0; right: 81px; transform: rotate(7deg); }
.hero-knight { z-index: 3; width: 160px; height: 205px; top: 70px; right: 230px; transform: rotate(-8deg); }
.hero-art-caption { position: absolute; right: 36px; bottom: 17px; color: #d4be8ca9; font: 700 9px Georgia, serif; letter-spacing: .14em; }
.game-layout { display: grid; grid-template-columns: minmax(0, 681px) minmax(320px, 1fr); gap: 24px; align-items: start; margin-top: 27px; }
.play-area { min-width: 0; }
.arena-heading { display: flex; align-items: end; gap: 13px; margin: 0 4px 13px; }
.small-caps { display: block; color: #bea477; font-size: 10px; letter-spacing: .19em; font-weight: 750; line-height: 1.4; }
.arena-heading h2 { font-size: 21px; letter-spacing: -.035em; margin: 4px 0 0; font-weight: 750; }
.arena-heading-rule { height: 1px; flex: 1; background: #5d725f8c; margin-bottom: 8px; }
.arena-heading-note { padding-bottom: 2px; white-space: nowrap; color: #97aa97; font-size: 11px; }
.arena-surface { overflow: hidden; padding: 0; border-radius: 16px; background: #26392d; border: 1px solid #61705f; box-shadow: 0 18px 40px #050f0b70, inset 0 1px #cfc39c3b; }
.player-status { display: flex; align-items: center; gap: 12px; min-height: 69px; padding: 10px 21px; background: linear-gradient(90deg, #293f33, #1e342c); transition: background 180ms ease; }
.player-status:first-child { border-bottom: 1px solid #8a966c55; }
.player-status:nth-child(3) { border-top: 1px solid #8a966c55; }
.player-status.active { background: linear-gradient(100deg, #405742, #2c4a3a); }
.player-emblem { display: grid; place-items: center; flex-shrink: 0; width: 43px; height: 43px; overflow: hidden; border: 1px solid #a88f5c77; border-radius: 50%; box-shadow: inset 0 1px 1px #fff3, 0 3px 9px #0004; }
.player-emblem img { width: 42px; height: 45px; object-fit: contain; transform: scale(1.13); }
.dark-emblem { background: radial-gradient(circle at 35% 25%, #9a8b6d, #3c3129 76%); }
.light-emblem { background: radial-gradient(circle at 35% 25%, #efe5d2, #9a8365 76%); }
.player-title strong { display: block; color: #f7efdf; font-size: 15px; letter-spacing: -.025em; }
.player-en { font: 600 10px Georgia, serif; letter-spacing: .11em; color: #c0b798; margin-left: 7px; }
.player-title small { display: block; font-size: 11px; margin-top: 3px; color: #b0c5b4; }
.player-turn-indicator { margin-left: auto; padding: 7px 12px; color: #a5b4aa; border: 1px solid #7f988655; border-radius: 30px; font-size: 11px; }
.active .player-turn-indicator { background: #d1b179; color: #223b30; border-color: #dcc289; font-weight: 800; box-shadow: 0 0 14px #d5b47735; }
.board-surround { padding: 17px; background: linear-gradient(145deg, #9b7050, #603b2c 49%, #83583e 78%, #54372c); box-shadow: inset 0 4px 8px #110c0a80, inset 0 -3px 4px #d5a56d63; }
.board-rim { padding: 7px; background: linear-gradient(150deg, #d6b17a, #8f633c 35%, #ddbb80 70%, #7d5032); border: 2px solid #4e3326; box-shadow: 0 9px 18px #11080685, inset 0 0 0 1px #fae8c07c; }
.chessboard { display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); aspect-ratio: 1; width: 100%; overflow: hidden; border: 1px solid #44291b; box-shadow: 0 0 0 1px #ffffff3b; }
.square { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 0; outline-offset: -3px; isolation: isolate; touch-action: manipulation; }
.square.light { background: linear-gradient(146deg, #f4e4c4 0%, #ead7b2 47%, #dbc39c 100%); }
.square.dark { background: linear-gradient(146deg, #b78b65 0%, #a57855 50%, #956846 100%); }
.square::selection { background: transparent; }
.square:focus-visible { outline: 3px solid #f5e3a4; z-index: 5; }
.square.selected { background: linear-gradient(135deg, #f6d886, #ddae54) !important; }
.square.last-move.light { background: linear-gradient(140deg, #e7d997, #d9c17b); }
.square.last-move.dark { background: linear-gradient(140deg, #b4a45e, #95894b); }
.square.in-check { background: linear-gradient(135deg, #f2a69b, #cb6553) !important; }
/* 3D PNG renders keep their natural shading and are vertically centred on the squares. */
.piece { z-index: 2; display: block; position: relative; width: 100%; height: 100%; max-width: none; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; transform: translateY(-2%) scale(1.12); filter: drop-shadow(2px 5px 3px #2a190e91); transition: transform 130ms ease, filter 130ms ease; }
.square:hover .piece { transform: translateY(-6%) scale(1.16); filter: drop-shadow(3px 9px 5px #1b0d0899); }
.square.selected .piece { transform: translateY(-9%) scale(1.2); filter: drop-shadow(3px 11px 6px #271910a8); }
.square small { position: absolute; z-index: 3; pointer-events: none; font: 800 clamp(9px, 1.2vw, 12px) Georgia, serif; text-shadow: 0 1px #ffffff3f; }
.coord-rank { top: 4px; left: 4px; }
.coord-file { bottom: 3px; right: 4px; }
.square.light small { color: #946943; }
.square.dark small { color: #fce8ba; }
.square.legal-empty::after { content: ''; position: absolute; z-index: 4; left: 40%; top: 40%; width: 20%; height: 20%; border-radius: 50%; background: #28503fa6; box-shadow: 0 1px 1px #fff6; pointer-events: none; }
.square.legal-capture::after { content: ''; position: absolute; z-index: 4; inset: 4px; border: 5px solid #4e8058bd; border-radius: 50%; pointer-events: none; }
.square.legal-en-passant::after { content: ''; position: absolute; z-index: 4; inset: 6%; border: 3px dashed #ae5b28; border-radius: 50%; background: #e9bb8333; pointer-events: none; }
.square.legal-en-passant::before { content: 'EP'; position: absolute; z-index: 5; right: 4px; bottom: 4px; padding: 1px 3px; border-radius: 3px; background: #fff3d5; font: 800 10px/1.2 system-ui, sans-serif; color: #924623; pointer-events: none; }
.square.en-passant-victim { box-shadow: inset 0 0 0 3px #bc6937, inset 0 0 0 7px #ffe1ae55; }
.square.en-passant-victim .piece { filter: drop-shadow(0 0 5px #c86237); }
.square.last-en-passant-victim { box-shadow: inset 0 0 0 4px #c2672f, inset 0 0 0 8px #ffe6b45c; }
.square.last-en-passant-victim::after { content: '잡힘'; position: absolute; z-index: 4; right: 2px; bottom: 3px; padding: 2px 4px; border-radius: 4px; color: #632b17; background: #ffdfaf; font: 800 10px/1.2 system-ui, sans-serif; pointer-events: none; }
.board-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; padding: 13px 2px; color: #a5b7a6; font-size: 11px; }
.foot-legend { display: flex; flex-wrap: wrap; gap: 9px 17px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.hint-dot, .move-dot, .ep-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #dfb45f; box-shadow: 0 1px 3px #0004; }
.move-dot { background: #78a887; }
.ep-dot { background: #d2a47c; border: 2px dashed #a45630; }
.sidebar { display: grid; gap: 16px; }
.panel { padding: 23px; border: 1px solid #506f5f; border-radius: 16px; background: linear-gradient(145deg, #2a4137, #20362f); box-shadow: 0 8px 26px #07130e4d, inset 0 1px #b5c8a61b; }
.panel-titleline { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.panel h2 { margin: 5px 0 0; color: #f0ebdc; font-size: 20px; letter-spacing: -.04em; font-weight: 800; }
.panel-symbol { font: 42px/1 Georgia, serif; color: #d3ba83; opacity: .62; }
.panel-description { margin: 11px 0 19px; color: #b0c0b0; font-size: 12px; line-height: 1.65; }
.mode-group { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mode-choice { display: flex; align-items: center; justify-content: flex-start; gap: 7px; min-height: 74px; padding: 11px 8px; text-align: left; border: 1px solid #647b66; border-radius: 10px; color: #c7d0c0; background: #172b25; font-size: 12px; font-weight: 800; transition: background 120ms ease, border-color 120ms ease, transform 120ms ease; }
.mode-choice:hover { border-color: #ceb180; background: #29443a; }
.mode-choice.active { border-color: #dbb77c; color: #f6e9cc; background: linear-gradient(130deg, #67553c, #423c2d); box-shadow: inset 0 1px #fff3, 0 2px 9px #070b0b55; }
.mode-choice small { display: block; margin-top: 5px; color: #a9bea7; font-size: 10px; font-weight: 500; }
.mode-choice.active small { color: #e0cead; }
.mode-icon { font: 27px/1 Georgia, serif; color: #dec798; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 0; }
.field-row[hidden] { display: none; }
.field-row label { display: block; color: #d7d2b8; font-size: 11px; font-weight: 750; }
.field-row select { appearance: none; display: block; width: 100%; margin-top: 9px; padding: 11px 30px 11px 11px; border: 1px solid #708675; border-radius: 9px; color: #f5edda; background: #1c332b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1 6 6 11 1' fill='none' stroke='%23d3b985' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 10px center; font-size: 12px; }
.field-row option { color: #f2f0e4; background: #20392e; }
.primary { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding: 15px 17px; border: 1px solid #f2d4a0; border-radius: 10px; color: #243126; background: linear-gradient(120deg, #e6c88f, #d1a76e); box-shadow: 0 4px 14px #080d0a60, inset 0 1px #fff8; font-size: 14px; font-weight: 850; }
.primary:hover { background: linear-gradient(125deg, #f0d8ab, #dbb580); }
.btn-arrow { font-size: 20px; font-weight: 500; }
.move-count { padding: 7px 10px; color: #d5bd8d; background: #182f27; border: 1px solid #53705d; border-radius: 20px; font-size: 11px; white-space: nowrap; }
.turn-display { margin-top: 18px; border-radius: 10px; padding: 15px 16px; border: 1px solid #77937d; background: linear-gradient(120deg, #294c3c, #284a3a); color: #e8d09b; font-size: 18px; font-weight: 800; box-shadow: inset 0 1px #ffffff13; }
.turn-display::before { content: '●'; display: inline-block; margin-right: 9px; font-size: 10px; color: #a6c997; vertical-align: 2px; }
.turn-display.check { background: #55362b; color: #ffd1a7; border-color: #ad725c; }
.turn-display.ended { background: #443f31; color: #f3d79c; border-color: #a6926b; }
.game-hint { min-height: 39px; margin: 12px 0 16px; font-size: 12px; line-height: 1.7; color: #b6c4b3; word-break: keep-all; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.actions button { padding: 11px 7px; border: 1px solid #638170; border-radius: 9px; background: #1a3028; color: #e0e3d2; font-size: 12px; font-weight: 800; }
.actions button:hover:not(:disabled) { border-color: #d4b57a; background: #2f4f3c; }
.actions button:disabled { opacity: .43; cursor: not-allowed; }
.actions button span { margin-right: 4px; font-size: 18px; line-height: .5; color: #d9c290; }
.history-heading { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; padding: 17px 0 9px; border-top: 1px solid #66806a6a; color: #bba57d; font: 750 10px system-ui, sans-serif; letter-spacing: .12em; }
.history-heading span:last-child { color: #91a996; font-size: 11px; letter-spacing: normal; }
.move-history { max-height: 180px; min-height: 34px; overflow: auto; font: 500 14px/2 Georgia, 'Malgun Gothic', serif; color: #d6dbc9; scrollbar-color: #667c65 transparent; }
.move-history ol { padding-left: 30px; margin: 0; }
.move-history li { padding-left: 5px; }
.move-history li::marker { color: #c8ab7d; font-size: 12px; }
.move-history li span { display: inline-block; min-width: 68px; margin-right: 9px; }
.history-special { margin-left: 2px; min-width: auto !important; margin-right: 0 !important; padding: 1px 6px; border: 1px solid #e6ba78; border-radius: 6px; background: #67462c; color: #ffe2ac; font: 800 10px/1.6 system-ui, sans-serif; }
.rules { padding: 0; overflow: hidden; }
.rules summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 19px 22px; cursor: pointer; list-style: none; }
.rules summary::-webkit-details-marker { display: none; }
.rules summary strong { display: block; margin-top: 6px; color: #e8ebdb; font-size: 16px; }
.rules-summary-sub { display: block; margin-top: 4px; color: #a7b8a8; font-size: 11px; font-weight: 500; line-height: 1.45; }
.rules-plus { color: #d9ba7a; font-size: 21px; flex-shrink: 0; transition: transform 160ms ease; }
.rules[open] .rules-plus { transform: rotate(45deg); }
.rules-content { border-top: 1px solid #597365; padding: 14px 21px 20px; color: #c6d1bf; font-size: 12px; line-height: 1.82; word-break: keep-all; display: grid; gap: 14px; }
.rules-callout { padding: 12px 14px; border-radius: 10px; border: 1px solid #6a8572; background: #1a2f28; }
.rules-callout strong { display: block; margin-bottom: 5px; color: #f4dfb2; font-size: 12.5px; }
.rules-callout p { margin: 0; font-size: 12px; line-height: 1.75; }
.rules-section { padding-top: 12px; border-top: 1px dashed #5b746488; }
.rules-section-title { margin: 0 0 8px; color: #ebd09a; font-size: 12.5px; font-weight: 800; letter-spacing: -.01em; }
.rules-section-note { margin: 0 0 10px; color: #9fb3a2; font-size: 11px; line-height: 1.6; }
.rules-content dl { display: grid; grid-template-columns: 92px 1fr; gap: 9px 10px; margin: 8px 0 0; }
.rules-content dt { color: #f3dbab; font-weight: 850; display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.rules-piece-val { display: inline-block; width: fit-content; padding: 1px 6px; border-radius: 99px; background: #172b24; border: 1px solid #667e6d; color: #d8c294; font-size: 10px; font-weight: 700; }
.rules-content dd { margin: 0; line-height: 1.7; }
.rules-detail-list, .rules-guide-chips { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.rules-detail-list li { padding: 10px 12px; border-radius: 9px; border: 1px solid #546e5f; background: #1b312a; display: grid; gap: 4px; }
.rules-detail-list li strong { color: #f2dab0; font-size: 12px; }
.rules-detail-list li span { font-size: 11.5px; line-height: 1.68; }
.rules-detail-list li small { color: #a7bca9; font-size: 11px; line-height: 1.58; padding-top: 3px; border-top: 1px solid #58726255; }
.rules-guide-chips li { padding: 8px 11px; border-radius: 8px; border: 1px solid #516b5d; background: #192d27; font-size: 11.5px; line-height: 1.62; }
.rules-guide-chips li b { color: #f1d8aa; margin-right: 4px; }
.credit { font-size: 11px; margin: 2px 0 0; }
.credit a { color: #ead09d; text-underline-offset: 3px; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 30px; border-top: 1px solid #486657; padding: 20px 3px 0; color: #98a997; font-size: 11px; }
footer a { color: #ead19e; text-decoration: none; font-weight: 750; }
footer a:hover { text-decoration: underline; }
dialog { width: min(460px, calc(100vw - 32px)); max-width: none; padding: 0; border: 1px solid #967e5a; border-radius: 18px; color: #f8e9cd; background: linear-gradient(135deg,#2b473b,#1b3028); box-shadow: 0 22px 85px #000a; }
dialog::backdrop { background: #09120fd9; backdrop-filter: blur(3px); }
.promotion-box { padding: 26px; }
.promotion-box h2 { margin: 7px 0 0; font-size: 22px; }
.promotion-box p:not(.small-caps) { font-size: 13px; color: #c7cfbe; line-height: 1.6; }
.promotion-pieces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 17px; }
.promotion-pieces button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 3px; min-height: 103px; border: 1px solid #80957e; border-radius: 10px; background: #334d3c; color: #f7e9c9; font-size: 12px; }
.promotion-pieces button:hover { border-color: #e6bb83; background: #4c6345; }
.promotion-piece { width: 73px; max-width: 100%; height: 76px; object-fit: contain; filter: drop-shadow(2px 4px 3px #0009); pointer-events: none; }
.cancel { width: 100%; margin-top: 15px; padding: 11px; color: #e1dcce; background: transparent; border: 1px solid #69806d; border-radius: 8px; }
.cancel:hover { background: #395343; }
@media (max-width: 1030px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) minmax(290px, 330px); gap: 17px; }
  .panel { padding: 18px; }
  .mode-choice { font-size: 11px; }
  .hero-king { right: 40px; }
  .hero-knight { right: 176px; }
}
@media (max-width: 770px) {
  .masthead-inner { min-height: 66px; padding: 0 15px; }
  .wordmark { font-size: 14px; }
  .wordmark-mark { font-size: 27px; }
  .masthead-right { display: none; }
  .masthead-inner { grid-template-columns: 1fr auto; }
  .wrap { padding: 16px 12px 32px; }
  .hero { min-height: 220px; grid-template-columns: 1fr 30%; }
  .hero-copy { padding: 27px 12px 26px 25px; }
  .hero h1 { font-size: clamp(25px, 5vw, 36px); }
  .hero-art { min-height: 220px; }
  .hero-halo { right: -75px; }
  .hero-king { width: 166px; height: 212px; right: 0; top: 5px; }
  .hero-knight { width: 118px; height: 150px; right: 102px; top: 77px; }
  .hero-art-caption { display: none; }
  .game-layout { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; margin-top: 20px; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .arena-heading h2 { font-size: 19px; }
  .board-surround { padding: 10px; }
  .board-rim { padding: 5px; }
  .player-status { min-height: 61px; padding: 8px 13px; }
  .panel { padding: 21px; }
  .rules { padding: 0; }
  .rules summary { padding: 19px 21px; }
}
@media (max-width: 480px) {
  .home-link { font-size: 11px; }
  .wordmark { font-size: 12px; }
  .wordmark-mark { font-size: 24px; }
  .wordmark small { font-size: 8px; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 24px 22px 23px; }
  .hero h1 { font-size: clamp(28px, 7.5vw, 35px); }
  .lead { font-size: 12px; }
  .hero-art { position: absolute; inset: 0; pointer-events: none; opacity: .15; }
  .hero-king { right: -20px; top: 6px; }
  .hero-knight { right: 70px; top: 84px; }
  .hero-meta { gap: 10px; font-size: 10px; }
  .arena-heading-note { font-size: 10px; }
  .board-surround { padding: 7px; }
  .board-rim { padding: 4px; }
  .square small { font-size: 10px; }
  .piece { transform: translateY(-1%) scale(1.13); }
  .board-foot { font-size: 10px; }
  .foot-legend { gap: 9px; }
  .player-emblem { width: 39px; height: 39px; }
  .panel { padding: 18px; }
  .rules { padding: 0; }
}
@media (max-width: 350px) {
  .mode-choice { flex-direction: column; align-items: start; min-height: 85px; }
  .hero-meta { flex-direction: column; gap: 4px; }
  .field-row { gap: 7px; }
  .field-row select { font-size: 11px; padding-left: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
/* Rendered chess images are taller than their squares: prevent their intrinsic
   180×230 sizing from expanding CSS grid rows and clipping the final rank. */
.chessboard { grid-template-rows: repeat(8, minmax(0, 1fr)); }
.square { min-width: 0; min-height: 0; height: 100%; aspect-ratio: auto; }
.piece { min-width: 0; min-height: 0; }
/* Sound console: intentionally quiet controls so the board stays the focus. */
.audio-panel { border-color: #6a7655; background: linear-gradient(145deg,#304636,#253a31 65%,#22372e); }
.audio-panel .panel-description { margin-bottom: 16px; }
.audio-symbol { color: #d4b87f; font-size: 39px; }
.audio-switches { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-bottom: 18px; }
.audio-switch {
 display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 62px;
 padding: 10px; border: 1px solid #617565; border-radius: 10px;
 color: #dadfce; background: #162a23; text-align: left;
 font-size: 12px; font-weight: 800; transition: border-color 140ms ease, background 140ms ease;
}
.audio-switch.is-on { background: linear-gradient(125deg,#66563b,#35463a); border-color: #dbb876; color: #f4e6c5; }
.audio-switch:hover:not(:disabled) { border-color: #e5c98e; }
.audio-switch:disabled { opacity: .65; cursor: wait; }
.audio-switch-icon { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #829a8640; font-size: 19px; font-weight: 600; color: #e4c891; }
.audio-switch small { display: block; margin-top: 3px; color: #b7c1b4; font-size: 10px; font-weight: 500; }
.audio-switch.is-on small { color: #e3cfad; }
.audio-label { display: block; margin-bottom: 8px; color: #e1d6b7; font-size: 11px; font-weight: 750; }
.audio-select { width: 100%; padding: 11px 12px; border: 1px solid #73846e; border-radius: 9px; background: #1d332b; color: #f4ead4; font-size: 12px; }
.audio-select option { color: #fff2d2; background: #213b2f; }
.audio-volume-row { display: grid; grid-template-columns: 92px minmax(0,1fr) 36px; align-items: center; gap: 8px; padding-top: 16px; }
.audio-volume-row label { color: #d2d7c5; font-size: 11px; font-weight: 650; }
.audio-volume-row input { width: 100%; min-width: 0; height: 19px; margin: 0; accent-color: #ddbe81; cursor: pointer; }
.audio-volume-row output { color: #dec69b; font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.audio-feedback { margin: 15px 0 0; padding-top: 11px; border-top: 1px solid #71816b66; min-height: 30px; font-size: 11px; line-height: 1.6; color: #abbdaa; }
.audio-feedback::before { content: '♫'; color: #e5c78e; margin-right: 7px; }
.audio-credits { margin-top: 8px; color: #acbea9; font-size: 10px; line-height: 1.7; }
.audio-credits summary { color: #c3b58f; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.audio-credits p { margin: 9px 0 0; }
.audio-credits a { color: #f0d59d; text-underline-offset: 3px; }
@media(max-width:420px) { .audio-switch { gap: 5px; padding: 8px; font-size: 11px; } .audio-switch-icon { width: 29px; flex-basis: 29px; } .audio-volume-row { grid-template-columns: 83px minmax(0,1fr) 34px; gap: 5px; } }

/* Chess captured piece tray & AI hint square highlight */
.captured-pieces {
  margin-left: auto;
  margin-right: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: #172a23;
  border: 1px solid #587260;
  color: #f3dbab;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.captured-pieces:empty { display: none; }
.captured-pieces + .player-turn-indicator { margin-left: 0; }
.square.hint-square::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 8px;
  border: 3px solid #ffd54f;
  box-shadow: 0 0 14px #ffd54f, inset 0 0 10px #ffd54f77;
  z-index: 4;
  pointer-events: none;
  animation: chess-hint-pulse 0.9s ease-in-out infinite alternate;
}
.hint-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 6;
  padding: 1px 5px;
  border-radius: 99px;
  background: linear-gradient(135deg, #ffd54f, #f59e0b);
  color: #1f1605;
  font: 800 9.5px/1.25 system-ui, sans-serif;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
@keyframes chess-hint-pulse {
  from { transform: scale(0.95); opacity: 0.85; }
  to { transform: scale(1.03); opacity: 1; }
}
.square.moving-to {
  z-index: 15;
}
.piece.piece-gliding {
  animation: chess-piece-glide 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, filter;
}
.piece.piece-captured-ghost {
  position: absolute;
  inset: 0;
  z-index: 1;
  animation: chess-piece-captured 230ms ease-out forwards;
  pointer-events: none;
}
@keyframes chess-piece-glide {
  0% {
    transform: translate(var(--move-from-x, 0%), calc(var(--move-from-y, 0%) - 2%)) scale(1.12);
    filter: drop-shadow(2px 5px 3px #2a190e91);
  }
  45% {
    transform: translate(calc(var(--move-from-x, 0%) * 0.35), calc(var(--move-from-y, 0%) * 0.35 - 14%)) scale(1.24);
    filter: drop-shadow(6px 16px 9px #140b06b8);
  }
  100% {
    transform: translate(0%, -2%) scale(1.12);
    filter: drop-shadow(2px 5px 3px #2a190e91);
  }
}
@keyframes chess-piece-captured {
  0% {
    transform: translateY(-2%) scale(1.12);
    opacity: 0.9;
  }
  100% {
    transform: translateY(-8%) scale(0.65);
    opacity: 0;
  }
}
