:root {
  --bg: #080c15;
  --bg-deep: #050810;
  --panel: #111b2b;
  --panel-2: #19263a;
  --panel-3: #0b1422;
  --gold: #e7bd6b;
  --gold-bright: #f6d58f;
  --gold-dim: #87672f;
  --ink: #f7f8fb;
  --muted: #91a0b5;
  --muted-2: #63738b;
  --line: #293950;
  --green: #35d399;
  --red: #fb7185;
  --magenta: #df75b2;
  --board-light: #e8ddc7;
  --board-dark: #718a72;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 50% -20%, #263b59 0%, transparent 48%), var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.topbar { min-height: 72px; padding: 0 clamp(18px, 5vw, 76px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #0c1421e8; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 950; letter-spacing: 2.5px; }
.brand b { color: var(--gold); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--gold-dim); border-radius: 8px; color: var(--gold); font-size: 19px; transform: rotate(-3deg); }
.engine-badge { display: flex; align-items: center; gap: 9px; color: #9eacc0; font-size: 10px; font-weight: 900; letter-spacing: 1.4px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px #fb718515; }
.status-dot.online { background: var(--green); box-shadow: 0 0 12px var(--green); }

main { width: min(1220px, 94%); margin: 0 auto; }
.hero { padding: 54px 15px 35px; text-align: center; }
.eyebrow, .dialog-tag, .section-kicker { color: var(--gold); font-size: 10px; font-weight: 950; letter-spacing: 4px; }
h1 { margin: 15px 0 10px; font-size: clamp(34px, 6vw, 62px); font-weight: 1000; letter-spacing: -2.8px; line-height: .98; }
h1 span { color: var(--gold); }
.subtitle { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.prize { display: inline-flex; align-items: center; gap: 9px; margin-top: 22px; padding: 11px 25px; border: 1px solid #8c6b32; border-radius: 11px; background: linear-gradient(135deg, #332a19, #171c27); color: var(--gold-bright); font-size: 25px; font-weight: 950; box-shadow: 0 12px 40px #0005; }
.prize span { font-size: 20px; }
.play-cta { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 210px; margin: 18px auto 0; padding: 14px 24px; border: 1px solid #f2d38b; border-radius: 10px; background: linear-gradient(120deg, #f6d58f, #bd8c38); color: #17130b; cursor: pointer; font-size: 12px; font-weight: 1000; letter-spacing: 1.4px; box-shadow: 0 12px 30px #0005; transition: transform .2s, box-shadow .2s; }
.play-cta:hover { transform: translateY(-3px); box-shadow: 0 16px 35px #0008; }
.play-cta span { font-size: 15px; }

.arena-layout { display: grid; grid-template-columns: minmax(0, 690px) minmax(290px, 1fr); gap: 24px; align-items: start; }
.panel { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, #172438, #101827); box-shadow: 0 25px 65px #0005; }
.board-panel { min-width: 0; }
.player-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: #1b2a40; border: 1px solid #31435b; border-radius: 11px; }
.player-identity { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: #263a56; color: var(--gold); font-size: 21px; }
.player-avatar { color: #b8d8ed; }
.player-card small, .stat small, .captured-row small, .difficulty-card small, .rule-note small { display: block; color: #9aabc1; font-size: 9px; font-weight: 900; letter-spacing: 1.2px; }
.player-card strong { display: block; margin-top: 3px; font-size: 13px; }
#engineVersion { color: var(--muted); }
.arena-heading { display: flex; align-items: end; justify-content: space-between; margin: 22px 3px 12px; }
.arena-heading h2 { margin: 5px 0 0; font-size: 21px; letter-spacing: -.5px; }
.exit-focus { display: none; padding: 7px 10px; border: 1px solid #40516a; border-radius: 8px; background: #23344b; color: var(--muted); cursor: pointer; font-size: 9px; font-weight: 900; letter-spacing: .7px; }
.turn-pill { padding: 7px 10px; border: 1px solid #42604f; border-radius: 99px; color: var(--green); background: #15372c; font-size: 9px; font-weight: 900; letter-spacing: 1px; }
.board-frame { padding: 9px; border: 1px solid #3b4b62; border-radius: 14px; background: #080d16; box-shadow: inset 0 0 25px #0008, 0 12px 30px #0004; }
.board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 5px; }
.square { position: relative; display: flex; justify-content: center; align-items: center; padding: 0; border: 0; aspect-ratio: 1; cursor: pointer; overflow: hidden; }
.square.light { background: var(--board-light); }
.square.dark { background: var(--board-dark); }
.square.selected { background: #edc653 !important; box-shadow: inset 0 0 0 4px #fff1a0; }
.square.target::after { content: ""; position: absolute; width: 24%; height: 24%; border-radius: 50%; background: #1b382b99; }
.square.target:has(.piece)::after { width: 88%; height: 88%; border: 5px solid #1b382b99; background: transparent; }
.piece { z-index: 2; font-family: "Segoe UI Symbol", "DejaVu Sans", serif; font-size: clamp(29px, 6.6vw, 64px); line-height: 1; user-select: none; transition: transform .15s; }
.square:hover .piece { transform: scale(1.06); }
.piece.w { color: #fffdf2; text-shadow: 0 2px 2px #333, 0 4px 5px #5558; }
.piece.b { color: #151b23; text-shadow: 0 1px 2px #fff9; }
.coordinate { position: absolute; z-index: 3; pointer-events: none; font-size: 10px; font-weight: 900; }
.rank { top: 3px; left: 4px; color: #283d32; }
.file { right: 4px; bottom: 3px; color: #283d32; }
.thinking-bar { height: 3px; margin-top: 13px; overflow: hidden; border-radius: 5px; background: #25344a; }
.thinking-bar span { display: block; width: 0; height: 100%; background: var(--gold); }
.thinking-bar.active span { width: 100%; animation: progress 2s infinite linear; }
@keyframes progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.status { margin-top: 13px; padding: 13px 14px; border: 1px solid #334760; border-radius: 10px; background: #1c2b41; color: #e4edf9; text-align: center; font-size: 12px; font-weight: 800; line-height: 1.5; }
.status.thinking { color: #f6d17d; }.status.warning { color: #ffb27a; }.status.win { color: #54e5a3; }.status.loss, .status.error { color: #fb8194; }.status.draw { color: #f9d56c; }
.player-card-bottom { margin-top: 12px; }.side-note { color: #8ba2bb; font-size: 9px; font-weight: 900; letter-spacing: 1px; }
.controls { display: flex; gap: 9px; margin-top: 13px; }
.btn { min-height: 44px; flex: 1; padding: 10px 12px; border: 1px solid #40516a; border-radius: 9px; background: #23344b; color: #fff; cursor: pointer; font-size: 10px; font-weight: 950; letter-spacing: .7px; transition: .2s; }
.btn:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-2px); }.btn:disabled { opacity: .5; cursor: not-allowed; }.btn-primary { border-color: transparent; background: linear-gradient(120deg, #f1d38c, #bd8c38); color: #17130b; }

.evidence-rail { display: grid; gap: 13px; }.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; color: var(--gold); font-size: 10px; font-weight: 950; letter-spacing: 2px; }.panel-title span { color: var(--muted-2); font-size: 9px; letter-spacing: 1px; }
.difficulty-card { display: flex; align-items: center; justify-content: space-between; padding: 14px; margin-bottom: 10px; border: 1px solid #2c3d55; border-radius: 10px; background: #1b2a3f; }.difficulty-card strong { display: block; margin-top: 6px; color: var(--red); font-size: 14px; }.threat-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #824655; border-radius: 50%; color: #ffafbb; font-weight: 950; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }.stat { min-height: 77px; padding: 13px; border: 1px solid #2c3d55; border-radius: 10px; background: #1b2a3f; }.stat strong { display: block; margin-top: 7px; font-size: 18px; }.gold-text { color: var(--gold-bright); }
.evidence-panel { padding-top: 17px; }.captured-row { padding: 12px 13px; margin-bottom: 9px; border: 1px solid #2c3d55; border-radius: 10px; background: #1b2a3f; }.captured { min-height: 29px; margin-top: 6px; color: #e7d6af; font-size: 22px; letter-spacing: 2px; word-break: break-word; }.section-spaced { margin-top: 20px; }.moves { height: 203px; overflow: auto; padding: 7px; border: 1px solid #26384e; border-radius: 9px; background: var(--panel-3); }.move-row { display: grid; grid-template-columns: 35px 1fr 1fr; padding: 9px; border-bottom: 1px solid #233247; font-size: 12px; }.move-row:nth-child(even) { background: #172438; }.empty-history { padding: 26px 12px; color: var(--muted-2); text-align: center; font-size: 11px; }.fen { padding: 10px; border-radius: 8px; background: var(--panel-3); color: #8395ad; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; line-height: 1.6; word-break: break-all; }.rule-note { display: flex; gap: 10px; align-items: start; padding: 13px; margin-top: 14px; border: 1px solid #5e3c55; border-radius: 10px; background: #281a2b; }.rule-note > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: #a05c85; color: #fff; font-weight: 950; }.rule-note strong { display: block; margin-top: 6px; color: #ebc4db; font-size: 12px; line-height: 1.6; }

.overlay { display: none; position: fixed; inset: 0; z-index: 50; justify-content: center; align-items: center; padding: 18px; background: #000c; backdrop-filter: blur(9px); }.overlay.show { display: flex; animation: fade-in .2s ease both; }.dialog { width: min(460px, 100%); padding: 28px; border: 1px solid #82683c; border-radius: 20px; background: linear-gradient(145deg, #1d2d45, #101827); box-shadow: 0 25px 100px #000b; text-align: center; animation: dialog-in .24s ease both; }.small-dialog { width: min(410px, 100%); }.dialog h2 { margin: 12px 0 8px; color: var(--gold); font-size: 27px; letter-spacing: -.7px; }.dialog p { color: #aab9cc; font-size: 13px; line-height: 1.75; }.promotion-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 20px; }.promotion-buttons button { padding: 12px 5px; border: 1px solid #53647b; border-radius: 10px; background: #263951; color: white; cursor: pointer; font-size: 25px; transition: .18s; }.promotion-buttons button:hover { border-color: var(--gold); transform: translateY(-2px); }.result-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 13px; border: 1px solid #a17938; border-radius: 19px; background: #3a2b16; color: var(--gold-bright); font-size: 36px; }.result-dialog > p { margin: 5px 0 12px; }.reward { display: none; margin-top: 19px; padding: 17px; border: 1px solid #9d4b79; border-radius: 14px; background: linear-gradient(145deg, #2a1b2c, #171b29); text-align: left; }.reward-heading { display: flex; align-items: center; gap: 10px; }.reward-heading > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #a85f8c; color: #fff; font-weight: 950; }.reward h3 { margin: 0; color: #f4a6d0; font-size: 14px; }.reward-heading small { color: #c990b1; font-size: 8px; font-weight: 900; letter-spacing: 1px; }.reward p { margin: 14px 0; color: #bdc4d2; font-size: 11px; line-height: 1.7; text-align: left; }.reward label { display: block; margin: 13px 0 7px; color: #f0c4dc; font-size: 10px; font-weight: 800; }.reward input { width: 100%; height: 45px; padding: 12px; outline: none; border: 1px solid #76516c; border-radius: 9px; background: #100f1c; color: white; font-size: 16px; }.reward input:focus { border-color: #ec83bd; }.btn-claim { width: 100%; margin-top: 11px; border: 0; background: linear-gradient(120deg, #f1a5cf, #bd5b98); color: #20101b; }.btn-claim span { float: right; font-size: 17px; line-height: 12px; }.claim-message { min-height: 16px; margin-top: 10px; color: #ffb2ce; font-size: 11px; line-height: 1.5; }.claim-message.success { color: #58e6a5; }.dialog-close { width: 100%; margin-top: 18px; }
.footer { margin-top: 46px; padding: 27px 15px; border-top: 1px solid var(--line); background: #0b111c; color: #72839b; text-align: center; font-size: 10px; line-height: 2; letter-spacing: 1px; }.footer span { color: var(--gold-dim); }.footer small { color: #4f6075; font-size: 8px; }
.focus-mode { overflow: hidden; }.focus-mode .topbar, .focus-mode .hero, .focus-mode .evidence-rail, .focus-mode .footer { display: none; }.focus-mode main { width: min(900px, 96%); margin: 24px auto; }.focus-mode .arena-layout { display: block; }.focus-mode .board-panel { max-width: 900px; margin: 0 auto; }.focus-mode .exit-focus { display: inline-block; }.focus-mode .arena-heading { margin-top: 5px; }.focus-mode .board-frame { padding: 12px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 780px) { .topbar { min-height: 62px; padding: 0 14px; }.brand { gap: 8px; font-size: 12px; letter-spacing: 1.5px; }.brand-mark { width: 27px; height: 27px; }.engine-badge { font-size: 8px; }.hero { padding: 35px 10px 26px; } h1 { font-size: clamp(33px, 10vw, 50px); letter-spacing: -2px; }.subtitle { font-size: 12px; }.prize { margin-top: 16px; font-size: 22px; text-align: center; }.arena-layout { grid-template-columns: 1fr; gap: 13px; }.panel { padding: 12px; border-radius: 14px; }.arena-heading { margin-top: 18px; }.piece { font-size: clamp(28px, 8vw, 50px); }.controls { gap: 6px; }.btn { padding: 9px 5px; font-size: 9px; }.evidence-rail { gap: 13px; }.dialog { padding: 23px 18px; } }

/* Top 10 leaderboard */
.leaderboard { margin-top: 22px; padding: 22px; }
.leaderboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.leaderboard-heading h2 { margin: 5px 0 0; font-size: 21px; }
.leaderboard-badge { padding: 7px 10px; border: 1px solid #5e4a27; border-radius: 999px; color: var(--gold-bright); font-size: 8px; font-weight: 900; letter-spacing: 1px; }
.leaderboard-head, .leader-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 90px 90px; align-items: center; gap: 12px; }
.leaderboard-head { padding: 0 15px 9px; color: #71849c; font-size: 8px; font-weight: 900; letter-spacing: 1.2px; }
.leaderboard-list { display: grid; gap: 6px; }
.leader-row { min-height: 46px; padding: 8px 15px; border: 1px solid #293c55; border-radius: 9px; background: #18283d; }
.leader-row strong { color: #f1f4f8; font-size: 13px; }
.leader-row b { color: var(--gold-bright); font-size: 11px; }
.leader-row em { color: #7ed9ae; font-size: 8px; font-style: normal; font-weight: 900; letter-spacing: .6px; }
.leader-row.top-rank { background: linear-gradient(90deg, #253650, #1a2b41); }
.rank { color: #8295ac; font-size: 11px; font-weight: 950; letter-spacing: 1px; }
.rank-gold { color: #f6d58f; }.rank-silver { color: #d4dce6; }.rank-bronze { color: #d59c68; }
@media (max-width: 780px) {
  .leaderboard { padding: 13px; }
  .leaderboard-heading { align-items: flex-start; }
  .leaderboard-badge { font-size: 7px; }
  .leaderboard-head, .leader-row { grid-template-columns: 34px minmax(0, 1fr) 48px 52px; gap: 6px; }
  .leaderboard-head { padding-left: 9px; padding-right: 9px; font-size: 7px; }
  .leader-row { padding: 8px 9px; }
  .leader-row strong { font-size: 11px; }.leader-row b { font-size: 9px; }.leader-row em { font-size: 7px; }
}
.focus-mode .leaderboard { display: none; }

/* Reference-style wooden chess table */
.board-panel { background: linear-gradient(145deg, #2a1a13, #130d0a); border-color: #63442f; }
.board-frame { padding: 14px; border: 10px solid transparent; border-radius: 8px; background: linear-gradient(90deg, #3b1d0e, #8a572f 16%, #4c2614 34%, #9a6538 52%, #42200f 74%, #754521); box-shadow: inset 0 0 0 2px #2b1308, inset 0 0 28px #190a04, 0 18px 35px #0009; }
.board { border: 2px solid #251107; border-radius: 1px; box-shadow: 0 5px 0 #1b0c05, 0 14px 20px #0008; }
.square.light { background: linear-gradient(135deg, #ecd2a4 0%, #c99a61 100%); box-shadow: inset 0 0 0 1px #8c5a3425; }
.square.dark { background: linear-gradient(135deg, #7d4827 0%, #4a2414 100%); box-shadow: inset 0 0 0 1px #26100655; }
.square.selected { background: #79bb4e !important; box-shadow: inset 0 0 0 5px #29752b, inset 0 0 18px #b7ef6c99; }
.square.target::after { width: 22%; height: 22%; background: #2a140caa; box-shadow: 0 2px 2px #fff4; }
.square.target:has(.piece)::after { width: 88%; height: 88%; border: 5px solid #31853aaa; background: transparent; box-shadow: inset 0 0 0 2px #f4dc9d55; }
.piece { font-family: "DejaVu Sans", "Segoe UI Symbol", "Times New Roman", serif; font-size: clamp(31px, 7vw, 68px); line-height: 1; transform: translateY(-2px); filter: drop-shadow(0 5px 2px #1d0c0566); }
.square:hover .piece { transform: translateY(-4px) scale(1.06); }
.piece.w { color: #f5ead2; text-shadow: 0 1px 0 #fff, 0 3px 0 #b79f79, 0 5px 4px #28140c99, 0 8px 8px #0008; }
.piece.b { color: #161311; text-shadow: 0 -1px 0 #665c51, 0 2px 0 #050403, 0 5px 3px #000b, 0 8px 9px #0009; }
.coordinate { color: #2b160b !important; text-shadow: 0 1px #f0d7a677; }

.focus-mode .board-panel { background: linear-gradient(145deg, #2a1a13, #130d0a); }

/* Clear glossy 3D piece treatment */
.piece { font-family: "DejaVu Sans", "Segoe UI Symbol", "Times New Roman", serif; font-weight: 900; font-size: clamp(32px, 7vw, 70px); transform: translateY(-2px); filter: drop-shadow(0 4px 2px #1d0c0566); }
.square:hover .piece { transform: translateY(-5px) scale(1.06); }
.piece.w { color: #fff1d3; -webkit-text-stroke: .22px #785b38; text-shadow: 0 1px 0 #fff, 0 2px 0 #d8bd91, 0 4px 2px #65472888, 0 6px 5px #0007; }
.piece.b { color: #2a211a; -webkit-text-stroke: .28px #0b0907; text-shadow: 0 -1px 0 #9b8972, 0 1px 0 #554537, 0 3px 2px #080503, 0 6px 5px #0008; }

/* Chessboard-inspired page background */
body { background-color: #0b0b0b; background-image: linear-gradient(#080c15d9, #080c15d9), repeating-conic-gradient(#d7cfbd 0 25%, #171411 0 50%); background-position: center, 0 0; background-size: auto, 180px 180px; background-attachment: fixed; }

.topbar-actions { display: flex; align-items: center; gap: 14px; }
.sound-toggle { padding: 7px 9px; border: 1px solid #596b81; border-radius: 7px; background: #18273a; color: #e8d29b; cursor: pointer; font-size: 8px; font-weight: 950; letter-spacing: .7px; transition: .2s; }
.sound-toggle:hover { border-color: var(--gold); transform: translateY(-1px); }
.sound-toggle[aria-pressed="false"] { color: #8390a0; border-color: #3a4656; background: #101722; }
@media (max-width: 780px) { .topbar-actions { gap: 8px; }.sound-toggle { padding: 6px 7px; font-size: 7px; }.engine-badge { gap: 5px; } }
