/* Gambit — four board worlds. Each one restyles the whole UI, not just the squares. */

/* =========================================================
   1. CLASSIC WOOD — walnut & maple, brass and felt
   ========================================================= */
body, body[data-theme="wood"] {
  --bg: radial-gradient(1100px 650px at 15% -10%, #6e4728 0%, transparent 60%), radial-gradient(900px 600px at 110% 15%, #4d2e18 0%, transparent 55%), linear-gradient(165deg, #2b180c, #1c0f07 60%, #140a04);
  --bg-solid: #24140a; --ink: #f7ead4; --muted: #cfb593; --link: #f0bf6a;
  --panel: linear-gradient(180deg, rgba(96, 61, 34, .93), rgba(62, 37, 19, .95)); --panel-solid: #47291a;
  --panel-border: 1px solid rgba(255, 220, 160, .22); --line: rgba(255, 222, 170, .2);
  --accent: #e8b25a; --accent-2: #c9662d; --accent-ink: #2a1608; --danger: #e36b52; --good: #a8d983; --bad: #ff9f8a; --focus: #ffd98a;
  --font-display: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --header-bg: rgba(31, 17, 8, .84); --radius: 18px; --radius-sm: 10px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 232, 190, .14);
  --btn-bg: rgba(255, 232, 200, .07); --input-bg: rgba(0, 0, 0, .25); --row-alt: rgba(255, 230, 190, .045); --hover: rgba(255, 230, 190, .12);
  --frame-w: 12px; --board-radius: 4px;
  --board-frame: 0 0 0 9px #3d2211, 0 0 0 11px #c3904e, 0 0 0 12px #2a160a, 0 26px 50px rgba(0, 0, 0, .6);
  --coord-on-light: #7c4c25; --coord-on-dark: #f1d6a6;
  --hl-last: rgba(255, 196, 64, .36); --hl-sel: rgba(255, 168, 40, .5); --hint: rgba(48, 24, 6, .38); --premove: rgba(80, 140, 255, .42); --premove-hint: rgba(60, 110, 230, .5);
  --check: rgba(255, 44, 20, .9); --arrow-best: #ffb03a; --arrow-hint: #78dcff;
  --pw-fill: #fcf3e1; --pw-stroke: #3b2312; --pw-line: #9a6a3c; --pb-fill: #2b1a0f; --pb-stroke: #0d0703; --pb-line: #dcb27a; --p-accent: #c9662d;
  --p-filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .38));
  --eval-white: #f7ead4; --eval-black: #23130a; --stamp: #ffd27f; --stamp-bg: rgba(40, 20, 8, .8);
  --toast-bg: #2c180b; --toast-ink: #f7ead4; --confetti-3: #f7ead4; --confetti-4: #a8d983; --knob: #fff6e6;
}
[data-theme="wood"] .sq.light {
  background:
    repeating-linear-gradient(93deg, rgba(150, 95, 40, .13) 0 1px, transparent 1px 6px, rgba(150, 95, 40, .07) 6px 8px, transparent 8px 13px),
    linear-gradient(160deg, #f3d9a8, #e1ba7d);
  background-position: calc(var(--gx) * 1px) 0, 0 0;
}
[data-theme="wood"] .sq.dark {
  background:
    repeating-linear-gradient(87deg, rgba(30, 14, 4, .3) 0 2px, transparent 2px 9px, rgba(255, 210, 160, .07) 9px 10px, transparent 10px 15px),
    linear-gradient(160deg, #8d5c34, #6a4122);
  background-position: calc(var(--gy) * 1px) 0, 0 0;
}
[data-theme="wood"] .side { background-image: var(--panel), repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 11px); }
[data-theme="wood"] .mode-title { font-style: italic; }
[data-theme="wood"] .btn.primary { background: linear-gradient(180deg, #f3c873, #d19a40); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 2px 0 #8a5a22; }
[data-theme="wood"] .logo-text { background: linear-gradient(180deg, #ffe0a3, #d19a40); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* =========================================================
   2. MARBLE PALACE — Carrara & verde, gilded hairlines
   ========================================================= */
body[data-theme="marble"] {
  --bg: linear-gradient(118deg, transparent 0 46%, rgba(150, 140, 125, .08) 47%, transparent 49%), linear-gradient(28deg, transparent 0 63%, rgba(150, 140, 125, .07) 64%, transparent 66%), radial-gradient(ellipse at top, #ffffff, #f1ece2 55%, #e2dacb);
  --bg-solid: #f3eee5; --ink: #27251f; --muted: #7b7262; --link: #8a6a2b;
  --panel: rgba(255, 255, 255, .84); --panel-solid: #fcfaf5;
  --panel-border: 1px solid rgba(176, 138, 62, .55); --line: rgba(150, 118, 52, .32);
  --accent: #a9822f; --accent-2: #2f5d57; --accent-ink: #fffdf7; --danger: #a63b2f; --good: #2d7a4c; --bad: #a63b2f; --focus: #2f5d57;
  --font-display: Didot, "Bodoni 72", "Bodoni MT", "Playfair Display", "Times New Roman", serif;
  --font-body: Optima, Candara, "Gill Sans", "Segoe UI", sans-serif;
  --font-mono: "SF Mono", Consolas, Menlo, monospace;
  --header-bg: rgba(252, 250, 245, .86); --radius: 3px; --radius-sm: 2px;
  --shadow: inset 0 0 0 4px #fcfaf5, inset 0 0 0 5px rgba(169, 130, 47, .45), 0 22px 44px rgba(80, 64, 30, .13);
  --btn-bg: rgba(255, 255, 255, .7); --input-bg: #fffdf8; --row-alt: rgba(169, 130, 47, .06); --hover: rgba(169, 130, 47, .12);
  --btn-hover-shadow: 0 6px 16px rgba(120, 95, 40, .18);
  --frame-w: 12px; --board-radius: 0;
  --board-frame: 0 0 0 5px #fcfaf5, 0 0 0 7px #a9822f, 0 0 0 9px #fcfaf5, 0 0 0 10px #a9822f, 0 34px 60px rgba(60, 50, 30, .28);
  --coord-on-light: #6d8c84; --coord-on-dark: #f2efe6;
  --hl-last: rgba(214, 178, 82, .4); --hl-sel: rgba(47, 93, 87, .38); --hint: rgba(47, 93, 87, .45); --premove: rgba(120, 80, 200, .32); --premove-hint: rgba(120, 80, 200, .45);
  --check: rgba(196, 40, 30, .85); --arrow-best: #a9822f; --arrow-hint: #2f5d57;
  --pw-fill: #fffef9; --pw-stroke: #6b5a2e; --pw-line: #b08a3e; --pb-fill: #22302c; --pb-stroke: #0b1210; --pb-line: #d9bd77; --p-accent: #b08a3e;
  --p-filter: drop-shadow(0 4px 3px rgba(60, 50, 30, .32));
  --eval-white: #fffdf7; --eval-black: #22302c; --stamp: #a9822f; --stamp-bg: rgba(252, 250, 245, .9);
  --toast-bg: #22302c; --toast-ink: #fdf9ef; --confetti-3: #2f5d57; --confetti-4: #e7d6a8; --knob: #fffdf7;
}
[data-theme="marble"] .sq.light {
  background:
    linear-gradient(calc(var(--gx) * 1deg + 15deg), transparent 0 43%, rgba(110, 110, 120, .2) 45%, transparent 48% 100%),
    linear-gradient(calc(var(--gy) * 1deg - 30deg), transparent 0 70%, rgba(130, 125, 120, .12) 71%, transparent 73%),
    radial-gradient(circle at calc(var(--gy) * .6%) 30%, #ffffff, #e9e7e1 75%);
}
[data-theme="marble"] .sq.dark {
  background:
    linear-gradient(calc(var(--gx) * 1deg + 30deg), transparent 0 37%, rgba(255, 255, 255, .24) 40%, transparent 44%, transparent 68%, rgba(255, 255, 255, .13) 70%, transparent 73%),
    radial-gradient(circle at calc(var(--gy) * .6%) 70%, #78968d, #3b5650 82%);
}
[data-theme="marble"] .kicker, [data-theme="marble"] .moves-head h2, [data-theme="marble"] .nav-btn, [data-theme="marble"] .nav-link { letter-spacing: .16em; text-transform: uppercase; font-size: .74rem; }
[data-theme="marble"] .mode-title, [data-theme="marble"] .section h2 { font-weight: 400; letter-spacing: .02em; }
[data-theme="marble"] .mode-title::after { content: ''; display: block; width: 56px; height: 1px; margin-top: .45rem; background: var(--accent); box-shadow: 0 3px 0 rgba(169, 130, 47, .45); }
[data-theme="marble"] .nav-btn[aria-pressed="true"] { background: transparent; color: var(--accent); border-color: var(--accent); }
[data-theme="marble"] .btn.primary { background: linear-gradient(180deg, #c49b45, #9a7426); }
[data-theme="marble"] .logo-text { letter-spacing: .2em; text-transform: uppercase; font-weight: 400; font-size: 1.3rem; }
[data-theme="marble"] .site-header { border-bottom: 1px solid var(--accent); box-shadow: 0 3px 0 -2px rgba(169, 130, 47, .4); }
[data-theme="marble"] .dlg::backdrop { background: rgba(240, 234, 222, .7); }

/* =========================================================
   3. NEON ARCADE — synthwave grid, glowing everything
   ========================================================= */
body[data-theme="neon"] {
  --bg: linear-gradient(180deg, #07051a 0%, #0f0730 55%, #2a0a45 100%);
  --bg-solid: #07051a; --ink: #e9f8ff; --muted: #92a8cc; --link: #19f6e8;
  --panel: rgba(17, 12, 50, .8); --panel-solid: #120d36;
  --panel-border: 1px solid rgba(25, 246, 232, .45); --line: rgba(25, 246, 232, .26);
  --accent: #19f6e8; --accent-2: #ff3cc7; --accent-ink: #03121a; --danger: #ff3c6e; --good: #3cff9e; --bad: #ff86ab; --focus: #ff3cc7;
  --font-display: "Courier New", ui-monospace, "SF Mono", Consolas, monospace;
  --font-body: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --header-bg: rgba(7, 5, 26, .82); --radius: 3px; --radius-sm: 2px;
  --shadow: 0 0 0 1px rgba(25, 246, 232, .25), 0 0 26px rgba(25, 246, 232, .16), 0 0 70px rgba(255, 60, 199, .12);
  --btn-bg: rgba(25, 246, 232, .06); --input-bg: rgba(0, 0, 0, .4); --row-alt: rgba(255, 60, 199, .06); --hover: rgba(25, 246, 232, .14);
  --btn-hover-shadow: 0 0 16px rgba(25, 246, 232, .45);
  --frame-w: 8px; --board-radius: 2px;
  --board-frame: 0 0 0 2px #ff3cc7, 0 0 18px 2px rgba(255, 60, 199, .7), 0 0 60px rgba(25, 246, 232, .35);
  --coord-on-light: #ff7fdc; --coord-on-dark: #19f6e8;
  --hl-last: rgba(255, 60, 199, .24); --hl-sel: rgba(25, 246, 232, .28); --hint: rgba(25, 246, 232, .6); --premove: rgba(255, 220, 60, .25); --premove-hint: rgba(255, 220, 60, .55);
  --check: rgba(255, 50, 100, .95); --arrow-best: #ff3cc7; --arrow-hint: #ffe14d;
  --pw-fill: rgba(25, 246, 232, .16); --pw-stroke: #19f6e8; --pw-line: #c4fffb; --pb-fill: rgba(255, 60, 199, .18); --pb-stroke: #ff3cc7; --pb-line: #ffc8f0; --p-accent: #ffe14d;
  --p-filter: none;
  --eval-white: #19f6e8; --eval-black: #1a0b3a; --stamp: #ffe14d; --stamp-bg: rgba(7, 5, 26, .85);
  --toast-bg: #120d36; --toast-ink: #e9f8ff; --confetti-3: #ffe14d; --confetti-4: #3cff9e; --knob: #e9f8ff;
}
[data-theme="neon"] .fx-layer {
  background:
    linear-gradient(rgba(255, 60, 199, .22) 1px, transparent 1px) 0 0 / 100% 46px,
    linear-gradient(90deg, rgba(255, 60, 199, .22) 1px, transparent 1px) 0 0 / 46px 100%;
  top: 58%; transform: perspective(380px) rotateX(62deg); transform-origin: top center; opacity: .55;
  -webkit-mask-image: linear-gradient(transparent, #000 40%); mask-image: linear-gradient(transparent, #000 40%);
}
[data-theme="neon"] main, [data-theme="neon"] .site-footer { position: relative; z-index: 1; }
body[data-theme="neon"]::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 150;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .028) 0 1px, transparent 1px 3px);
}
[data-theme="neon"] .sq.light { background: linear-gradient(145deg, #211b5e, #17124a); box-shadow: inset 0 0 0 1px rgba(25, 246, 232, .1); }
[data-theme="neon"] .sq.dark { background: linear-gradient(145deg, #0d0a2b, #08061d); box-shadow: inset 0 0 0 1px rgba(255, 60, 199, .08); }
[data-theme="neon"] .piece.w svg { filter: drop-shadow(0 0 3px #19f6e8) drop-shadow(0 0 7px rgba(25, 246, 232, .5)); }
[data-theme="neon"] .piece.b svg { filter: drop-shadow(0 0 3px #ff3cc7) drop-shadow(0 0 7px rgba(255, 60, 199, .5)); }
[data-theme="neon"] .logo-text, [data-theme="neon"] .mode-title, [data-theme="neon"] .section h2 {
  text-transform: uppercase; letter-spacing: .08em; color: #fff;
  text-shadow: 0 0 6px #19f6e8, 0 0 18px rgba(25, 246, 232, .7), 0 0 34px rgba(255, 60, 199, .5);
}
[data-theme="neon"] .logo-text { animation: flicker 6s infinite; }
[data-theme="neon"] .logo-mark { fill: #ff3cc7; filter: drop-shadow(0 0 6px #ff3cc7); }
[data-theme="neon"] .btn.primary, [data-theme="neon"] .nav-btn[aria-pressed="true"] { box-shadow: 0 0 14px rgba(25, 246, 232, .65); }
[data-theme="neon"] .clock.running { box-shadow: 0 0 14px rgba(25, 246, 232, .7); }
[data-theme="neon"] .only-neon { display: inline-block; }
[data-theme="neon"] .blink { font-size: .5em; vertical-align: middle; margin-left: .5em; color: #ffe14d; text-shadow: 0 0 8px #ffe14d; animation: blink 1.1s steps(1) infinite; }
[data-theme="neon"] .joke::before { content: '> '; }
@keyframes flicker { 0%, 19%, 21%, 23%, 54%, 56%, 100% { opacity: 1; } 20%, 22%, 55% { opacity: .45; } }
@keyframes blink { 50% { opacity: 0; } }

/* =========================================================
   4. NEWSPAPER — black & white print, diagram hatching
   ========================================================= */
body[data-theme="news"] {
  --bg: radial-gradient(rgba(0, 0, 0, .045) 1px, transparent 1.2px) 0 0 / 5px 5px, #f2efe5;
  --bg-solid: #f2efe5; --ink: #121212; --muted: #4f4b44; --link: #121212;
  --panel: #f8f6ee; --panel-solid: #f8f6ee;
  --panel-border: 2px solid #121212; --line: rgba(18, 18, 18, .55);
  --accent: #121212; --accent-2: #b3261e; --accent-ink: #f8f6ee; --danger: #b3261e; --good: #121212; --bad: #b3261e; --focus: #b3261e;
  --font-display: "Times New Roman", Times, Georgia, serif;
  --font-body: Georgia, "Times New Roman", Times, serif;
  --font-mono: "Courier New", Courier, monospace;
  --header-bg: #f2efe5; --radius: 0; --radius-sm: 0;
  --shadow: none; --btn-hover-shadow: 3px 3px 0 #121212;
  --btn-bg: transparent; --input-bg: #fffdf6; --row-alt: rgba(0, 0, 0, .045); --hover: rgba(0, 0, 0, .07);
  --frame-w: 8px; --board-radius: 0;
  --board-frame: 0 0 0 2px #121212, 0 0 0 5px #f8f6ee, 0 0 0 6px #121212;
  --coord-on-light: #121212; --coord-on-dark: #121212;
  --hl-last: rgba(0, 0, 0, .13); --hl-sel: rgba(0, 0, 0, .22); --hint: rgba(0, 0, 0, .55); --premove: rgba(179, 38, 30, .22); --premove-hint: rgba(179, 38, 30, .6);
  --check: rgba(179, 38, 30, .75); --arrow-best: #121212; --arrow-hint: #b3261e;
  --pw-fill: #ffffff; --pw-stroke: #121212; --pw-line: #121212; --pb-fill: #121212; --pb-stroke: #121212; --pb-line: #f8f6ee; --p-accent: #9a9a9a;
  --p-filter: none;
  --eval-white: #ffffff; --eval-black: #121212; --stamp: #b3261e; --stamp-bg: rgba(248, 246, 238, .92);
  --toast-bg: #121212; --toast-ink: #f8f6ee; --confetti-3: #8a8a8a; --confetti-4: #ffffff; --knob: #f8f6ee;
}
[data-theme="news"] .sq.light { background: #fbfaf5; }
[data-theme="news"] .sq.dark { background: repeating-linear-gradient(45deg, #121212 0 1.3px, transparent 1.3px 4.6px), #fbfaf5; }
[data-theme="news"] .coord { background: #fbfaf5; padding: 1px 2px; }
[data-theme="news"] .only-news { display: block; }
[data-theme="news"] .site-header { flex-wrap: wrap; border-bottom: 4px double #121212; }
[data-theme="news"] .logo-text { font-family: "Old English Text MT", "UnifrakturMaguntia", "Engravers Old English", "Times New Roman", serif; font-size: 1.9rem; font-weight: 400; }
[data-theme="news"] .logo-mark { fill: #121212; }
[data-theme="news"] .masthead { order: 3; flex-basis: 100%; text-align: center; border-top: 1px solid #121212; padding-top: .25rem; font-family: var(--font-body); }
[data-theme="news"] .nav-btn, [data-theme="news"] .nav-link { border-radius: 0; font-variant: small-caps; letter-spacing: .05em; font-size: 1rem; }
[data-theme="news"] .nav-btn[aria-pressed="true"] { background: transparent; color: #121212; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
[data-theme="news"] .side, [data-theme="news"] .stat-card, [data-theme="news"] .chart-card, [data-theme="news"] .table-card, [data-theme="news"] .credit-card { border-top: 6px double #121212; }
[data-theme="news"] .mode-title { font-size: clamp(1.9rem, 2.8vw, 2.5rem); font-weight: 900; line-height: 1; text-transform: uppercase; letter-spacing: -.01em; }
[data-theme="news"] .status { font-style: italic; }
[data-theme="news"] .status::first-letter { font-size: 1.6em; font-weight: 700; font-style: normal; }
[data-theme="news"] .btn { border: 1.5px solid #121212; }
[data-theme="news"] .btn:hover:not(:disabled) { transform: translate(-2px, -2px); background: transparent; }
[data-theme="news"] .btn.primary:hover:not(:disabled) { background: #121212; filter: none; }
[data-theme="news"] .about-grid > div:first-child { column-count: 2; column-gap: 2rem; column-rule: 1px solid #121212; }
[data-theme="news"] .about-grid > div:first-child h2, [data-theme="news"] .about-grid > div:first-child .kicker { column-span: all; }
[data-theme="news"] .res-stamp { color: #b3261e; border: 4px solid #b3261e; padding: 0 .3em; border-radius: 6px; }
[data-theme="news"] .joke::before { content: '☞ '; color: #121212; }
[data-theme="news"] .opp-emoji, [data-theme="news"] .avatar, [data-theme="news"] .lc-emoji { filter: grayscale(1) contrast(1.2); }
[data-theme="news"] .dlg { box-shadow: 8px 8px 0 #121212; }
@media (max-width: 920px) { [data-theme="news"] .about-grid > div:first-child { column-count: 1; } }

/* theme previews in settings */
.theme-card[data-t="wood"] .mini i:nth-child(odd) { background: #e9c992; }
.theme-card[data-t="wood"] .mini i:nth-child(even) { background: #7a4d2a; }
.theme-card[data-t="marble"] .mini i:nth-child(odd) { background: #f4f2ec; }
.theme-card[data-t="marble"] .mini i:nth-child(even) { background: #4f6d66; }
.theme-card[data-t="neon"] .mini { box-shadow: 0 0 0 1px #ff3cc7, 0 0 8px #ff3cc7; }
.theme-card[data-t="neon"] .mini i:nth-child(odd) { background: #211b5e; }
.theme-card[data-t="neon"] .mini i:nth-child(even) { background: #08061d; }
.theme-card[data-t="news"] .mini { box-shadow: 0 0 0 1px #121212; }
.theme-card[data-t="news"] .mini i:nth-child(odd) { background: #fbfaf5; }
.theme-card[data-t="news"] .mini i:nth-child(even) { background: repeating-linear-gradient(45deg, #121212 0 1px, #fbfaf5 1px 3px); }
