/* Šachárna – vzhled */
:root {
  --bg: #302e2b; --bg2: #262522; --bg3: #3c3a37; --line: #45423e;
  --tx: #ffffffde; --tx2: #bab9b8; --tx3: #8b8987;
  --green: #81b64c; --green-d: #5d9948; --green-sh: #45753c;
  --light: #ebecd0; --dark: #739552; --hl: rgba(255, 255, 51, .5); --hl-d: rgba(255, 255, 51, .5);
  --graph-w: #ffffff; --graph-b: #403d39;
  --side-w: 190px; --panel-w: 380px; --ev-w: 22px;
  --bs: min(calc(100vh - 140px), calc(100vw - var(--side-w) - var(--panel-w) - 110px));
  --c-brilliant: #1baaa6; --c-best: #81b64c; --c-excellent: #96bc4b; --c-good: #96af8b; --c-book: #a88865;
  --c-forced: #97af8b; --c-inaccuracy: #f7c631; --c-mistake: #ffa459; --c-miss: #ff7769; --c-blunder: #fa412d;
  color-scheme: dark;
}
:root[data-theme="brown"] { --light: #f0d9b5; --dark: #b58863; --hl: rgba(155, 199, 0, .45); }
:root[data-theme="blue"] { --light: #dee3e6; --dark: #8ca2ad; --hl: rgba(20, 120, 220, .35); }
:root[data-theme="gray"] { --light: #dcdcdc; --dark: #ababab; --hl: rgba(255, 220, 60, .55); }
:root[data-theme="purple"] { --light: #e5dbf3; --dark: #9f88c4; --hl: rgba(255, 230, 80, .5); }
:root[data-theme="coral"] { --light: #b1e4b9; --dark: #70a2a3; --hl: rgba(255, 255, 80, .5); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--tx);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; }
.muted { color: var(--tx3); }
.small { font-size: 12.5px; }

.app { display: flex; min-height: 100vh; }

/* ---------- boční menu ---------- */
.side { width: var(--side-w); background: var(--bg2); display: flex; flex-direction: column; padding: 10px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 8px; padding: 6px 16px 16px; font-weight: 800; font-size: 21px; letter-spacing: -.3px; }
.logo-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--green); display: grid; place-items: center; color: #fff; font-size: 26px; line-height: 1; box-shadow: 0 3px 0 var(--green-sh); }
.nav-btn { display: flex; align-items: center; gap: 11px; background: none; border: 0; padding: 11px 16px; text-align: left; font-weight: 600; color: var(--tx2); }
.nav-btn:hover { background: #ffffff0d; color: var(--tx); }
.nav-btn.on { background: #ffffff14; color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.ni { width: 24px; text-align: center; font-size: 19px; }
.side-sp { flex: 1; }

/* ---------- hlavní plocha ---------- */
.main { flex: 1; display: flex; gap: 22px; justify-content: center; align-items: flex-start; padding: 16px 20px; min-width: 0; }
.board-area { width: calc(var(--bs) + var(--ev-w) + 8px); flex-shrink: 0; }
body:not(.with-eval) .board-area { width: var(--bs); }
.board-row { display: flex; gap: 8px; }
#board { width: var(--bs); height: var(--bs); flex-shrink: 0; }

.pbar { height: 52px; display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.av { width: 40px; height: 40px; border-radius: 5px; display: grid; place-items: center; font-size: 24px; flex-shrink: 0; color: #222; line-height: 1; }
.av.lg { width: 64px; height: 64px; font-size: 40px; border-radius: 8px; }
.av.xl { width: 72px; height: 72px; font-size: 46px; border-radius: 8px; }
.pinfo { flex: 1; min-width: 0; }
.pname { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elo { color: var(--tx3); font-weight: 400; }
.caps { height: 18px; display: flex; align-items: center; }
.cap-grp { display: inline-flex; margin-right: 4px; }
.cap-grp .cp { width: 17px; height: 17px; margin-right: -8px; }
.cap-grp .cp:last-child { margin-right: 0; }
.adv { font-size: 12px; color: var(--tx3); margin-left: 4px; font-weight: 600; }
.clock { min-width: 112px; padding: 6px 12px; border-radius: 4px; background: #989795; color: #00000094; font: 700 24px/1.15 ui-monospace, "SF Mono", Menlo, Consolas, monospace; text-align: right; }
.clock.cb { background: #21201d; color: #ffffff70; }
.clock.cw { background: #989795; color: #26252280; }
.clock.active.cw { background: #fff; color: #262522; }
.clock.active.cb { background: #262522; color: #fff; box-shadow: inset 0 0 0 2px #ffffff30; }
.clock.active.low { background: #e02828 !important; color: #fff !important; }
.thinking { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--tx2); animation: dot 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- šachovnice ---------- */
.board { position: relative; user-select: none; -webkit-user-select: none; touch-action: none; border-radius: 3px; overflow: hidden; box-shadow: 0 4px 18px #0006; }
.sqs { position: absolute; inset: 0; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); }
.sq { position: relative; }
.sq[data-light="1"] { background: var(--light); }
.sq[data-light="0"] { background: var(--dark); }
.sq.last::before, .sq.sel::before { content: ""; position: absolute; inset: 0; background: var(--hl); }
.sq.chk::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, #ff0000 0%, #e70000c0 30%, #a9000000 72%); }
.sq.mark::before { content: ""; position: absolute; inset: 0; background: rgba(235, 97, 80, .82); }
.sq.dot::after { content: ""; position: absolute; left: 33%; top: 33%; width: 34%; height: 34%; border-radius: 50%; background: rgba(0, 0, 0, .14); z-index: 4; }
.sq.cap::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 calc(var(--bs) * .0095) rgba(0, 0, 0, .14); z-index: 4; }
.sq.hov { box-shadow: inset 0 0 0 calc(var(--bs) * .006) rgba(255, 255, 255, .7); }
.crd { position: absolute; font-weight: 700; font-size: calc(var(--bs) * .026); line-height: 1; pointer-events: none; }
.sq[data-light="1"] .crd { color: var(--dark); }
.sq[data-light="0"] .crd { color: var(--light); }
.crd.rk { left: 4%; top: 4%; }
.crd.fl { right: 5%; bottom: 3%; }
.pcs { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.pc { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; background-size: 100% 100%; will-change: transform; }
.pc.drag { z-index: 10; transform-origin: center; filter: drop-shadow(0 4px 6px #0005); }
.pc.wK, .cp.wK { background-image: url(../img/pieces/wK.svg); } .pc.wQ, .cp.wQ { background-image: url(../img/pieces/wQ.svg); }
.pc.wR, .cp.wR { background-image: url(../img/pieces/wR.svg); } .pc.wB, .cp.wB { background-image: url(../img/pieces/wB.svg); }
.pc.wN, .cp.wN { background-image: url(../img/pieces/wN.svg); } .pc.wP, .cp.wP { background-image: url(../img/pieces/wP.svg); }
.pc.bK, .cp.bK { background-image: url(../img/pieces/bK.svg); } .pc.bQ, .cp.bQ { background-image: url(../img/pieces/bQ.svg); }
.pc.bR, .cp.bR { background-image: url(../img/pieces/bR.svg); } .pc.bB, .cp.bB { background-image: url(../img/pieces/bB.svg); }
.pc.bN, .cp.bN { background-image: url(../img/pieces/bN.svg); } .pc.bP, .cp.bP { background-image: url(../img/pieces/bP.svg); }
.cp { display: inline-block; width: 22px; height: 22px; background-size: 100% 100%; vertical-align: middle; font-style: normal; }
.cp.half { background: linear-gradient(90deg, #fff 50%, #222 50%); border-radius: 50%; width: 18px; height: 18px; box-shadow: 0 0 0 1px #888; }
.arw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.ar polyline { stroke-linecap: butt; }
.ar-user polyline { stroke: rgba(255, 170, 0, .8); } .ar-user polygon { fill: rgba(255, 170, 0, .8); }
.ar-best polyline { stroke: rgba(150, 190, 70, .85); } .ar-best polygon { fill: rgba(150, 190, 70, .85); }
.ar-hint polyline { stroke: rgba(70, 150, 235, .85); } .ar-hint polygon { fill: rgba(70, 150, 235, .85); }
.bdg { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.badge { position: absolute; width: 5.2%; height: 5.2%; transform: translate(-70%, -30%); border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: calc(var(--bs) * .025); box-shadow: 0 2px 4px #0006; border: 2px solid #fff; animation: pop .25s ease-out; }
@keyframes pop { from { transform: translate(-70%, -30%) scale(.3); } }
.promo { position: absolute; inset: 0; background: #0006; z-index: 20; }
.promo-col { position: absolute; width: 12.5%; height: 50%; display: flex; flex-direction: column; background: #fff; box-shadow: 0 4px 20px #000a; border-radius: 3px; overflow: hidden; }
.pc-btn { flex: 1; border: 0; background: #fff; position: relative; padding: 0; }
.pc-btn:hover { background: #e8e8e8; }
.pc-btn .pc { width: 100%; height: 100%; position: absolute; }

/* ---------- ukazatel ohodnocení ---------- */
.evalbar { display: none; width: var(--ev-w); height: var(--bs); background: #403d39; position: relative; border-radius: 3px; overflow: hidden; flex-shrink: 0; }
body.with-eval .evalbar { display: block; }
.ev-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: #fff; transition: height .5s ease; }
.evalbar.flip .ev-fill { bottom: auto; top: 0; }
.ev-txt { position: absolute; left: 0; right: 0; text-align: center; font-size: 10.5px; font-weight: 800; }
.ev-txt.bottom { bottom: 4px; } .ev-txt.top { top: 4px; }
.ev-txt.on-white { color: #403d39; } .ev-txt.on-black { color: #fff; }

/* ---------- panel ---------- */
.panel { width: var(--panel-w); background: var(--bg2); border-radius: 8px; display: flex; flex-direction: column; height: calc(var(--bs) + 104px); min-height: 480px; overflow: hidden; flex-shrink: 0; }
.ph { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #ffffff0f; }
.ph h2 { margin: 0; font-size: 18px; }
.ph-ico { font-size: 22px; }
.pscroll { flex: 1; overflow-y: auto; padding: 14px 16px; min-height: 0; }
.pfoot { padding: 12px 16px; display: flex; gap: 8px; border-top: 1px solid #ffffff0f; }
.pfoot .btn { flex: 1; }

.btn { background: var(--bg3); border: 0; border-radius: 6px; padding: 10px 14px; font-weight: 700; color: var(--tx); box-shadow: 0 3px 0 #1e1d1b; transition: filter .1s; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1e1d1b; }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-sh); }
.btn.big { font-size: 20px; padding: 14px 18px; width: 100%; }
.btn.sm { padding: 7px 10px; font-size: 13px; }

.bot-hero { display: flex; gap: 12px; align-items: flex-start; }
.bubble { position: relative; background: #fff; color: #312e2b; border-radius: 10px; padding: 10px 12px; font-size: 14px; flex: 1; font-weight: 500; }
.bubble::before { content: ""; position: absolute; left: -7px; top: 16px; border: 7px solid transparent; border-left: 0; border-right-color: #fff; }
.bot-name { font-size: 20px; font-weight: 800; margin-top: 12px; }
.bot-name .elo { font-size: 16px; }
.bot-desc { color: var(--tx2); font-size: 13.5px; margin-bottom: 12px; }
.bot-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
.bot-card { background: var(--bg3); border: 2px solid transparent; border-radius: 6px; padding: 5px 2px 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bot-card .av { width: 36px; height: 36px; font-size: 22px; }
.bot-card.on { border-color: var(--green); background: #4a4744; }
.bc-elo { font-size: 11px; color: var(--tx2); font-weight: 700; }
.opt { margin-bottom: 14px; }
.opt-l { font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--tx3); font-weight: 700; margin-bottom: 6px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; background: var(--bg3); border: 2px solid transparent; border-radius: 6px; padding: 8px; display: grid; place-items: center; }
.seg button .cp { width: 32px; height: 32px; }
.seg button .cp.half { width: 26px; height: 26px; }
.seg button.on { border-color: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--bg3); border: 2px solid transparent; border-radius: 6px; padding: 6px 10px; font-weight: 700; font-size: 13.5px; }
.chip.on { border-color: var(--green); }
.stats-mini { font-size: 12.5px; color: var(--tx3); }
.stats-mini b { color: var(--tx); }
.field { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.field span { width: 90px; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.field input { flex: 1; background: var(--bg3); border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; color: var(--tx); }
.check { display: flex; align-items: center; gap: 9px; padding: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }

.game-bot { padding: 12px 16px 4px; }
.game-bot .av.xl { width: 52px; height: 52px; font-size: 32px; }
.game-bot .bubble { font-size: 13.5px; }
.opening { padding: 8px 16px; font-size: 13px; color: var(--tx2); border-bottom: 1px solid #ffffff0a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 34px; }
.moves { flex: 1; overflow-y: auto; min-height: 80px; font-size: 14.5px; }
.pscroll .moves { overflow: visible; margin: 8px -16px 0; }
.moves.empty { display: grid; place-items: center; }
.mrow { display: grid; grid-template-columns: 44px 1fr 1fr; padding: 1px 8px; }
.mrow:nth-child(even) { background: #ffffff06; }
.mn { color: var(--tx3); padding: 4px 0 4px 6px; }
.mv { padding: 3px 6px; border-radius: 3px; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 4px; white-space: nowrap; border-bottom: 2px solid transparent; }
.mv:hover { background: #ffffff10; }
.mv.cur { background: #ffffff24; border-bottom-color: #ffffff40; }
.fig { font-size: 1.15em; line-height: 1; }
.mi { width: 17px; height: 17px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 900; color: #fff; font-style: normal; flex-shrink: 0; }
.mi.big { width: 34px; height: 34px; font-size: 16px; }
.c-inaccuracy { color: var(--c-inaccuracy); } .c-mistake { color: var(--c-mistake); } .c-blunder { color: var(--c-blunder); }
.c-miss { color: var(--c-miss); } .c-brilliant { color: var(--c-brilliant); }
.b-brilliant { background: var(--c-brilliant); } .b-best { background: var(--c-best); } .b-excellent { background: var(--c-excellent); }
.b-good { background: var(--c-good); } .b-book { background: var(--c-book); } .b-forced { background: var(--c-forced); }
.b-inaccuracy { background: var(--c-inaccuracy); } .b-mistake { background: var(--c-mistake); } .b-miss { background: var(--c-miss); } .b-blunder { background: var(--c-blunder); }
.navrow { display: flex; gap: 4px; padding: 8px 12px; border-top: 1px solid #ffffff0f; }
.nb { flex: 1; background: var(--bg3); border: 0; border-radius: 5px; padding: 9px 0; font-size: 15px; color: var(--tx2); }
.nb:hover { background: #4a4744; color: #fff; }
.actrow { display: flex; gap: 4px; padding: 4px 12px 12px; }
.ab { flex: 1; background: none; border: 0; border-radius: 5px; padding: 6px 0; font-size: 19px; color: var(--tx2); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.ab span { font-size: 11.5px; font-weight: 600; }
.ab:hover { background: #ffffff10; color: #fff; }
.result-box { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #ffffff0f; }
.rb-t { font-size: 20px; font-weight: 800; text-align: center; }
.rb-s { text-align: center; color: var(--tx2); font-size: 13.5px; margin-top: -6px; }
.rm-row { display: flex; gap: 8px; }
.rm-row .btn { flex: 1; }

.ana-line { padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; border-bottom: 1px solid #ffffff0f; min-height: 46px; font-size: 13.5px; }
.ana-line.small { border-top: 1px solid #ffffff0f; border-bottom: 0; }
.ana-score { font-weight: 800; font-size: 16px; padding: 2px 8px; border-radius: 4px; background: #fff; color: #312e2b; }
.ana-score.b { background: #403d39; color: #fff; }
.ana-pv { color: var(--tx2); flex: 1; min-width: 0; }
.ana-depth { color: var(--tx3); font-size: 11.5px; }
.loader { padding: 4px 16px 14px; }
.loader summary { cursor: pointer; color: var(--tx2); font-size: 13.5px; padding: 4px 0; }
.loader textarea { width: 100%; background: var(--bg3); border: 1px solid var(--line); color: var(--tx); border-radius: 5px; padding: 8px; resize: vertical; margin: 6px 0; font: 12.5px/1.4 ui-monospace, Menlo, Consolas, monospace; }

/* rozbor */
.rv-wait { padding: 30px 20px; text-align: center; color: var(--tx2); }
.spinner { width: 42px; height: 42px; border: 4px solid #ffffff20; border-top-color: var(--green); border-radius: 50%; margin: 0 auto 12px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.rv-prog { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.rv-prog i { display: block; height: 100%; background: var(--green); transition: width .2s; }
.graph { width: 100%; height: 70px; border-radius: 5px; cursor: pointer; display: block; }
.rv-acc { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; }
.rv-pl { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rv-acc-l { color: var(--tx2); font-weight: 700; }
.acc-box { font-size: 22px; font-weight: 800; padding: 4px 14px; border-radius: 6px; min-width: 76px; text-align: center; }
.acc-box.w { background: #fff; color: #312e2b; } .acc-box.b { background: #403d39; color: #fff; }
.rv-info { display: flex; gap: 10px; align-items: center; background: var(--bg3); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; min-height: 66px; }
.rv-coach { font-size: 34px; }
.rv-txt { flex: 1; }
.rv-ev { font-size: 12.5px; color: var(--tx3); }
.rv-best { font-size: 13.5px; color: var(--tx2); }
.rv-tbl { margin-bottom: 4px; }
.rv-tbl summary { cursor: pointer; color: var(--tx2); font-size: 13.5px; padding: 4px 0; }
.rv-row { display: grid; grid-template-columns: 40px 1fr 40px; padding: 3px 0; font-size: 13.5px; }
.rv-n { text-align: center; font-weight: 800; }
.rv-k { display: flex; align-items: center; gap: 8px; justify-content: center; }

/* úlohy */
.pz-turn { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 8px; background: var(--bg3); margin-bottom: 14px; }
.pz-turn .cp { width: 46px; height: 46px; }
.pz-turn.w { box-shadow: inset 4px 0 0 #fff; } .pz-turn.b { box-shadow: inset 4px 0 0 #111; }
.pz-msg { font-size: 17px; font-weight: 800; }
.pz-msg.ok { color: var(--green); } .pz-msg.bad { color: var(--c-blunder); }
.pz-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.pz-stats div { background: #ffffff08; border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; }
.pz-stats span { font-size: 12px; color: var(--tx3); }
.pz-stats b { font-size: 19px; }
.pz-stats em { font-style: normal; font-size: 12.5px; font-weight: 700; }
.up { color: var(--green); } .down { color: var(--c-blunder); }
.pz-btns { display: flex; flex-direction: column; gap: 8px; }

/* modální okna */
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.mbox { position: relative; background: var(--bg2); border-radius: 10px; padding: 22px; width: min(420px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px #000a; animation: rise .2s ease-out; }
.mbox.small { width: min(360px, 100%); }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.mbox h3 { margin: 0 0 14px; }
.mclose { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--tx3); font-size: 18px; padding: 4px 8px; }
.rm { display: flex; flex-direction: column; gap: 12px; }
.rm-head { text-align: center; margin: -22px -22px 0; padding: 20px; background: var(--bg3); border-radius: 10px 10px 0 0; }
.rm.won .rm-head { background: var(--green); }
.rm-title { font-size: 26px; font-weight: 800; }
.rm-sub { color: #ffffffb0; }
.rm-players { display: flex; align-items: center; justify-content: space-around; padding: 6px 0; }
.rm-p { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; max-width: 130px; text-align: center; }
.rm-score { font-size: 24px; font-weight: 800; color: var(--tx2); }
.rm-rating { text-align: center; color: var(--tx2); }
.cm p { font-size: 16px; margin: 4px 0 18px; }
.pgn-out, .fen-out { width: 100%; background: var(--bg3); color: var(--tx); border: 1px solid var(--line); border-radius: 5px; padding: 8px; font: 12.5px/1.45 ui-monospace, Menlo, Consolas, monospace; margin-bottom: 10px; resize: vertical; }
.fen-out { margin-top: 4px; }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.theme-btn { background: var(--bg3); border: 2px solid transparent; border-radius: 6px; padding: 6px; font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.theme-btn.on { border-color: var(--green); }
.tb { display: grid; grid-template-columns: 1fr 1fr; width: 40px; height: 40px; border-radius: 3px; overflow: hidden; }
.tb i:nth-child(1), .tb i:nth-child(4) { background: var(--l); } .tb i:nth-child(2), .tb i:nth-child(3) { background: var(--d); }
.tb-green { --l: #ebecd0; --d: #739552; } .tb-brown { --l: #f0d9b5; --d: #b58863; } .tb-blue { --l: #dee3e6; --d: #8ca2ad; }
.tb-gray { --l: #dcdcdc; --d: #ababab; } .tb-purple { --l: #e5dbf3; --d: #9f88c4; } .tb-coral { --l: #b1e4b9; --d: #70a2a3; }
.set-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #ffffff12; }
.credits { margin-top: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: #fff; color: #222; padding: 10px 18px; border-radius: 8px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 200; box-shadow: 0 6px 20px #0008; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- menší obrazovky ---------- */
@media (max-width: 1180px) {
  :root { --side-w: 64px; --panel-w: 330px; }
  .logo-t, .nl { display: none; }
  .nav-btn { justify-content: center; padding: 13px 0; }
  .logo { justify-content: center; padding: 6px 0 16px; }
  .bot-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  :root { --ev-w: 12px; --bs: min(calc(100vw - 32px - var(--ev-w) - 6px), calc(100vh - 230px)); }
  body:not(.with-eval) { --bs: min(calc(100vw - 32px), calc(100vh - 230px)); }
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: sticky; top: 0; z-index: 50; flex-direction: row; align-items: center; padding: 0 8px; }
  .logo { padding: 6px 8px; }
  .logo-ico { width: 30px; height: 30px; font-size: 22px; }
  .side-sp { display: none; }
  .nav-btn { flex: 1; padding: 12px 0; box-shadow: none !important; }
  .nav-btn.on { box-shadow: inset 0 -3px 0 var(--green) !important; }
  .main { flex-direction: column; align-items: center; padding: 6px 16px 16px; gap: 10px; }
  .board-row { gap: 6px; }
  .ev-txt { display: none; }
  .panel { width: 100%; height: auto; min-height: 0; max-width: 560px; }
  .moves { max-height: 170px; }
  .pscroll { overflow: visible; }
  .pscroll .moves { max-height: none; }
  .pbar { height: 46px; }
  .av { width: 34px; height: 34px; font-size: 20px; }
  .clock { min-width: 88px; font-size: 20px; padding: 5px 9px; }
  .bot-grid { grid-template-columns: repeat(7, 1fr); }
  .bot-card .av { width: 30px; height: 30px; font-size: 18px; }
}
@media (max-width: 420px) {
  .bot-grid { grid-template-columns: repeat(4, 1fr); }
  .ab span { font-size: 10.5px; }
}
.cp.fp { width: 1.25em; height: 1.25em; margin: -3px 0 -2px; }

/* ---------- dáma ---------- */
body[data-app="dama"] #chessMain, body:not([data-app="dama"]) #damaMain { display: none; }
body[data-app="dama"] .board-area { width: var(--bs); }
#dBoard { width: var(--bs); height: var(--bs); flex-shrink: 0; }
.dpc { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; display: grid; place-items: center; pointer-events: none; will-change: transform; }
.dpc.drag { z-index: 10; }
.dpc i, .dk-ico { position: relative; display: grid; place-items: center; border-radius: 50%; }
.dpc i { width: 76%; height: 76%; }
.dpc.w i, .dk-ico.w { background: radial-gradient(circle at 35% 30%, #fffdf6, #eadcbd 58%, #cbb88f); box-shadow: 0 calc(var(--bs) * .006) 0 #a38f68, 0 calc(var(--bs) * .01) calc(var(--bs) * .012) #0007; }
.dpc.b i, .dk-ico.b { background: radial-gradient(circle at 35% 30%, #67615b, #312e2b 58%, #1b1a18); box-shadow: 0 calc(var(--bs) * .006) 0 #0b0a09, 0 calc(var(--bs) * .01) calc(var(--bs) * .012) #0007; }
.dpc i::after { content: ""; width: 64%; height: 64%; border-radius: 50%; border: calc(var(--bs) * .004) solid rgba(0, 0, 0, .13); }
.dpc.b i::after { border-color: rgba(255, 255, 255, .1); }
.dpc.k i::before, .dk-ico.k::before { content: ""; position: absolute; inset: 22%; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 19 4 7l5 5 3-8 3 8 5-5 2 12z' fill='%23e8b83a' stroke='%23845f12' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat; }
.dpc.must i { box-shadow: 0 0 0 calc(var(--bs) * .006) #f6d33c, 0 calc(var(--bs) * .01) calc(var(--bs) * .012) #0007; animation: must 1.1s ease-in-out infinite; }
@keyframes must { 50% { box-shadow: 0 0 0 calc(var(--bs) * .011) #f6d33caa, 0 calc(var(--bs) * .01) calc(var(--bs) * .012) #0007; } }
.dpc.taken { opacity: .35; }
.dk-ico { display: inline-grid; width: 18px; height: 18px; vertical-align: middle; box-shadow: 0 2px 0 #0006 !important; }
.dk-ico.big { width: 30px; height: 30px; }
.ni .dk-ico { width: 19px; height: 19px; }
.av .dk-ico { width: 26px; height: 26px; }
.dk-caps { gap: 4px; font-size: 13px; font-weight: 700; color: var(--tx2); }
.dk-caps .dk-ico { width: 14px; height: 14px; }
.dk-caps .dk-ico.k::before { inset: 15%; }
.dk-turn { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 4px; color: var(--tx3); min-width: 70px; text-align: center; }
.dk-turn.on.w { background: #fff; color: #262522; } .dk-turn.on.b { background: #111; color: #fff; box-shadow: inset 0 0 0 1px #ffffff30; }
.dk-bots { grid-template-columns: repeat(5, 1fr) !important; }
.seg.txt button { font-weight: 700; padding: 10px; }
.must-txt { color: #f6d33c; }
.rules { margin-top: 8px; font-size: 13.5px; color: var(--tx2); }
.rules summary { cursor: pointer; padding: 4px 0; }
.rules ul { margin: 6px 0; padding-left: 18px; }
.rules li { margin-bottom: 4px; }
