:root{color-scheme:dark;--bg:#171925;--surface:#242638;--line:#3a3e57;--text:#f6f1fc;--muted:#bcbdd2;--accent:#ffcbab;--light:#e5dce9;--dark:#797bb2;font-family:system-ui,-apple-system,sans-serif}
/* Keep scrolling and pinch zoom while suppressing double-tap zoom across the app. */
*{box-sizing:border-box;touch-action:manipulation}
body{margin:0;background:radial-gradient(ellipse at 42% 0,#22312a 0,transparent 58rem),var(--bg);color:var(--text);padding:env(safe-area-inset-top) max(16px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px,env(safe-area-inset-left))}
button,select{font:inherit;color:inherit;background:#25342c;border:1px solid var(--line);border-radius:10px;min-height:44px;padding:8px 13px}
button{cursor:pointer} button:disabled{opacity:.42;cursor:default} button:hover:not(:disabled){filter:brightness(1.16)}
:focus-visible{outline:2px solid #e6fa9b;outline-offset:-3px}
.mast,main{max-width:1060px;margin:auto}.mast{display:flex;justify-content:space-between;align-items:center;padding:20px 0 24px;gap:12px}
.brand{display:flex;align-items:center;gap:10px}.brand span{color:var(--accent);font-size:29px}.mast p{margin:0;color:var(--muted);font-size:.77rem;text-align:right}
h1,h2,p{margin:0}h1{font-size:1.55rem;letter-spacing:-.04em}h2{font-size:1.08rem;letter-spacing:-.02em}
main{display:grid;grid-template-columns:minmax(0,1.42fr) minmax(270px,1fr);gap:26px;padding-bottom:30px}
.position{display:grid;grid-template-columns:24px minmax(0,1fr);gap:8px;align-items:stretch}
.meter{background:#242d29;border:1px solid #4d5b52;border-radius:6px;position:relative;overflow:hidden}
#white-bar{background:#e8efdf;position:absolute;bottom:0;width:100%;height:50%;transition:height .25s}#score{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-90deg);background:#15201a;color:#fff;padding:1px 5px;border-radius:4px;font-size:.68rem;white-space:nowrap}
.board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));aspect-ratio:1;border-radius:8px;overflow:hidden;container-type:inline-size}
.square{position:relative;display:grid;place-items:center;min-height:0;padding:0;border:0;border-radius:0;aspect-ratio:1;line-height:1;background:var(--light);color:#243d2b;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}
.square.dark{background:var(--dark);color:#f3f8e9}.square.last{box-shadow:inset 0 0 0 100px #dce15d55}.square.selected{box-shadow:inset 0 0 0 4px #f5dc57}.square.suggested{box-shadow:inset 0 0 0 4px #fff28a}.square.check{background:#c66c64}.square.target::after{content:"";position:absolute;z-index:2;width:26%;aspect-ratio:1;background:#18302060;border-radius:50%;pointer-events:none}.square.target:has(.piece)::after{width:85%;background:transparent;border:4px solid #18302070}
.piece{width:95%;height:95%;pointer-events:none;filter:drop-shadow(0 1px 1px #17231865)}
.coord{position:absolute;font-size:clamp(8px,2.25cqw,14px);font-weight:750}.file{bottom:3px;right:4px}.rank{top:3px;left:4px}
.seat{display:flex;gap:9px;align-items:center;margin:10px 0 10px 32px}.seat span:last-child{margin-left:auto;color:var(--muted);font-size:.8rem}.dot{width:12px;height:12px;border:1px solid #89998e;border-radius:50%}.dot.white{background:#edf4e7}.dot.black{background:#1b231f}
#status{min-height:1.5em;margin:12px 0;color:var(--muted)}.actions{display:flex;gap:8px;flex-wrap:wrap}.actions>button:first-child{flex-grow:1}.actions>button:nth-child(2){flex-grow:1}
.panels{display:grid;gap:12px;align-content:start}.card{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:15px}.card-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.switch{display:flex;align-items:center;gap:5px;color:var(--muted);min-height:38px;cursor:pointer}.switch input{accent-color:var(--accent);width:18px;height:18px}.label,.fine,.settings label{font-size:.77rem;color:var(--muted)}.label{margin-top:12px;margin-bottom:5px}#review{line-height:1.45}#recommendation{line-height:1.4;margin-top:8px;color:var(--accent);font-size:.86rem}#recommendation:empty{display:none}.metrics{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0 8px}.metrics div{background:#121c16;border-radius:9px;padding:8px 10px;display:flex;justify-content:space-between;align-items:center;gap:6px}.metrics span{color:var(--muted);font-size:.78rem}.metrics strong{color:var(--accent)}.fine{line-height:1.4}a{color:var(--accent)}
#history{max-height:215px;overflow:auto;margin-top:9px;color:var(--muted);font-size:.88rem}.move-row{display:grid;grid-template-columns:30px 1fr 1fr;align-items:center;gap:4px}.move-row button{min-height:40px;text-align:left;background:transparent;border-color:transparent;padding:4px 8px}.move-row button[aria-current=true]{color:var(--accent);background:#2c4030}.quiet{padding:4px 8px;min-height:32px;font-size:.75rem}
.settings{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0}.settings label{display:grid;gap:5px}.settings select{width:100%;padding-inline:6px;font-size:.84rem}.primary{background:var(--accent);color:#192416;font-weight:700;width:100%;border:0}.card>.fine:last-child{margin-top:10px}
dialog{max-width:calc(100% - 24px);border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--text);padding:20px}dialog h2{margin-bottom:12px}dialog::backdrop{background:#0009}
#new-game p{color:var(--muted);margin-bottom:14px}#new-game button[value=start]{background:var(--accent);color:#192416;font-weight:700}
body{background:radial-gradient(ellipse at 18% 0,#30334e 0,transparent 58rem),var(--bg)}
button,select{background:#30334a}
:focus-visible{outline-color:var(--accent)}
.mast,main{max-width:1150px}
.mast{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);border-bottom:1px solid var(--line);margin-bottom:14px;padding-block:12px}
.mast p{text-align:left;font-size:.7rem}.setup-link{justify-self:end;text-decoration:none;padding:9px 14px;background:#30334a;border:1px solid var(--line);border-radius:8px;font-size:.85rem;font-weight:650}
.brand span{font-size:26px}.brand h1{font-size:1.35rem}
main{grid-template-columns:minmax(0,1.65fr) minmax(250px,1fr);gap:20px;scroll-margin-top:max(8px,env(safe-area-inset-top))}
.position{grid-template-columns:18px minmax(0,1fr);gap:6px}
.board{border-radius:5px;box-shadow:0 12px 30px #08091540}
.square{color:#45476e}.square.dark{color:#fff5fc}.square.last{box-shadow:inset 0 0 0 100px #88e0bf70}.square.selected,.square.suggested{box-shadow:inset 0 0 0 4px #ffcbab}.square.check{background:#ca718a}.square.target::after{background:#30334a65}.square.target:has(.piece)::after{background:transparent;border-color:#30334a85}
.piece{width:93%;height:93%;filter:drop-shadow(0 2px 1px #23214250)}
.meter{background:#232438;border-color:#4b4d70}.meter #white-bar{background:#ebe1f2}#score{background:#28263d}
.seat{margin:8px 0 8px 24px;min-height:34px}.seat .dot{width:24px;height:24px;border-radius:6px;border-color:#8587ae}.seat .dot.white{background:#f6e0d9}.seat .dot.black{background:#434773}
#status{font-size:.85rem;margin:6px 0 10px}.play>.actions{padding:7px;background:#222436;border:1px solid var(--line);border-radius:10px}
.card{border-radius:10px}.card h2{font-size:1rem}
.metrics div{background:#1b1d2d}
.primary,#new-game button[value=start]{color:#362331}
.history-actions{display:flex;align-items:center;gap:4px}.history-actions .quiet{min-height:36px}.history-actions #prev,.history-actions #next{font-size:1.25rem;line-height:1;min-width:36px}
.move-row:nth-child(even){background:#1e2030}.move-row button[aria-current=true]{background:#3e3a58}
.game-view-heading{display:none}
@media(max-width:720px){
  body{padding-inline:env(safe-area-inset-left) env(safe-area-inset-right)}
  .mast{max-width:560px;margin:0 auto 6px;padding:8px 12px}.mast p{line-height:1.25}
  main{grid-template-columns:minmax(0,1fr);gap:10px;max-width:560px}.panels{display:contents}
  .notation{grid-row:1;margin-inline:8px;padding:4px 8px 5px}
  .notation .card-head{min-height:36px}.notation h2{font-size:.78rem;color:var(--muted)}
  #history{display:flex;align-items:center;gap:5px;overflow-x:auto;overflow-y:hidden;white-space:nowrap;margin-top:3px;min-height:36px;scrollbar-width:none}
  .move-row{display:flex;flex:none;gap:0;padding-left:4px;border-radius:4px}.move-row button{min-height:36px;padding:4px 7px}
  .position{grid-template-columns:13px minmax(0,1fr);gap:3px}.board{border-radius:2px}.meter{border-radius:2px}
  .seat{margin:4px 10px 4px 16px}.play>#status,.play>.actions,.coach,.setup{margin-inline:8px}.card:not(.notation){padding:12px}
  .settings select{font-size:16px}
  body.board-open{overflow:hidden}
  body.board-open main{
    position:fixed;inset:0;z-index:5;max-width:none;overflow:auto;overscroll-behavior:contain;
    background:var(--bg);padding:max(4px,env(safe-area-inset-top)) env(safe-area-inset-right) max(16px,env(safe-area-inset-bottom)) env(safe-area-inset-left)
  }
  body.board-open .play{grid-row:1}
  body.board-open .notation{grid-row:2}
  body.board-open .game-view-heading{display:flex;align-items:center;justify-content:space-between;padding:2px 10px 0}
  .game-view-heading button{font-size:.82rem}
}
.board{width:100%;min-width:0;container-type:normal;grid-template-rows:repeat(8,minmax(0,1fr))}
.coord{font-size:clamp(8px,2vw,13px)}
@media(max-width:720px){
  .position{display:block;position:relative;margin-left:16px;aspect-ratio:1}
  .position .board{position:absolute;inset:0;height:100%}
  .position .meter{position:absolute;top:0;bottom:0;left:-16px;width:13px}
}
.move-grade,.opening-feedback{margin:0 10px 6px;padding:5px 9px;border-radius:6px;background:#282c43;color:#eeeaff;font-size:.8rem}
.move-grade[data-grade=Brilliant]{background:#164f60;color:#b1faff}
.move-grade[data-grade=Excellent],.move-grade[data-grade=Good]{background:#244534;color:#d4ffdd}
.move-grade[data-grade=Blunder]{background:#662f42;color:#ffe1e7}
.opening-feedback{background:#443a56;color:#ffe1bb}
.board .square.dark{--field-tint:rgba(192,190,183,.27)}
.board .piece{width:100%;height:100%;filter:none}
.square[data-square^='h']{--tile-x:0%}.square[data-square$='1']{--tile-y:0%}
.square[data-square^='g']{--tile-x:14.285714%}.square[data-square$='2']{--tile-y:14.285714%}
.square[data-square^='f']{--tile-x:28.571429%}.square[data-square$='3']{--tile-y:28.571429%}
.square[data-square^='e']{--tile-x:42.857143%}.square[data-square$='4']{--tile-y:42.857143%}
.square[data-square^='d']{--tile-x:57.142857%}.square[data-square$='5']{--tile-y:57.142857%}
.square[data-square^='c']{--tile-x:71.428571%}.square[data-square$='6']{--tile-y:71.428571%}
.square[data-square^='b']{--tile-x:85.714286%}.square[data-square$='7']{--tile-y:85.714286%}
.square[data-square^='a']{--tile-x:100%}.square[data-square$='8']{--tile-y:100%}
.capture-tray{display:flex;align-items:center;gap:4px;flex-wrap:wrap;font-size:.7rem;color:var(--muted)}
.capture-tray span{display:inline-flex;align-items:center}.capture-tray img{width:20px;height:20px;object-fit:contain}
.seat{flex-wrap:wrap}.seat .capture-tray span:last-child{margin:0;font-size:inherit}
.grade-symbol{display:inline-block;margin-left:4px;color:#b5edbf;font-weight:800}.grade-symbol[data-grade=Brilliant]{color:#8eebe8}.grade-symbol[data-grade=Blunder],.grade-symbol[data-grade=Fehler]{color:#ff9daa}.grade-symbol[data-grade=Ungenau]{color:#ffcf80}
body[data-theme=forest]{--tile-light:#e4e6d4;--tile-dark:#849d7c}
body[data-theme=walnut]{--tile-light:#eed5b3;--tile-dark:#aa785f}
body[data-theme=slate]{--tile-light:#d9dce1;--tile-dark:#87909f}
body[data-theme]:not([data-theme=ocean]) .board .square{background:var(--tile-light)}
body[data-theme]:not([data-theme=ocean]) .board .square.dark{background:var(--tile-dark)}
body[data-theme=walnut] .board .square{background-image:repeating-linear-gradient(3deg,transparent 0 7px,#6539150b 8px 9px)}
body[data-theme]:not([data-theme=ocean]) .board .square.check{background-color:#d7818d}
.board{position:relative}
.board-grade{position:absolute;right:0;top:0;z-index:3;border-radius:50%;min-width:1.55em;height:1.55em;display:grid;place-items:center;background:#408753;color:white;font:bold clamp(11px,1.8vw,22px)/1 system-ui;box-shadow:0 1px 3px #0005;pointer-events:none}
.board-grade[data-grade=Blunder]{background:#ce292d}.board-grade[data-grade=Fehler]{background:#d26724}.board-grade[data-grade=Ungenau]{background:#997125}.board-grade[data-grade=Brilliant]{background:#168a91}
.threat-arrow{position:absolute;z-index:2;height:4%;transform-origin:left center;background:#cc343acd;clip-path:polygon(0 28%,83% 28%,83% 0,100% 50%,83% 100%,83% 72%,0 72%);pointer-events:none}
#retry-actions[hidden]{display:none}#retry-actions{margin-block:8px}#retry{background:#608b35;color:white}
.board-open{background:radial-gradient(ellipse at bottom left,#174970,transparent 65%),#0b1825}
.coach #review{background:#f6f7fb;color:#222a38;border-radius:14px 14px 14px 3px;padding:12px 16px}
@media(min-width:721px){.board-open .coach{grid-row:1}.board-open .panels{align-self:start}}
@media(max-width:720px){body.board-open{overflow-y:auto}}
.coach #retry-actions{margin-top:12px}
@media(min-width:721px){
.notation .meter{height:20px;margin-top:12px}
.notation .meter #white-bar{width:var(--white-share);height:100%!important}
.notation .meter #score{inset:0 6px 0 auto;align-content:center;color:white;text-shadow:0 1px 3px #000}
.position{display:block}
}
@media(max-width:720px){body.board-open main:has(#retry-actions:not([hidden])) .coach{grid-row:2}body.board-open main:has(#retry-actions:not([hidden])) .notation{grid-row:3}}
[hidden]{display:none!important}
body,body.board-open{--bg:#141b20;--surface:#202b31;--line:#36434a;--text:#f4f4e9;--muted:#a9b8ba;background:#141b20;color:var(--text);min-height:100vh;padding-bottom:calc(88px + env(safe-area-inset-bottom));overflow:auto}
body main,body.board-open main{position:static;display:block;max-width:780px;overflow:visible;margin:auto;background:transparent;padding:0 12px}
.panels{display:contents}.page,.card,body .setup{border:1px solid var(--line);border-radius:18px;background:var(--surface);padding:clamp(16px,3vw,32px);margin:12px auto}
h2{font-size:clamp(22px,4vw,36px)}.hero{background:linear-gradient(130deg,#263d41,#1c292f)}.hero h2{font-size:clamp(38px,7vw,72px);line-height:1;margin:18px 0}.home-art{font:110px/1.1 Georgia;color:#b1d9bf}.page>button,.page form button,#matches button{display:block;width:100%;margin:8px 0;text-align:left}.hero>button:first-of-type,#new,.primary{background:#a2e3bf;color:#13291f;font-weight:750}.page input,.page select{width:100%;margin:8px 0;padding:12px;border-radius:8px;font-size:16px}.page input{background:#141c20;color:white;border:1px solid var(--line)}.dock{position:fixed;bottom:0;left:0;right:0;z-index:8;display:flex;justify-content:center;background:#172127f5;border-top:1px solid var(--line);padding:4px 4px calc(4px + env(safe-area-inset-bottom))}.dock button{width:19%;max-width:115px;text-align:center;border:0;background:none;color:#b4bec0;font-size:12px}.dock b{display:block;font:22px/1.2 Georgia}.dock [aria-current=true]{color:#a2e3bf;background:#283831}
.board-links,.samples{display:flex;gap:6px;flex-wrap:wrap}.samples{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr))}.samples button{text-align:left}.sample{display:flex;margin-top:8px}.sample>*{width:15%;aspect-ratio:1}.samples [aria-pressed=true]{border-color:#a2e3bf}#appearance .settings{display:block}#appearance label{margin-top:14px}
body[data-theme] .board .square,body[data-theme] .board .square.dark{background:var(--studio-light)!important}body[data-theme] .board .square.dark{background:var(--studio-dark)!important}.board .square.selected,.board .square.last{box-shadow:inset 0 0 0 3px #f4ba4e}.board .square.check{outline:3px solid #d7354b;outline-offset:-3px}
#grade-table{width:100%;border-collapse:collapse}#grade-table td{padding:7px;border-bottom:1px solid var(--line)}#grade-table td:not(:first-child){text-align:center}.curve{width:100%;background:#162229;border-radius:10px;margin-top:8px}#summary details{margin:18px 0}summary{cursor:pointer}#review-board{width:min(100%,400px);display:grid;grid-template-columns:repeat(8,1fr);margin:10px 0}#review-board span{display:grid;aspect-ratio:1;background:var(--studio-light)}#review-board span:is(:nth-child(16n+2),:nth-child(16n+4),:nth-child(16n+6),:nth-child(16n+8),:nth-child(16n+9),:nth-child(16n+11),:nth-child(16n+13),:nth-child(16n+15)){background:var(--studio-dark)}#review-board img{width:100%}.position{max-width:min(100%,65vh);margin-inline:auto}
@media(min-width:850px){body[data-screen=board] main{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(270px,1fr);max-width:1180px;gap:18px}body[data-screen=board] .coach[hidden]{display:block!important;grid-column:2;grid-row:1;align-self:start}}
@media(max-width:720px){body.board-open main{padding:0 4px}body .position{margin-left:16px;max-width:min(calc(100% - 16px),65vh)}.play{min-width:0}body .notation #history{display:block;overflow:auto;max-height:58vh}body .notation .move-row{display:grid;grid-template-columns:2em 1fr 1fr}.board-links{padding-left:12px}.mast,.board-open .mast{display:grid}.seat{margin-block:2px}}
@media(min-width:721px){body[data-screen=board] .position{display:grid;grid-template-columns:16px minmax(0,1fr)}} body[data-screen=board] #retry-actions:not([hidden]){display:flex} @media(max-width:849px){body[data-screen=board]:has(#retry-actions:not([hidden])) .coach[hidden]{display:block!important}}
.ui-icon{width:21px;height:21px;vertical-align:middle;flex:none}.dock .ui-icon{display:block;margin:0 auto 3px}.actions .ui-icon{margin-right:4px}.home-queen{width:108px;display:block;margin:20px 0}.brand{align-items:center}
.review-switch,.step-controls{display:flex;gap:8px;align-items:center;margin:14px 0}.review-switch button{flex:1}.review-switch [aria-pressed=true]{background:#b3e8cd;color:#15272b}.walking .curve{display:none}#summary #review-board{width:100%;position:relative;overflow:hidden;border-radius:8px;align-self:start}#review-board>span{position:relative;min-width:0}#review-board img{display:block;height:100%}.review-grade{position:absolute;right:0;top:0;background:#35734f;color:white;font:700 clamp(10px,1.6vw,18px)/1.6 system-ui;border-radius:50%;min-width:1.6em;text-align:center;z-index:3}.review-grade[data-grade=Blunder],.review-grade[data-grade=Miss]{background:#aa3548}.review-grade[data-grade=Fehler],.review-grade[data-grade=Ungenau]{background:#965b19}.review-last{box-shadow:inset 0 0 0 3px #f4cb69}.review-arrow{position:absolute;height:4.7%;background:#167c63db;transform-origin:0 50%;pointer-events:none;clip-path:polygon(0 33%,80% 33%,80% 0,100% 50%,80% 100%,80% 67%,0 67%)}.move-note{padding:16px;background:#172328;border-radius:10px}#better{color:#a7e4c9;font-size:.88rem}.step-controls{justify-content:space-between;margin-bottom:0}#review-head{font-size:1.18rem}#review-walk{display:grid;gap:12px}#summary:not(.walking) #again{margin-top:16px}#grade-table tr:nth-child(2){font-weight:750;color:#b5edce}#grade-table td:not(:first-child){font-variant-numeric:tabular-nums}@media(min-width:740px){#review-walk{grid-template-columns:1.55fr 1fr;align-items:start}}
#player-pair{display:grid;grid-template-columns:1fr 1fr;gap:12px}#player-pair>div{background:#162328;border:1px solid #405358;border-radius:12px;display:grid;grid-template-columns:44px 1fr;align-items:center;padding:10px;overflow-wrap:anywhere}#player-pair img{width:44px;grid-row:span 2}#player-pair small{color:#abc5c3}#player-pair b{grid-column:span 2;font-size:1.55rem;padding:8px}#grade-table tr:nth-child(-n+2){display:none}#grade-table .legend{position:static;display:inline-grid;place-items:center;min-width:24px;height:24px;font-size:14px}.legend[data-grade=Brilliant]{background:#087d81}.legend[data-grade=Great]{background:#476d9e}.legend[data-grade=Book]{background:#8c674c}#coach-intro,.move-note{border-left:4px solid #8bcdae;padding:12px;background:#23363b}#summary:not(.walking) .review-switch{position:sticky;top:0;z-index:2;background:#202b31;padding-block:6px}#review-play,#rnext{background:#a2e3bf;color:#18362e;font-weight:bold}.walking #coach-intro,.walking #duel,.walking #again{display:none}#review-walk{grid-template-areas:'meter' 'note' 'board' 'foot';grid-template-columns:1fr}.move-note{grid-area:note}.move-note p{margin:5px 0}.review-foot{grid-area:foot;min-width:0}#review-board{grid-area:board}.walking #progress{font-size:.77rem;margin:2px 0}.walking .review-switch{margin:6px 0}.walking .review-switch button{min-height:36px}.walking h2{margin-block:4px}#review-meter{grid-area:meter;height:22px;border-radius:5px;background:#404e57;overflow:hidden;position:relative}#review-meter i{display:block;height:100%;background:#c9e6d6}#review-meter output{position:absolute;inset:1px auto auto 6px;font-weight:bold;background:#25323a;color:white;font-size:.8rem;border-radius:3px;padding:1px 5px}#move-strip{display:flex;gap:4px;overflow:auto}#move-strip button{flex:none;padding:4px 8px;min-height:36px}#move-strip [aria-current=true]{border-color:#a2e3bf;background:#324e45}.archive-record{display:flex!important;align-items:center;gap:10px}.archive-avatar{padding:9px;background:#405851;border-radius:8px}.archive-record span{flex:1}.archive-record small{display:block;color:#aabeba}.archive-record em{font-size:.8rem;color:#c3dfca}
@media(min-width:740px){#review-walk{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);grid-template-areas:'board meter' 'board note' 'board foot';grid-template-rows:auto 1fr auto}}
@media(max-width:739px){#summary.walking{padding:8px;margin:2px auto}#summary.walking #review-board{max-width:min(100%,54dvh);justify-self:center}#review-walk{gap:5px}.walking .step-controls{margin-top:5px}}
:root{font-family:system-ui,-apple-system,"Segoe UI",sans-serif;font-synthesis:none}
body,body.board-open{--bg:#141b20;--surface:#20292e;--line:#354047;--muted:#aab8bb}
h1,h2,h3,.card h2,.page h2{letter-spacing:-.025em;line-height:1.15}h1{font-size:1.25rem}.page h2,.card h2{font-size:clamp(1.25rem,3vw,1.75rem);font-weight:730}.page p,.card p{line-height:1.45}.page small,.card small,.fine{font-size:.8rem;color:var(--muted)}
.hero{display:grid;grid-template-columns:1fr 64px;gap:8px;align-items:center}.hero h2{font-size:clamp(28px,5vw,44px);margin:0}.hero .home-queen{width:60px;margin:0}.hero>button{grid-column:span 2;margin:0}
.dock button,.review-switch button{font-weight:600}.dock button[aria-current=true]{box-shadow:inset 0 -2px #a2e3bf}.ui-icon{stroke-width:1.75}
#move-strip button{display:inline-flex;align-items:center;gap:4px;font-weight:600;font-variant-numeric:tabular-nums}.strip-mark{display:inline-grid;place-items:center;min-width:1.55em;height:1.55em;padding-inline:2px;border-radius:50%;font:bold .72rem/1 system-ui;background:#397953;color:white}.strip-mark[data-grade=Brilliant]{background:#087d81}.strip-mark[data-grade=Great]{background:#476d9e}.strip-mark[data-grade=Blunder],.strip-mark[data-grade=Miss]{background:#aa3548}.strip-mark[data-grade=Fehler]{background:#965b19}
.walking .move-note{min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain}.walking #review-head{display:block;font-size:1rem;font-weight:750}.walking #detail{font-size:.9rem}.walking #better{display:block;font-size:.81rem}.walking #review-board{aspect-ratio:1;grid-template-rows:repeat(8,minmax(0,1fr))}.walking #review-board>span{min-height:0}.walking #review-board img{width:100%;height:100%;object-fit:contain}
@media(max-width:739px){#summary.walking #review-walk{grid-template-rows:22px clamp(78px,11dvh,100px) auto auto}.walking #review-board{align-self:start}}
@media(min-width:740px){#summary.walking #review-walk{grid-template-rows:22px minmax(0,1fr) auto}.walking .move-note{max-height:34vh}.walking .review-foot{align-self:end}}
/* The playing surface keeps its own geometry throughout a turn. */
body[data-screen=board]{overflow-anchor:none}
body[data-screen=board] .play{align-self:start;display:flex;flex-direction:column;align-items:stretch;min-width:0}
body[data-screen=board] .position{order:2;display:grid;grid-template-columns:12px minmax(0,1fr);grid-template-areas:"meter board";gap:5px;width:min(100%,max(195px,calc(100svh - 318px)));max-width:none;aspect-ratio:auto;margin:0 auto;position:relative}
body[data-screen=board] .position .meter{grid-area:meter;position:relative;inset:auto;width:auto;height:100%}
body[data-screen=board] .position .board{grid-area:board;position:relative;inset:auto;aspect-ratio:1;width:100%;height:auto;overflow:hidden}
body[data-screen=board] .square{aspect-ratio:auto;min-width:0;min-height:0}
body[data-screen=board] .game-view-heading{display:none}
body[data-screen=board] .seat{order:1;height:34px;min-height:34px;margin:2px 6px;flex-wrap:nowrap;overflow:hidden}
body[data-screen=board] .position~.seat{order:3}
body[data-screen=board] .capture-tray{flex:1;min-width:0;flex-wrap:nowrap;white-space:nowrap;overflow-x:auto;scrollbar-width:none}
body[data-screen=board] .seat .dot{width:14px;height:14px;border-radius:50%;flex:none}
body[data-screen=board] #status{order:4;min-height:22px;margin:4px 8px;font-weight:650;font-size:.88rem}
body[data-screen=board] .game-feedback{order:5;height:32px;overflow:auto;scrollbar-width:thin}
body[data-screen=board] .game-feedback p{margin:0 6px 3px;padding:3px 8px;font-size:.8rem}
body[data-screen=board] .play>.actions{order:6;display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) 44px;padding:0;gap:4px;border:0;background:transparent}
body[data-screen=board] .play>.actions button{min-width:0;min-height:44px;padding:4px;font-size:.77rem;line-height:1.15}
body[data-screen=board] .board-links{order:7;margin:4px 0;padding:0;justify-content:center;gap:16px}
body[data-screen=board] .board-links button{border:0;background:transparent;font-size:.8rem;min-height:40px}
@media(min-width:850px){body[data-screen=board] main{align-items:start}body[data-screen=board] .coach{max-height:70svh;overflow:auto}body[data-screen=board] .play{width:min(100%,max(240px,calc(100svh - 315px)));justify-self:center}body[data-screen=board] .position{width:100%}}
@media(max-width:849px){body[data-screen=board]:has(#retry-actions:not([hidden])) .coach[hidden]{position:fixed;bottom:calc(65px + env(safe-area-inset-bottom));inset-inline:6px;z-index:7;margin:0;padding:8px;max-height:34svh;overflow:auto}body[data-screen=board]:has(#retry-actions:not([hidden])) .coach[hidden]>:not(#retry-actions):not(#review){display:none}body[data-screen=board] .coach[hidden] #review{margin:0;padding:6px}}

.phone-back,.phone-rival,.phone-history,#phone-options,.capture-tray .capture-copy,.capture-lead{display:none}
#play-options{width:min(360px,calc(100vw - 28px));border:0;border-radius:20px;padding:12px 16px;background:#302f2b;color:#faf8f3}
#play-options::backdrop{background:#12110ec9}
#play-options header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
#play-options h2{font-size:20px}
#play-options button{background:transparent;border:0;text-align:left;color:inherit}
#play-options header button{font-size:26px}
#play-options form>button{display:flex;align-items:center;width:100%;gap:10px}
@media(max-width:720px) and (orientation:portrait){
 body[data-screen=board]{--footer:#2c2b27;--bg:#23221f;background:var(--bg);padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);min-height:100svh}
 body[data-screen=board] .mast{height:46px;position:relative;display:flex;justify-content:center;max-width:none;margin:0;padding:0;border:0;background:transparent}
 body[data-screen=board] .mast :is(#offline,.setup-link),body[data-screen=board] .dock,body[data-screen=board] .board-links,body[data-screen=board] .position .meter,body[data-screen=board] .play #flip,body[data-screen=board] #move-grade{display:none}
 body[data-screen=board] .brand{gap:4px}body[data-screen=board] .brand img{width:24px;height:24px}body[data-screen=board] h1{font-size:18px}
 body[data-screen=board] .phone-back{position:absolute;inset:0 auto 0 4px;display:grid;place-items:center;width:44px;background:transparent;border:0;color:#b1aea7}
 body[data-screen=board] main{padding:0;margin:0;max-width:none}
 body[data-screen=board] .play{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(60px,1fr) auto 34px 44px 62px minmax(4px,.18fr);min-height:calc(100svh - 46px - env(safe-area-inset-top) - env(safe-area-inset-bottom));background:var(--footer);gap:0;isolation:isolate}
 body[data-screen=board] .phone-rival{grid-area:1/1/2/-1;align-self:stretch;background:var(--bg);display:flex;align-items:flex-end;padding:0 12px 10px}
 .phone-rival img{width:clamp(54px,17vw,80px);height:auto;max-height:85%;object-fit:contain;object-position:bottom}
 body[data-screen=board] .position{grid-area:2/1/3/-1;display:block;width:100%;max-width:none;margin:0}
 body[data-screen=board] .position .board{width:100%;max-width:none;box-shadow:none;border:0;border-radius:0}
 body[data-screen=board] .seat{grid-row:3;grid-column:1;align-self:center;margin:0;padding:0 12px;height:30px;min-height:0}
 body[data-screen=board] .position~.seat{grid-column:2}
 body[data-screen=board] .position~.seat .capture-tray{justify-content:flex-end}
 body[data-screen=board] .seat>:not(.capture-tray),body[data-screen=board] .capture-tray .capture-count,body[data-screen=board] .capture-tray small{display:none}
 body[data-screen=board] .capture-tray{display:flex;align-items:center;gap:2px;margin:0}
 .capture-tray .capture-copy{display:inline-block;margin-left:-9px}.capture-tray img{width:17px;height:18px}.capture-lead{display:inline;font-size:12px;color:#cccac3;margin-left:3px}
 body[data-screen=board] #status,body[data-screen=board] .game-feedback{grid-area:1/1/2/-1;align-self:end;margin:0 12px 10px 24%;padding:0;overflow:auto;order:1;height:auto;max-height:42px;font-size:12px;line-height:1.35;color:#cdcac2;text-align:left}
 body[data-screen=board] #status:not([data-important=true]){clip-path:inset(50%);width:1px;height:1px;min-height:0}
 body[data-screen=board] .game-feedback:has(#opening-feedback[hidden]),body[data-screen=board] .play:has(#status[data-important=true]) .game-feedback{display:none}
 body[data-screen=board] .phone-history{grid-area:4/1/5/-1;display:grid;align-items:center;grid-template-columns:44px minmax(0,1fr) 44px;padding-inline:2px;min-width:0}
 .phone-history>button,body[data-screen=board] .play>.actions button{display:grid;place-items:center;padding:0;border:0;border-radius:0;background:transparent;color:#c5c2bb;box-shadow:none}
 #phone-moves{min-width:0}
 #phone-moves #history{display:flex;align-items:center;gap:5px;height:44px;min-height:0;margin:0;overflow:auto hidden;white-space:nowrap;scrollbar-width:none;font-size:0}
 #phone-moves .move-row{display:flex;align-items:center;gap:1px;background:none;color:#b7b4ad;font-size:15px}
 #phone-moves .move-row button{min-height:32px;padding:2px 6px;border:0;color:#faf9f5;font-weight:650;font-size:15px;background:none}
 #phone-moves .move-row [aria-current=true]{background:#45443e;box-shadow:inset 0 -2px #a4a199;border-radius:4px}
 #phone-moves .grade-icon{font-size:9px}
 body[data-screen=board] .play>.actions{grid-area:5/1/6/-1;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;margin:0}
 body[data-screen=board] .play>.actions button{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:5px;line-height:1.1;font-size:12px;font-weight:650}
 body[data-screen=board] .play>.actions .ui-icon{width:22px;height:22px;margin:0!important}
 #phone-options{order:0}#resign{order:1}#hint{order:2}#undo{order:3}
 body[data-screen=board]:has(#retry-actions:not([hidden])) .coach[hidden]{bottom:calc(8px + env(safe-area-inset-bottom));background:#33322e;box-shadow:0 4px 24px #0005}
}

@media(max-width:720px) and (orientation:portrait){
 body[data-screen=board] .play{height:calc(100svh - 46px - env(safe-area-inset-top) - env(safe-area-inset-bottom));grid-template-rows:minmax(0,1fr) auto 34px 44px 62px minmax(0,.18fr)}
 body[data-screen=board] .play #phone-options{display:flex}
 body[data-screen=board][data-theme=ocean] #board .square{background:linear-gradient(145deg,#fcf5e9,#f8ede5)!important}
 body[data-screen=board][data-theme=ocean] #board .square.dark{background:radial-gradient(ellipse at 12% 2%,#468aaa66,transparent 58%),linear-gradient(145deg,#5196a9,#537da4)!important}
 body[data-screen=board][data-theme=ocean] #board .square.dark::before{content:"";position:absolute;inset:0;background:url('/assets/tide.svg') center/210% 210%;background-position:var(--tile-x,50%) var(--tile-y,50%);pointer-events:none}
 body[data-screen=board] #board .square:is(.last,.selected,.suggested){box-shadow:inset 0 0 0 100px #79efd393}
 body[data-screen=board] #board .piece{position:relative}
 body[data-screen=board] #board .square:hover:not(:disabled){filter:none}
}
