/* SkakKraken — page styles. Piece images are in pieces.css. */
:root { --light:#8a9aa8; --dark:#4b5a68; --bg:#121417; --panel:#1c1f23; --text:#e3e6ea; --muted:#8b939c;
        --accent:#6fb38a; --best:#6fdc8c; --consider:#e0a84f; --reply:#5aa9e6; --hint:#c792ea; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin:0; min-height:100vh; background:var(--bg); color:var(--text);
       font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
       display:flex; justify-content:center; align-items:flex-start; padding:24px; }

/* ---------- board colour themes ---------- */
body, body[data-theme="slate"] { --light:#8a9aa8; --dark:#4b5a68; --frame:transparent; }
body[data-theme="wood"]   { --light:#e8c896; --dark:#b2784a; --frame:#5c3a1e; }
body[data-theme="walnut"] { --light:#cfa274; --dark:#71452a; --frame:#3b2414; }
body[data-theme="green"]  { --light:#eeeed2; --dark:#769656; --frame:transparent; }
body[data-theme="blue"]   { --light:#dee3e6; --dark:#8ca2ad; --frame:transparent; }
body[data-theme="ice"]    { --light:#eaf3f8; --dark:#7fa6c0; --frame:transparent; }
body[data-theme="purple"] { --light:#e6dcf1; --dark:#8a6fb0; --frame:transparent; }
body[data-theme="bw"]     { --light:#f4f4f4; --dark:#6e6e6e; --frame:#111; }
body[data-theme="wood"] .sq, body[data-theme="walnut"] .sq {
  background-image:
    repeating-linear-gradient(var(--grain, 3deg), rgba(255,255,255,.07) 0 1px, transparent 1px 5px, rgba(0,0,0,.07) 5px 6px, transparent 6px 11px),
    radial-gradient(ellipse at var(--gx, 30%) 40%, rgba(0,0,0,.10), transparent 60%),
    linear-gradient(var(--grain, 3deg), rgba(0,0,0,.06), rgba(255,255,255,.05) 50%, rgba(0,0,0,.08));
}

/* ---------- splash ---------- */
#splash { position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center; cursor:pointer;
          background: rgba(6,9,11,.82); backdrop-filter: blur(6px);
          transition: opacity .7s ease, visibility .7s ease; }
#splash.hide { opacity:0; visibility:hidden; }
/* The splash card: width : height = 2 : 5 (swap --sw/--sh for a wide banner) */
.splash-card { --sw:2; --sh:5;
               height:min(92vh, calc(92vw * var(--sh) / var(--sw))); aspect-ratio: var(--sw) / var(--sh);
               position:relative; overflow:hidden; border-radius:18px; container-type:size;
               display:flex; flex-direction:column; align-items:center; justify-content:center;
               background: radial-gradient(ellipse 120% 60% at 50% 30%, #23574a 0%, #12302a 45%, #0a1513 85%);
               border:1px solid rgba(143,227,184,.25);
               box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 0 60px rgba(0,0,0,.35);
               animation: kCard .7s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes kCard { from { transform: scale(.85) translateY(30px); opacity:0; } to { transform:none; opacity:1; } }
.splash-inner { text-align:center; position:relative; z-index:1; width:100%; padding:0 6cqw; }
.splash-kraken { width:86cqw; margin:0 auto; animation: kRise 1.1s cubic-bezier(.2,.9,.25,1.2) .15s both; }
.splash-pieces { position:absolute; bottom:4cqh; left:0; right:0; display:flex; justify-content:center; gap:3cqw;
                 font-size:9cqw; color:rgba(190,240,215,.16); z-index:1; }
.splash-pieces span { animation: kBob 2.4s ease-in-out infinite; animation-delay: calc(var(--d, 0) * 1s); }
.splash-pieces span:nth-child(2) { --d:.2 } .splash-pieces span:nth-child(3) { --d:.4 } .splash-pieces span:nth-child(4) { --d:.6 }
.splash-pieces span:nth-child(5) { --d:.8 } .splash-pieces span:nth-child(6) { --d:1 }
@keyframes kBob { 50% { transform: translateY(-1.2cqh); color:rgba(190,240,215,.3); } }
.splash-kraken svg { width:100%; height:auto; display:block; overflow:visible; animation: kFloat 3.2s ease-in-out 1.1s infinite; }
#splash .k-left  { transform-origin: 86px 150px;  animation: kWaveL 1.3s ease-in-out infinite alternate; }
#splash .k-right { transform-origin: 170px 150px; animation: kWaveR 1.3s ease-in-out .65s infinite alternate; }
#splash .k-tL    { transform-origin: 104px 168px; animation: kWiggle 1.6s ease-in-out infinite alternate; }
#splash .k-tR    { transform-origin: 152px 168px; animation: kWiggle 1.6s ease-in-out .8s infinite alternate-reverse; }
#splash .k-pupils{ animation: kLook 2.6s ease-in-out infinite; }
.k-eyes { transform-origin: 128px 124px; animation: kBlink 5s infinite; }
@keyframes kRise   { from { transform: translateY(80px) scale(.5) rotate(-8deg); opacity:0; } to { transform:none; opacity:1; } }
@keyframes kFloat  { 50% { transform: translateY(-12px) rotate(1.5deg); } }
@keyframes kWaveL  { from { transform: rotate(-7deg); } to { transform: rotate(9deg); } }
@keyframes kWaveR  { from { transform: rotate(7deg); } to { transform: rotate(-9deg); } }
@keyframes kWiggle { from { transform: skewX(-7deg) rotate(-2deg); } to { transform: skewX(7deg) rotate(2deg); } }
@keyframes kLook   { 0%,20% { transform: translate(0,0); } 35%,55% { transform: translate(-5px,1px); } 70%,90% { transform: translate(4px,-1px); } 100% { transform: translate(0,0); } }
@keyframes kBlink  { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }
.splash-title { margin:4cqh 0 1cqh; font-size:14cqw; line-height:1.05; font-weight:800; letter-spacing:.5px; color:#e9f5ee; }
.splash-title span { display:inline-block; opacity:0; animation: kLetter .5s cubic-bezier(.2,.9,.3,1.4) both; animation-delay: calc(.55s + var(--i) * 55ms); }
.splash-title span.k { color:var(--accent); }
@keyframes kLetter { from { opacity:0; transform: translateY(26px) scale(.6); } to { opacity:1; transform:none; } }
.splash-by { color:#9fb8ac; font-size:5.2cqw; opacity:0; animation: kFade .6s ease 1.3s both; }
@keyframes kFade { to { opacity:1; } }
.splash-bar { width:64cqw; height:4px; margin:4.5cqh auto 0; border-radius:2px; background:rgba(255,255,255,.1); overflow:hidden; }
.splash-bar div { height:100%; width:0; background:linear-gradient(90deg, #4fae80, #8fe3b8); animation: kLoad 2.6s ease-in-out .2s forwards; }
@keyframes kLoad { to { width:100%; } }
.splash-skip { margin-top:2.2cqh; font-size:max(11px, 3.6cqw); color:#6f8a7e; opacity:0; animation: kFade .5s ease 1.8s both; }
.bubble { position:absolute; bottom:-40px; border-radius:50%; border:2px solid rgba(160,230,200,.35);
          background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(255,255,255,0) 60%);
          animation: kBubble linear infinite; }
@keyframes kBubble { from { transform: translate(0,0); opacity:0; } 10% { opacity:1; } to { transform: translate(var(--dx), -110cqh); opacity:.2; } }
@media (prefers-reduced-motion: reduce) { #splash *, .k-eyes { animation:none !important; opacity:1 !important; } .splash-bar div { width:100%; } }

/* ---------- about window ---------- */
.about-btn { margin-left:auto; align-self:center; font-size:13px; padding:6px 12px; border-radius:20px; }
.modal { position:fixed; inset:0; z-index:150; display:flex; align-items:center; justify-content:center; padding:16px;
         background:rgba(6,9,11,.78); backdrop-filter: blur(4px); }
.modal[hidden] { display:none; }
.modal-card { position:relative; width:min(680px, 100%); max-height:calc(100vh - 32px); overflow:auto; background:var(--panel);
              border:1px solid #2c3238; border-radius:14px; padding:22px 26px; box-shadow:0 30px 80px rgba(0,0,0,.6);
              font-size:14.5px; line-height:1.55; animation: kCard .35s cubic-bezier(.2,.9,.3,1.1) both; }
.modal-close { position:absolute; top:10px; right:12px; width:34px; height:34px; padding:0; border-radius:50%; font-size:22px; line-height:1; }
.about-head { display:flex; align-items:center; gap:14px; margin-bottom:6px; }
.about-logo { width:84px; height:84px; flex:none; } .about-logo svg { width:100%; height:100%; }
.about-head h2 { margin:0; font-size:24px; } .about-head h2 span { color:var(--accent); }
.modal-card h3 { margin:20px 0 6px; font-size:16px; color:var(--best); }
.modal-card p { margin:8px 0; }
.modal-card code { background:#15181b; padding:1px 6px; border-radius:4px; font-size:13px; }
.about-list { margin:6px 0; padding-left:20px; } .about-list li { margin:5px 0; }
.small { font-size:13px; }
.about-tiles { display:grid; grid-template-columns:repeat(3, 1fr); gap:10px; margin:12px 0; }
.tile { background:#15181b; border-radius:10px; padding:12px; text-align:center; }
.tile .big { font-size:22px; font-weight:800; color:var(--text); font-variant-numeric: tabular-nums; }
.about-bars { display:flex; flex-direction:column; gap:8px; margin:10px 0; }
.barrow { display:grid; grid-template-columns:130px 1fr 70px; align-items:center; gap:10px; font-size:13px; }
.barrow .sc { text-align:right; font-weight:700; }
.wdl { display:flex; height:22px; border-radius:5px; overflow:hidden; font-style:normal; }
.wdl i { display:flex; align-items:center; justify-content:center; font-style:normal; font-size:12px; font-weight:700; }
.wdl .w { background:#4fae80; color:#0b1a10; } .wdl .d { background:#8b939c; color:#111; } .wdl .l { background:#c25555; color:#fff; }
.games { margin-top:12px; background:#15181b; border-radius:10px; padding:10px 12px; }
.games summary { cursor:pointer; font-weight:600; }
.games-scroll { max-height:280px; overflow:auto; margin-top:8px; }
.games table { width:100%; border-collapse:collapse; font-size:12.5px; }
.games th, .games td { padding:4px 6px; text-align:left; border-bottom:1px solid #23282d; white-space:nowrap; }
.games th { position:sticky; top:0; background:#15181b; color:var(--muted); font-weight:600; }
.games td.op { white-space:normal; color:var(--muted); }
.games tr.win td.res { color:#6fdc8c; font-weight:700; } .games tr.loss td.res { color:#ff8a80; font-weight:700; } .games tr.draw td.res { color:#c9ced4; font-weight:700; }
.games .dl { display:inline-block; margin-top:10px; color:var(--best); text-decoration:none; font-weight:600; }
@media (max-width: 560px) { .about-tiles { grid-template-columns:1fr; } .barrow { grid-template-columns:1fr; } .modal-card { padding:18px; } }

/* ---------- player bars & clocks ---------- */
#boardCol { display:flex; flex-direction:column; }
.player { display:flex; align-items:center; justify-content:space-between; gap:10px; width:var(--board, 560px); height:40px; }
#plTop { margin-bottom:8px; } #plBot { margin-top:8px; }
.pname { display:flex; align-items:center; gap:8px; font-weight:600; font-size:15px; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pname .dotc { width:14px; height:14px; border-radius:50%; flex:none; border:2px solid #555; }
.pname .dotc.w { background:#f2f2f2; } .pname .dotc.b { background:#111; border-color:#888; }
.pname .tomove { color:var(--accent); font-size:12px; font-weight:500; }
.ptime { font-family: ui-monospace, Menlo, monospace; font-size:22px; font-weight:700; padding:4px 12px; border-radius:6px;
         background:#1c1f23; color:#9aa3ad; min-width:96px; text-align:right; transition: background .2s, color .2s; }
.ptime.on  { background:#e9ecef; color:#111; }
.ptime.low { background:#7a2222; color:#fff; }
.ptime.on.low { background:#d84040; color:#fff; }
.ptime.flag { background:#5a1d1d; color:#ffb3b3; }

.wrap { display:flex; gap:24px; flex-wrap:wrap; justify-content:center; }
.brand { display:flex; align-items:center; gap:10px; margin:0 0 12px; }
.brand .logo { width:72px; height:72px; margin:-6px 0 -6px -6px; }
.brand .logo svg { width:100%; height:100%; display:block; }
.brand h1 { margin:0; line-height:1.1; font-size:26px; font-weight:700; letter-spacing:.3px; }
.brand h1 span { color:var(--accent); }
.brand small { display:block; color:var(--muted); font-size:13px; margin-top:2px; }

#boardWrap { position:relative; width:var(--board, 560px); height:var(--board, 560px); border-radius:4px; overflow:hidden;
             box-shadow:0 0 0 6px var(--frame), 0 12px 34px rgba(0,0,0,.55); }
#board { position:absolute; inset:0; display:grid; grid-template-columns:repeat(8,1fr); grid-template-rows:repeat(8,1fr);
         user-select:none; -webkit-user-select:none; touch-action:none; }
#arrows { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:3; }
#anim { position:absolute; inset:0; pointer-events:none; z-index:4; }
.sq { position:relative; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.sq.l { background:var(--light); } .sq.d { background:var(--dark); }
.sq.last::after { content:''; position:absolute; inset:0; background:rgba(255,228,60,.36); pointer-events:none; }
.sq.sel { box-shadow: inset 0 0 0 4px var(--accent); }
.sq.hover { box-shadow: inset 0 0 0 4px rgba(255,255,255,.6); }
.sq.check { background: radial-gradient(circle, #ff3b3b 0%, #e02020 35%, transparent 75%) !important; }
.sq .dot { position:absolute; width:28%; height:28%; border-radius:50%; background:rgba(10,20,30,.45); z-index:2; }
.sq .ring { position:absolute; inset:4%; border-radius:50%; border:5px solid rgba(10,20,30,.45); z-index:2; }
.pc { position:relative; z-index:1; display:block; width:88%; height:88%; background-size:contain; pointer-events:none;
      background-repeat:no-repeat; background-position:center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.floater { position:absolute; width:12.5%; height:12.5%; display:flex; align-items:center; justify-content:center; }
.ghost { position:fixed; left:0; top:0; pointer-events:none; z-index:400; display:flex; align-items:center; justify-content:center; }
.ghost .pc { width:100%; height:100%; filter: drop-shadow(0 8px 8px rgba(0,0,0,.55)); }
.coord { position:absolute; font-size:max(9px, calc(var(--board, 560px) / 48)); font-weight:700; opacity:.8; z-index:0; }
.coord.f { right:3px; bottom:2px; } .coord.r { left:3px; top:2px; }
.sq.l .coord { color:var(--dark); } .sq.d .coord { color:var(--light); }

.side { width:min(88vw, 330px); background:var(--panel); border-radius:8px; padding:16px; display:flex; flex-direction:column; gap:14px; }
#status { font-size:16px; font-weight:600; padding:10px 12px; border-radius:6px; background:#262a2f; }
#status.over { background:#3a3220; color:#f0c96a; }
#status.thinking { color:var(--consider); }
#status.hint { color:var(--hint); }
label { font-size:13px; color:var(--muted); display:block; margin-bottom:4px; }
select, button { font:inherit; font-size:14px; padding:8px 10px; border-radius:6px; border:1px solid #353a41;
                 background:#15181b; color:var(--text); }
button { cursor:pointer; background:#2a2f35; } button:hover:not(:disabled) { background:#363c43; }
button:disabled { opacity:.45; cursor:default; }
button.primary { background:var(--accent); color:#0b1a10; border-color:transparent; font-weight:600; }
.row { display:flex; gap:8px; } .row > * { flex:1; min-width:0; } .row select { width:100%; }
.chk { display:flex; align-items:center; gap:8px; color:var(--text); font-size:13px; margin:0; cursor:pointer; }
.chk.off { opacity:.45; cursor:default; }
.toggles { display:flex; flex-direction:column; gap:6px; }
input[type=text], input[type=number] { font:inherit; font-size:14px; padding:8px 10px; border-radius:6px; border:1px solid #353a41;
                 background:#15181b; color:var(--text); width:100%; min-width:0; }
#fen { font-family: ui-monospace, Menlo, monospace; font-size:12px; }
.fenrow { display:flex; gap:6px; } .fenrow input { flex:1; } .fenrow button { flex:none; padding:8px 10px; }
.n960row { display:flex; gap:6px; } .n960row button { flex:none; padding:8px 10px; }
#opening { font-size:13px; color:var(--best); min-height:18px; }
#status.error { color:#ff8a80; background:#3a2324; }

.think { background:#15181b; border-radius:6px; padding:10px; display:flex; flex-direction:column; gap:8px; font-size:13px; }
.think-head { display:flex; justify-content:space-between; font-weight:600; }
.think-head span:last-child { color:var(--muted); font-weight:400; }
.evalrow { display:flex; align-items:center; gap:10px; }
.evalbar { position:relative; flex:1; height:14px; border-radius:4px; background:#2b3036; overflow:hidden; }
#evalFill { position:absolute; left:0; top:0; bottom:0; width:50%; background:#e9ecef; transition: width .35s ease; }
#evalTxt { min-width:58px; text-align:right; font-weight:700; font-family: ui-monospace, Menlo, monospace; }
.consider { min-height:18px; } .consider b { color:var(--consider); }
.muted { color:var(--muted); }
#tPV { font-family: ui-monospace, Menlo, monospace; color:var(--best); line-height:1.5; min-height:18px; }
.cands { display:flex; flex-direction:column; gap:2px; font-family: ui-monospace, Menlo, monospace; }
.cand { display:flex; justify-content:space-between; padding:2px 6px; border-radius:4px; }
.cand.top { background:rgba(111,220,140,.12); color:var(--best); }
.stats { color:var(--muted); font-size:12px; }

#moves { background:#15181b; border-radius:6px; padding:8px; height:170px; overflow:auto; font-family: ui-monospace, Menlo, monospace; font-size:13px; }
#moves .mv { display:grid; grid-template-columns:32px 1fr 1fr; padding:2px 4px; }
#moves .mv:nth-child(odd) { background:#1a1e22; }
#moves .n { opacity:.5; }
#promo { position:fixed; inset:0; background:rgba(0,0,0,.55); display:none; align-items:center; justify-content:center; z-index:60; }
#promo .box { background:var(--panel); padding:16px; border-radius:10px; display:flex; gap:10px; }
#promo button { width:72px; height:72px; padding:6px; background:var(--light); display:flex; align-items:center; justify-content:center; }
#promo button .pc { width:100%; height:100%; }

/* ---------- move navigation, analysis, PGN ---------- */
.moves-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:4px; }
.moves-head label { margin:0; }
.navbtns { display:flex; gap:4px; }
.navbtns button { padding:3px 9px; font-size:13px; line-height:1.3; }
#moves .mv span.m { cursor:pointer; border-radius:3px; padding:0 4px; justify-self:start; }
#moves .mv span.m:hover { background:#2a3036; }
#moves .mv span.m.cur { background:var(--accent); color:#0b1a10; font-weight:700; }
#moves .mv span.m.var { color:var(--hint); font-style:italic; }
#moves .mv span.m.var.cur { background:var(--hint); color:#1a1024; }
.anbar { background:#241f35; border:1px solid #4e4278; border-radius:6px; padding:8px 10px; display:flex; flex-direction:column; gap:8px; font-size:13.5px; }
.anbar[hidden] { display:none; }
#anInfo b { color:var(--hint); }
#pgnText { width:100%; height:min(42vh, 320px); resize:vertical; font-family: ui-monospace, Menlo, monospace; font-size:12.5px;
           background:#15181b; color:var(--text); border:1px solid #353a41; border-radius:6px; padding:8px; }
#pgnMsg.err { color:#ff8a80; } #pgnMsg.ok { color:var(--best); }
#openingPick { font-size:13px; }

/* ======================================================================
   Phones & tablets
   body.compact is set by fitBoard() when the panel sits below the board.
   ====================================================================== */
html { -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; }
#board, #boardWrap { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right));
       padding-top: max(24px, env(safe-area-inset-top)); }
.ghost.touch .pc { filter: drop-shadow(0 14px 12px rgba(0,0,0,.6)); }
.sq.hover.touch { box-shadow: inset 0 0 0 6px rgba(255,255,255,.75); }

.sheet-head { display:none; }
#mbar, #sheetBackdrop { display:none; }

@media (pointer: coarse) {
  button, select, input[type=text], input[type=number] { min-height: 42px; }
  .navbtns button { min-height: 36px; padding: 4px 12px; }
  #moves .mv span.m { padding: 2px 6px; }
  .chk input { width: 20px; height: 20px; }
}

body.compact { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) calc(76px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
body.compact .wrap { gap: 14px; width: 100%; }
body.compact .brand { margin-bottom: 6px; }
body.compact .brand .logo { width: 46px; height: 46px; margin: -4px 0 -4px -4px; }
body.compact .brand h1 { font-size: 20px; }
body.compact .brand small { font-size: 11.5px; }
body.compact .about-btn .lbl { display: none; }
body.compact .about-btn { width: 40px; padding: 6px 0; }
body.compact .player { height: 34px; }
body.compact #plTop { margin-bottom: 6px; } body.compact #plBot { margin-top: 6px; }
body.compact .ptime { font-size: 19px; min-width: 84px; padding: 3px 10px; }
body.compact .pname { font-size: 14px; }
body.compact .side { width: 100%; max-width: 640px; padding: 12px; }
body.compact #actRow { display: none; }                 /* hint & undo live in the bottom bar */
body.compact #moves { height: 140px; }
body.compact input, body.compact select, body.compact textarea { font-size: 16px; }   /* stops iOS zooming in */

/* bottom action bar */
body.compact #mbar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 110;
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(22,25,29,.96); backdrop-filter: blur(8px); border-top: 1px solid #2c3238; }
#mbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px 0; min-height: 52px;
  background: transparent; border: none; border-radius: 10px; color: var(--text); }
#mbar button:active:not(:disabled) { background: #2a2f35; }
#mbar button span { font-size: 21px; line-height: 1.1; }
#mbar button small { font-size: 10.5px; color: var(--muted); }
#mbar button:disabled { opacity: .35; }

/* settings become a slide-up sheet */
body.compact #settings { position: fixed; left: 0; right: 0; bottom: 0; z-index: 130; max-height: 86vh; overflow: auto;
  background: var(--panel); border-radius: 18px 18px 0 0; border-top: 1px solid #353a41; box-shadow: 0 -20px 50px rgba(0,0,0,.5);
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); visibility: hidden; }
body.compact.sheet-open #settings { transform: none; visibility: visible; }
body.compact .sheet-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -8px; background: var(--panel);
  padding: 10px 0 6px; z-index: 1; }
body.compact .sheet-head b { font-size: 17px; }
body.compact .sheet-head::before { content: ''; position: absolute; left: 50%; top: 2px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #444b53; }
.sheet-head button { width: 38px; height: 38px; min-height: 0; padding: 0; border-radius: 50%; font-size: 22px; }
body.compact.sheet-open #sheetBackdrop { display: block; position: fixed; inset: 0; z-index: 125; background: rgba(0,0,0,.5); }

/* modals fill a phone screen */
@media (max-width: 560px) {
  .modal { padding: 0; }
  .modal-card { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; padding: max(16px, env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
}

/* ---------- side panel: collapsible sections, fits the window ---------- */
.sec { border-top: 1px solid #2a2f35; padding-top: 6px; display: flex; flex-direction: column; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
.sec-t { background: none; border: none; padding: 4px 0; min-height: 0; display: flex; align-items: center; gap: 6px; cursor: pointer;
         font-size: 12.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.sec-t:hover:not(:disabled) { background: none; color: var(--text); }
.sec-t .chev { display: inline-block; transition: transform .2s; font-size: 11px; }
.sec.collapsed .sec-t .chev { transform: rotate(-90deg); }
.sec.collapsed .sec-b { display: none; }
.sec-b { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.sec-meta { color: var(--muted); font-size: 12px; }
.sec.collapsed .sec-h .navbtns { display: none; }
#actRow button { padding-left: 4px; padding-right: 4px; white-space: nowrap; }
.compact-only { display: none; }
#secMoves .row { margin-top: 0; }

body:not(.compact) .side { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; gap: 10px; }
body:not(.compact) #secMoves:not(.collapsed) { flex: 1 1 auto; min-height: 200px; }
body:not(.compact) #secMoves:not(.collapsed) .sec-b { flex: 1; min-height: 0; }
body:not(.compact) #moves { flex: 1 1 auto; height: auto; min-height: 90px; }
.side { scrollbar-width: thin; }

/* phones: settings live in the slide-up sheet, so their section header goes away */
body.compact #secSettings { border-top: none; padding: 0; }
body.compact #secSettings > .sec-h { display: none; }
body.compact #secSettings > .sec-b { display: flex !important; margin: 0; }
body.compact .bar-dup { display: none; }
body.compact .compact-only { display: block; }
body.compact .side { gap: 10px; }

/* phone in landscape: board left, panel right, action bar down the right edge */
body.compact.land { padding: max(8px, env(safe-area-inset-top)) calc(80px + env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); }
body.compact.land .brand { display: none; }
body.compact.land .wrap { flex-wrap: nowrap; align-items: flex-start; gap: 12px; }
body.compact.land .side { flex: 1; min-width: 250px; max-height: calc(100vh - 16px); overflow: auto; position: sticky; top: 8px; }
body.compact.land #mbar { grid-template-columns: 1fr; grid-auto-rows: 1fr; top: 0; bottom: 0; left: auto; right: 0; width: 74px;
  border-top: none; border-left: 1px solid #2c3238;
  padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) 6px; }
body.compact.land #mbar button { min-height: 0; }
body.compact.land #settings { left: auto; right: 80px; width: min(420px, 70vw); max-height: 100vh; border-radius: 18px 0 0 0; }

/* help section in the about window */
.help-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 8px 0; }
.help-grid > div { background:#15181b; border-radius:10px; padding:10px 12px; font-size:13.5px; }
.help-grid ul { margin:6px 0 0; padding-left:18px; } .help-grid li { margin:3px 0; }
kbd { background:#2a2f35; border:1px solid #3a4047; border-bottom-width:2px; border-radius:4px; padding:0 5px; font-size:12px; font-family: ui-monospace, Menlo, monospace; }
@media (max-width: 640px) { .help-grid { grid-template-columns: 1fr; } }

@media (max-width: 560px) {
  .about-head { padding-right: 40px; }
  .about-logo { width: 58px; height: 58px; }
  .about-head h2 { font-size: 20px; }
}

/* ---------- clearer section headers ---------- */
.sec { border-top: none; padding-top: 0; }
.sec-h { background: #262b31; border: 1px solid #343a42; border-left: 3px solid #3b4249; border-radius: 8px;
         padding: 2px 6px 2px 4px; min-height: 36px; transition: background .15s, border-color .15s; }
.sec:not(.collapsed) > .sec-h { border-left-color: var(--accent); }
.sec-h:hover { background: #2e343b; border-color: #46505a; }
.sec-t { flex: 1; align-self: stretch; padding: 6px 4px; font-size: 13px; color: #d4dae0; letter-spacing: .5px; }
.sec-t:hover:not(:disabled) { color: #fff; }
.sec-t .chev { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
               background: #1b1f23; color: var(--accent); font-size: 10px; flex: none; }
.sec.collapsed > .sec-h { background: #22272c; }
.sec.collapsed > .sec-h .sec-t { color: #b9c1c9; }
.sec.collapsed > .sec-h::after { content: 'show'; font-size: 11px; color: var(--muted); padding-right: 6px; }
.sec-meta { padding-right: 6px; }
.sec-b { margin-top: 10px; }

/* ---------- modes (Play / Daily puzzle / Puzzles) ---------- */
.brand { flex-wrap: wrap; }
.modes { display:flex; gap:4px; margin-left:auto; background:#1a1d21; border:1px solid #2c3238; border-radius:22px; padding:3px; }
.modes button { border:none; background:transparent; border-radius:18px; padding:6px 12px; font-size:13px; color:#b9c1c9; min-height:0; white-space:nowrap; }
.modes button:hover:not(:disabled) { background:#262b31; color:#fff; }
.modes button.on { background:var(--accent); color:#0b1a10; font-weight:700; }
.brand .about-btn { margin-left: 8px; }
body.compact .modes { order: 5; width: 100%; margin: 8px 0 0; justify-content: space-between; }
body.compact .modes button { flex: 1; padding: 8px 4px; font-size: 13px; }
body.compact .brand { align-items: center; }
body.compact .brand .about-btn { margin-left: auto; }
body.compact.land .modes { display: none; }

body:not(.ctx-puzzle) #secPuzzle { display:none; }
body.ctx-puzzle #secSettings, body.ctx-puzzle #secThink, body.ctx-puzzle #undoBtn, body.ctx-puzzle #swapBtn,
body.ctx-puzzle #opening, body.ctx-puzzle #mbar [data-act="undo"] { display:none !important; }
body.ctx-puzzle #mbar { grid-template-columns: repeat(5, 1fr); }
body:not([data-mode="random"]) #pzFilters { display:none; }

.pzprogress { display:flex; gap:6px; align-items:center; }
.pzprogress i { width:22px; height:8px; border-radius:4px; background:#2f353c; }
.pzprogress i.done { background:var(--accent); }
.pzprogress i.bad { background:#c25555; }
.pzprogress span { margin-left:6px; font-size:12.5px; color:var(--muted); }
.pzresult { font-size:13.5px; line-height:1.5; }
.pzresult:empty { display:none; }
.pzresult .ok { color:var(--best); font-weight:700; } .pzresult .meh { color:#e0c070; font-weight:700; } .pzresult .no { color:#ff8a80; font-weight:700; }
.pzresult a { color:var(--best); }
.chips { display:flex; flex-wrap:wrap; gap:4px; margin:6px 0; }
.chips span { background:#2a2f35; border-radius:10px; padding:1px 8px; font-size:12px; color:#c9ced4; }
.pzstats { font-size:12.5px; color:var(--muted); line-height:1.6; background:#15181b; border-radius:8px; padding:8px 10px; }
.pzstats b { color:var(--text); }
#status.ok { color:var(--best); background:#1f2e25; }
#boardWrap.solved { animation: kSolved 1.3s ease; }
@keyframes kSolved { 0% { box-shadow: 0 0 0 6px var(--frame), 0 0 0 0 rgba(111,220,140,.0); }
  35% { box-shadow: 0 0 0 6px var(--frame), 0 0 0 14px rgba(111,220,140,.55); } 100% { box-shadow: 0 0 0 6px var(--frame), 0 12px 34px rgba(0,0,0,.55); } }

/* ---------- the header kraken: slow, gentle idle animation with rising bubbles ---------- */
.brand .logo { position: relative; }
.brand .logo svg { animation: lgFloat 6s ease-in-out infinite; overflow: visible; }
.brand .k-left  { transform-origin: 86px 150px;  animation: lgWaveL 3.8s ease-in-out infinite alternate; }
.brand .k-right { transform-origin: 170px 150px; animation: lgWaveR 4.4s ease-in-out infinite alternate; }
.brand .k-tL    { transform-origin: 104px 168px; animation: lgWiggle 3.4s ease-in-out infinite alternate; }
.brand .k-tR    { transform-origin: 152px 168px; animation: lgWiggle 3.4s ease-in-out 1.7s infinite alternate-reverse; }
@keyframes lgFloat  { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 25% { transform: translate(1px, -3px) rotate(2deg); }
                      50% { transform: translate(0, -5px) rotate(0deg); } 75% { transform: translate(-1px, -3px) rotate(-2deg); } }
@keyframes lgWaveL  { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
@keyframes lgWaveR  { from { transform: rotate(8deg); } to { transform: rotate(-8deg); } }
@keyframes lgWiggle { from { transform: skewX(-7deg) rotate(-2deg); } to { transform: skewX(7deg) rotate(2deg); } }
.lbub { position: absolute; left: var(--x); bottom: 38%; width: var(--s); height: var(--s); border-radius: 50%; pointer-events: none;
        border: 1px solid rgba(160, 230, 200, .55); background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.45), rgba(255,255,255,0) 65%);
        opacity: 0; animation: lgBubble var(--t, 9s) ease-in var(--d) infinite; }
@keyframes lgBubble { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 8% { opacity: .8; }
                      25% { transform: translate(var(--w), -18px) scale(.85); } 50% { transform: translate(calc(var(--w) * -1), -38px) scale(1); }
                      75% { transform: translate(var(--w), -58px) scale(1.05); opacity: .5; } 100% { transform: translate(0, -80px) scale(1.15); opacity: 0; } }
.sf-logo { width: 22px; height: 22px; vertical-align: -5px; margin-right: 6px; border-radius: 5px; }
@media (prefers-reduced-motion: reduce) { .brand .logo svg, .brand .k-left, .brand .k-right, .brand .k-tL, .brand .k-tR, .lbub { animation: none !important; } .lbub { display: none; } }

.levels { width:100%; border-collapse:collapse; font-size:13px; margin:6px 0 10px; }
.levels th, .levels td { text-align:left; padding:4px 8px; border-bottom:1px solid #2a2f35; }
.levels th { color:var(--muted); font-weight:600; } .levels td:nth-child(2) { font-weight:700; font-variant-numeric: tabular-nums; }
#aiOpts { flex-wrap: wrap; row-gap: 6px; }

/* ---------------- accounts ---------------- */
.acct-btn.in { border-color: var(--best); color: var(--best); }
.acct-card-wrap { width: min(560px, 100%); }
.acct-card-wrap h2 { margin: 0 40px 12px 0; font-size: 20px; }
.acct-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.acct-tabs button { border-radius: 20px; padding: 6px 14px; font-size: 13px; }
.acct-tabs button.on { background: var(--best); color: #10251a; border-color: var(--best); font-weight: 600; }
.acct-form { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.acct-form label:not(.chk) { font-size: 12px; color: var(--muted, #9aa3ab); margin-top: 4px; }
.acct-form input[type=text], .acct-form input[type=email], .acct-form input[type=password] { width: 100%; padding: 9px 10px; font-size: 15px; }
.acct-form button { margin-top: 8px; align-self: flex-start; padding: 8px 18px; }
.acct-form a { align-self: flex-start; color: var(--best); }
.acct-msg { min-height: 18px; font-size: 13px; }
.acct-msg.err { color: #ff8a80; } .acct-msg.ok { color: var(--best); }
.acct-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.acct-name { font-size: 18px; font-weight: 700; }
.acct-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.acct-stats div { text-align: center; background: rgba(0,0,0,.18); border-radius: 10px; padding: 8px 4px; }
.acct-stats b { display: block; font-size: 20px; color: var(--best); }
.acct-stats span { font-size: 11px; color: var(--muted, #9aa3ab); }
.acct-sec { border-top: 1px solid rgba(255,255,255,.08); padding: 8px 0; }
.acct-sec summary, .acct-privacy summary { cursor: pointer; font-size: 14px; }
.acct-sec.danger summary { color: #ff8a80; }
button.danger { background: #5a2326; border-color: #8a3a3e; color: #ffd6d3; }
.acct-privacy { margin-top: 10px; font-size: 13px; }
.acct-privacy p { color: var(--muted, #9aa3ab); }
.acct-games { width: 100%; border-collapse: collapse; font-size: 13px; }
.acct-games th { text-align: left; font-weight: 600; color: var(--muted, #9aa3ab); padding: 4px; border-bottom: 1px solid rgba(255,255,255,.1); }
.acct-games td { padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: top; }
.acct-games td.res { white-space: nowrap; font-weight: 600; }
.acct-games td.acts { white-space: nowrap; text-align: right; }
.acct-games td.acts button { padding: 3px 7px; margin-left: 3px; font-size: 13px; }
.acct-boards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.acct-boards h4 { margin: 0 0 6px; font-size: 14px; }
.acct-board { margin: 0; padding-left: 22px; font-size: 13px; }
.acct-board li { padding: 3px 0; } .acct-board li span { display: inline-block; min-width: 50%; }
.acct-board li.me { color: var(--best); font-weight: 600; }
@media (max-width: 560px) { .acct-boards { grid-template-columns: 1fr; } .acct-stats { grid-template-columns: repeat(2, 1fr); } }
body.compact .acct-btn .lbl { display: none; }
body.compact .acct-btn { width: 40px; padding: 6px 0; }
body.compact .brand .acct-btn { margin-left: auto; }
body.compact .brand .acct-btn + .about-btn { margin-left: 6px; }

/* ---------------- online games ---------------- */
body:not(.ctx-online) #secOnline { display:none; }
body.ctx-online #secSettings, body.ctx-online #secThink, body.ctx-online #secPuzzle, body.ctx-online #undoBtn, body.ctx-online #swapBtn,
body.ctx-online #hintBtn, body.ctx-online #anAdopt, body.ctx-online #pgnImport, body.ctx-online #pgnFile,
body.ctx-online #mbar [data-act="undo"], body.ctx-online #mbar [data-act="hint"] { display:none !important; }
body.ctx-online.og-live #analyseBtn, body.ctx-online.og-live #mbar [data-act="analyse"] { display:none !important; }
body.ctx-online #mbar { grid-template-columns: repeat(4, 1fr); }
body.ctx-online.og-live #mbar { grid-template-columns: repeat(3, 1fr); }
.og-form { display:grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.og-form label { font-size: 12px; color: var(--muted, #9aa3ab); display:block; margin-bottom: 3px; }
.og-form select, .og-form input[type=text] { width: 100%; }
.og-form .full { grid-column: 1 / -1; }
#ogBody h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #9aa3ab); }
#ogBody .primary { width: 100%; margin-top: 10px; }
.og-list { list-style: none; margin: 0; padding: 0; }
.og-list li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; background: rgba(255,255,255,.03); margin-bottom: 5px; font-size: 13px; }
.og-list li .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.og-list li .tc { color: var(--muted, #9aa3ab); white-space: nowrap; }
.og-list li.turn { box-shadow: inset 3px 0 0 var(--best); }
.og-list li button { padding: 4px 12px; font-size: 13px; }
.og-link { display: flex; gap: 6px; margin: 8px 0; }
.og-link input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 13px; }
.og-wait { display:flex; align-items:center; gap:10px; margin: 10px 0; color: var(--consider); }
.og-wait .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--consider); animation: ogpulse 1.4s infinite; }
@keyframes ogpulse { 0%,100% { opacity: .25 } 50% { opacity: 1 } }
.og-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.og-acts button { flex: 1 1 auto; }
.og-note { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.04); margin-top: 8px; }
.og-note.offer { background: #24302a; color: var(--best); }
.og-note.warn { background: #3a3220; color: #f0c96a; }
.og-pres { font-size: 12px; color: var(--muted, #9aa3ab); }
.og-pres .on { color: var(--best); } .og-pres .off { color: #f0c96a; }
.player .og-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-left:6px; vertical-align: middle; background:#666; }
.player .og-dot.on { background: var(--best); }
body.ctx-online.og-none #secMoves, body.ctx-online.og-none #secPos, body.ctx-online.og-none #mbar [data-act="analyse"],
body.ctx-online.og-none #mbar [data-act="prev"], body.ctx-online.og-none #mbar [data-act="next"] { display:none !important; }
body.ctx-online.og-none #mbar { grid-template-columns: 1fr; }
details.history { margin: 14px 0; padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); }
details.history > summary { cursor: pointer; }
details.history h4 { margin: 16px 0 6px; font-size: 15px; color: var(--best); }

/* ---------------- light page (body[data-ui="light"]) ---------------- */
.ui-btn { padding: 6px 10px; }
body[data-ui="light"] { --bg:#eef1f4; --panel:#ffffff; --text:#1d2329; --muted:#66707a; --accent:#3f9a68; --best:#1f8a4c;
  --consider:#b26b00; --reply:#2470b3; --hint:#8a4fc1; color-scheme: light; }
body[data-ui="light"] .modal-card { border-color:#d9dee3; box-shadow:0 30px 80px rgba(0,0,0,.25); }
body[data-ui="light"] .modal-card code, body[data-ui="light"] .tile, body[data-ui="light"] .games, body[data-ui="light"] .games th,
body[data-ui="light"] .help-grid > div, body[data-ui="light"] .think, body[data-ui="light"] #moves, body[data-ui="light"] .pzstats,
body[data-ui="light"] #pgnText { background:#f2f4f6; }
body[data-ui="light"] .games th, body[data-ui="light"] .games td, body[data-ui="light"] .levels th, body[data-ui="light"] .levels td { border-bottom-color:#e1e5e9; }
body[data-ui="light"] .games tr.draw td.res { color:#555; } body[data-ui="light"] .games tr.loss td.res { color:#c0392b; }
body[data-ui="light"] .ptime { background:#e4e8ec; color:#3a424a; }
body[data-ui="light"] .ptime.on { background:#1d2329; color:#fff; }
body[data-ui="light"] .ptime.low { background:#f6c9c9; color:#7a1010; } body[data-ui="light"] .ptime.on.low { background:#d84040; color:#fff; }
body[data-ui="light"] .pname .dotc { border-color:#8a939c; } body[data-ui="light"] .pname .dotc.w { background:#fff; }
body[data-ui="light"] #status { background:#e6eaee; }
body[data-ui="light"] #status.over { background:#fbefd2; color:#7a5100; }
body[data-ui="light"] #status.error { background:#fde4e2; color:#a8261d; }
body[data-ui="light"] #status.ok { background:#dff2e6; color:#17703e; }
body[data-ui="light"] select, body[data-ui="light"] input[type=text], body[data-ui="light"] input[type=number],
body[data-ui="light"] input[type=email], body[data-ui="light"] input[type=password], body[data-ui="light"] textarea { background:#fff; border-color:#cdd3d9; color:var(--text); }
body[data-ui="light"] button { background:#e9edf1; border-color:#cdd3d9; color:var(--text); }
body[data-ui="light"] button:hover:not(:disabled) { background:#dde3e8; }
body[data-ui="light"] button.primary { background:var(--accent); color:#fff; border-color:transparent; }
body[data-ui="light"] button.primary:hover:not(:disabled) { background:#358a5b; }
body[data-ui="light"] .cand.top { background:rgba(31,138,76,.12); }
body[data-ui="light"] .evalbar { background:#3a4048; box-shadow: inset 0 0 0 1px #c9cfd5; }
body[data-ui="light"] #evalFill { background:#fff; }
body[data-ui="light"] #moves .mv:nth-child(odd) { background:#e8ebee; }
body[data-ui="light"] #moves .mv span.m:hover { background:#d9dfe4; }
body[data-ui="light"] #moves .mv span.m.cur { color:#fff; }
body[data-ui="light"] .anbar { background:#f1ecfb; border-color:#cbbbee; }
body[data-ui="light"] #mbar { background:rgba(255,255,255,.96); border-top-color:#dde2e6; }
body[data-ui="light"] #mbar button { background:transparent; border-color:transparent; }
body[data-ui="light"] #mbar button:active:not(:disabled) { background:#e9edf1; }
body[data-ui="light"].compact #settings { border-top-color:#d0d6dc; box-shadow:0 -20px 50px rgba(0,0,0,.18); }
body[data-ui="light"].compact .sheet-head::before { background:#c3c9cf; }
body[data-ui="light"] .sec { border-top-color:#e3e7eb; }
body[data-ui="light"].compact.land #mbar { border-left-color:#dde2e6; }
body[data-ui="light"] kbd { background:#eef1f4; border-color:#cdd3d9; }
body[data-ui="light"] .sec-h { background:#eef1f4; border-color:#d9dee3; border-left-color:#c3cad1; }
body[data-ui="light"] .sec-h:hover { background:#e5e9ed; border-color:#c9d0d6; }
body[data-ui="light"] .sec-t { color:#2a3138; } body[data-ui="light"] .sec-t:hover:not(:disabled) { color:#000; }
body[data-ui="light"] .sec-t .chev { background:#fff; }
body[data-ui="light"] .sec-h button, body[data-ui="light"] .sec-t { background:transparent; border-color:transparent; }
body[data-ui="light"] .sec.collapsed > .sec-h { background:#f3f5f7; } body[data-ui="light"] .sec.collapsed > .sec-h .sec-t { color:#4a535c; }
body[data-ui="light"] .modes { background:#e3e8ec; border-color:#d3d9de; }
body[data-ui="light"] .modes button { background:transparent; color:#4a535c; border-color:transparent; }
body[data-ui="light"] .modes button:hover:not(:disabled) { background:#d6dce1; color:#000; }
body[data-ui="light"] .modes button.on { background:var(--accent); color:#fff; }
body[data-ui="light"] .pzprogress i { background:#d6dbe0; }
body[data-ui="light"] .chips span { background:#e6eaee; color:#3a424a; }
body[data-ui="light"] .pzresult .meh { color:#9a6b00; } body[data-ui="light"] .pzresult .no { color:#c0392b; }
body[data-ui="light"] .acct-card, body[data-ui="light"] details.history { background:rgba(0,0,0,.025); border-color:rgba(0,0,0,.08); }
body[data-ui="light"] .acct-stats div { background:rgba(0,0,0,.045); }
body[data-ui="light"] .acct-sec { border-top-color:rgba(0,0,0,.08); }
body[data-ui="light"] .acct-games th, body[data-ui="light"] .acct-games td { border-bottom-color:rgba(0,0,0,.07); }
body[data-ui="light"] .acct-msg.err, body[data-ui="light"] #pgnMsg.err, body[data-ui="light"] .acct-sec.danger summary { color:#c0392b; }
body[data-ui="light"] button.danger { background:#fde4e2; border-color:#f0b3ae; color:#a8261d; }
body[data-ui="light"] .acct-tabs button.on { color:#fff; }
body[data-ui="light"] .og-list li, body[data-ui="light"] .og-note { background:rgba(0,0,0,.04); }
body[data-ui="light"] .og-note.offer { background:#dff2e6; } body[data-ui="light"] .og-note.warn { background:#fbefd2; color:#7a5100; }
body[data-ui="light"] .og-pres .off { color:#9a6b00; }

body.compact .ui-btn { width: 40px; padding: 6px 0; }
body.compact .brand .ui-btn, body.compact .brand .acct-btn + .ui-btn { margin-left: 6px; }
@media (max-width: 400px) { body.compact .brand .about-btn { width: 36px; height: 36px; } body.compact .brand h1 { font-size: 18px; } }
@media (max-width: 380px) { body.compact .brand small { font-size: 10px; } body.compact .brand .about-btn { width: 34px; height: 34px; margin-left: 4px; }
  body.compact .brand .logo { width: 40px; height: 40px; } }
body.compact .brand { column-gap: 6px; }
body.compact .brand .ui-btn, body.compact .brand .acct-btn + .ui-btn, body.compact .brand .ui-btn + .about-btn { margin-left: 0; }

/* ---------------- position editor ---------------- */
.ed-card { width: min(760px, 100%); }
.ed-wrap { display: flex; gap: 16px; flex-wrap: wrap; }
.ed-left { flex: 1 1 340px; min-width: 260px; max-width: 440px; }
.ed-right { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; }
.ed-right > label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.ed-board { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; width: 100%; border-radius: 4px; overflow: hidden;
            box-shadow: 0 0 0 4px var(--frame, transparent); touch-action: none; user-select: none; }
.ed-board .sq { cursor: crosshair; }
.ed-board .sq .pc { width: 90%; height: 90%; }
.ed-board .sq.unsure::after { content: '?'; position: absolute; right: 2px; top: 0; font-size: 11px; font-weight: 800; color: #ff5a3c; z-index: 3; }
.ed-palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 6px 0; }
.ed-palette button { aspect-ratio: 1; padding: 2px; display: flex; align-items: center; justify-content: center; touch-action: none; }
.ed-palette button .pc { width: 100%; height: 100%; }
.ed-palette button.on { background: var(--accent); }
.ed-tools { display: flex; gap: 6px; } .ed-tools button { flex: 1; } .ed-tools button.on { background: var(--accent); color: #0b1a10; border-color: transparent; }
.ed-castle { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; font-size: 13px; }
.ed-castle .chk.off { opacity: .4; }
#edMsg.err { color: #ff8a80; } #edMsg.ok { color: var(--best); }
body[data-ui="light"] #edMsg.err { color: #c0392b; }

body.compact .modes .long { display: none; }
body.compact .modes button { padding: 6px 9px; }
