/*!
 * BENKO CHESS COPYRIGHT NOTICE
 * © 2023–2026 Petar Benković / Benko Chess. All rights reserved.
 * This notice applies to original Benko Chess code in this file.
 * Third-party components, where present, retain their respective licences and notices.
 */
:root{
  --navy:#18324d;--navy2:#244d70;--cream:#f5efe5;--paper:#fffdf9;--gold:#d9c5a5;
  --text:#263444;--muted:#6b7785;--line:#d8d0c5;--accent:#a66b12;
  --shadow:0 18px 50px rgba(34,46,59,.13);
  --publication-font:"Segoe UI",Arial,sans-serif;
  --notation-font:"Segoe UI",Arial,sans-serif;
  --board-size:400px;
}
*{box-sizing:border-box}html{scroll-behavior:smooth}
body{margin:0;background:linear-gradient(180deg,#ebe3d8,#f7f4ee 320px);color:var(--text);font-family:var(--publication-font)}
body.embed-page{background:transparent}
button,select,input,textarea{font:inherit}
.topbar{height:76px;background:var(--navy);display:flex;align-items:center;padding:0 24px;color:white;gap:13px;position:sticky;top:0;z-index:20;box-shadow:0 5px 18px rgba(15,30,45,.22)}
.brand-mark{width:48px;height:48px;display:grid;place-items:center;border-radius:50%;overflow:hidden;background:var(--navy2);box-shadow:0 2px 10px rgba(0,0,0,.22)}
.brand-mark img{display:block;width:48px;height:48px}
.brand-copy{display:flex;flex-direction:column;gap:2px}.brand-copy strong{font:700 20px Georgia}.brand-copy span{font-size:12px;color:#d9e5ed}
.pgn-link{margin-left:auto;color:white;text-decoration:none;border:1px solid rgba(255,255,255,.35);padding:8px 14px;border-radius:8px;font-weight:700}
.page-shell{max-width:1450px;margin:0 auto;padding:28px 20px 48px}
.compact-page{padding-top:18px}
.hero-card{background:var(--navy);color:white;border-radius:18px;padding:30px 34px;display:grid;grid-template-columns:1fr 260px;gap:30px;box-shadow:var(--shadow);position:relative;overflow:hidden}
.hero-card:after{content:"♞";position:absolute;right:290px;bottom:-58px;font:700 180px Georgia;color:rgba(255,255,255,.045)}
.eyebrow{display:inline-block;color:#ead9bd;text-transform:uppercase;letter-spacing:.12em;font-size:11px;font-weight:800}
.hero-card h1{font:700 clamp(30px,4vw,52px) Georgia;margin:7px 0 12px}.hero-card p{max-width:800px;line-height:1.65;color:#dce7ef;margin:0;white-space:pre-line}
.hero-card aside{align-self:stretch;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.14);border-radius:14px;padding:18px;display:flex;flex-direction:column;justify-content:flex-end;gap:8px}.hero-card aside span{font-size:13px;color:#d9e5ed}
.viewer-layout{--board-panel-width:518px;--viewer-panel-height:auto;display:grid;grid-template-columns:minmax(300px,var(--board-panel-width)) minmax(350px,1fr);gap:18px;margin-top:24px;align-items:start}
.compact-page .viewer-layout{margin-top:0}
body.layout-balanced .viewer-layout{grid-template-columns:minmax(300px,var(--board-panel-width)) minmax(360px,1fr)}
body.layout-notation-wide .viewer-layout{grid-template-columns:minmax(300px,var(--board-panel-width)) minmax(500px,1.35fr)}
body.layout-notation-extra .viewer-layout{grid-template-columns:minmax(300px,var(--board-panel-width)) minmax(650px,1.75fr)}
.board-panel,.notation-panel,.index-section{background:var(--paper);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow)}
.board-panel{padding:18px;min-width:0;align-self:start}.game-head{display:flex;justify-content:space-between;gap:12px;font-size:17px;align-items:flex-start}.game-head b{color:var(--accent)}.player-lines{display:flex;flex-direction:column;gap:4px;min-width:0}.player-line{display:flex;align-items:center;gap:8px;min-width:0}.player-line strong{color:#102f4f;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.player-color{width:13px;height:13px;border:1px solid #263444;box-shadow:inset 0 0 0 1px rgba(255,255,255,.35);flex:0 0 auto}.player-color.white{background:#fffdf3}.player-color.black{background:#1e2630}.player-elo{color:#66717b;font-weight:700;font-size:14px}
.meta-line{min-height:24px;color:var(--muted);font-size:13px;margin:5px 0 8px}
.board-size-toolbar{display:none;align-items:center;justify-content:center;gap:5px;min-height:32px;margin:0 0 8px;color:var(--muted);font-size:11px;flex-wrap:wrap}
.board-size-toolbar>span{font-weight:800;text-transform:uppercase;letter-spacing:.06em;margin-right:2px}.board-size-toolbar small{margin-left:6px;font-size:10px;opacity:.82}
.size-btn{min-width:30px;height:27px;padding:0 8px;border:1px solid #c5cdd4;background:#f4f6f7;color:#33475b;border-radius:6px;cursor:pointer;font-weight:800}
.size-btn:hover,.size-btn.active{background:var(--navy2);border-color:var(--navy2);color:#fff}
.board-resize-shell{width:min(100%,var(--board-size));max-width:100%;aspect-ratio:1;margin:0 auto;position:relative;min-width:280px;min-height:280px}
.board-resize-shell.coords-outside .board{width:calc(100% - 24px);height:calc(100% - 24px);margin-left:24px}
.board{width:100%;height:100%;display:grid;grid-template-columns:repeat(8,1fr);grid-template-rows:repeat(8,1fr);background-image:url('../boards/blue.webp');background-repeat:repeat;background-size:25% 25%;box-shadow:inset 0 0 0 1px rgba(0,0,0,.16),0 10px 24px rgba(35,40,45,.17);touch-action:none;overflow:hidden}
.square{position:relative;display:grid;place-items:center;user-select:none}.square.selected{background:rgba(255,214,77,.55)}.square.last{box-shadow:inset 0 0 0 999px rgba(255,235,95,.25)}
.square.hint:after{content:"";width:22%;aspect-ratio:1;border-radius:50%;background:rgba(35,50,68,.32);position:absolute}.square.capture-hint:after{content:"";position:absolute;inset:7%;border:4px solid rgba(35,50,68,.34);border-radius:50%}
.piece{width:89%;height:89%;object-fit:contain;position:relative;z-index:3;cursor:grab;filter:drop-shadow(0 2px 1px rgba(0,0,0,.22));touch-action:none}.piece:active{cursor:grabbing}.piece.is-dragging{opacity:0}.floating-piece{position:fixed;left:0;top:0;z-index:2000;pointer-events:none;object-fit:contain;transform:translate(-50%,-50%);filter:drop-shadow(0 2px 1px rgba(0,0,0,.22))}.promotion-picker{position:absolute;z-index:1000;display:flex;gap:5px;padding:7px;background:rgba(255,255,255,.96);border:1px solid #b8c4cf;border-radius:10px;box-shadow:0 14px 38px rgba(18,35,52,.24)}.promotion-picker button{width:54px;height:54px;border:1px solid #c7d1da;border-radius:50%;background:linear-gradient(#f9fbfc,#e8eef3);display:grid;place-items:center;cursor:pointer}.promotion-picker button:hover{background:#dfeaf2;transform:translateY(-1px)}.promotion-picker img{width:44px;height:44px;object-fit:contain;filter:drop-shadow(0 2px 1px rgba(0,0,0,.2))}
.coord{position:absolute;font-size:10px;font-weight:800;opacity:.72;z-index:4;text-shadow:0 1px rgba(255,255,255,.25)}.coord.file{right:3px;bottom:1px}.coord.rank{left:3px;top:1px}
.coord-out{position:absolute;z-index:6;color:#33475b;font-size:13px;font-weight:900;line-height:1;pointer-events:none}.coord-out.file{bottom:2px;transform:translateX(-50%)}.coord-out.rank{left:5px;transform:translateY(-50%)}
.controls{display:flex;justify-content:center;gap:var(--control-gap,7px);margin:15px auto 0;flex-wrap:nowrap;width:min(100%,var(--board-control-width,600px))}.controls button{width:var(--control-btn,44px);height:var(--control-height,38px);border:1px solid #c5cdd4;background:#f4f6f7;border-radius:8px;cursor:pointer;display:grid;place-items:center;flex:0 0 auto}.controls button:hover{background:#e5edf2}.controls button.game-nav{width:var(--control-game-btn,48px);background:#edf3f7;border-color:#9fb2c2;box-shadow:inset 0 -2px 0 rgba(21,49,77,.08)}.controls button.game-nav:hover{background:#dfeaf2}.controls img{width:var(--control-icon,22px);height:var(--control-icon,22px)}.controls button.game-nav img{width:var(--control-game-icon,25px);height:var(--control-game-icon,25px)}
.status{margin-top:10px;min-height:20px;text-align:center;color:var(--muted);font-size:13px}
.notation-panel{padding:18px;display:flex;flex-direction:column;height:var(--viewer-panel-height);min-height:0;max-height:none;overflow:hidden}.notation-panel label{font-size:12px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.notation-panel select{flex:0 0 auto;margin:6px 0 12px;padding:9px 10px;border:1px solid var(--line);border-radius:8px;background:white;color:var(--text);font-size:14px;line-height:1.25}
.engine-panel{flex:0 0 auto;border:1px solid var(--line);background:#f7f8f8;border-radius:8px;margin:0 0 10px;overflow:hidden}.engine-head{min-height:38px;display:flex;align-items:center;gap:8px;padding:6px 8px;color:#2b3a48}.engine-head strong{font-size:14px;color:var(--navy)}.engine-head span{font-size:12px;color:var(--muted);margin-right:auto}.engine-head button{border:1px solid #aebbc7;background:#fff;color:var(--navy);border-radius:6px;padding:5px 9px;font-size:12px;font-weight:800;cursor:pointer}.engine-head button:hover{background:#edf3f7}.engine-lines{border-top:1px solid var(--line);padding:4px 8px 6px;background:white}.engine-line{display:grid;grid-template-columns:48px minmax(0,1fr) 24px;gap:8px;align-items:baseline;min-height:24px;font-size:14px;line-height:1.25}.engine-score{font-weight:800;color:#1f2f3f}.engine-pv{white-space:normal;overflow:hidden;color:#333}.engine-expand{width:24px;height:22px;border:0;background:transparent;color:#7b8792;cursor:pointer;font-size:13px;line-height:1}.engine-expand:hover{color:var(--navy)}.engine-line.is-empty{grid-template-columns:48px minmax(0,1fr)}.engine-line.is-empty .engine-pv{color:var(--muted);font-style:italic}
.moves{min-height:0;flex:1 1 auto;overflow:auto;line-height:1.58;font-family:var(--notation-font);font-size:16px;padding-right:7px;color:#111827}.move{display:inline-block;padding:0 3px;border-radius:4px;cursor:pointer;font-weight:700;color:#111827}.move:hover{background:#e8edf1}.move.active{background:var(--navy2);color:white}.move-num{color:#111827;font-weight:700;margin-left:6px}.game-result-token{display:inline-block;margin-left:8px;font-weight:800;color:#111827}.nag{color:currentColor;font-weight:800;margin-left:2px}.comment{font-family:var(--publication-font);font-size:15px;font-style:normal;font-weight:400;color:#123fba;margin:0 4px}.comment:before{content:" "}.comment:after{content:" "}.comment-main,.comment-side{color:#123fba}.variation{display:inline;color:#8f2634;font-size:.96em;line-height:inherit;margin:0 3px;font-weight:500;white-space:normal}.variation-open,.variation-close{font-weight:700;color:currentColor}.variation-open{margin-right:4px}.variation-close{margin-left:2px}.variation-label{color:#123fba;font-weight:400;margin-right:.18em}.variation-sep{display:inline-block;color:#5d6570;font-weight:500;margin:0 4px 0 0}.variation .move{font-weight:500;color:currentColor;text-decoration:none;padding-left:1px;padding-right:2px}.variation-label+.move,.variation-label+.move-num+.move{padding-left:0}.variation-label+.move-num,.variation-open+.move-num{margin-left:0}.variation .move:hover{text-decoration:underline;text-underline-offset:3px}.variation .move-num{color:currentColor;font-weight:500}.variation .nag{color:currentColor;font-weight:600}.variation .comment{color:#123fba;font-weight:400}.variation.depth-0{color:#8f2634}.variation.depth-1{color:#557a3b}.variation.depth-2{color:#5f3a24}.variation.depth-3{color:#6f5a8f}.variation.depth-4{color:#4f6f73}.variation.depth-1,.variation.depth-2,.variation.depth-3,.variation.depth-4{font-size:.95em}
.index-section{margin-top:24px;padding:20px}.section-head{display:flex;align-items:baseline;justify-content:space-between}.section-head h2{font:700 28px Georgia;color:var(--navy);margin:0 0 15px}.section-head span{color:var(--muted);font-size:13px}
.game-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.game-item{border:1px solid var(--line);background:#fff;border-radius:10px;text-align:left;padding:12px 14px;cursor:pointer;color:var(--text)}.game-item:hover,.game-item.active{border-color:#7795ad;background:#edf3f7}.game-item strong{display:block}.game-item span{display:block;color:var(--muted);font-size:12px;margin-top:4px}.empty-note{color:var(--muted);font-style:italic}
footer{background:#132a40;color:#cdd9e3;padding:25px;text-align:center;font-size:13px}footer a{color:#fff;text-decoration:none}footer a:hover{color:#ead9bd;text-decoration:none}
.embed-hidden{display:none!important}
.embed-shell{max-width:1040px;margin:0 auto;padding:10px}
.embed-viewer{grid-template-columns:minmax(300px,var(--board-panel-width)) minmax(280px,1fr);gap:12px;margin-top:0}
body.embed-page.layout-balanced .embed-shell{max-width:1040px}
body.embed-page.layout-notation-wide .embed-shell{max-width:1180px}
body.embed-page.layout-notation-extra .embed-shell{max-width:1360px}
body.embed-page.layout-balanced .embed-viewer{grid-template-columns:minmax(300px,var(--board-panel-width)) minmax(340px,1fr)}
body.embed-page.layout-notation-wide .embed-viewer{grid-template-columns:minmax(300px,var(--board-panel-width)) minmax(500px,1.4fr)}
body.embed-page.layout-notation-extra .embed-viewer{grid-template-columns:minmax(300px,var(--board-panel-width)) minmax(650px,1.8fr)}
.embed-page .board-panel,.embed-page .notation-panel{border-radius:10px;box-shadow:0 10px 28px rgba(20,28,38,.12)}
.embed-page .notation-panel{min-height:0;max-height:none}
.embed-page .board-resize-shell{max-width:500px}
.embed-page .board{border-radius:4px}
.embed-page .game-head{font-size:15px}
.board-only-page{background:transparent}
.board-only-shell{max-width:720px;margin:0 auto;padding:10px}
.board-only-panel{width:max-content;max-width:calc(100vw - 20px);margin:0 auto}
.board-only-page .board-resize-shell{max-width:500px}
.board-only-page .controls{margin-top:12px}
.board-only-select{margin:12px auto 0;width:100%;max-width:none}
.board-only-select label{display:block;margin:0 0 6px;color:var(--muted);font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.08em}
.board-only-select select{width:100%;padding:var(--game-select-pad-y,10px) var(--game-select-pad-x,12px);border:1px solid var(--line);border-radius:8px;background:white;color:var(--text);font-size:var(--game-select-font,14px);line-height:1.25}
body.theme-dark{--paper:#1d2833;--text:#edf3f7;--muted:#aebbc7;--line:#41505d;background:#111a22}.theme-dark .notation-panel select,.theme-dark .game-item{background:#263441;color:var(--text)}.theme-dark .player-line strong,.theme-dark .move,.theme-dark .move-num,.theme-dark .game-result-token{color:#e3edf4}.theme-dark .comment{color:#b5c2cd}.theme-dark .size-btn{background:#263441;color:#dce7ef;border-color:#52606d}
@media(max-width:1050px){.viewer-layout,body.layout-balanced .viewer-layout,body.layout-notation-wide .viewer-layout,body.layout-notation-extra .viewer-layout,.embed-viewer,body.embed-page.layout-balanced .embed-viewer,body.embed-page.layout-notation-wide .embed-viewer,body.embed-page.layout-notation-extra .embed-viewer{grid-template-columns:1fr}.layout-splitter{display:none}.notation-panel{height:auto;min-height:360px;max-height:620px}.board-resize-shell{max-width:min(100%,500px)}.game-grid{grid-template-columns:1fr}}
@media(max-width:600px){.page-shell{padding:14px 8px 30px}.topbar{padding:0 10px}.brand-copy strong{font-size:16px}.hero-card{padding:22px 18px;border-radius:12px;grid-template-columns:1fr}.hero-card aside{display:none}.board-panel,.notation-panel,.index-section{border-radius:10px}.board-panel{padding:9px}.controls{gap:4px}.controls button{width:39px;height:36px}.game-head{font-size:14px}.board-resize-shell{min-width:230px;min-height:230px}.board-size-toolbar small{display:none}}
