/* OLPW:css/chess.css | styles for chess */
:root {
    --bg: #1b1d22; --panel: #262a31; --panel2: #1f2228; --text: #e8e8e8; --muted: #8d939c; --line: #363b44;
    --accent: #7fa650; --accent2: #5b8bd6; --danger: #e5484d; --shadow: rgba(0,0,0,.45);
    --light: #ebecd0; --dark: #779556;
    --bsz: max(280px, min(calc(100vh - 150px), calc(100vw - 420px), 680px));
  }
  [data-theme="light"] {
    --bg: #f3f1ec; --panel: #ffffff; --panel2: #f6f4ef; --text: #1f2328; --muted: #6b7078; --line: #dedad2; --shadow: rgba(30,30,40,.14);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 14px; }
  button { font-family: inherit; }
  .app { display: flex; gap: 22px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }

  /* ---------- board column ---------- */
  .board-col { display: flex; flex-direction: column; gap: 8px; }
  .pbar { display: flex; align-items: center; gap: 10px; width: calc(var(--bsz) + 26px); padding-left: 26px; }
  .avatar { width: 38px; height: 38px; border-radius: 6px; background: var(--panel); display: grid; place-items: center; font-size: 26px; line-height: 1; box-shadow: 0 1px 3px var(--shadow); font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", serif; }
  .pinfo { flex: 1; min-width: 0; }
  .pname { font-weight: 700; font-size: 14px; display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--panel); padding: 1px 6px; border-radius: 4px; }
  .caps { font-size: 17px; line-height: 1; min-height: 18px; color: var(--muted); letter-spacing: -3px; margin-top: 3px; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", serif; }
  .caps b { font-size: 12px; letter-spacing: 0; margin-left: 7px; font-weight: 700; font-family: system-ui, sans-serif; }
  .checks { color: var(--danger); letter-spacing: 1px; font-size: 13px; margin-left: 4px; }
  .clock { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 22px; font-weight: 700; padding: 5px 12px; border-radius: 6px; background: var(--panel); color: var(--muted); min-width: 96px; text-align: right; }
  .clock.on { background: #f1f1f1; color: #111; }
  [data-theme="light"] .clock.on { background: #2b2f36; color: #fff; }
  .clock.low { color: #fff !important; background: var(--danger) !important; }
  .clock.hidden { visibility: hidden; }

  .board-area { display: flex; gap: 8px; align-items: stretch; }
  .evalbar { width: 18px; border-radius: 4px; overflow: hidden; background: #3a3a3a; position: relative; display: flex; flex-direction: column-reverse; box-shadow: 0 1px 3px var(--shadow); }
  .evalbar.off { visibility: hidden; }
  .evalbar .fill { background: #f4f4f4; height: 50%; transition: height .5s ease; }
  .evalbar span { position: absolute; left: 0; right: 0; font-size: 9px; font-weight: 700; text-align: center; }
  .evalbar span.top { top: 3px; color: #eee; }
  .evalbar span.bot { bottom: 3px; color: #333; }
  .board { position: relative; width: var(--bsz); height: var(--bsz); border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px rgba(57,208,255,.25), 0 0 34px rgba(57,208,255,.18), 0 12px 40px var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; }
  .squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
  .sq { position: relative; }
  .sq.l { background-color: var(--light); background-image: var(--tex, none); background-size: var(--texsize, 100% 100%); }
  .sq.d { background-color: var(--dark); background-image: var(--tex, none); background-size: var(--texsize, 100% 100%); }
  .sq.last::after { content: ''; position: absolute; inset: 0; background: rgba(255, 221, 0, .38); }
  .sq.sel::after { content: ''; position: absolute; inset: 0; background: rgba(255, 221, 0, .55); }
  .sq.check::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,0,0,.95) 0%, rgba(231,0,0,.55) 35%, rgba(169,0,0,0) 72%); z-index: 1; }
  .sq.hover { box-shadow: inset 0 0 0 4px rgba(255,255,255,.75), inset 0 0 18px rgba(57,208,255,.35); }
  .sq:hover { filter: brightness(1.12); cursor: pointer; }
  .pc .g { filter: drop-shadow(0 2px 3px rgba(0,0,0,.55)); transition: transform .12s ease; }
  .sq:hover ~ .pc:hover .g, .pc:hover .g { transform: scale(1.06); }
  .sq.hill .hillmark { position: absolute; inset: 38%; border-radius: 50%; border: 2px dashed rgba(0,0,0,.25); }
  .sq.mark::before { content: ''; position: absolute; inset: 0; background: rgba(235, 97, 80, .8); }
  .sq .co { position: absolute; font-size: calc(var(--bsz) / 42); font-weight: 700; pointer-events: none; z-index: 2; }
  .sq .co.r { top: 3%; left: 4%; }
  .sq .co.f { bottom: 2%; right: 5%; }
  .sq.l .co { color: var(--dark); }
  .sq.d .co { color: var(--light); }
  .sq .dot { position: absolute; inset: 36%; border-radius: 50%; background: rgba(0,0,0,.18); z-index: 3; }
  .sq .ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 calc(var(--bsz) / 90) rgba(0,0,0,.18); z-index: 3; }

  .pieces { position: absolute; inset: 0; pointer-events: none; }
  .pc { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; display: grid; place-items: center; will-change: transform; z-index: 4; }
  .pc.dragging { z-index: 20; transition: none !important; }
  .pc.dragging .g { transform: scale(1.12); }
  .pc.ghost { animation: fadeOut .22s ease forwards; z-index: 3; }
  @keyframes fadeOut { to { opacity: 0; transform: scale(.6); } }
  .g { position: relative; font-size: calc(var(--bsz) / 8 * .84); line-height: 1; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", "Arial Unicode MS", serif; transition: transform .12s; }
  .g span { display: block; }
  .g span + span { position: absolute; left: 0; top: 0; }
  /* classic: filled glyph underneath, outline glyph on top */
  .st-classic .pw .fill { color: #fff; }
  .st-classic .pw .line { color: #1a1a1a; }
  .st-classic .pb .fill { color: #1a1a1a; }
  .st-classic .pb .line { color: #1a1a1a; }
  .st-classic .g { filter: drop-shadow(0 2px 1.5px rgba(0,0,0,.35)); }
  /* solid */
  .st-solid .pw .fill { color: #fafafa; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 0 2px #000, 0 2px 3px rgba(0,0,0,.45); }
  .st-solid .pb .fill { color: #151515; text-shadow: 0 0 1px rgba(255,255,255,.6), 0 2px 3px rgba(0,0,0,.35); }
  .st-solid .line { display: none; }
  /* neo */
  .st-neo .fill { background: linear-gradient(180deg, #fffdf6, #d9d2c0); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .st-neo .pb .fill { background: linear-gradient(180deg, #5b5b5b, #121212); -webkit-background-clip: text; background-clip: text; }
  .st-neo .line { color: rgba(0,0,0,.85); }
  .st-neo .pb .line { color: #000; }
  .st-neo .g { filter: drop-shadow(0 3px 2px rgba(0,0,0,.4)); }
  .st-royal .pw .fill { color: #fff8e7; }
  .st-royal .pw .line { color: #b8860b; }
  .st-royal .pb .fill { color: #5a1020; }
  .st-royal .pb .line { color: #e3b341; }
  .st-royal .g { filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
  .st-metal .fill { -webkit-background-clip: text; background-clip: text; color: transparent; }
  .st-metal .pw .fill { background-image: linear-gradient(180deg, #ffffff, #c9ced6 45%, #8e959f 55%, #e8ebef); }
  .st-metal .pb .fill { background-image: linear-gradient(180deg, #fff1a8, #e0b021 45%, #a8780a 55%, #f5d86a); }
  .st-metal .line { color: rgba(0,0,0,.75); }
  .st-metal .g { filter: drop-shadow(0 3px 2px rgba(0,0,0,.45)); }
  .st-neon .line { display: none; }
  .st-neon .pw .fill { color: #e9fdff; text-shadow: 0 0 2px #00e5ff, 0 0 6px #00e5ff, 0 0 12px rgba(0,229,255,.7); }
  .st-neon .pb .fill { color: #3a0030; text-shadow: 0 0 2px #ff2bd6, 0 0 6px #ff2bd6, 0 0 12px rgba(255,43,214,.75); }
  .st-letters .g span { display: none; }
  .st-letters .g::before { content: attr(data-t); display: grid; place-items: center; width: .78em; height: .78em; border-radius: 50%; font: 800 .46em/1 system-ui, sans-serif; box-shadow: 0 2px 4px rgba(0,0,0,.35); }
  .st-letters .pw::before { background: #fafafa; color: #1d1d1d; border: .05em solid #1d1d1d; }
  .st-letters .pb::before { background: #1d1d1d; color: #fafafa; border: .05em solid #fafafa; }
  .confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }
  .sq.check::before { animation: checkPulse 1s ease-in-out 2; }
  @keyframes checkPulse { 50% { opacity: .55; transform: scale(.92); } }

  .arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
  .badges { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
  .badge { position: absolute; width: 4.8%; height: 4.8%; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: calc(var(--bsz) / 42); box-shadow: 0 2px 4px rgba(0,0,0,.35); border: 2px solid #fff; line-height: 1; }
  .sq.fog::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(48,52,60,.9) 0 6px, rgba(58,63,72,.9) 6px 12px); }
  .sq.fog .co { color: #9aa1ab !important; z-index: 3; }
  .sq.pre::before { content: ''; position: absolute; inset: 0; background: rgba(220, 60, 60, .45); z-index: 1; }
  .fog-cover { position: absolute; inset: 0; z-index: 28; display: none; place-items: center; text-align: center; background: repeating-linear-gradient(45deg, #2c3038 0 10px, #343944 10px 20px); color: #fff; cursor: pointer; padding: 20px; }
  .fog-cover.on { display: grid; }
  .fog-cover b { display: block; font-size: 22px; margin-bottom: 6px; }
  .fog-cover span { font-size: 14px; opacity: .8; }
  .pocket { display: flex; gap: 3px; flex-wrap: wrap; min-height: 26px; margin-top: 2px; }
  .pk { position: relative; width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: grid; place-items: center; padding: 0; }
  .pk .g { font-size: 24px; }
  .pk b { position: absolute; right: -3px; bottom: -3px; background: var(--accent); color: #fff; font-size: 9px; border-radius: 6px; padding: 0 3px; line-height: 13px; }
  .pk.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
  .pk-empty { font-size: 11px; color: var(--muted); line-height: 26px; }
  .avatar.bot { font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; font-size: 22px; }
  .opening { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: -6px; min-height: 0; }
  .opening:empty { display: none; }
  .botcard { display: flex; gap: 10px; align-items: flex-start; }
  .botcard .bav { width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; font-size: 28px; flex: none; font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; }
  .bubble { position: relative; background: var(--panel); border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 600; line-height: 1.35; flex: 1; animation: pop .25s ease; }
  .bubble small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; margin-bottom: 2px; }
  @keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
  .bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .bcard { display: flex; gap: 8px; align-items: center; text-align: left; padding: 8px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; }
  .bcard .bav { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; font-size: 22px; flex: none; font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; }
  .bcard b { display: block; font-size: 13px; }
  .bcard span { display: block; font-size: 11px; color: var(--muted); }
  .bcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
  .bot-bio { font-size: 12px; color: var(--muted); margin-top: 8px; }
  .rv-players { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; margin: 6px 0 10px; }
  .rv-acc { font-size: 26px; font-weight: 800; padding: 6px 10px; border-radius: 8px; display: inline-block; min-width: 76px; }
  .rv-acc.acc-w { background: #fff; color: #222; border: 1px solid var(--line); }
  .rv-acc.acc-b { background: #333; color: #fff; border: 1px solid #333; }
  .rv-name { font-size: 12px; font-weight: 700; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rv-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
  .rv-table td { padding: 4px 6px; }
  .rv-table td:first-child, .rv-table td:last-child { text-align: center; font-weight: 700; width: 70px; }
  .rv-table td:nth-child(2) { white-space: nowrap; padding-left: 28%; }
  .rv-table tr:last-child td { border-top: 1px solid var(--line); padding-top: 8px; }
  .rv-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 800; }
  .graph { width: 100%; height: 90px; border-radius: 8px; overflow: hidden; background: #3a3a3a; cursor: pointer; display: block; }
  .rv-msg { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
  .rv-msg .bubble { font-weight: 500; }
  .progress { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; margin: 12px 0 4px; }
  .progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; margin: 8px 0; }
  .stats div { background: var(--panel2); border-radius: 8px; padding: 8px 4px; }
  .stats b { display: block; font-size: 20px; }
  .stats span { font-size: 11px; color: var(--muted); }
  .arch { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
  .arow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; background: var(--panel2); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
  .arow b { font-size: 13px; }
  .arow .meta { color: var(--muted); }
  .arow .btns2 { display: flex; gap: 4px; }
  .arow .btns2 .b { padding: 6px 8px; font-size: 12px; }
  .delta-up { color: #2fa84f; font-weight: 700; } .delta-down { color: var(--danger); font-weight: 700; }
  .boom { position: absolute; width: 12.5%; height: 12.5%; z-index: 15; pointer-events: none; }
  .boom::before { content: ''; position: absolute; inset: -60%; border-radius: 50%; background: radial-gradient(circle, rgba(255,240,150,.95), rgba(255,120,0,.75) 40%, rgba(255,40,0,0) 70%); animation: boom .5s ease-out forwards; }
  @keyframes boom { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }

  .promo-pick { position: absolute; z-index: 30; width: 12.5%; display: none; flex-direction: column; background: var(--panel); box-shadow: 0 6px 20px rgba(0,0,0,.5); border-radius: 4px; overflow: hidden; }
  .promo-pick.on { display: flex; }
  .promo-pick button { aspect-ratio: 1; border: none; background: var(--panel); cursor: pointer; display: grid; place-items: center; }
  .promo-pick button:hover { background: var(--accent); }
  .promo-pick .x { aspect-ratio: auto; padding: 4px; font-size: 14px; color: var(--muted); background: var(--panel2); }
  .viewing-banner { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 25; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 20px; display: none; cursor: pointer; }
  .viewing-banner.on { display: block; }

  /* ---------- side panel ---------- */
  .side { width: 340px; background: var(--panel); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 6px 24px var(--shadow); max-height: calc(var(--bsz) + 110px); min-height: 420px; }
  .side-head h1 { font-size: 20px; display: flex; align-items: center; gap: 8px; }
  .side-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 600; }
  .status { padding: 11px 12px; border-radius: 12px; background: var(--panel2); font-weight: 700; font-size: 14px; line-height: 1.35; border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s; }
  .status.check { color: var(--danger); border-color: rgba(255,59,92,.5); box-shadow: 0 0 14px rgba(255,59,92,.25); }
  .status.over { color: var(--accent); border-color: rgba(60,179,113,.5); box-shadow: 0 0 14px rgba(60,179,113,.25); }
  .status small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); margin-top: 2px; }
  .dots::after { content: ''; animation: dots 1.2s steps(4) infinite; }
  @keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
  .thinkbar { height: 4px; border-radius: 3px; background: var(--panel2); overflow: hidden; margin-top: -8px; visibility: hidden; }
  .thinkbar.on { visibility: visible; }
  .thinkbar i { display: block; height: 100%; width: 0; background: var(--accent); }
  .puzzle-box { display: none; background: var(--panel2); border-radius: 8px; padding: 12px; font-size: 13px; }
  .puzzle-box.on { display: block; }
  .puzzle-box .pt { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
  .puzzle-box .pd { color: var(--muted); margin-bottom: 10px; }
  .puzzle-box .row { display: flex; gap: 6px; }
  .puzzle-box button { flex: 1; }
  .puzzle-box .tip { color: var(--muted); font-size: 12px; line-height: 1.45; margin: -4px 0 10px; }
  .puzzle-box .fb { padding: 8px 10px; border-radius: 7px; background: var(--panel); margin-bottom: 8px; font-weight: 600; line-height: 1.4; }
  .puzzle-box .fb small { display: block; font-weight: 500; color: var(--muted); }
  .qstats { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
  .qstats span { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px; background: var(--panel); }
  .q-best { color: #2fa84f; } .q-good { color: #6d9f3a; } .q-inaccuracy { color: #d2a019; } .q-mistake { color: #e07b22; } .q-blunder { color: var(--danger); }
  .moves .m i { font-style: normal; margin-left: 2px; font-size: 11px; }
  .rush-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .rush-score { font-size: 30px; font-weight: 800; line-height: 1; }
  .rush-time { font-family: ui-monospace, Consolas, monospace; font-size: 22px; font-weight: 700; padding: 4px 10px; border-radius: 6px; background: var(--panel); }
  .rush-lives { font-size: 16px; letter-spacing: 2px; }
  .rushlog { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 10px; min-height: 10px; }
  .rushlog i { width: 10px; height: 10px; border-radius: 2px; background: #2fa84f; }
  .rushlog i.no { background: var(--danger); }
  .result-modal .rushlog { justify-content: center; margin: 4px 0 6px; }
  .board.blind-all .pc, .board.blind-opp .pc.opp { opacity: 0; transition: opacity .25s; }
  .board.blind-all .pc.dragging, .board.blind-opp .pc.opp.dragging { opacity: .9; }
  .modal input.fen { width: 100%; padding: 9px 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
  .modal input.fen.bad { border-color: var(--danger); }
  .modal .label small { text-transform: none; letter-spacing: 0; font-weight: 500; }
  .moves { flex: 1; min-height: 110px; overflow-y: auto; background: var(--panel2); border-radius: 8px; padding: 6px 4px; font-size: 13px; }
  .moves .mr { display: grid; grid-template-columns: 34px 1fr 1fr; align-items: center; }
  .moves .mr:nth-child(odd) { background: rgba(127,127,127,.06); }
  .moves .n { color: var(--muted); text-align: right; padding-right: 8px; font-size: 12px; }
  .moves .m { padding: 3px 6px; border-radius: 4px; cursor: pointer; font-weight: 600; font-family: ui-monospace, Consolas, monospace; }
  .moves .m:hover { background: rgba(127,127,127,.18); }
  .moves .m.cur { background: var(--accent); color: #fff; }
  .moves .empty { color: var(--muted); font-size: 12px; padding: 8px; text-align: center; }
  .moves .res { text-align: center; font-weight: 700; padding: 6px; color: var(--muted); }
  .nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .b, .nav button { padding: 9px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .12s, border-color .15s, box-shadow .15s; }
  .b:hover:not(:disabled), .nav button:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
  .b:active:not(:disabled), .nav button:active:not(:disabled) { transform: translateY(0) scale(.97); }
  .b.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(60,179,113,.35); }
  .b.primary:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(60,179,113,.5); }
  .b:disabled, .nav button:disabled { opacity: .38; cursor: not-allowed; }
  .b.red:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
  .note { font-size: 12px; color: var(--muted); line-height: 1.45; }

  /* ---------- modals ---------- */
  .overlay { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
  .overlay.on { display: flex; }
  .modal { background: var(--panel); border-radius: 16px; padding: 22px; max-width: 560px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 24px 70px rgba(0,0,0,.6), 0 0 0 1px rgba(57,208,255,.12); animation: modalIn .22s ease; }
  @keyframes modalIn { from { transform: translateY(12px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
  .modal h2 { margin-bottom: 6px; font-size: 20px; }
  .modal p { color: var(--muted); margin-bottom: 16px; font-size: 14px; line-height: 1.5; }
  .modal .label { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 14px 0 8px; }
  .modal .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
  .modal .actions .b { padding: 10px 18px; font-size: 14px; }
  .result-modal { text-align: center; }
  .result-modal .actions { justify-content: center; }
  .result-big { font-size: 44px; margin: 4px 0 6px; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", serif; }
  .seg { display: flex; flex-wrap: wrap; gap: 6px; }
  .seg button { flex: 1 1 auto; padding: 9px 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; }
  .seg button small { display: block; font-size: 10px; font-weight: 500; opacity: .75; margin-top: 2px; }
  .seg button.on { border-color: var(--accent); background: var(--accent); color: #fff; }
  .vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .vcard { text-align: left; padding: 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; }
  .vcard b { display: block; font-size: 13px; }
  .vcard span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
  .vcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
  .vgroup { font-size: 12px; font-weight: 700; color: var(--accent); margin: 12px 0 6px; }
  .vcard.world { text-decoration: none; border-style: dashed; }
  .vcard.world:hover { border-color: var(--accent); }

  /* new variant visuals */
  .g.duck { font-size: calc(var(--bsz) / 8 * .7); filter: drop-shadow(0 3px 2px rgba(0,0,0,.35)); }
  .sqicon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--bsz) / 8 * .5); pointer-events: none; z-index: 1; }
  .sqicon.box { animation: boxbob 1.6s ease-in-out infinite; }
.sqicon.lstar { animation: boxbob 1.2s ease-in-out infinite; filter: drop-shadow(0 0 6px rgba(255, 200, 40, .8)); }
  @keyframes boxbob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4%) scale(1.08); } }
  .homeline { position: absolute; left: 0; right: 0; height: 4px; pointer-events: none; z-index: 1; }
  .homeline.w { background: rgba(255,255,255,.75); }
  .homeline.b { background: rgba(0,0,0,.6); }
  .homeline.top { top: 0; } .homeline.bot { bottom: 0; }
  .ptag { position: absolute; right: 2%; top: 0; font-size: calc(var(--bsz) / 8 * .26); line-height: 1; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
  .sq.frozen::after { content: "❄"; position: absolute; left: 3%; bottom: 2%; font-size: calc(var(--bsz) / 8 * .26); }
  .sq.frozen { box-shadow: inset 0 0 0 100vmax rgba(110,190,255,.42); }
  .sq.pfrz { box-shadow: inset 0 0 0 100vmax rgba(110,190,255,.22); }
  .sq.jmp { box-shadow: inset 0 0 0 4px #c18cff; }
  .sq.goal { box-shadow: inset 0 0 0 100vmax rgba(255,215,0,.16); }
  .sq.anomaly { box-shadow: inset 0 0 0 3px #ff3b5c, inset 0 0 22px rgba(255,59,92,.6); animation: anoPulse 1s infinite alternate; border-radius: 4px; }
  .sq.anomaly::before { content: ''; position: absolute; inset: 12%; border-radius: 50%; border: 2px dashed rgba(255,59,92,.7); animation: spinTile 6s linear infinite; }
  @keyframes spinTile { to { transform: rotate(360deg); } }
  @keyframes anoPulse { from { filter: brightness(.8); } to { filter: brightness(1.4); } }
  .phasebar { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 30; display: none; align-items: center; gap: 8px; padding: 7px 10px 7px 14px; border-radius: 22px; background: rgba(20,20,20,.88); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
  .phasebar.on { display: flex; }
  .phasebar button { pointer-events: auto; border: 0; border-radius: 14px; padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; background: #fff; color: #111; }
  .spells { display: inline-flex; gap: 4px; margin-left: 8px; }
  .spb { border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 12px; padding: 2px 8px; font-size: 12px; font-weight: 700; cursor: pointer; }
  .spb:disabled { opacity: .4; cursor: default; }
  .spb.on { background: var(--accent); color: #fff; border-color: var(--accent); }
  .bh-board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; max-width: 240px; aspect-ratio: 1; border-radius: 4px; overflow: hidden; margin: 4px 0; }
  .bh-board > div { display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
  .bh-board .l { background: var(--light); } .bh-board .d { background: var(--dark); }
  .bh-board .last { box-shadow: inset 0 0 0 100vmax rgba(255,255,60,.35); }
  .bh-board .g { font-size: 22px; }
  .bh-line { display: flex; gap: 8px; align-items: center; font-size: 12px; }
  .bh-line span { color: var(--muted); }
  .bh-line i { color: var(--accent); font-style: normal; font-weight: 700; margin-left: auto; }
  .army-modal { max-width: 520px; }
  .abudget { font-size: 14px; margin-bottom: 10px; } .abudget b { font-size: 22px; color: var(--accent); } .abudget.bad b { color: var(--danger); }
  .apal-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
  .apal { display: flex; flex-direction: column; align-items: center; width: 54px; padding: 4px 0; border-radius: 8px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; }
  .apal.on { border-color: var(--accent); }
  .apal .g, .agrid .g { font-size: 30px; }
  .apal small { font-size: 10px; color: var(--muted); }
  .agrid { display: grid; grid-template-columns: repeat(8, 1fr); border-radius: 6px; overflow: hidden; }
  .ac { aspect-ratio: 1; border: 0; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; padding: 0; }
  .ac.l { background: var(--light); } .ac.d { background: var(--dark); }
  .ac:hover { filter: brightness(1.1); }
  .afiles { display: grid; grid-template-columns: repeat(8, 1fr); text-align: center; font-size: 11px; color: var(--muted); margin-top: 2px; }
  .arank { font-size: 11px; color: var(--muted); margin: 4px 0; }
  .editor-modal { max-width: 860px; }
  .edwrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .edboard { display: grid; grid-template-columns: repeat(8, 1fr); border-radius: 6px; overflow: hidden; touch-action: none; user-select: none; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
  .edc { aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; background-image: var(--tex, none); background-size: var(--texsize, 100% 100%); }
  .edc.l { background-color: var(--light); } .edc.d { background-color: var(--dark); }
  .edc:hover { box-shadow: inset 0 0 0 3px rgba(255, 170, 0, .7); }
  .edboard .g { font-size: min(44px, 9vw); pointer-events: none; }
  .edr, .edf { position: absolute; font-size: 10px; font-weight: 700; color: rgba(0,0,0,.45); pointer-events: none; }
  .edr { left: 3px; top: 2px; } .edf { right: 3px; bottom: 1px; }
  .edpal-row { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
  .edpal-row .apal { width: 46px; }
  .edpal-row .g { font-size: 28px; }
  .edtools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .edtools .b { font-size: 12px; padding: 7px 6px; text-align: left; }
  .edsum { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; font-size: 13px; }
  .edsum small { color: var(--muted); }
  .edmsg { margin-top: 14px; font-weight: 700; font-size: 14px; color: var(--accent); }
  .edmsg.bad { color: #e5484d; }
  @media (max-width: 700px) { .edwrap { grid-template-columns: 1fr; } }
  .pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
  .pgrid button { padding: 8px 4px; border-radius: 8px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
  .pgrid button.on { border-color: var(--accent); }
  .pgrid button.done { color: var(--accent); }
  .themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .theme-opt { background: var(--panel2); border: 2px solid var(--line); border-radius: 10px; padding: 8px 6px 6px; cursor: pointer; color: var(--text); font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .theme-opt.on { border-color: var(--accent); }
  .swatch { width: 40px; height: 40px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 5px; overflow: hidden; }
  .toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .tgl { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 8px 10px; background: var(--panel2); border-radius: 8px; border: 1px solid var(--line); }
  .tgl input { accent-color: var(--accent); width: 16px; height: 16px; }
  .toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: linear-gradient(90deg, #0f172a, #1e293b); color: #e2e8f0; border: 1px solid rgba(57,208,255,.35); box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 18px rgba(57,208,255,.15); padding: 11px 20px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; transition: .25s cubic-bezier(.2,.7,.3,1); pointer-events: none; z-index: 200; }
  .toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

  @media (max-width: 900px) {
    :root { --bsz: min(calc(100vw - 52px), 560px); }
    body { padding: 8px 8px 96px; align-items: flex-start; }
    .side { width: calc(var(--bsz) + 26px); max-height: none; }
  }
  @media (max-width: 520px) {
    .overlay { padding: 8px; }
    .modal { padding: 16px 14px; max-height: calc(100vh - 16px); }
    .seg button { flex: 1 1 calc(50% - 6px); padding: 8px 6px; font-size: 12px; }
    .seg.modes button small { display: none; }
    .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .vcard { padding: 8px; }
    .vcard span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .pgrid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  }
  body:has(.overlay.on) .olpw-float { display: none; }
