/* A large board with persistent navigation and a compact side workspace. */
:root { --surface:#252925; --canvas:#1a1d1a; --line:#3a413a; --ink:#edf0e8; --muted:#a0aa9c; --accent:#b6d88a; }
/* Start (Nová partie, Pokračovat, Začít hrát): v zeleném prostředí jantarový, aby vynikl; ostatní prostředí v chess-environment.css mají zelený. */
:root { --ui-go:#f2b84b; --ui-go-hover:#f6c96f; --ui-on-go:#2b1b00; --ui-go-soft:#f2b84b24; }
[hidden] { display:none !important; }
* { box-sizing:border-box; }
body { display:block; min-height:100vh; margin:0; padding:22px 24px 22px 214px; background:var(--canvas); color:var(--ink); font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; }
button,select,input { font-family:inherit; }
button:focus-visible,select:focus-visible,input:focus-visible,summary:focus-visible,a:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.app-rail { position:fixed; inset:0 auto 0 0; width:190px; padding:28px 17px; background:var(--ui-rail,#222620); border-right:1px solid var(--ui-border,#333b30); display:flex; flex-direction:column; z-index:15; }
.brand { font-size:27px; font-weight:750; letter-spacing:-1px; display:flex; gap:7px; align-items:center; color:var(--ink); text-decoration:none; }
.brand > img { flex:none; width:34px; height:34px; display:block; }
.rail-caption { color:var(--ui-muted,#899581); font-size:13px; margin:14px 0 32px; }
.rail-menu { display:grid; gap:7px; }
.rail-menu button,.rail-bottom .btn { border:0; border-radius:8px; color:var(--ui-soft-text,#bfc6b9); background:transparent; text-align:left; padding:13px 12px; font-size:14px; font-weight:600; box-shadow:none; }
.rail-menu button > .nav-label { display:inline; }
.rail-menu button:hover,.rail-bottom .btn:hover { background:var(--ui-hover,#30392c); filter:none; }
.rail-menu button.selected { color:var(--ui-highlight,#d9efc5); background:var(--ui-selected,#35442b); }
.rail-menu button:disabled { opacity:.5; cursor:wait; }
.rail-bottom { margin-top:auto; }
.rail-bottom p { border-top:1px solid var(--ui-border,#3a4234); padding-top:22px; margin:20px 12px 0; font-size:13px; line-height:1.8; color:var(--ui-muted,#a4b098); }
.rail-bottom small { color:var(--ui-dim,#75826c); font-size:13px; }
.play-area { width:100%; max-width:1600px; margin:auto; display:grid; grid-template-columns:minmax(360px,1fr) 338px; gap:28px; align-items:start; }
.board-col { width:min(100%,calc(100dvh - 142px)); max-width:1050px; min-width:0; margin:0 auto; gap:8px; }
.board-row { width:100%; gap:8px; }
.board-frame { flex:1; min-width:0; --frame:21px; padding:2px; border-radius:4px; box-shadow:0 14px 40px #0003; }
.board { width:100%; height:auto; aspect-ratio:1; }
.eval-bar { width:20px; min-width:20px; flex:0 0 20px; align-self:stretch; height:auto; border-radius:3px; }
.player-bar { width:100%; border:1px solid transparent; background:transparent; padding:8px 11px; min-height:46px; }
.player-bar.active { background:var(--ui-active,#252d22); border-color:var(--ui-border,#3b4e30); box-shadow:none; color:var(--ui-text,#f0f4e9); }
.pb-rating { font-size:13px; }
.pb-me { font-size:13px; }
.pb-ava { border-radius:6px; }
.sidebar { width:100%; min-width:0; padding:22px; gap:17px; background:var(--surface); border:1px solid var(--ui-border,#363e32); border-radius:12px; max-height:calc(100dvh - 44px); overflow:auto; scrollbar-width:thin; scrollbar-color:var(--ui-border,#4a5841) transparent; }
.workspace-heading h1 { margin:7px 0; font-size:27px; letter-spacing:-.8px; line-height:1.15; }
.eyebrow { font-size:13px; letter-spacing:1.7px; font-weight:700; color:var(--ui-muted,#91a77d); }
.workspace-heading p { font-size:13px; margin:0; color:var(--muted); line-height:1.6; }
.controls { justify-content:flex-start; }
.setup-details > summary { cursor:pointer; font-size:13px; color:var(--ui-soft-text,#b8c8aa); padding:4px 0; }
.setup-details[open] > summary { margin-bottom:14px; }
.game-setup { display:grid; grid-template-columns:1fr 1fr; gap:12px; width:100%; margin:0; padding:0; border:0; background:transparent; }
.game-setup #familyWrap,.game-setup #levelWrap,.game-setup #newGameBtn,.game-setup .setup-note { grid-column:1 / -1; }
.controls label { display:flex; flex-direction:column; align-items:stretch; gap:6px; font-size:13px; color:var(--ui-soft-text,#afb9a5); font-weight:500; min-width:0; }
.controls select { width:100%; min-width:0; padding:10px 11px; background:var(--ui-control,#30372b); border:1px solid var(--ui-border,#48533f); border-radius:6px; color:var(--ui-text,#e9efdf); font-size:13px; }
.game-setup .setup-note { font-size:13px; line-height:1.6; color:var(--ui-muted,#8c9a81); margin:-3px 0 0; }
.btn { background:var(--ui-button,#353e2f); color:var(--ui-text,#e2e9d8); border:1px solid var(--ui-border,#4a5740); border-radius:6px; box-shadow:none; padding:9px 11px; font-size:14px; }
.btn:hover { background:var(--ui-hover,#435239); filter:none; }
.btn:disabled { opacity:.45; cursor:wait; }
.btn.primary,#newGameBtn { background:var(--accent); color:var(--ui-onaccent,#203015); font-weight:700; border-color:var(--accent); }
#newGameBtn { width:100%; padding:11px; margin-top:2px; font-size:13px; }
.btn.primary:hover,#newGameBtn:hover { background:var(--ui-accent-hover,#c6e5a4); }
.status { padding:0; min-height:22px; font-size:13px; line-height:1.5; background:transparent; border:0; }
.actions { display:flex; gap:8px; flex-wrap:wrap; }
.actions .btn { flex:1; white-space:nowrap; }
.workspace-tabs { display:flex; border-bottom:1px solid var(--ui-border,#44503a); gap:12px; }
.workspace-tabs button { flex:1; background:none; border:0; border-bottom:2px solid transparent; color:var(--ui-muted,#99a88c); padding:9px 4px; font-size:13px; font-weight:600; }
.workspace-tabs button[aria-pressed="true"] { color:var(--ui-highlight,#d4e8bf); border-bottom-color:var(--accent); }
body[data-pane="play"]:not(.coaching) #sfPanel,body[data-pane="play"] #summary { display:none; }
body.classical-game #qualityMsg,body.classical-game #botBubble { display:none; }
body:not(.no-abilities) #evalBtn { display:none; }
body.analysis-locked #sfOutput { display:none; }
.sf-panel { padding:0; margin:0; background:transparent; border:0; color:var(--ink); }
.sf-panel h2 { margin:0; color:var(--ui-text,#d7e5c9); font-size:13px; font-weight:600; }
.sf-panel p { color:var(--ui-muted,#aab69f); line-height:1.6; font-size:13px; }
.sf-panel #sfStatus { font-size:13px; margin:9px 0; }
.sf-output { background:var(--ui-fill,#1c2418); padding:13px; border:1px solid var(--ui-border,#3c4c30); border-radius:7px; margin:9px 0; gap:7px; }
.sf-grade { font-size:16px; font-weight:750; }
.sf-output p { font-size:13px; color:var(--ui-soft-text,#d0dec2); margin:0; }
.sf-output strong { font-size:13px; border-top:1px solid var(--ui-border,#39492f); padding-top:8px; color:var(--ui-soft-text,#cadfba); }
.sf-output small { color:var(--ui-muted,#8ea47b); font-size:13px; }
.sf-output > div:not(.sf-grade) { font-size:13px; color:var(--ui-soft-text,#aebea0); }
.sf-panel .btn { display:block; width:100%; margin:7px 0; }
.engine-notice { background:var(--ui-warning-bg,#463b22); color:var(--ui-warning-text,#edcc8d); padding:12px; border:1px solid var(--ui-warning-line,#6d5933); border-radius:6px; font-size:13px; line-height:1.6; margin:0; }
.engine-notice a { color:var(--ui-warning-text,#ffe0a3); text-decoration:underline; }
.engine-notice p { margin:0 0 8px; }
.panel-title { color:var(--ui-muted,#9cad8d); font-size:13px; letter-spacing:.6px; margin-bottom:-8px; }
.moves-panel { background:var(--ui-fill,#1d2419); border:1px solid var(--ui-border,#3d4933); max-height:23vh; min-height:92px; }
.mv-row { font-size:13px; }
.mv.viewed,.mv.last { background:var(--ui-selected,#394b2d); }
.mv-ann { margin-left:5px; }
.moves-nav { gap:7px; }
.moves-nav .btn { padding:7px; }
.hint { font-size:13px; line-height:1.6; color:var(--ui-muted,#829272); margin:0; }
.game-settings { background:var(--ui-settings,#20271c); padding:14px; border:1px solid var(--ui-border,#4c5b3e); border-radius:8px; }
.settings-heading { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.settings-heading h2 { font-size:15px; margin:0; }
.settings-heading .btn { font-size:18px; line-height:1; padding:4px 9px; }
.settings-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.settings-grid label { grid-column:1 / -1; }
.settings-grid #evalHelp { grid-column:1 / -1; }
.settings-grid .btn { font-size:13px; }
.analysis-prefs { border-top:1px solid var(--ui-border,#435336); margin-top:16px; padding-top:13px; color:var(--ui-soft-text,#b5c5a4); font-size:13px; }
.sf-transfer { border-color:var(--ui-border,#435336); font-size:13px; }
.sf-transfer summary,.sf-licence { color:var(--ui-soft-text,#acc593); }
.sf-transfer .btn { width:auto; margin-top:8px; display:inline-block; }
.sf-toggle { font-size:13px; margin-bottom:12px; }
.review-bar { flex-wrap:wrap; border:1px solid var(--ui-border,#4d643c); background:var(--ui-settings,#2b3822); font-size:13px; }
.review-bar .btn { font-size:13px; }
.review-bar .rb-live { display:none; }
/* During play, the move record and selected move own the right column. */
.sidebar { height:calc(100dvh - 44px); gap:12px; }
.workspace-heading h1 { font-size:21px; margin:3px 0 0; }
.workspace-heading > p,.workspace-tabs { display:none; }
/* Pokyn pod deskou: schopnosti, dosazení a krátké hlášky. Bez nich nezabírá místo ani mezeru sloupce. */
.board-hint { display:none; }
.board-hint:has(#hint.shown) { display:flex; align-items:center; gap:8px; }
.board-hint #hint { display:none; flex:1; min-width:0; min-height:0; padding:8px 12px; border:1px solid var(--ui-warning-line,#806339); border-radius:10px; background:var(--ui-warning-bg,#382c17); color:var(--ui-warning-text,#f0cf8e); font-size:14px; line-height:1.4; }
.board-hint #hint.shown { display:block; }
.board-hint #hint.warn { color:var(--ui-warning-text,#f0cf8e); font-weight:700; }
.board-hint #hintCancel { flex:none; min-height:40px; }
.board-hint #hintCancel[hidden] { display:none; }
.actions { flex-direction:row; }
.actions .btn { width:auto; padding:8px 10px; font-size:13px; }
.history-section { display:flex; flex-direction:column; gap:9px; flex:1 0 205px; min-height:205px; }
.history-section .panel-title { display:flex; justify-content:space-between; margin:0; font-size:13px; letter-spacing:0; }
#moveCount { color:var(--muted); font-size:13px; font-weight:400; }
.history-section .moves-panel { flex:1; min-height:90px; max-height:none; }
.history-section .moves-nav { margin:0; }
.sf-panel { flex:none; }
.sf-output { max-height:190px; overflow:auto; margin:7px 0 0; }
.sf-output > div:not(.sf-grade),.sf-output > small { font-size:13px; }
.sf-output strong { padding-top:5px; }
.current-move { font-size:15px; font-weight:650; margin:0; }
.review-options,.summary-details { flex:none; color:var(--muted); font-size:13px; }
.review-options > summary,.summary-details > summary { cursor:pointer; padding:7px 0; }
.review-options .btn { width:100%; margin:5px 0; }
.variation-tools { flex:none; padding:10px; border:1px solid var(--ui-border,#4c643b); border-radius:7px; background:var(--ui-fill,#1d2419); font-size:13px; }
.variation-tools label { display:flex; align-items:center; gap:9px; color:var(--muted); }
.variation-tools select { flex:1; min-width:0; font:inherit; color:var(--ink); background:var(--ui-control,#30372b); border:1px solid var(--ui-border,#48533f); padding:6px; border-radius:5px; }
.variation-tools p { margin:7px 0; color:var(--muted); line-height:1.5; }
.variation-tools.compact p,.variation-tools.compact .variation-actions { display:none; }
.variation-tools #returnVariation { display:none; }
.variation-actions { display:flex; flex-wrap:wrap; gap:6px; }
.variation-actions .btn { flex:1 1 auto; padding:7px; font-size:13px; }
.branch-move { border-left:2px solid var(--accent); }
.review-bar { flex-wrap:nowrap; }
.review-bar .rb-text { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
/* Ukázka: když se popisek nevejde, ustoupí název řady, ne číslo a tah. */
.review-bar .rb-preview { display:flex; }
.rb-preview .rb-long { flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:pre; }
.rb-preview .rb-step { flex:none; }
.review-bar .btn { flex:none; white-space:nowrap; }
.settings-backdrop { position:fixed; inset:0; background:#0008; z-index:39; }
.settings-drawer { position:fixed; inset:0 0 0 auto; width:min(430px,100%); border-radius:0; z-index:40; padding:22px; overflow-y:auto; background:var(--surface); color:var(--ink); border-color:var(--ui-border,#4c5b3e); }
.settings-open { overflow:hidden; }
.settings-drawer .settings-heading { position:sticky; top:-22px; z-index:1; padding:14px 0; background:var(--surface); }
.settings-drawer .setup-details { padding-bottom:18px; margin-bottom:18px; border-bottom:1px solid var(--ui-border,#4c5b3e); }
.settings-drawer .setup-details > summary { font-size:14px; }
.settings-drawer .game-setup { margin-top:12px; }
.settings-drawer .settings-grid { margin-top:15px; }
.rail-bottom > .btn { display:block; width:100%; }
@media (max-width:900px) {
  .sidebar { height:auto; }
  .history-section { flex:none; min-height:0; }
  .history-section .moves-panel { flex:none; height:240px; max-height:320px; }
  .rail-bottom { display:flex; }
  .rail-bottom > .btn { width:auto; }
  
}
@media (min-width:1600px) { .sidebar { padding:25px; } .play-area { grid-template-columns:minmax(480px,1fr) 370px; gap:40px; } }
@media (max-width:1200px) and (min-width:901px) { body { padding:18px 18px 18px 150px; } .app-rail { width:132px; padding:23px 10px; } .brand { font-size:22px; } .brand > img { width:26px; height:26px; } .rail-menu button { font-size:13px; padding:12px 8px; } .rail-caption { font-size:13px; } .play-area { grid-template-columns:minmax(300px,1fr) 292px; gap:18px; } .sidebar { padding:17px; } }
@media (max-width:900px) {
  .play-area { grid-template-columns:minmax(0,1fr); gap:20px; }
  .board-col { width:min(100%,660px); }
  .sidebar { max-width:660px; max-height:none; overflow:visible; margin:auto; padding:20px; }
  .moves-panel { max-height:240px; }
}
@media (max-width:540px) {
  .board-frame { --frame:15px; padding:1px; }
  .player-bar { padding:6px; min-height:40px; }
  .pb-me { font-size:13px; }
  .pb-rating { font-size:13px; padding:2px 4px; }
  .eval-bar { width:16px; min-width:16px; flex-basis:16px; }
  .board-row { gap:4px; }
  .sidebar { padding:17px; }
}
/* Archive and practice use the same calm environment as the board. */
.workspace-heading { position:relative; padding-right:32px; }
.focus-button { position:absolute; right:0; top:2px; font-size:19px; padding:3px 6px; }
.session-choices,.favorite-bots { grid-column:1 / -1; }
.session-choices > span { display:block; font-size:13px; color:var(--muted); margin-bottom:7px; }
.session-choices > div { display:flex; gap:7px; }
.session-choices .btn { flex:1; }
.session-choices .btn[aria-pressed="true"] { border-color:var(--accent); background:var(--ui-selected,#35442b); }
.favorite-bots { display:flex; flex-direction:column; gap:8px; }
.favorite-bots select { font-size:13px; }
.nav-more { color:var(--muted); font-size:13px; }
.nav-more > summary { cursor:pointer; padding:13px 12px; }
.nav-more > summary .ui-icon { display:none; }
.rail-menu button[hidden] { display:none !important; }
.nav-more > div { display:grid; gap:4px; }
.menu-settings { font-size:13px; padding:15px 0; color:var(--muted); border-top:1px solid var(--line); }
.menu-settings summary { cursor:pointer; }
.menu-order-row { display:flex; align-items:center; gap:6px; margin:9px 0; }
.menu-order-row label { flex:1; }
.menu-order-row .btn { padding:5px 10px; }
.hub-open .play-area { display:none; }
.hub-page { max-width:1250px; margin:20px auto; }
.hub-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.hub-heading h1 { font-size:32px; margin:7px 0 0; letter-spacing:-1px; }
.hub-intro { color:var(--muted); font-size:14px; line-height:1.7; margin:18px 0 30px; }
.hub-filters { display:flex; align-items:center; flex-wrap:wrap; gap:15px; margin-bottom:25px; font-size:13px; color:var(--muted); }
.hub-filters input[type="search"] { flex:1; min-width:210px; }
.hub-page input:not([type="checkbox"]),.hub-page textarea,.move-notes textarea,.move-notes select,.variation-name input { width:100%; padding:11px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:var(--surface); font:inherit; }
.hub-page textarea,.move-notes textarea { resize:vertical; line-height:1.6; }
.game-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:18px; }
.game-card,.endgame-card { padding:23px; border:1px solid var(--line); background:var(--surface); border-radius:12px; min-width:0; }
.game-card-top { display:flex; align-items:center; justify-content:space-between; font-size:13px; color:var(--muted); }
.game-card h2,.game-card h3 { font-size:18px; line-height:1.4; margin:15px 0 7px; overflow-wrap:anywhere; }
.game-card p,.endgame-card p { color:var(--muted); font-size:14px; line-height:1.6; }
.favorite-game { background:none; border:0; color:var(--accent); font-size:25px; padding:0 5px; cursor:pointer; }
.game-facts { display:flex; flex-wrap:wrap; gap:8px; font-size:13px; color:var(--muted); padding:13px 0; }
.game-facts span { background:var(--canvas); padding:5px 8px; border-radius:4px; }
.game-card-actions { display:flex; gap:8px; }
.game-card-actions .primary { flex:1; }
.rename-game { color:var(--muted); font-size:13px; margin-top:15px; }
.rename-game summary { cursor:pointer; }
.rename-game input { margin:10px 0; }
.hub-empty { grid-column:1 / -1; color:var(--muted); text-align:center; border:1px dashed var(--line); border-radius:12px; padding:45px 25px; line-height:1.7; font-size:13px; }
.hub-empty > span { font-size:45px; color:var(--accent); }
.hub-empty h2 { color:var(--ink); font-size:21px; }
.training-stats { display:flex; flex-wrap:wrap; gap:15px; margin-bottom:35px; }
.training-stats > div { border-left:2px solid var(--accent); padding:0 24px 0 15px; }
.training-stats strong,.training-stats span { display:block; }
.training-stats strong { font-size:27px; }
.training-stats span { color:var(--muted); font-size:13px; margin-top:6px; }
.hub-section { margin:35px 0; }
.hub-section > h2 { font-size:20px; margin-bottom:20px; }
.hub-section > p { font-size:13px; color:var(--muted); }
.endgame-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(340px,100%),1fr)); gap:10px; }
.endgame-card { display:grid; grid-template-columns:32px minmax(0,1fr) auto; gap:4px 12px; align-items:center; }
.endgame-card.now { border-color:var(--accent); }
.endgame-card h3 { font-size:15px; margin:0; }
.endgame-card p { margin:0; font-size:13px; line-height:1.4; }
.endgame-card .btn { min-height:44px; }
.endgame-icon { font-size:26px; line-height:1; text-align:center; color:var(--accent); }
.endgame-best { font-weight:600; color:var(--ink); }
.endgame-progress { display:flex; align-items:center; gap:12px; margin:0 0 12px; color:var(--ink); font-size:14px; }
.endgame-progress progress { flex:1; min-width:0; height:8px; accent-color:var(--accent); }
.import-box { border:1px solid var(--line); border-radius:12px; background:var(--surface); padding:25px; max-width:850px; }
.import-box h2 { margin-top:0; font-size:21px; }
.import-box p { color:var(--muted); font-size:13px; line-height:1.7; }
.import-box label[for] { font-size:13px; display:block; margin:20px 0 8px; }
.import-box textarea { background:var(--canvas); font-family:ui-monospace,monospace; font-size:13px; }
.import-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; margin-top:15px; }
.import-actions label.btn { cursor:pointer; }
.archive-notice { position:fixed; left:220px; bottom:15px; max-width:calc(100vw - 250px); z-index:50; padding:13px 18px; background:var(--surface); border:1px solid var(--accent); border-radius:8px; font-size:13px; box-shadow:0 4px 25px #0005; }
.study-tools,.review-guide,.move-notes { flex:none; }
.retry-mode .history-section,.puzzle-mode .history-section,.retry-mode .current-move { display:none !important; }
.study-tools { display:flex; flex-wrap:wrap; gap:5px; }
.study-tools .btn { flex:1; font-size:13px; padding:7px 5px; }
.review-guide,.move-notes { font-size:13px; color:var(--muted); }
.review-guide summary,.move-notes summary { cursor:pointer; padding:7px 0; }
.moment { width:100%; text-align:left; border:1px solid var(--line); border-radius:6px; padding:10px; margin:7px 0; color:var(--ink); background:var(--ui-fill,var(--canvas)); font:inherit; cursor:pointer; }
.moment strong,.moment span { display:block; }
.moment span { color:var(--muted); line-height:1.6; font-size:13px; margin-top:5px; }
.move-notes label { display:block; }
.move-notes textarea { margin:8px 0; background:var(--canvas); font-size:13px; }
.note-actions { display:flex; flex-wrap:wrap; gap:7px; }
.note-actions .btn,.note-actions select { flex:1 1 100px; font-size:13px; padding:8px; }
.move-notes .hint { margin-top:9px; }
.study-mark { box-shadow:inset 0 0 0 5px rgba(65,160,235,.7) !important; }
.variation-name { display:flex; gap:5px; margin-top:8px; }
.variation-name input { padding:7px; min-width:0; font-size:13px; background:var(--canvas); }
.variation-name .btn { font-size:13px; padding:6px; }
.archive-context { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:13px; padding:7px 10px; border:1px solid var(--line); background:var(--surface); border-radius:6px; }
.archive-context .btn { font-size:13px; padding:5px 8px; }
.exit-focus { display:none; }
body.focus-mode { padding:20px; }
.focus-mode .app-rail,.focus-mode .sidebar,.focus-mode .eval-bar,.focus-mode #archiveContext,.focus-mode #reviewBar { display:none !important; }
.focus-mode .play-area { grid-template-columns:minmax(0,1fr); }
.focus-mode .board-col { width:min(100%,calc(100dvh - 142px)) !important; }
.focus-mode .exit-focus { display:block; position:fixed; right:20px; top:20px; z-index:30; }
@media (max-width:900px) {
  .hub-page { margin:10px auto; max-width:660px; }
  .archive-notice { left:15px; right:15px; max-width:none; }
}
@media (max-width:540px) {
  .rail-bottom #settingsBtn { padding:10px; min-width:44px; }
  .rail-bottom #settingsBtn .settings-label { display:none; }
  .rail-menu { gap:1px; }
  .rail-menu button { padding:10px 6px; font-size:13px; }
  .hub-heading h1 { font-size:27px; }
  .hub-heading .btn { font-size:13px; padding:9px; }
  .hub-intro { font-size:14px; }
  .game-cards { grid-template-columns:minmax(0,1fr); }
  .endgame-card { padding:12px; }
  .import-box { padding:17px; }
  .variation-name { flex-wrap:wrap; }
  .review-bar .btn { padding:6px; font-size:13px; }
  .focus-mode .exit-focus { top:5px; right:5px; font-size:13px; }
  body.focus-mode { padding:48px 8px 20px; }
}

/* Clear primary actions and compact, accessible choices for young players. */
#undoBtn { background:transparent; border:1px solid var(--line); color:var(--ink); font-weight:500; }
#undoBtn:hover { background:var(--ui-hover,#30392c); }
#undoBtn span,#newGameBtn span { margin-right:5px; font-size:17px; }
.side-select-source { display:none !important; }
.side-choices { display:flex; gap:8px; align-items:center; }
.side-choices::before { content:'Hraješ'; color:var(--muted); font-size:13px; }
html[lang="en"] .side-choices::before { content:'You play'; }
.side-choices .btn { width:54px; min-height:48px; font-size:32px; line-height:1; background:#364256; border:2px solid transparent; }
.side-choices [data-side="w"] { color:#fff9e8; text-shadow:0 1px 1px #000; }
.side-choices [data-side="b"] { color:#111823; background:#d1d8df; }
.side-choices .btn[aria-pressed="true"] { border-color:#62c67b; box-shadow:0 0 0 2px var(--surface),0 0 0 3px #62c67b; }
.coach-choices { grid-column:1 / -1; margin:0; padding:12px; min-width:0; border:1px solid var(--line); border-radius:8px; }
.coach-choices legend { font-size:13px; padding:0 6px; }
.coach-choices > div { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.coach-choices .btn { display:flex; flex-direction:column; justify-content:center; gap:5px; min-height:60px; padding:9px 5px; white-space:normal; line-height:1.4; }
.coach-choices small { display:block; font-size:13px; line-height:1.5; color:var(--muted); }
.coach-choices .btn[aria-pressed="true"] { border-color:var(--accent); background:var(--ui-selected); }
.coach-choices .btn[aria-pressed="true"] small { color:inherit; }
.coach-choices p { margin:10px 0 4px; font-size:13px; line-height:1.5; color:var(--ink); }
.workspace-heading .game-context { display:block; margin-top:9px; font-size:13px; color:var(--accent); }
.sf-engine-details { margin-top:10px; border-top:1px solid var(--line); padding-top:10px; }
.sf-engine-details summary { cursor:pointer; font-size:13px; color:var(--muted); }
.sf-engine-details[open] { display:grid; gap:7px; }
.sf-engine-details > :not(summary) { display:block; margin-top:8px; }
#resumeGame { flex:2; border-color:#62c67b; }

/* The move record receives the remaining desktop height. */
@media (min-width:901px) {
  .play-area { max-width:1900px; grid-template-columns:minmax(0,1fr) minmax(380px,420px); gap:22px; }
  .sidebar { padding:16px 18px; gap:9px; overflow:hidden; }
  body[data-pane="review"] .sidebar { overflow-x:hidden; overflow-y:auto; }
  .history-section { flex:1 1 auto; min-height:0; overflow:hidden; gap:7px; }
  .history-section .moves-panel { flex:1 1 auto; min-height:0; overflow:auto; }
}
@media (min-width:901px) and (max-width:1200px) {
  .play-area { grid-template-columns:minmax(0,1fr) minmax(318px,350px); gap:14px; }
  .sidebar { padding:14px; }
}
.workspace-heading { display:flex; flex-wrap:wrap; align-items:baseline; gap:8px; min-height:26px; padding-right:32px; }
.workspace-heading .eyebrow { display:none; }
.workspace-heading h1 { margin:0; font-size:18px; line-height:1.25; white-space:nowrap; }
.workspace-heading .game-context { display:inline; margin:0; min-width:0; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.focus-button { top:0; }
body.classical-game .sidebar > .status { display:none; }
.player-bar.active { border-color:var(--accent); background:var(--ui-active,#203528); box-shadow:inset 3px 0 var(--accent); }
.pb-turn { flex:none; padding:3px 6px; border-radius:5px; background:var(--ui-active,#203528); font-size:13px; font-weight:750; color:var(--accent); white-space:nowrap; }
.pb-clock { margin-left:4px; }
.history-section .moves-nav { display:flex; gap:7px; flex:none; }
.history-section .moves-nav [data-nav="first"] { display:none; }
.history-section .moves-nav .btn { min-height:36px; padding:6px 10px; }
.history-section .moves-panel { border-radius:7px; }
.mv-opening { display:block; width:100%; padding:5px 8px; border:0; border-left:2px solid var(--accent); background:var(--ui-fill,#16283c); color:var(--ink); text-align:left; font-size:13px; cursor:pointer; }
.mv-opening:hover { background:var(--ui-hover,#294260); }
.mv-note { margin-left:4px; font-size:13px; color:var(--accent); }
.review-heading { display:flex; align-items:center; justify-content:space-between; gap:6px; }
.review-heading h2 { margin:0 auto 0 0; }
.review-heading .btn { width:auto; margin:0; padding:3px 8px; line-height:1; font-size:16px; }
body[data-pane="play"] #noteToggle,body[data-pane="play"] .move-notes { display:none; }
.sf-output { max-height:min(46vh,340px); overflow:auto; }
.study-tools { gap:5px; }
.study-tools .btn { padding:6px; }
body[data-pane="play"] .review-options,body[data-pane="play"] .review-guide { display:none; }
.move-notes:not([open]) { display:none; }
.review-bar { padding:5px 8px; }
.review-bar .rb-text { font-size:13px; }
.workspace-dialog { width:min(92vw,440px); max-height:80dvh; border:1px solid var(--line); border-radius:12px; padding:20px; background:var(--surface); color:var(--ink); box-shadow:0 24px 80px #000a; overflow:auto; }
.workspace-dialog::backdrop { background:#050b18b9; }
.dialog-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.dialog-heading h2 { margin:0; font-size:21px; }
.dialog-heading .dialog-close { min-width:44px; min-height:44px; padding:3px 10px; font-size:22px; }
.workspace-dialog p { font-size:13px; line-height:1.55; color:var(--ui-soft-text,var(--ink)); }
.opening-guide { width:min(92vw,470px); }
.opening-guide-board { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); grid-template-rows:repeat(8,minmax(0,1fr)); width:min(100%,300px); aspect-ratio:1; margin:14px auto; border:5px solid #273345; border-radius:6px; overflow:hidden; }
.opening-guide-square { display:flex; align-items:center; justify-content:center; min-width:0; min-height:0; font-size:27px; }
.opening-guide-square.light { background:#ebecd0; }
.opening-guide-square.dark { background:#779954; }
.opening-guide-square .piece-svg { width:90%; height:90%; }
.opening-guide-controls { display:flex; gap:8px; justify-content:center; }
.opening-guide-controls .btn { min-height:44px; }
.opening-guide-controls [data-opening-step="play"] { flex:1; max-width:180px; }
.opening-guide-counter { margin:8px 0; text-align:center; }
.opening-guide-line { padding:8px; border-radius:6px; background:var(--ui-fill,var(--canvas)); }
.opening-guide-footnote { font-size:13px !important; color:var(--muted) !important; }
body[data-pane="play"] .summary-details { display:none; }

/* Shared control icons and secondary actions. Keep character art in the board and bot picker. */
.ui-icon { width:18px; height:18px; flex:none; display:inline-block; vertical-align:-3px; color:var(--ui-icon-color,#f2b33d); }
:is(.btn.primary,#newGameBtn,.selected) > .ui-icon { color:inherit; }
/* Barevné ikony hlavních akcí (etapa 02): ozdoba vedle nápisu, záporný okraj drží výšku tlačítka. */
.ui-emblem { width:28px; height:28px; flex:none; display:inline-block; vertical-align:middle; margin:-6px 2px -6px -3px; user-select:none; pointer-events:none; }
.rail-menu button,.rail-bottom #settingsBtn { display:flex; align-items:center; gap:9px; }
.rail-menu button .ui-icon,.rail-bottom .ui-icon { width:20px; height:20px; }
.btn.quiet { background:transparent; border-color:transparent; color:var(--muted); box-shadow:none; }
.btn.quiet:hover { background:var(--ui-hover,#30392c); color:var(--ink); }
.btn.quiet[aria-pressed="true"] { color:var(--accent); }
.library-tools,.empty-actions { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px; }
/* Rozehraná partie nahoře v Moje partie (#53, místo stránky Rozbor). */
.library-live { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin:0 0 16px; }
.library-live[hidden] { display:none; }
.library-live h2 { margin:2px 0 4px; font-size:18px; }
.library-live p { margin:0; color:var(--muted); font-size:14px; }
.library-live .btn { min-height:44px; }
.empty-actions { justify-content:center; margin:20px 0 0; }
.hub-page .btn { min-height:44px; font-size:14px; }
.hub-page textarea:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
#libraryImport > .btn { margin:12px 0; }
#hubPage:has(#libraryImport:not([hidden])) :is(#libraryTools,#libraryFilters,#libraryResults) { display:none; }
.training-empty { border-top:1px solid var(--line); padding-top:20px; }
.training-empty > h2 { font-size:16px; margin:0 0 8px; }
.training-empty-note { color:var(--muted); font-size:14px; line-height:1.6; margin:0; }
@media(max-width:540px) {
  .workspace-heading .game-context { white-space:normal; }
  .import-actions .btn { flex:1 1 auto; }
}
@media (max-width:900px) {
  .history-section { flex:none; min-height:0; overflow:visible; }
  .history-section .moves-panel { height:clamp(240px,38dvh,420px); max-height:none; }
  .sidebar { gap:10px; }
}
@media (max-width:540px) {
  .workspace-heading { flex-wrap:wrap; gap:2px 8px; }
  .workspace-heading .game-context { font-size:13px; }
  .player-bar { flex-wrap:wrap; }
  .pb-name { min-width:0; white-space:normal; }
  .pb-turn { font-size:13px; }
  .history-section .moves-nav .btn { min-height:44px; }
  .workspace-dialog { width:calc(100vw - 20px); max-height:82dvh; padding:17px; }
  body.history-view #movesNav { position:sticky; bottom:6px; z-index:11; padding:5px; border-radius:8px; background:var(--surface); box-shadow:0 5px 20px #0008; }
}

/* Clear game context, mobile panel and preference groups. */
.workspace-heading .game-context { flex-basis:100%; white-space:normal; overflow:visible; line-height:1.5; }
.workspace-status { font-size:14px; font-weight:650; line-height:1.5; margin:0; color:var(--accent); }
.history-notice { padding:10px; border-left:3px solid var(--accent); background:var(--ui-fill,var(--canvas)); font-size:13px; line-height:1.5; }
.history-notice .btn { margin-top:8px; min-height:44px; }
.board-tools { display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.board-tools .btn { min-height:44px; background:transparent; }
.history-close { display:none; }
.active-game-link { margin:0 0 8px; }
.active-game-link button { width:100%; display:flex; align-items:center; gap:8px; border:0; background:var(--ui-selected); color:var(--ink); border-radius:8px; padding:13px 12px; font:inherit; font-size:14px; font-weight:600; text-align:left; min-height:44px; }
.settings-section { border-top:1px solid var(--line); padding:18px 0; display:flex; flex-wrap:wrap; gap:10px; }
.settings-section h3 { flex-basis:100%; font-size:16px; margin:0 0 6px; }
.settings-section > label,.settings-section > div,.settings-section > details,.settings-section > p,.settings-section > fieldset { width:100%; min-width:0; }
.settings-section > label { display:grid; gap:8px; font-size:14px; }
.settings-section select { width:100%; min-height:44px; padding:8px 11px; font-size:14px; color:var(--ink); background:var(--ui-control,#30372b); border:1px solid var(--ui-border,#48533f); border-radius:6px; }
.settings-section .btn { min-height:44px; }
.settings-section .hint { font-size:13px; line-height:1.55; margin:4px 0; }
.settings-section .coach-choices { padding-top:0; border-top:0; }
.settings-section .analysis-prefs { border-top:0; padding:0; }
.environment-previews { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.environment-previews .btn { display:flex; align-items:center; gap:6px; padding:6px 8px; text-align:left; font-size:13px; }
.environment-previews [aria-pressed="true"] { outline:2px solid var(--accent); }
.language-choices { flex-basis:100%; display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.language-choices [aria-pressed="true"] { outline:2px solid var(--accent); }
.environment-previews i { width:24px; height:24px; border-radius:5px; flex:none; border:1px solid #8996a8; }
/* Only the swatches in the environment previews: a bare [data-environment] i would also match the
   <html> attribute and paint every <i> on the page, including mini-board pieces. */
.environment-previews [data-environment="navy"] i { background:#17283c; } .environment-previews [data-environment="green"] i { background:#35442b; }
.environment-previews [data-environment="graphite"] i { background:#33343a; } .environment-previews [data-environment="ivory"] i { background:#eee9dc; }
#finishConfirm { max-width:460px; } #finishConfirm p { line-height:1.6; } #finishConfirm .confirm-actions { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; margin-top:12px; }
@media(min-width:901px) {
  .sidebar { overflow-y:auto; }
  /* Sloupec s deskou se vejde do okna: lišty hráčů 2× 46, řádek Otočit 44, mezery 3× 8 a okraje stránky 2× 22 = 204 px. */
  .board-col { width:min(100%,calc(100dvh - 204px)); }
  .focus-mode .board-col { width:min(100%,calc(100dvh - 200px)) !important; }   /* okraje 2× 20 místo 2× 22 */
  /* Lišta nad deskou: trénink nebo archiv 66 px, lišta rozboru 47 px, vždy + mezera 8 px. V průchodu rozborem je skrytá. */
  body:not(.review-flow-active):has(#archiveContext:not([hidden])) .board-col,
  body:has(#trainingContext:not([hidden])) .board-col { width:min(100%,calc(100dvh - 278px)); }
  body:not(.review-flow-active):has(#reviewBar:not([hidden])) .board-col,
  body[data-review-step="variation"]:has(#reviewBar:not([hidden])) .board-col { width:min(100%,calc(100dvh - 260px)); }
  body:not(.review-flow-active):has(#archiveContext:not([hidden])):has(#reviewBar:not([hidden])) .board-col { width:min(100%,calc(100dvh - 334px)); }
  .history-section { flex:1 0 180px; min-height:180px; }
  .pz-all .pz-list { grid-template-columns:repeat(10,minmax(0,1fr)); }
}
@media(max-width:900px) {
  body.classical-game[data-game-panel="moves"] #sfPanel,
  body.classical-game[data-game-panel="moves"] #studyTools,
  body.classical-game[data-game-panel="moves"] .review-options,
  body.classical-game[data-game-panel="moves"] .review-guide,
  body.classical-game[data-game-panel="moves"] .move-notes,
  body.classical-game[data-game-panel="moves"] .summary-details,
  body.classical-game[data-game-panel="moves"] #learningAnalysisNotice { display:none !important; }
  body.classical-game[data-game-panel="coach"]:not(.history-sheet) .history-section { display:none !important; }
  .sf-output { max-height:none; }
}
@media(max-width:340px) {
  .environment-previews { grid-template-columns:1fr; }
}

.settings-section .environment-picker { margin:0; font-size:14px; }
@media(max-width:900px) {
  body.classical-game[data-game-panel="coach"] .review-options:not([hidden]) { display:block; }
}

body.classical-game.coaching .review-options:not([hidden]) { display:block; }

/* Trénink: záložky Moje hry / Koncovky / Hádanky / Zahájení */
/* Trénink: segmentový přepínač v jednom řádku, vybraná část je plně zvýrazněná. */
.hub-page .training-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:2px; max-width:560px; margin:0 0 20px; padding:3px; background:var(--ui-fill,#1d2419); border:1px solid var(--line); border-radius:10px; }
.hub-page .training-tabs .ui-button { min-height:44px; padding:4px 2px; border:0; border-radius:7px; background:transparent; color:var(--ui-soft-text,var(--muted)); font-size:14px; white-space:nowrap; box-shadow:none; }
.hub-page .training-tabs .ui-button[aria-selected="true"],.hub-page .training-tabs .ui-button[aria-selected="true"]:hover:enabled { background:var(--accent); color:var(--ui-onaccent,#172016); font-weight:700; box-shadow:none; }
@media(hover:none) { .hub-page .training-tabs .ui-button:not([aria-selected="true"]):hover:enabled { background:transparent; } }
#openPuzzles { margin-bottom:14px; }
#trainingExit { flex:none; display:inline-flex; align-items:center; gap:4px; white-space:nowrap; }
#trainingExit .ui-icon { width:16px; height:16px; flex:none; }
/* Hádanka: zadání a stav jsou obyčejný text, kategorie v záhlaví, mřížka čísel se dá složit. */
.pz-head { flex-wrap:wrap; gap:2px 8px; }
/* Zadání stojí nad deskou na místě lišty soupeře, deska se proto neposune. */
#pzTask { display:none; }
body.puzzle-mode #barTop { display:none; }
body.puzzle-mode #pzTask { display:flex; align-items:center; flex-wrap:wrap; gap:0 10px; min-height:46px; padding:2px 4px; color:var(--ink); font-weight:500; font-size:15px; line-height:1.3; }
.pz-side { display:inline-flex; align-items:center; gap:8px; font-size:18px; font-weight:800; }
.pz-side::before { content:''; width:14px; height:14px; border-radius:50%; border:2px solid var(--line); background:#f5f1e6; }
#pzTask[data-mover="b"] .pz-side::before { background:#16130f; }
.pz-clock { margin-left:auto; font-size:22px; font-weight:800; font-variant-numeric:tabular-nums; }
.pz-stars { color:var(--ink); letter-spacing:1px; font-size:13px; white-space:nowrap; }
.pz-run { display:flex; align-items:center; flex-wrap:wrap; gap:6px 12px; min-height:16px; }
.pz-run[hidden],#pzSolveBtn[hidden],.pz-end[hidden] { display:none; }
.pz-run-dot { width:14px; height:14px; margin-right:-4px; border-radius:50%; border:2px solid var(--muted); }
.pz-run-dot.now { border-color:var(--ink); box-shadow:0 0 0 2px var(--accent); }
.pz-run-dot.clean { background:var(--accent); border-color:var(--accent); }
.pz-run-dot.done { background:linear-gradient(90deg,var(--accent) 50%,transparent 50%); border-color:var(--accent); }
.pz-run-dot.miss { border-color:var(--muted); background:repeating-linear-gradient(45deg,var(--muted) 0 2px,transparent 2px 4px); }
.pz-score { font-size:14px; font-weight:700; color:var(--ink); }
#pzSolveBtn { min-height:44px; }
.pz-end { padding:12px 14px; border-radius:12px; color:var(--ink); }
.pz-end h3 { margin:0 0 2px; font-size:22px; }
.pz-end p { margin:0 0 10px; color:var(--ink); font-size:14px; }
.pz-end-btns { display:flex; flex-wrap:wrap; gap:8px; }
.pz-end-btns .btn { flex:1 1 140px; min-height:44px; }
.pz-end:not([hidden]) ~ #pzBtns,.pz-end:not([hidden]) ~ #pzMore { display:none; }
body.pz-fast :is(#pzHintBtn,#pzRetryBtn,#pzNextBtn,#hintBtn,#pzMore,#pzSolveBtn) { display:none !important; }
.pz-more > summary { cursor:pointer; font-size:13px; color:var(--ui-soft-text,var(--muted)); padding:12px 0; }
.pz-more[open] { display:flex; flex-direction:column; gap:6px; }
.pz-more #pzPrevBtn { min-height:40px; }
.puzzle-start { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:16px; }
.puzzle-start .btn { min-height:44px; }
.puzzle-start .btn[hidden] { display:none; }
.puzzle-fast { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:15px; margin-bottom:15px; }
.puzzle-themes { margin-bottom:12px; }
.puzzle-themes > summary { cursor:pointer; padding:12px 0; font-weight:700; min-height:44px; box-sizing:border-box; }
.puzzle-source { color:var(--muted); font-size:12px; margin:0 0 16px; }
.pz-head .pz-cat { margin-right:auto; font-weight:600; }
.puzzle-panel .pz-btns { flex-wrap:wrap; }
.puzzle-panel .pz-btns .btn { flex:1 1 0; min-width:0; min-height:40px; padding:6px 2px; }
.pz-all > summary { cursor:pointer; font-size:13px; color:var(--ui-soft-text,var(--muted)); padding:6px 0; }
.pz-all .pz-list { max-height:none; overflow:visible; margin-top:6px; }
.puzzle-mode .workspace-heading .game-context,.puzzle-mode .sidebar > .status { display:none; }
.train-tab[hidden] { display:none; }
.train-tab > .hub-section:first-child { margin-top:0; }
.puzzle-groups { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:15px; margin-bottom:20px; }
.puzzle-group { padding:18px; border:1px solid var(--line); background:var(--surface); border-radius:12px; display:flex; flex-direction:column; gap:8px; }
.puzzle-group.current { border-color:var(--accent); }
.puzzle-group h3 { margin:0; font-size:16px; }
.puzzle-group p { margin:0; color:var(--muted); font-size:13px; }
.puzzle-group progress { width:100%; height:8px; accent-color:var(--accent); }
.puzzle-group .btn { align-self:flex-start; min-height:40px; }
.openings-section > p { font-size:14px; line-height:1.6; }
.opening-group { margin:28px 0; }
.opening-group > h3 { font-size:18px; margin:0 0 14px; }
.opening-group > h3 span { color:var(--muted); font-weight:400; font-size:14px; margin-left:6px; }
.opening-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:16px; }
.opening-card { display:flex; flex-direction:column; gap:12px; padding:16px; border:1px solid var(--line); background:var(--surface); border-radius:12px; min-width:0; }
/* 3 : 2 a čtverec mají ve sloupcích 3fr a 2fr stejnou výšku, ať je obrázek jakkoli široký. */
.opening-card-top { display:grid; grid-template-columns:3fr 2fr; gap:8px; align-items:start; }
.opening-card-top .ui-art { width:100%; height:auto; aspect-ratio:3/2; border-radius:8px; object-fit:cover; }
.opening-card-top .mini-board { width:100%; align-self:start; }
.opening-card .mini-board span { font-size:clamp(10px,1.3vw,14px); }
.opening-card-body { display:flex; flex-direction:column; flex:1; gap:8px; min-width:0; }
.opening-card h3 { font-size:16px; margin:0; line-height:1.3; }
.opening-played { color:var(--accent); font-size:14px; margin-left:4px; }
.opening-moves { margin:0; font-size:13px; color:var(--ink); font-family:ui-monospace,monospace; overflow-wrap:anywhere; }
.opening-desc { margin:0; font-size:13px; color:var(--muted); line-height:1.5; }
.opening-card .ui-actions { margin-top:auto; }
.opening-card .ui-actions .btn { min-height:44px; flex:1 1 auto; padding-inline:10px; }
.opening-card-play { flex-basis:100% !important; }
.opening-rows { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,420px),1fr)); gap:8px; }
.opening-row { display:flex; align-items:stretch; min-width:0; border:1px solid var(--line); background:var(--surface); border-radius:10px; overflow:hidden; }
.opening-row[hidden] { display:none; }
.opening-row-main { display:flex; align-items:center; gap:10px; flex:1 1 auto; min-width:0; min-height:56px; padding:6px 10px; text-align:left; border:0; background:none; color:var(--ink); font:inherit; cursor:pointer; }
.opening-row-main:hover { background:var(--ui-hover,#30392c); }
.opening-row-main .ui-art { width:66px; height:44px; border-radius:6px; object-fit:cover; }
.opening-row-text { display:grid; gap:2px; min-width:0; }
.opening-row-text strong { font-size:14px; line-height:1.3; overflow-wrap:anywhere; }
.opening-row-text small { font-size:12px; }
.opening-row-play { flex:none; align-self:center; min-height:44px; margin:6px 6px 6px 0; padding-inline:10px; font-size:13px; }
.opening-three { margin:0 0 18px; padding:12px 16px; border-radius:12px; font-size:14px; }
.opening-three summary { min-height:32px; cursor:pointer; font-weight:700; }
.openings-section .opening-three p { margin:8px 0; font-size:13px; line-height:1.5; }
.opening-three .btn { min-height:44px; }
.opening-tips { list-style:none; margin:8px 0; padding:0; display:grid; gap:6px; font-size:13px; line-height:1.5; color:var(--ui-soft-text,var(--ink)); }
.opening-only { flex:none; }
.opening-only:has(input:checked) { border-color:var(--accent); }
.hub-page .opening-only input { appearance:none; position:relative; width:36px; height:20px; border-radius:10px; background:var(--ui-control,#30372b); border:1px solid var(--line); cursor:pointer; }
.hub-page .opening-only input::after { content:''; position:absolute; top:2px; left:2px; width:14px; height:14px; border-radius:50%; background:var(--ink); }
.hub-page .opening-only input:checked { background:var(--accent); }
.hub-page .opening-only input:checked::after { left:18px; background:var(--ui-onaccent,#203015); }
.opening-guide-art:has(.ui-art) { flex:none; margin-right:10px; }
.opening-guide-art .ui-art { width:72px; height:48px; border-radius:6px; object-fit:cover; }
.opening-guide .dialog-heading h2 { flex:1 1 auto; min-width:0; overflow-wrap:anywhere; }
@media (max-height:780px) { .opening-guide-board { width:min(100%,220px); } }
.opening-guide-extra { display:grid; gap:8px; }
/* Zahraj si to zůstává vidět, i když se okno na malém telefonu posouvá. */
.opening-guide-actions { position:sticky; bottom:0; padding-block:8px; background:var(--surface); }
.opening-guide-actions:empty { display:none; }
.opening-guide-play { min-height:44px; width:100%; }
.openings-section input[type="search"] { min-height:44px; }
.opening-variants { font-size:13px; }
.opening-variants summary { cursor:pointer; color:var(--ui-soft-text,var(--muted)); padding:6px 0; }
.opening-variant { display:flex; flex-direction:column; gap:2px; width:100%; text-align:left; background:var(--ui-fill,#1d2419); border:1px solid var(--line); border-radius:8px; padding:8px 10px; margin-top:6px; color:var(--ink); font:inherit; font-size:13px; cursor:pointer; }
.opening-variant:hover { background:var(--ui-hover,#30392c); }
.opening-variant.played strong::after { content:' ✓'; color:var(--accent); }
.opening-variant span { font-size:13px; color:var(--muted); font-family:ui-monospace,monospace; overflow-wrap:anywhere; }
.opening-guide-demo { margin-top:8px; }
@media (max-width:540px) {
  .hub-page .training-tabs .ui-button { font-size:13px; }
  .opening-cards { grid-template-columns:1fr; }
}

/* ---- Telefon „deska napřed“ (do 900 px): spodní lišta záložek, hlavička 48 px, pás tahů a akce pod deskou. ---- */
.nav-short { display:none; }
.pb-spacer { display:none; }
.mobile-dock { display:none; }
@media (max-width:900px) {
  :root { --bar-h:56px; --top-h:48px; }
  body { padding:calc(var(--top-h) + 8px) 10px calc(var(--bar-h) + 14px + env(safe-area-inset-bottom,0px)); }
  body::before { content:''; position:fixed; top:0; left:0; right:0; height:var(--top-h); background:var(--ui-rail,#222620); border-bottom:1px solid var(--ui-border,#333b30); z-index:14; }
  .app-rail { inset:auto 0 0 0; width:100%; height:auto; min-height:var(--bar-h); padding:0 0 env(safe-area-inset-bottom,0px); display:flex; flex-direction:row; align-items:stretch; gap:0; border-right:0; border-top:1px solid var(--ui-border,#333b30); background:var(--ui-rail,#222620); box-shadow:0 -6px 20px #0004; }
  .app-rail .brand { position:fixed; top:0; left:10px; height:var(--top-h); margin:0; display:flex; align-items:center; gap:4px; font-size:19px; letter-spacing:-.5px; z-index:16; }
  .app-rail .brand > img { width:24px; height:24px; }
  .rail-caption,.rail-bottom p { display:none; }
  .rail-menu { display:contents; }
  .rail-menu > button,.active-game-link button,.nav-more > summary { flex:1 1 0; min-width:0; min-height:var(--bar-h); margin:0; padding:6px 2px; border:0; border-radius:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; font-size:12px; font-weight:600; line-height:1.1; text-align:center; color:var(--ui-soft-text,#bfc6b9); background:transparent; box-shadow:none; overflow:hidden; }
  .rail-menu > button .ui-icon,.active-game-link .ui-icon { display:block; width:22px; height:22px; margin:0; }
  .rail-menu > button.selected,.active-game-link button.selected { color:var(--accent); background:transparent; box-shadow:inset 0 3px var(--accent); }
  .rail-menu > button:hover,.active-game-link button:hover { background:var(--ui-hover,#30392c); }
  .nav-full { display:none; } .nav-short { display:inline; }
  .nav-label { display:block; max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .rail-menu > [data-route="home"] { order:0; } .active-game-link { order:1; } .rail-menu > button { order:2; }
  .active-game-link { display:flex; flex:1 1 0; min-width:0; margin:0; padding:0; border:0; background:transparent; }
  .active-game-link[hidden] { display:none; }
  .app-rail { -webkit-text-size-adjust:100%; text-size-adjust:100%; }   /* větší systémové písmo v prohlížeči nesmí useknout popisky šesti položek */
  .rail-menu > .nav-more,.menu-settings { display:none; }   /* všechny položky jsou přímo v liště, není co skrývat ani řadit */
  .rail-bottom { position:fixed; top:0; right:6px; height:var(--top-h); margin:0; display:flex; align-items:center; z-index:16; }
  .rail-bottom #settingsBtn { padding:8px; min-width:44px; min-height:44px; border-radius:8px; justify-content:center; }
  .rail-bottom #settingsBtn .settings-label { display:none; }
  body.focus-mode::before { display:none; }
  body.focus-mode { padding:8px 6px 12px; }
  .archive-notice { bottom:calc(var(--bar-h) + 10px + env(safe-area-inset-bottom,0px)); }
  /* pás posledních tahů a hlavní akce přímo pod deskou */
  .mobile-dock { display:flex; align-items:center; gap:4px; }
  .mobile-dock .strip-arrow { flex:none; width:38px; min-height:38px; margin:0; padding:0; display:inline-flex; align-items:center; justify-content:center; }
  .mobile-dock .strip-arrow[hidden] { display:none; }
  /* Vodorovné přejetí patří hře (procházení tahů), svislé dál posouvá stránku. */
  .move-strip { flex:1 1 auto; min-width:0; display:flex; align-items:center; gap:4px; overflow-x:auto; scrollbar-width:none; padding:4px 2px; min-height:40px; font-size:14px; font-variant-numeric:tabular-nums; touch-action:pan-y; user-select:none; -webkit-user-select:none; }
  .move-strip::-webkit-scrollbar { display:none; }
  .move-strip .ms-num { color:var(--muted); font-size:13px; padding:0 2px 0 6px; flex:none; }
  .move-strip .ms-ply { flex:none; border:1px solid transparent; border-radius:6px; padding:6px 7px; background:transparent; color:var(--ink); font:inherit; font-weight:600; min-height:34px; }
  .move-strip .ms-ply.current { background:var(--ui-selected,#394b2d); border-color:var(--accent); }
  .move-strip .ms-ply .mv-ann { margin-left:3px; }
  .move-strip .ms-opening,.move-strip .ms-more { flex:none; border:1px solid var(--line); border-radius:6px; padding:6px 9px; background:var(--ui-control,#30372b); color:var(--ui-soft-text,var(--muted)); font:inherit; font-size:13px; min-height:34px; }
  .move-strip .ms-empty { color:var(--muted); font-size:13px; padding:0 6px; }
  .board-tools { display:flex; flex-wrap:nowrap; gap:6px; margin-top:2px; }
  .board-tools .btn { flex:1 1 auto; min-width:0; min-height:44px; padding:8px 4px; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:inline-flex; align-items:center; justify-content:center; gap:5px; }
  .board-tools .btn .ui-emblem { width:26px; height:26px; margin:0 -3px; }
  .board-tools #undoBtn { order:0; } .board-tools #hintBtn { order:1; } .board-tools #flipBtn { order:2; } .board-tools #openGameReview { order:3; }
  /* Hra: pod deskou nástroje a hned hodnocení trenéra nebo nabídka trenéra; tah je v pásu tahů. Stránka Rozbor zanikla (#53), Rozbor je tady pod deskou. */
  #currentMove { display:none; }
  /* Pět položek (s trenérem: Vrátit tah, Nápověda, Otočit, Rozbor, ⛶): Otočit a Rozbor jen obrázkem 44 px (nápis zůstává pro čtečku),
     ať se Vrátit tah a Nápověda vejdou i s ikonou. Pravidla pro nízký a úzký telefon jejich obrázek neschovají. */
  .board-tools:has(#hintBtn:not([hidden])):has(#openGameReview:not([hidden])) :is(#flipBtn,#openGameReview) { flex:0 0 44px; padding:0; gap:0; font-size:0; }
  .board-tools:has(#hintBtn:not([hidden])):has(#openGameReview:not([hidden])) :is(#flipBtn,#openGameReview) :is(.ui-emblem,.ui-icon) { display:inline-block; width:30px; height:30px; margin:0; }
  .board-tools #focusBtn { order:4; position:static; flex:0 0 44px; }
  .focus-mode #focusBtn,.focus-mode .ms-more { display:none; }
  .play-area { gap:6px; }
  .sidebar { padding:12px; gap:8px; }
  body.classical-game .sidebar > .actions { display:none; }   /* Nápověda a Vrátit tah jsou u desky */
  .workspace-heading { padding-right:0; align-items:baseline; flex-wrap:wrap; }
  .workspace-heading .game-context { flex-basis:auto; }
  body.coaching:not(.review-flow-active) .workspace-heading { order:1; }
  body:not(.review-flow-active) #sfPanel { position:relative; }
  body:not(.review-flow-active) .review-heading { position:absolute; bottom:6px; right:6px; z-index:1; }   /* první řádek karty patří trenérovi, známce a Lepšímu tahu */
  body:not(.review-flow-active) .review-heading h2 { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  body:not(.review-flow-active) #sfStatus { padding-right:44px; }
  body:not(.review-flow-active) #sfOutput,body:not(.review-flow-active) #sfStatus { margin-top:0; }
  /* Hra s trenérem: chyba má být vidět bez posouvání, proto úspornější karta a na nižším telefonu o kousek menší deska. */
  body.coaching:not(.review-flow-active) .sidebar { padding:6px 8px 12px; }
  body.coaching:not(.review-flow-active) #sfOutput { padding:6px 8px; max-height:none; overflow:visible; gap:4px; }
  @media (orientation:portrait) {
    body.coaching:not(.review-flow-active):not(.focus-mode) .board-col { width:min(100%,max(240px,calc(100dvh - 410px))); min-height:calc(100dvh - var(--top-h) - var(--bar-h) - 22px - env(safe-area-inset-bottom,0px)); }
    /* Karta trenéra bere zbytek výšky a dlouhý text se posouvá v ní: pás tahů a nástroje stojí na stejném místě hned nad spodní lištou. */
    .board-col > #sfPanel:not([hidden]) { flex:1 1 90px; min-height:0; width:calc(100vw - 12px); margin-inline:calc((100% - 100vw + 12px) / 2); display:flex; flex-direction:column; }
    .board-col > #sfPanel #sfOutput { flex:1 1 0; min-height:0; overflow-y:auto; align-content:start; }
    .board-col > #sfPanel #sfStatus { flex:none; }
    /* Řádek Soupeř je vždy celý vidět. Delší věta o vlastním tahu se posouvá nad ním. */
    .board-col > #sfPanel .sf-live-row + .sf-live-row:not(:has(p)) { position:sticky; bottom:-4px; z-index:2; margin-top:0; padding-block:4px 2px; margin-bottom:-2px; background:var(--ui-fill,#1c2418); }
    /* Otázka a plán stejně: delší věta o tahu se posouvá nad nimi, hrozba nebo rada je vždy vidět. */
    .board-col > #sfPanel .sf-live-row.sf-ask,.board-col > #sfPanel .sf-live-row.sf-plan { position:sticky; bottom:-4px; z-index:2; margin-top:0; padding-block:4px 2px; margin-bottom:-2px; background:var(--ui-fill,#1c2418); }
    .board-col > #sfPanel .sf-live-row.sf-ask { padding-block:4px 7px; }
    .board-col > #sfPanel #sfOutput { padding-block:3px 4px; gap:2px; }
    /* Lišty hráčů jdou přes celou šířku jako karta, i když je deska na nízkém telefonu menší: jméno se nezalomí a nástroje zůstanou nad spodní lištou. */
    body.coaching:not(.review-flow-active):not(.focus-mode) .board-col > :is(.player-bar,.mobile-dock,.board-tools) { width:calc(100vw - 12px); margin-inline:calc((100% - 100vw + 12px) / 2); }
  }
  .board-col > #sfPanel { position:relative; }
  .focus-mode .board-col > #sfPanel { display:none; }   /* soustředění schovává postranní panel, karta odešla s ním */
  /* První řádek: známka, Lepší tah a ⓘ. Podrobnosti rozboru otevře klepnutí na trenéra jako v Detailu tahu. */
  .board-col > #sfPanel .review-heading { position:absolute; top:6px; bottom:auto; right:5px; z-index:1; }
  .board-col > #sfPanel #sfOutput > :first-child .sf-live-head { padding-right:32px; }
  body[data-pane="review"] .board-col > #sfPanel #sfOutput > :first-child .sf-live-head { padding-right:84px; }   /* v panelu Rozbor je vedle ⓘ i 📝 */
  .board-col > #sfPanel #sfOutput > .sf-live-hint:first-child { padding-right:32px; }
  .board-col > #sfPanel .sf-live-head .btn.sf-live-better { top:0; margin-block:-6px -5px; }
  .board-col > #sfPanel .sf-engine-details > summary { display:none; }
  .board-col > #sfPanel .sf-engine-details:not([open]) { display:none; }
  .board-col > #sfPanel .sf-live-row > .coach-face[data-engine-details] { cursor:pointer; }
  .rb-text .rb-long { display:none; }
  /* Prohlížení starších tahů a ukázka nesmí posunout desku ani pás pod prstem: lišta leží na místě horní lišty hráče. */
  body:not(.review-flow-active):not(.focus-mode):is(.history-view,.study-preview) #reviewBar,
  body[data-review-step="variation"]:not(.focus-mode).history-view #reviewBar { position:fixed; top:var(--top-h,48px); left:0; right:0; z-index:16; margin:0; border-radius:0; min-height:44px; }
  body:not(.review-flow-active):not(.focus-mode):is(.history-view,.study-preview) #barTop,
  body[data-review-step="variation"]:not(.focus-mode).history-view #barTop { visibility:hidden; }
  body:is(.history-view,.study-preview) .pb-turn { display:none; }
  .review-bar .rb-live { display:inline-flex; flex:none; margin-left:auto; }
  body:not(.review-flow-active) #historyNotice { display:none; }   /* Zpět do hry je v liště nahoře, tady by bylo pod ohybem */
  /* Historie tahů: vysouvací panel pod lištou hráče, deska zůstává vidět. V Detailu rozboru zůstává na stránce. */
  body:not(.review-flow-active):not(.history-sheet) .history-section { display:none !important; }
  body.history-sheet .history-section { display:flex !important; position:fixed; left:0; right:0; top:var(--history-sheet-top,50dvh); bottom:calc(var(--bar-h) + env(safe-area-inset-bottom,0px)); z-index:13; flex:none; gap:8px; padding:8px 12px 10px; background:var(--surface); border-top:1px solid var(--accent); border-radius:12px 12px 0 0; box-shadow:0 -10px 24px #0008; }
  body.history-sheet .history-section .moves-panel { flex:1 1 auto; height:auto; min-height:0; max-height:none; overflow:auto; }
  body.history-sheet #movesNav { position:static; padding:0; background:transparent; box-shadow:none; }
  .history-section .panel-title { align-items:center; gap:10px; }
  #moveCount { margin-left:auto; }
  body.history-sheet .history-close { display:inline-flex; align-items:center; justify-content:center; width:44px; min-height:40px; padding:0; }
  /* Trénink: hlavička v horní liště (vlevo zpět, pak co cvičíš), ať je deska výš. Popis a nadpis části opakují přepínač. */
  body:not(.focus-mode) #trainingContext { position:fixed; top:0; left:0; right:56px; z-index:17; height:var(--top-h); margin:0; padding:0 6px 0 4px; gap:6px; border:0; border-bottom:1px solid var(--ui-border,#333b30); border-radius:0; background:var(--ui-rail,#222620); }
  #trainingContext #trainingExit { order:-1; flex:none; min-height:40px; padding:6px 8px 6px 2px; background:transparent; border-color:transparent; color:var(--ink); box-shadow:none; }
  #trainingContext #trainingRestart { flex:none; min-height:40px; padding:6px 8px; }
  #trainingLabel { flex:1 1 auto; min-width:0; font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  #trainingLabel .training-note { display:none; }
  .hub-intro:has(+ .training-tabs),#trainingEndgames > h2,#trainingPuzzles > h2 { display:none; }
  .hub-page .training-tabs { margin-top:10px; max-width:none; }
  .puzzle-group { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; align-items:center; padding:12px; }
  .puzzle-group h3,.puzzle-group p,.puzzle-group progress { grid-column:1; }
  .puzzle-group .btn { grid-column:2; grid-row:1 / span 3; align-self:center; min-height:44px; }
  /* Hádanka: zadání hned pod deskou. Nápověda je u desky, postup v horní liště; pás tahů a vrácení tahu tu nemají co dělat. */
  .puzzle-mode .mobile-dock,.puzzle-mode .board-tools #undoBtn,.puzzle-mode .workspace-heading,#pzHintBtn,#pzProgress,body.puzzle-mode #barBottom { display:none; }
  body.puzzle-mode #pzTask { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:0 8px; align-items:center; min-height:44px; padding:0; }
  .pz-side { font-size:17px; }
  /* Karta konce musí být nad spodní lištou bez posouvání. */
  .puzzle-panel:has(.pz-end:not([hidden])) > :is(.pz-head,.pz-run,#pzStatus) { display:none; }
  .pz-end { scroll-margin-bottom:76px; }
  .pz-end h3 { font-size:20px; }
  .pz-end p { margin-bottom:8px; }
  .pz-goal { grid-column:1; }
  .pz-clock { grid-column:2; grid-row:1 / span 2; }
  body.puzzle-mode .sidebar .puzzle-panel { padding:0; border:0; background:transparent; }
  .puzzle-panel .pz-btns .btn { flex:1 1 0; min-height:44px; padding:6px 2px; font-size:13px; }
  .pz-all .pz-dot { min-height:40px; }
  /* Stránky přehledu: Zpět dělá totéž co spodní lišta a tlačítko Zpět na Androidu. */
  .hub-heading [data-home] { display:none; }
  /* Na nízkém telefonu se deska zmenší, aby nástroje pod ní nezajížděly pod spodní lištu. */
  @media (orientation:portrait) { body:not(.focus-mode) .board-col { width:min(100%,max(240px,calc(100dvh - 350px))); } }
  /* Nejnižší telefony: deska má šířku, kterou by jinak bral sloupec hodnocení. */
  @media (orientation:portrait) and (max-height:660px) {
    body:not(.focus-mode):not(.review-flow-active) .eval-bar { display:none; }
    body.coaching:not(.review-flow-active):not(.focus-mode) .board-col { width:min(100%,max(210px,calc(100dvh - 416px))); }
    .board-col > #sfPanel:not([hidden]) { flex-basis:70px; }
  }
  @media (orientation:portrait) and (max-height:720px),(max-width:340px) { .board-tools .btn:not(#focusBtn) { padding-inline:2px; } .board-tools .btn:not(#focusBtn) :is(.ui-icon,.ui-emblem) { display:none; } }
  /* Lišty hráčů vždy na jednom řádku: barva, obrázek, jméno, číslo, sebrané figurky, kdo je na tahu, hodiny. Když není místo, nejdřív zmizí sebrané figurky a slovo Bílý nebo Černý a zkrátí se jméno. Hodiny se nezalomí. */
  .player-bar { flex-wrap:nowrap; padding:2px 8px; gap:6px; min-height:38px; white-space:nowrap; }
  .pb-dot { flex:none; }
  .pb-name { display:flex; align-items:center; flex:0 1 auto; min-width:0; white-space:nowrap; }   /* bez overflow: klepací plocha jména přesahuje lištu */
  .pb-color { flex:none; white-space:pre; }
  .player-bar.pb-tight .pb-color { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .pb-me { display:inline-flex; align-items:center; min-width:0; flex:0 1 auto; }
  .pb-ava { flex:none; }
  .pb-who { min-width:0; overflow:hidden; text-overflow:ellipsis; }
  .pb-unit { display:none; }
  .pb-rating { flex:none; padding-inline:6px; }
  .pb-spacer { display:block; order:2; flex:1 1 0; min-width:0; }
  .pb-turn { order:3; flex:none; }
  .pb-clock { order:4; margin-left:0; min-width:58px; font-size:16px; flex:none; padding-inline:6px; }
  .pb-caps { order:1; flex:0 1000 auto; min-width:0; margin:0; flex-wrap:nowrap; overflow:hidden; }
  .pb-caps:empty,.player-bar.pb-nocaps .pb-caps { display:none; }
  .pb-adv { order:1; flex:none; margin-left:0; }
  .pb-adv:empty { display:none; }
  @media (orientation:portrait) and (max-height:660px) { .player-bar { min-height:34px; padding-block:0; } .move-strip { min-height:34px; padding-block:1px; } .move-strip :is(.ms-ply,.ms-opening,.ms-more) { min-height:30px; padding-block:3px; } .mobile-dock .strip-arrow { min-height:34px; } }
}
@media (max-width:540px) {
  body { padding-left:6px; padding-right:6px; }
  .board-tools .btn { font-size:13px; gap:2px; }
  .board-tools #openGameReview :is(.ui-icon,.ui-emblem) { display:none; }
}

/* ---- Krok 3: čitelnější písmo, SVG ikony, toasty v barvách motivu, souřadnice v políčkách ---- */
.pen .ui-icon { width:12px; height:12px; vertical-align:-1px; opacity:.7; }
.pb-me { border-bottom:0; }
.pb-me:hover { text-decoration:underline; text-underline-offset:3px; }
#enableCoach { font-size:13px; padding:7px 10px; align-self:flex-start; }
.toast { background:var(--surface); border:1px solid var(--accent); color:var(--ink); box-shadow:0 12px 30px #0007; }
.toast b { color:var(--ink); }
.toast small { color:var(--muted); }
/* Božský tah: vpravo nahoře, zmizí až po kliknutí. */
.divine-toast { position:fixed; top:calc(env(safe-area-inset-top,0px) + 12px); right:12px; z-index:40; width:min(calc(100vw - 24px),340px); min-height:44px; display:flex; align-items:center; gap:10px; padding:10px 34px 10px 10px; border:2px solid #f0c040; border-radius:14px; background:var(--surface); color:var(--ink); font:inherit; text-align:left; cursor:pointer; animation:divineIn .45s cubic-bezier(.2,1.4,.4,1), divineGlow 1.6s ease-in-out .45s 8; box-shadow:0 0 18px 3px #f0c04099, 0 12px 30px #0007; }
.divine-toast .t-ic { flex:none; width:64px; height:64px; font-size:44px; line-height:64px; text-align:center; }
.divine-toast .t-ic img { width:100%; height:100%; display:block; }
.divine-toast b { display:block; font-size:17px; color:var(--ink); }
.divine-toast small { display:block; margin-top:2px; font-size:13px; font-weight:600; color:var(--muted); }
.divine-x { position:absolute; top:6px; right:9px; font-size:15px; line-height:1; color:var(--muted); }
@keyframes divineIn { from { transform:translateY(-30px) scale(.85); opacity:0; } to { transform:none; opacity:1; } }
@keyframes divineGlow { 50% { box-shadow:0 0 34px 11px #f0c040cc, 0 12px 30px #0007; } }
@media (prefers-reduced-motion:reduce) { .divine-toast { animation:none; } }
:is(.badge-art,.konik) { user-select:none; pointer-events:none; }
/* Obrázky odznaků (etapa 05): zamčené šedí pravidlo .bd-ic, šedé verze se nevyrábějí. */
.bd-grid { grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); }   /* obrázek je širší než emoji, text potřebuje místo */
.bd-card .bd-ic { flex:none; }
.bd-ic .badge-art { display:block; width:52px; height:52px; }
.t-ic .badge-art { display:block; width:60px; height:60px; margin:-4px -2px; }
.bd-head h3 .ui-emblem { width:32px; height:32px; margin:-8px 2px -6px -4px; }
/* Koník (etapa 04). Má vlastní okraj v obrázku, proto záporné okraje: nesmí zvýšit řádek vedle sebe. */
.head-konik { flex:none; width:72px; height:72px; margin:-10px 0 -10px auto; }
.hub-empty .empty-konik { display:block; width:128px; height:128px; margin:-14px auto 0; }
.result-card .rc-title { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.result-card .rc-title > div { min-width:0; }
.rc-konik { flex:none; }
@media (max-width:900px) {
  .head-konik { width:60px; height:60px; margin:-8px 0 -8px auto; }
}
.btn .ui-icon { vertical-align:-4px; }
.workspace-status.turn-only { display:none; }
.puzzle-mode #workspaceStatus { display:none; }   /* v hádance mluví stavový řádek panelu */
/* Souřadnice uvnitř políček (jako na lichess): deska získá rám zpět jako hrací plochu. */
.board-frame { --frame:0px; padding:4px; }
.files,.ranks,.corner { display:none; }
.board-frame > .board { grid-area:2 / 2 / 3 / 3; }   /* bez rámu by se deska sama umístila do prázdného nulového sloupce */
.square-file,.square[data-rank]::before { position:absolute; font-size:clamp(9px,1.5vw,12px); font-weight:700; line-height:1; letter-spacing:0; pointer-events:none; z-index:1; font-family:Inter,system-ui,sans-serif; }
.square-file { right:3px; bottom:2px; }
.square-file::before { content:attr(data-file); }
.square[data-rank]::before { content:attr(data-rank); left:3px; top:2px; }
.square.light .square-file,.square.light::before { color:rgba(0,0,0,.55); }
.square.dark .square-file,.square.dark::before { color:rgba(255,255,255,.78); }

/* PWA: lišta nové verze a tlačítko sdílení v dialogu konce partie */
.pwa-update { position:fixed; left:50%; bottom:calc(16px + env(safe-area-inset-bottom,0px)); transform:translateX(-50%); z-index:60; display:flex; align-items:center; gap:10px; padding:10px 12px 10px 16px; border:1px solid var(--accent); border-radius:10px; background:var(--surface); color:var(--ink); font-size:14px; box-shadow:0 12px 30px #0007; max-width:calc(100vw - 20px); }
.pwa-update .btn { min-height:40px; }
@media (max-width:900px) { .pwa-update { bottom:calc(var(--bar-h,56px) + 12px + env(safe-area-inset-bottom,0px)); } }
#installApp { margin-top:12px; }

/* Klávesnice na desce */
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
#board:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.square.kb-cursor { box-shadow:inset 0 0 0 4px var(--accent,#8bb9f5); }

/* Hláška soupeře v jeho liště (klasické šachy). Lišta nemění výšku: místo stupně a sebraných figur je krátce věta, nejvýš dva řádky. */
.pb-say { order:1; flex:1 1 0; min-width:0; margin:0 4px; font-size:12px; line-height:1.15; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; pointer-events:none; animation:paSayIn .25s ease-out; }
.player-bar:has(.pb-say) :is(.pb-rating,.pb-caps,.pb-adv,.pb-turn) { display:none; }
@keyframes paSayIn { from { opacity:0; } to { opacity:1; } }
@media (prefers-reduced-motion:reduce) { .pb-say { animation:none; } }
/* Telefon: na větu je potřeba místo, jméno ustoupí a kdo mluví, ukáže obrázek. */
@media (max-width:900px) { .pb-say { margin:0 2px; } .player-bar:has(.pb-say) :is(.pb-name,.pb-bot) { font-size:0; } .player-bar:has(.pb-say) .pb-dot { display:none; } }
@media (max-width:340px) { .player-bar:has(.pb-say) .pb-name { display:none; } }

/* Koncovka v řadě: cíl a počítadlo stojí nad deskou na místě lišty soupeře, deska se proto neposune. Soupeř nemá jméno. */
body.lesson-mode #barTop { display:none; }
.lesson-task[hidden],.lesson-panel[hidden],#lessonEnd[hidden] { display:none; }
.lesson-task { display:flex; align-items:center; flex-wrap:wrap; gap:0 10px; min-height:46px; padding:2px 4px; color:var(--ink); font-size:15px; line-height:1.3; }
.lesson-task .pz-side { font-size:14px; font-weight:500; }
.lesson-task[data-mover="b"] .pz-side::before { background:#16130f; }
.lesson-goal { font-weight:700; }
.lesson-count { margin-left:auto; font-weight:800; font-variant-numeric:tabular-nums; white-space:nowrap; }
.lesson-panel { padding:12px 14px; border-radius:12px; color:var(--ink); }
.lesson-panel h2 { margin:2px 0 4px; font-size:18px; }
.lesson-panel p { margin:0; font-size:14px; line-height:1.45; }
.lesson-panel.finished #lessonInfo { display:none; }
.lesson-panel #lessonEnd { padding:0; }
.lesson-panel #lessonEnd p { margin-bottom:10px; }
/* Bez prázdného panelu: před prvním tahem jen cíl a postup, po konci karta a zápis. */
body.lesson-mode :is(.ms-empty,.mv-empty,#openGameReview,.review-options) { display:none; }
body.lesson-start :is(#sfPanel,#moveHistory),body.lesson-over :is(#sfPanel,#workspaceStatus,#studyTools,#reviewGuide,.summary-details,#undoBtn) { display:none !important; }
.board-col > .lesson-panel { flex:none; margin-top:6px; }
/* Telefon, před prvním tahem: panel bere zbytek výšky jako karta trenéra a delší věta se posouvá v něm, nástroje stojí na stejném místě. */
@media (max-width:900px) and (orientation:portrait) {
  body.lesson-start .board-col > .lesson-panel { flex:1 1 90px; min-height:0; overflow-y:auto; }
  body.lesson-mode:not(.focus-mode) .board-col > .lesson-panel { width:calc(100vw - 12px); margin-inline:calc((100% - 100vw + 12px) / 2); box-sizing:border-box; }
}

/* Karta Dnes nad záložkami Tréninku. */
.today-card { padding:14px 16px; border-radius:12px; margin:0 0 14px; color:var(--ink); }
.today-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.today-card h2 { margin:2px 0 8px; font-size:20px; }
.today-count { font-weight:800; font-variant-numeric:tabular-nums; white-space:nowrap; }
.today-steps { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.today-steps li { display:grid; grid-template-columns:24px minmax(0,1fr) auto; gap:10px; align-items:center; min-height:48px; }
.today-mark { width:24px; height:24px; box-sizing:border-box; border-radius:50%; border:2px solid var(--muted); display:grid; place-items:center; font-size:14px; font-weight:800; }
.today-steps li.done .today-mark { border-color:var(--accent); color:var(--ink); }
.today-text strong { display:block; font-size:15px; font-weight:600; }
.today-text small { color:var(--ink); opacity:.8; font-size:13px; }
.today-steps .btn { min-height:44px; white-space:nowrap; }
.today-done { display:flex; align-items:center; gap:12px; }
.today-done p { margin:0; font-size:14px; line-height:1.45; }
.today-konik { width:72px; height:72px; flex:none; }

/* Souřadnice a Co visí?: vlastní deska na stránce, bez zásahu do partie. */
.drill-body { max-width:520px; margin:0 auto; display:grid; gap:12px; }
.drill-card { padding:16px; border-radius:12px; color:var(--ink); }
.drill-card p { margin:0 0 10px; line-height:1.5; font-size:15px; }
.drill-best { font-weight:700; }
.drill-top { display:flex; align-items:center; gap:12px; min-height:46px; color:var(--ink); }
.drill-target { font-size:34px; font-weight:800; line-height:1; min-width:2ch; }
.drill-score { font-size:15px; font-weight:700; }
.drill-clock { margin-left:auto; font-size:22px; font-weight:800; font-variant-numeric:tabular-nums; }
.drill-ask { margin:0; color:var(--ink); font-size:15px; line-height:1.35; min-height:2.7em; }
.drill-board { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); width:100%; max-width:min(520px,calc(100dvh - 300px)); min-width:min(280px,100%); margin:0 auto; border-radius:6px; overflow:hidden; touch-action:manipulation; }
.drill-sq { appearance:none; border:0; padding:0; margin:0; aspect-ratio:1; min-width:0; cursor:pointer; color:inherit; font:inherit; }
.drill-sq .piece { width:100%; height:100%; pointer-events:none; }
.drill-sq:focus-visible { outline:3px solid var(--accent); outline-offset:-3px; }
.drill-sq.good { box-shadow:inset 0 0 0 100px rgba(46,160,67,.55); }
.drill-sq.bad { box-shadow:inset 0 0 0 100px rgba(214,48,49,.55); }
.drill-sq.picked { box-shadow:inset 0 0 0 4px #1f6feb,inset 0 0 0 100px rgba(31,111,235,.25); }
.drill-sq:is(.right,.missed,.wrong)::after { position:absolute; top:1px; right:2px; font-size:13px; font-weight:800; line-height:1; color:#fff; text-shadow:0 0 3px #000,0 0 3px #000; }
.drill-sq.right { box-shadow:inset 0 0 0 4px #2ea043,inset 0 0 0 100px rgba(46,160,67,.3); }
.drill-sq.right::after { content:'✓'; }
.drill-sq.missed { box-shadow:inset 0 0 0 4px #e0861f,inset 0 0 0 100px rgba(224,134,31,.3); }
.drill-sq.missed::after { content:'!'; }
.drill-sq.wrong { box-shadow:inset 0 0 0 4px #d63031,inset 0 0 0 100px rgba(214,48,49,.3); }
.drill-sq.wrong::after { content:'✕'; }
.drill-actions { display:grid; gap:8px; }
.drill-actions .btn { min-height:44px; }
.drill-legend { display:flex; flex-wrap:wrap; gap:4px 14px; font-size:13px; color:var(--ink); }
.drill-legend span::before { display:inline-block; margin-right:4px; font-weight:800; }
.drill-legend .right::before { content:'✓'; }
.drill-legend .missed::before { content:'!'; }
.drill-legend .wrong::before { content:'✕'; }
@media (max-width:900px) {
  .lesson-task { min-height:44px; padding:0; font-size:14px; }
  .lesson-task .pz-side { display:none; }
  .lesson-panel { padding:10px 12px; }
  .lesson-panel h2 { font-size:16px; }
  .lesson-panel p { font-size:13px; }
  .puzzle-panel,.lesson-panel { scroll-margin-bottom:76px; }
}

/* Styl trenéra řídí nálepky: s Panem Učitelem a Mr. Botem je na desce jen značka tahu, bez popisku a slavnostních nápisů. */
body.coach-calm .quality-label,body.coach-calm .winner-tag,body.coach-calm .winner-crown { display:none; }
.trainer-toggles .sf-toggle { display:flex; align-items:center; gap:8px; min-height:44px; }

/* Obrázky etapy 18 (ChessArt). Rozměr je vždy daný tady, takže načtení obrázku nic neposune. Bílé i tmavé figury mají černý obrys, čitelné jsou na všech prostředích. */
.ui-art { display:block; flex:none; width:40px; height:40px; object-fit:contain; user-select:none; pointer-events:none; }
.hub-page .training-tabs .ui-button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; min-width:0; }
.training-tabs .ui-art { width:48px; height:48px; }
.puzzle-group h3:has(.ui-art) { display:flex; align-items:center; gap:8px; }
.puzzle-group h3 .ui-art { width:40px; height:40px; margin:-4px 0; }
#openPuzzles { display:inline-flex; align-items:center; justify-content:center; gap:6px; }
#openPuzzles .ui-art { width:30px; height:30px; margin:-6px -2px; }
.today-head { align-items:center; }
.today-head > div { flex:1 1 auto; min-width:0; }
.today-head > .ui-art { width:48px; height:48px; margin:-4px -2px -4px -4px; }
.game-card-date { display:flex; align-items:center; gap:8px; min-width:0; }
.game-card-date .ui-art { width:36px; height:36px; margin:-6px 0; }
.endgame-medals { display:flex; gap:8px; margin:0 0 12px; }
.endgame-medals .ui-art { width:48px; height:48px; filter:grayscale(1); opacity:.45; }
.endgame-medals .ui-art.got { filter:none; opacity:1; }
.endgame-icon .ui-art { width:32px; height:32px; }
.lesson-medal.ui-art { float:right; width:52px; height:52px; margin:-4px -4px 0 8px; }
@media (max-width:340px) { .lesson-medal.ui-art { display:none; } }   /* nadpis by se zalomil a karta povyrostla; odznak je dál v seznamu koncovek */
.end-card h2:has(.ui-art) { display:flex; align-items:center; gap:8px; }
.end-card h2 .ui-art { width:40px; height:40px; margin:-4px 0; }
.result-card .rc-title > div { flex:1 1 0; }
.rc-art.ui-art { width:44px; height:44px; }
.rc-handicap:has(.ui-art) { display:flex; align-items:center; gap:8px; }
.rc-handicap .ui-art { width:36px; height:36px; }
/* Když soupeř mluví, je výraz větší. Záporné okraje: lišta se nezvýší ani na počítači, ani na nejnižším telefonu. */
.player-bar:has(.pb-say) .pb-ava { flex:none; width:32px; height:32px; margin-block:-4px; }
@media (max-width:900px) {
  .training-tabs .ui-art { width:36px; height:36px; }
  /* S trenérem je v kartě výsledku místo jen na jeho obrázku: výsledek sedí v rohu, nápis v bublině se nezúží. */
  .result-card:has(.rc-konik) .rc-title { position:relative; }
  .result-card:has(.rc-konik) .rc-art.ui-art { position:absolute; left:46px; top:46px; z-index:1; width:40px; height:40px; }
}
