/* ---------- Themes (from mockups/mockup.html) ---------- */
.t-wood {
  --font-ui: 'Lora', Georgia, serif; --font-title: 'Cormorant Garamond', Georgia, serif;
  --bg: radial-gradient(ellipse at 30% 20%, #4a3020 0%, #2a1a10 55%, #1c110a 100%); --bg-flat: #2a1a10;
  --text: #f3e6cc; --muted: #c9b48f;
  --sq-light: #ecd2a4; --sq-dark: #a9744a;
  --frame: linear-gradient(135deg, #5b3a22, #3b2414); --frame-pad: 14px;
  --panel: linear-gradient(180deg, #f8efdb, #f1e4c6); --panel-flat: #f6ecd6; --panel-text: #3b2a1a; --panel-muted: #8a7254; --panel-border: #d9c6a0;
  --card: #fffaf0; --bubble-user: #6b4426; --bubble-user-text: #fff6e6;
  --accent: #b8892b; --accent-text: #fff;
  --hl-last: rgba(255, 214, 92, .55); --good: #3d7a3a; --warn: #c27a1a; --bad: #b0352a;
  --radius: 6px; --shadow: 0 20px 50px rgba(0,0,0,.55);
  --pill-bg: rgba(255,255,255,.08); --pill-border: rgba(233,201,138,.35);
  --player-bg: rgba(0,0,0,.25);
  --eval-white: #f5ead2; --eval-black: #2a1a10;
  --overlay-bg: #f6ecd6;
}
.t-night {
  --font-ui: 'Inter', system-ui, sans-serif; --font-title: 'Manrope', system-ui, sans-serif;
  --bg: radial-gradient(ellipse at 20% 0%, #1b2540 0%, #0d121e 55%, #090c14 100%); --bg-flat: #0d121e;
  --text: #e6ecf7; --muted: #8b97b0;
  --sq-light: #cdd7e8; --sq-dark: #6a7fa3;
  --frame: transparent; --frame-pad: 0px;
  --panel: rgba(23, 30, 47, .92); --panel-flat: #171e2f; --panel-text: #e6ecf7; --panel-muted: #8b97b0; --panel-border: rgba(255,255,255,.08);
  --card: rgba(255,255,255,.05); --bubble-user: #2f6df6; --bubble-user-text: #fff;
  --accent: #38bdf8; --accent-text: #04121c;
  --hl-last: rgba(56, 189, 248, .38); --good: #34d399; --warn: #fbbf24; --bad: #fb5a6e;
  --radius: 14px; --shadow: 0 0 0 1px rgba(255,255,255,.05), 0 30px 80px rgba(0,0,0,.6), 0 0 120px rgba(56,189,248,.08);
  --pill-bg: rgba(255,255,255,.05); --pill-border: rgba(255,255,255,.1);
  --player-bg: rgba(255,255,255,.04);
  --eval-white: #e6ecf7; --eval-black: #1a2133;
  --overlay-bg: #121a2b;
}
.t-paper {
  --font-ui: 'Manrope', system-ui, sans-serif; --font-title: 'Manrope', system-ui, sans-serif;
  --bg: #f4f1ea; --bg-flat: #f4f1ea;
  --text: #22261f; --muted: #7d8277;
  --sq-light: #eef0e2; --sq-dark: #8fa98c;
  --frame: transparent; --frame-pad: 0px;
  --panel: #ffffff; --panel-flat: #ffffff; --panel-text: #22261f; --panel-muted: #8b9085; --panel-border: #ebe7dc;
  --card: #f7f6f1; --bubble-user: #22261f; --bubble-user-text: #fff;
  --accent: #4f7a4b; --accent-text: #fff;
  --hl-last: rgba(247, 213, 84, .6); --good: #4f7a4b; --warn: #d08a1c; --bad: #d1493a;
  --radius: 18px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 18px 40px rgba(60,60,40,.10);
  --pill-bg: #fff; --pill-border: #e6e2d6;
  --player-bg: #fff;
  --eval-white: #ffffff; --eval-black: #30352c;
  --overlay-bg: #ffffff;
}

/* ---------- Base ---------- */
:root { --board: 360px; --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body { font-family: var(--font-ui); background: var(--bg); background-color: var(--bg-flat); color: var(--text); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.hidden { display: none !important; }
svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#app { height: 100%; display: flex; flex-direction: column; padding-top: var(--safe-top); padding-bottom: env(safe-area-inset-bottom); }

header { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 4px 2px 12px; flex: 0 0 auto; }
.logo { font-family: var(--font-title); font-weight: 700; font-size: 18px; min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.t-wood .logo { font-size: 22px; color: #f1d9a6; }
.logo span { overflow: hidden; text-overflow: ellipsis; }
.logo .knight { width: 26px; height: 26px; }
.hdr-right { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.pill { font-size: 14px; padding: 8px 14px; border-radius: 999px; background: var(--pill-bg); border: 1px solid var(--pill-border); color: var(--muted); display: flex; gap: 8px; align-items: center; }
.pill b { color: var(--text); font-weight: 600; }
.pill.lvl { display: none; }
.swatches { gap: 2px; padding: 2px 4px; }
.sw { width: 34px; height: 34px; border-radius: 50%; position: relative; }
.sw::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; border: 2px solid transparent; }
.sw.on::before { border-color: var(--accent); box-shadow: 0 0 0 2px var(--pill-bg); inset: 5px; }
.sw.s1::before { background: linear-gradient(135deg, #ecd2a4 50%, #a9744a 50%); }
.sw.s2::before { background: linear-gradient(135deg, #c8d3e6 50%, #1b2540 50%); }
.sw.s3::before { background: linear-gradient(135deg, #eef0e2 50%, #8fa98c 50%); }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--text); }
.iconbtn svg { width: 22px; height: 22px; }

main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 4px 8px 8px; gap: 8px; }
.left { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; align-items: center; }
.left > * { width: calc(var(--board) + 2 * var(--frame-pad)); }
.player { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: calc(var(--radius) * .7); background: var(--player-bg); min-height: 44px; }
.t-paper .player { box-shadow: 0 1px 2px rgba(0,0,0,.04); border: 1px solid var(--panel-border); }
.ava { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; font-family: 'Inter', sans-serif; }
.ava.claude { background: linear-gradient(135deg, #d97757, #b85c3c); color: #fff; }
.ava.me { background: var(--accent); color: var(--accent-text); }
.pname { font-weight: 600; font-size: 15px; }
.psub { font-size: 12.5px; color: var(--muted); }
.thinking { color: var(--accent); }
.thinking::after { content: '…'; animation: dots 1.2s steps(4) infinite; display: inline-block; width: 1em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0 } to { width: 1em } }
.captured { margin-left: auto; display: flex; align-items: center; }
.captured img { width: 20px; height: 20px; margin-left: -7px; }
.t-wood .captured img, .t-night .captured img { filter: drop-shadow(0 0 1.5px rgba(255,255,255,.55)); }
.captured span { font-size: 13px; color: var(--muted); margin-left: 6px; font-family: 'Inter', sans-serif; }
.clock-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 4px; }

.board-row { display: flex; gap: 12px; justify-content: center; width: auto !important; }
.evalbar { display: none; width: 26px; border-radius: 6px; overflow: hidden; flex-direction: column; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.evalbar .b { background: var(--eval-black); transition: flex-basis .4s; flex: 0 0 50%; }
.evalbar .w { background: var(--eval-white); flex: 1; }
.evalbar .val { position: absolute; width: 100%; text-align: center; font-size: 10px; font-weight: 700; font-family: 'Inter', sans-serif; }
.evalbar.wtop .val { top: 6px; color: var(--eval-white); }
.evalbar.wbottom .val { bottom: 6px; color: var(--eval-black); }
.frame { background: var(--frame); padding: var(--frame-pad); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
.t-wood .frame { box-shadow: var(--shadow), inset 0 0 0 2px rgba(233,201,138,.25); }
#board { width: var(--board); height: var(--board); border-radius: calc(var(--radius) * .5); overflow: hidden; }
.t-wood #board { border-radius: 2px; box-shadow: 0 0 0 2px #2a1a10; overflow: visible; }

/* chessground look */
cg-board square.last-move { background-color: var(--hl-last); }
cg-board square.move-dest { background: radial-gradient(rgba(20,30,20,.32) 19%, transparent 21%); }
cg-board square.oc.move-dest { background: radial-gradient(transparent 0%, transparent 79%, rgba(20,30,20,.3) 80%); }
cg-board square.move-dest:hover { background: rgba(20,85,30,.25); }
cg-board square.selected { background-color: rgba(20,85,30,.45); }
cg-board square.check { background: radial-gradient(ellipse at center, rgba(255,0,0,1) 0%, rgba(231,0,0,1) 25%, rgba(169,0,0,0) 89%, rgba(158,0,0,0) 100%); }
.cg-wrap piece { filter: drop-shadow(0 2px 2px rgba(0,0,0,.22)); }
.cg-wrap piece.dragging { transform-origin: center; }
.cg-wrap coords { opacity: 1; font-family: 'Inter', sans-serif; font-weight: 700; font-size: clamp(9px, 2.5vw, 12px); }
.cg-wrap coords.ranks { left: 3px; top: 1px; height: 100%; width: 12px; }
.cg-wrap coords.ranks coord { transform: none; flex: 0 0 12.5%; }
.cg-wrap coords.files { left: 0; bottom: 0; height: auto; width: 100%; text-transform: none; text-align: right; }
.cg-wrap coords.files coord { flex: 0 0 12.5%; padding-right: 3px; }
coords.ranks:not(.black) coord:nth-child(odd), coords.files:not(.black) coord:nth-child(odd),
coords.ranks.black coord:nth-child(even), coords.files.black coord:nth-child(even) { color: var(--sq-light); }
coords.ranks:not(.black) coord:nth-child(even), coords.files:not(.black) coord:nth-child(even),
coords.ranks.black coord:nth-child(odd), coords.files.black coord:nth-child(odd) { color: var(--sq-dark); }
.cg-wrap .cg-shapes { opacity: .85; }

.promo { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; border-radius: var(--radius); }
.promo-box { display: flex; gap: 6px; padding: 10px; border-radius: 14px; background: var(--overlay-bg); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.promo-box button { width: calc(var(--board) / 6); height: calc(var(--board) / 6); min-width: 52px; min-height: 52px; border-radius: 10px; background: var(--sq-light); }
.promo-box img { width: 100%; height: 100%; }

.toolbar { display: flex; gap: 6px; justify-content: space-between; }
.tbtn { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; height: 44px; padding: 0 11px; border-radius: calc(var(--radius) * .7); background: var(--player-bg); border: 1px solid var(--pill-border); color: var(--text); font-size: 14px; font-weight: 500; }
.tbtn svg { width: 19px; height: 19px; flex: 0 0 19px; }
.tbtn:disabled { opacity: .35; }
.tbtn.on { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.tbtn .lbl { display: none; }
.navgrp { display: flex; gap: 4px; }
.navgrp .tbtn { padding: 0 9px; }

/* ---------- Coach panel ---------- */
.panel { flex: 1; min-height: 120px; background: var(--panel); background-color: var(--panel-flat); color: var(--panel-text); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--panel-border); }
.t-night .panel { backdrop-filter: blur(20px); }
.grip { display: flex; justify-content: center; padding: 7px 0 3px; cursor: pointer; flex: 0 0 auto; }
.grip span { width: 40px; height: 4px; border-radius: 2px; background: var(--panel-muted); opacity: .5; }
.ptabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--panel-border); flex: 0 0 auto; align-items: center; }
.ptab { padding: 10px 12px 11px; font-size: 14.5px; color: var(--panel-muted); font-weight: 500; border-bottom: 2px solid transparent; min-height: 44px; }
.ptab.on { color: var(--panel-text); border-bottom-color: var(--accent); font-weight: 600; }
.ptab-close { margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; color: var(--panel-muted); }
.ptab-close svg { width: 22px; height: 22px; }
.pbody { flex: 1; min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.chat { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.chat > :first-child { margin-top: auto; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .ava { width: 30px; height: 30px; font-size: 12px; flex: 0 0 30px; }
.bubble { background: var(--card); border: 1px solid var(--panel-border); border-radius: calc(var(--radius) * .9 + 2px); padding: 10px 13px; font-size: 14.5px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.t-night .bubble { border-color: rgba(255,255,255,.06); }
.bubble.small { font-size: 13.5px; color: var(--panel-muted); padding: 8px 12px; }
.bubble.small .vt { color: var(--good); font-weight: 700; }
.bubble b { font-weight: 700; }
.verdict { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.vtag { background: var(--bad); color: #fff; font-weight: 700; font-size: 13px; padding: 3px 10px; border-radius: 999px; font-family: 'Inter', sans-serif; white-space: nowrap; }
.vtag.g-best, .vtag.g-good { background: var(--good); }
.vtag.g-inaccuracy { background: var(--warn); }
.vtag.g-mistake { background: color-mix(in srgb, var(--bad) 70%, var(--warn)); }
.t-night .vtag.g-best, .t-night .vtag.g-good, .t-night .vtag.g-inaccuracy { color: #04121c; }
.veval { font-size: 13px; color: var(--panel-muted); font-family: 'Inter', sans-serif; }
.veval b { color: var(--panel-text); }
.veval b.down { color: var(--bad); }
.better { margin-top: 9px; padding: 8px 12px; border-radius: calc(var(--radius) * .6); background: color-mix(in srgb, var(--good) 12%, transparent); border-left: 3px solid var(--good); font-size: 14px; }
.better b { color: var(--good); }
.actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.act { font-size: 14px; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--panel-border); background: transparent; color: var(--panel-text); font-weight: 600; }
.act.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.act.on { border-color: var(--accent); color: var(--accent); }
.msg.me { flex-direction: row-reverse; }
.msg.me .bubble { background: var(--bubble-user); color: var(--bubble-user-text); border: none; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--panel-muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25 } 40% { opacity: 1 } }
.result-card { text-align: center; }
.result-card .big { font-family: var(--font-title); font-size: 22px; font-weight: 700; margin-bottom: 4px; }

.moves { padding: 12px; font-size: 15px; font-variant-numeric: tabular-nums; display: grid; grid-template-columns: 36px 1fr 1fr; gap: 2px 4px; align-content: start; }
.moves .n { color: var(--panel-muted); padding: 7px 0; font-family: 'Inter', sans-serif; font-size: 13px; }
.moves .m { padding: 6px 8px; border-radius: 6px; text-align: left; display: flex; gap: 6px; align-items: center; min-height: 36px; }
.moves .m.cur { background: color-mix(in srgb, var(--accent) 22%, transparent); font-weight: 700; }
.moves .m .sym { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 12.5px; }
.sym.g-best, .sym.g-good { color: var(--good); } .sym.g-inaccuracy { color: var(--warn); } .sym.g-mistake, .sym.g-blunder { color: var(--bad); }
.review { padding: 14px; font-size: 14.5px; line-height: 1.55; }
.review p + p { margin-top: 10px; }
.stats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { padding: 6px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--panel-border); font-size: 13px; }
.stat b { font-family: 'Inter', sans-serif; }
.empty { color: var(--panel-muted); text-align: center; padding: 20px 10px; font-size: 14px; line-height: 1.5; }

.input { margin: 8px 10px 10px; display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 16px; border-radius: 999px; border: 1px solid var(--panel-border); background: var(--card); flex: 0 0 auto; }
.input input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--panel-text); font: inherit; font-size: 16px; outline: none; height: 40px; }
.input input::placeholder { color: var(--panel-muted); }
.send { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; flex: 0 0 40px; }
.send svg { width: 18px; height: 18px; stroke: var(--accent-text); stroke-width: 2.4; }

/* Mobile sheet: collapsed shows only the latest coach card */
.panel:not(.open) .latest .ctext { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.panel:not(.open) .latest .better, .panel:not(.open) .latest > .ava { display: none; }
.act .sht { display: none; }
.panel:not(.open) .latest .actions { margin-top: 8px; flex-wrap: nowrap; gap: 6px; }
.panel:not(.open) .latest .act .lng { display: none; }
.panel:not(.open) .latest .act .sht { display: inline; }
.panel:not(.open) .latest .act { white-space: nowrap; }
.panel:not(.open) .latest .act { min-height: 38px; padding: 7px 12px; }
.panel:not(.open) .chat { padding: 4px 8px 8px; }
.panel:not(.open) .latest .bubble { flex: 1; padding: 8px 11px; }
.panel:not(.open) .ptabs, .panel:not(.open) .input { display: none; }
.panel:not(.open) .tab.chat > .msg:not(.latest), .panel:not(.open) .tab.chat > .older { display: none; }
.panel.open { position: fixed; left: 0; right: 0; bottom: 0; height: 86%; z-index: 30; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(30%); opacity: .6 } to { transform: none; opacity: 1 } }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 25; }

/* ---------- Overlays: new game, history, menu ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92%; overflow-y: auto; background: var(--overlay-bg); color: var(--panel-text); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .22s ease-out; }
.sheet h2 { font-family: var(--font-title); font-size: 24px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.t-wood .sheet h2 { font-size: 28px; }
.sheet h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--panel-muted); margin: 16px 0 8px; font-family: 'Inter', sans-serif; }
.opts { display: grid; gap: 8px; }
.opts.c3 { grid-template-columns: repeat(3, 1fr); }
.opts.c2 { grid-template-columns: repeat(2, 1fr); }
.opt { border: 2px solid var(--panel-border); border-radius: 14px; padding: 12px 10px; text-align: center; min-height: 56px; background: var(--card); color: var(--panel-text); }
.opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.opt img { width: 40px; height: 40px; display: block; margin: 0 auto 4px; }
.opt .t { font-weight: 700; font-size: 15px; }
.opt .s { font-size: 12.5px; color: var(--panel-muted); margin-top: 2px; }
.opt .prev { height: 34px; border-radius: 8px; margin-bottom: 6px; }
.big-btn { width: 100%; margin-top: 20px; min-height: 52px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 17px; }
.big-btn.ghost { background: transparent; border: 1px solid var(--panel-border); color: var(--panel-text); margin-top: 10px; }
.close-x { width: 44px; height: 44px; display: grid; place-items: center; color: var(--panel-muted); }
.close-x svg { width: 22px; height: 22px; }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 6px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--panel-border); text-align: left; color: var(--panel-text); }
.menu-item:last-child { border-bottom: none; }
.menu-item svg { width: 22px; height: 22px; color: var(--accent); }
.menu-item.danger, .menu-item.danger svg { color: var(--bad); }
.hist-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 6px; border-bottom: 1px solid var(--panel-border); text-align: left; color: var(--panel-text); }
.hist-item .res { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-family: 'Inter', sans-serif; font-size: 13px; background: var(--card); border: 1px solid var(--panel-border); flex: 0 0 48px; }
.hist-item .res.win { background: var(--good); color: #fff; border: none; }
.hist-item .res.loss { background: var(--bad); color: #fff; border: none; }
.hist-item .res.live { background: var(--accent); color: var(--accent-text); border: none; }
.hist-item .t { font-weight: 700; font-size: 15px; }
.hist-item .s { font-size: 13px; color: var(--panel-muted); margin-top: 2px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: #222; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: 90%; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.gate { height: 100%; display: grid; place-items: center; text-align: center; padding: 30px; font-size: 16px; line-height: 1.6; }

.t-wood .ptab, .t-wood .moves .m, .t-wood .bubble, .t-wood .review { font-family: 'Lora', serif; }

/* ---------- Wide screens: two columns like the desktop mockup ---------- */
@media (min-width: 900px) and (min-height: 560px) {
  header { padding: 16px 32px 6px; }
  .logo { overflow: visible; }
  .sw { width: 38px; height: 38px; }
  .logo { font-size: 26px; } .t-wood .logo { font-size: 32px; }
  .logo .knight { width: 34px; height: 34px; }
  .pill.lvl { display: flex; }
  main { flex-direction: row; justify-content: center; align-items: flex-start; gap: 28px; padding: 12px 32px 24px; }
  .left { gap: 10px; align-items: flex-start; }
  .left > .player, .left > .toolbar { margin-left: 38px; }
  .evalbar { display: flex; }
  .tbtn .lbl { display: inline; }
  .tbtn { padding: 0 14px; }
  .panel, .panel.open { position: static; flex: 0 1 520px; min-width: 380px; height: calc(var(--board) + 2 * var(--frame-pad) + 172px); border-radius: var(--radius); animation: none; padding-bottom: 0; }
  .panel .grip, .ptab-close { display: none; }
  .panel:not(.open) .ptabs, .panel:not(.open) .input { display: flex; }
  .panel:not(.open) .latest .ctext { display: block; -webkit-line-clamp: unset; }
  .panel:not(.open) .latest .better { display: block; }
  .panel:not(.open) .latest .act .lng { display: inline; }
  .panel:not(.open) .latest .act .sht { display: none; }
  .panel:not(.open) .latest .actions { flex-wrap: wrap; }
  .panel:not(.open) .latest > .ava { display: grid; }
  .panel:not(.open) .chat { padding: 16px 18px; }
  .panel:not(.open) .tab.chat > .msg:not(.latest), .panel:not(.open) .tab.chat > .older { display: flex; }
  .ptabs { padding: 10px 14px 0; }
  .chat { padding: 16px 18px; }
  .backdrop { display: none !important; }
  .overlay { align-items: center; }
  .sheet { border-radius: 20px; }
}
