/* NN Chess Arena board appearance preferences.
   The current-default theme intentionally adds no board overrides. */
.board-theme-dialog { width:min(92vw,620px); }
.board-theme-dialog h2 { margin-bottom:6px; }
.board-theme-intro { margin:0 0 14px; color:#dfceb2; font-size:.92rem; }
.board-theme-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.board-theme-option { position:relative; display:block; cursor:pointer; }
.board-theme-option input { position:absolute; opacity:0; pointer-events:none; }
.board-theme-card {
    display:grid; gap:8px; min-height:132px; padding:10px;
    border:2px solid rgba(235,198,116,.24); border-radius:14px;
    background:rgba(24,14,10,.72); color:#f8ead2;
    transition:border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.board-theme-option input:checked + .board-theme-card {
    border-color:#f0bf55; box-shadow:0 0 0 2px rgba(240,191,85,.16),0 10px 24px rgba(0,0,0,.3);
    transform:translateY(-2px);
}
.board-theme-option input:focus-visible + .board-theme-card { outline:3px solid #85c7ff; outline-offset:2px; }
.board-theme-card strong { font-size:.94rem; }
.board-theme-card small { color:#cbbba3; line-height:1.25; }
.board-theme-preview {
    display:grid; grid-template-columns:repeat(4,1fr); overflow:hidden;
    height:58px; border:4px solid #6f472d; border-radius:7px; background:#e8cfaa;
}
.board-theme-preview i:nth-child(odd) { background:#ead6b8; }
.board-theme-preview i:nth-child(even) { background:#98663f; }
.board-theme-preview i:nth-child(5),.board-theme-preview i:nth-child(7),
.board-theme-preview i:nth-child(10),.board-theme-preview i:nth-child(12) { filter:brightness(.82); }
.preview-elegant { border-color:#5c351e; }
.preview-elegant i:nth-child(odd) { background:#f4e5c4; }
.preview-elegant i:nth-child(even) { background:#956039; }
.preview-royal { border-color:#3c1d0e; transform:perspective(120px) rotateX(10deg); box-shadow:0 8px 9px #090403; }
.preview-royal i:nth-child(odd) { background:linear-gradient(135deg,#edcc92,#c99656); }
.preview-royal i:nth-child(even) { background:linear-gradient(135deg,#783b1c,#3f1d0d); }
.preview-glass { border-color:#13a8d5; box-shadow:0 0 12px #13a8d5; }
.preview-glass i:nth-child(odd) { background:linear-gradient(135deg,#a8c4d2,#526f7d); }
.preview-glass i:nth-child(even) { background:linear-gradient(135deg,#152d3c,#07141e); }
.board-theme-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:16px; }
.board-theme-saved { min-height:20px; margin:10px 0 0; color:#f6c85f; text-align:center; }

/* Elegant Classic 2D */
body[data-board-theme="elegant-classic-2d"] .royal-board-frame {
    background:linear-gradient(145deg,#3b2113,#7d4a29 46%,#2a150c);
    border-color:#d99a46; box-shadow:0 12px 28px rgba(22,8,2,.56),inset 0 0 0 2px #402113;
}
body[data-board-theme="elegant-classic-2d"] .chessboard { border-color:#e2ad62; }
body[data-board-theme="elegant-classic-2d"] .square.light { background:#f2dfbc; }
body[data-board-theme="elegant-classic-2d"] .square.dark { background:#956039; }
body[data-board-theme="elegant-classic-2d"] .piece-image { filter:drop-shadow(0 2px 1px rgba(35,16,7,.42)); }

/* Royal Wooden 3D: gameplay remains a normal 8x8 hit grid; visual depth is CSS-only. */
body[data-board-theme="royal-wooden-3d"] .royal-board-frame {
    transform:perspective(1100px) rotateX(5deg); transform-origin:center bottom;
    background:linear-gradient(145deg,#1e0d06,#7b3d1b 42%,#240e05);
    border-color:#b9782d; box-shadow:0 22px 34px rgba(0,0,0,.62),inset 0 0 0 3px #3e1b0c;
}
body[data-board-theme="royal-wooden-3d"] .chessboard { border-color:#d39a51; box-shadow:inset 0 0 18px rgba(35,11,2,.42); }
body[data-board-theme="royal-wooden-3d"] .square.light { background:linear-gradient(135deg,#e8c587,#c79655); }
body[data-board-theme="royal-wooden-3d"] .square.dark { background:linear-gradient(135deg,#743817,#3f1b0b); }
body[data-board-theme="royal-wooden-3d"] .piece-image {
    transform:translateY(-3px) scale(1.03);
    filter:drop-shadow(0 7px 3px rgba(17,5,1,.62)) saturate(.88) contrast(1.08);
}

/* Modern Glass 3D */
body[data-board-theme="modern-glass-3d"] .royal-board-frame {
    transform:perspective(1100px) rotateX(4deg); transform-origin:center bottom;
    background:linear-gradient(145deg,#07131d,#16384b 52%,#050d13);
    border-color:#29bde8; box-shadow:0 0 20px rgba(22,191,239,.48),0 22px 36px rgba(0,0,0,.58),inset 0 0 12px #28b9e2;
}
body[data-board-theme="modern-glass-3d"] .board-coins { color:#a5edff; }
body[data-board-theme="modern-glass-3d"] .chessboard { border-color:#71ddfa; box-shadow:inset 0 0 18px rgba(53,199,239,.22); }
body[data-board-theme="modern-glass-3d"] .square.light { background:linear-gradient(135deg,#9bb8c7,#5f7e8e); }
body[data-board-theme="modern-glass-3d"] .square.dark { background:linear-gradient(135deg,#173446,#071722); }
body[data-board-theme="modern-glass-3d"] .piece-image {
    transform:translateY(-3px) scale(1.02);
    filter:drop-shadow(0 0 5px rgba(128,225,255,.8)) drop-shadow(0 7px 3px rgba(0,0,0,.65)) saturate(.7) contrast(1.2);
}
@media (max-width:520px) {
    .board-theme-options { grid-template-columns:1fr; }
    .board-theme-card { min-height:auto; }
    body[data-board-theme="royal-wooden-3d"] .royal-board-frame,
    body[data-board-theme="modern-glass-3d"] .royal-board-frame { transform:perspective(900px) rotateX(3deg); }
}
@media (prefers-reduced-motion:reduce) {
    .board-theme-card { transition:none; }
}


/* Cascade lock: the base medieval board uses nested selectors and mobile rules.
   Keep every saved theme authoritative at all viewport sizes. */
body.battle-body[data-board-theme="elegant-classic-2d"] .royal-board-frame .chessboard .square.light {
    background:#f2dfbc !important;
}
body.battle-body[data-board-theme="elegant-classic-2d"] .royal-board-frame .chessboard .square.dark {
    background:#956039 !important;
}
body.battle-body[data-board-theme="royal-wooden-3d"] .royal-board-frame {
    transform:perspective(1100px) rotateX(5deg) !important;
}
body.battle-body[data-board-theme="royal-wooden-3d"] .royal-board-frame .chessboard .square.light {
    background:linear-gradient(135deg,#f0cf91,#bd8243) !important;
}
body.battle-body[data-board-theme="royal-wooden-3d"] .royal-board-frame .chessboard .square.dark {
    background:linear-gradient(135deg,#7b3b18,#351408) !important;
}
body.battle-body[data-board-theme="royal-wooden-3d"] .royal-board-frame .piece-image {
    transform:translateY(-4px) scale(1.035) !important;
    filter:drop-shadow(0 8px 3px rgba(17,5,1,.72)) saturate(.82) contrast(1.12) !important;
}
body.battle-body[data-board-theme="modern-glass-3d"] .royal-board-frame {
    transform:perspective(1100px) rotateX(4deg) !important;
}
body.battle-body[data-board-theme="modern-glass-3d"] .royal-board-frame .chessboard .square.light {
    background:linear-gradient(135deg,#b4d0dc,#577687) !important;
}
body.battle-body[data-board-theme="modern-glass-3d"] .royal-board-frame .chessboard .square.dark {
    background:linear-gradient(135deg,#193b50,#041019) !important;
}
body.battle-body[data-board-theme="modern-glass-3d"] .royal-board-frame .piece-image {
    transform:translateY(-4px) scale(1.03) !important;
    filter:drop-shadow(0 0 7px rgba(128,225,255,.95)) drop-shadow(0 8px 3px rgba(0,0,0,.72)) saturate(.65) contrast(1.25) !important;
}
@media (max-width:520px) {
    body.battle-body[data-board-theme="royal-wooden-3d"] .royal-board-frame,
    body.battle-body[data-board-theme="modern-glass-3d"] .royal-board-frame {
        transform:perspective(900px) rotateX(3deg) !important;
    }
}


/* Distinct piece sets for each selectable board. */
.piece-glyph {
    position:relative;
    z-index:3;
    display:none;
    width:100%;
    text-align:center;
    font-family:"DejaVu Sans","Noto Sans Symbols 2","Segoe UI Symbol",serif;
    font-size:clamp(30px,9.4vw,62px);
    line-height:1;
    pointer-events:none;
}
body.battle-body[data-board-theme="elegant-classic-2d"] .piece-image {
    display:none !important;
}
body.battle-body[data-board-theme="elegant-classic-2d"] .piece-glyph {
    display:block;
    transform:translateY(-1px);
}
body.battle-body[data-board-theme="elegant-classic-2d"] .piece-glyph.white {
    color:#fff3d5;
    -webkit-text-stroke:1px #4b3322;
    text-shadow:0 2px 1px rgba(54,30,15,.42);
}
body.battle-body[data-board-theme="elegant-classic-2d"] .piece-glyph.black {
    color:#26211d;
    -webkit-text-stroke:1px #0b0908;
    text-shadow:0 2px 1px rgba(255,238,203,.24);
}
body.battle-body[data-board-theme="royal-wooden-3d"] .piece-glyph,
body.battle-body[data-board-theme="modern-glass-3d"] .piece-glyph,
body.battle-body[data-board-theme="current-default"] .piece-glyph {
    display:none;
}
body.battle-body[data-board-theme="royal-wooden-3d"] .piece-image[aria-label^="White"] {
    filter:sepia(.82) saturate(1.25) hue-rotate(-13deg) brightness(1.13) drop-shadow(0 8px 3px rgba(34,12,3,.7)) !important;
}
body.battle-body[data-board-theme="royal-wooden-3d"] .piece-image[aria-label^="Black"] {
    filter:sepia(.72) saturate(1.55) hue-rotate(-18deg) brightness(.68) contrast(1.28) drop-shadow(0 8px 3px rgba(12,3,1,.82)) !important;
}
body.battle-body[data-board-theme="royal-wooden-3d"] .royal-board-frame {
    border-width:7px;
    border-style:ridge;
    box-shadow:0 24px 38px rgba(0,0,0,.68),inset 0 0 0 4px #2e1006 !important;
}


/* Captured pieces follow the selected board's piece set. */
.captured-piece-glyph {
    display:none;
    width:16px;
    flex:0 0 16px;
    text-align:center;
    font-family:"DejaVu Sans","Noto Sans Symbols 2","Segoe UI Symbol",serif;
    font-size:18px;
    line-height:1;
}
body[data-board-theme="current-default"] .captured-piece-image {
    display:block !important;
    filter:none !important;
    transform:none !important;
}
body[data-board-theme="elegant-classic-2d"] .captured-piece-image {
    display:none !important;
}
body[data-board-theme="elegant-classic-2d"] .captured-piece-glyph {
    display:block;
}
body[data-board-theme="elegant-classic-2d"] .captured-piece-glyph.white {
    color:#fff3d5;
    -webkit-text-stroke:.5px #4b3322;
    text-shadow:0 1px 1px rgba(54,30,15,.42);
}
body[data-board-theme="elegant-classic-2d"] .captured-piece-glyph.black {
    color:#26211d;
    -webkit-text-stroke:.5px #0b0908;
}
body[data-board-theme="royal-wooden-3d"] .captured-piece-glyph,
body[data-board-theme="modern-glass-3d"] .captured-piece-glyph {
    display:none;
}
body[data-board-theme="royal-wooden-3d"] .captured-piece-image[aria-label*="white"] {
    filter:sepia(.82) saturate(1.25) hue-rotate(-13deg) brightness(1.13) !important;
}
body[data-board-theme="royal-wooden-3d"] .captured-piece-image[aria-label*="black"] {
    filter:sepia(.72) saturate(1.55) hue-rotate(-18deg) brightness(.68) contrast(1.28) !important;
}
body[data-board-theme="modern-glass-3d"] .captured-piece-image {
    filter:drop-shadow(0 0 3px rgba(128,225,255,.88)) saturate(.65) contrast(1.25) !important;
}
@media (max-width:380px) {
    .captured-piece-glyph { width:13px; flex-basis:13px; font-size:15px; }
}
