/* ===== Theme tokens =====
 * Every colour in the UI comes from these variables. A new puzzle type only needs a single type colour
 * (set as --type / --accent by app.js); tints, buttons and thumbnails are derived from it per theme. */
:root {
  color-scheme: light;
  --bg: #f6f3ec; --card: #ffffff; --surface: #ffffff; --surface-hover: #f3f1ea; --ink: #1f2333; --muted: #5d6275;
  --line: #d9d5cb; --grid: #2a2f45; --thin: #c9cbd6; --sel: #ffe28a; --peer: #eef1fb; --same: #dfe6ff;
  --entry: #2f51cc; --note: #555b70; --revealed: #62677b;
  --err: #c62828; --err-bg: #ffe3e3; --ok: #17784f; --accent: #4f7cff; --type: var(--accent);
  --accent-strong: color-mix(in srgb, var(--accent) 62%, #000); --on-accent: #ffffff; --tint-pct: 13%;
  --focus: #1a56db;
  --cage: #535a73; --cage-sum: #2f3448; --sign: #b93a22;
  --clue-bg: #3a4058; --clue-ink: #ffffff; --clue-diag: #8a90a8; --kak-gap: #2a2f45;
  --chip: #ece8de; --pill: #efece4; --pill-ink: #555b70; --prog: #fff1cc; --prog-ink: #7a5300; --done: #d8f3e6; --done-ink: #17784f;
  --rev: #eaecf3; --rev-ink: #4f5670; --star: #b06a00; --star-off: #d8d3c6; --track: #e6e2d6;
  --overlay: rgba(246, 243, 236, .86); --warn-bg: #fff1f0; --warn-line: #ffc9c4; --warn-ink: #a82a22;
  --thumb-bg: #ffffff; --thumb-ink: #2a2f45; --logo-bg: #1f2333;
  --w0: #d63a3a; --w1: #2f68d8; --w2: #23914a; --w3: #d9741a; --w4: #8448d6; --w5: #0f8f8f; --w6: #d13c97; --w7: #8a5a2b; --w-glyph: #ffffff; --w-tint: 18%;
  --pp-e: #f6ecc9; --pp-e-ink: #3d3008; --pp-e-line: #d8bf6a; --pp-w-line: #aab3c8; --pp-k: #2a2f45; --pp-k-ink: #ffffff; --pp-r: #e0453a; --pp-r-ink: #000000; --pp-o: #f28c28; --pp-o-ink: #16181f; --pp-y: #f2c230; --pp-y-ink: #16181f; --pp-g: #3fa34d; --pp-g-ink: #16181f; --pp-d: #1f6b30; --pp-d-ink: #ffffff; --pp-b: #3a6fd8; --pp-b-ink: #ffffff; --pp-c: #8fd3f4; --pp-c-ink: #16181f; --pp-p: #f49ac1; --pp-p-ink: #16181f; --pp-u: #8b5cf6; --pp-u-ink: #000000; --pp-n: #8a5a2b; --pp-n-ink: #ffffff; --pp-w: #e4e8f0; --pp-w-ink: #16181f; --pp-s: #9aa0ad; --pp-s-ink: #16181f; --pp-t: #e3b37c; --pp-t-ink: #16181f;
  --wy-g: #2b7d3d; --wy-p: #7b3fd6; --wy-x: #5d6275; --wy-ink: #ffffff; --wy-cur: #d96b00; --wy-tile-line: #c9cbd6; --wy-filled-line: #6b7083; --wy-key: #e4e1d7; --wy-key-ink: #1f2333; --wy-hint: #f3e6ff; --wy-rev: #62677b;
  --cw-cell: #ffffff; --cw-block: #1f2333; --cw-inword: #dfe9fb; --cw-sel: #ffe28a; --cw-locked: #136b45; --cw-rev: #984511; --cw-cur-bg: #e6ebf5;
  --lw-tile: #f3e2bd; --lw-tile-ink: #3d2b0c; --lw-tile-line: #d9c08c; --lw-given: #ece8de; --lw-inword: #e6f1fb; --lw-sel: #ffe28a; --lw-blank: transparent;
  --pc-fill: #262b40; --pc-cross: #7d8396; --pc-done: #858a9b; --pc-pic-bg: #e3e9f2;
  --ws-line-op: .32; --ws-trace: #6d3fe0; --ws-trace-bg: #f1ebff; --ws-trace-ink: #4425a8; --ws-cellline: #eceaf2; --ws-slot: #b9b3cc;
  --radius: 16px; --shadow: 0 1px 2px rgba(20,25,40,.06), 0 6px 20px rgba(20,25,40,.07);
  --shadow-hover: 0 2px 4px rgba(20,25,40,.06), 0 12px 28px rgba(20,25,40,.10);
  --cell: 44px; --fs: 1; --note-k: 1;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #13151d; --card: #1c1f2c; --surface: #252a3b; --surface-hover: #2e3448; --ink: #eceef7; --muted: #a9afc6;
  --line: #3a4058; --grid: #c5cadf; --thin: #3e4560; --sel: #4a3f10; --peer: #242a3f; --same: #2c3a66;
  --entry: #93b2ff; --note: #b0b6cc; --revealed: #a3a9bf;
  --err: #ff8f8f; --err-bg: #4a1f25; --ok: #6fe0ad;
  --accent-strong: color-mix(in srgb, var(--accent) 62%, #000); --tint-pct: 20%;
  --focus: #9ec0ff;
  --cage: #a3aac6; --cage-sum: #dde1ef; --sign: #ffa58a;
  --clue-bg: #454c69; --clue-ink: #ffffff; --clue-diag: #8d94b0; --kak-gap: #5e6584;
  --chip: #262a3b; --pill: #2a2f43; --pill-ink: #c3c8da; --prog: #4a3b0f; --prog-ink: #ffd772; --done: #133d2d; --done-ink: #7de6b6;
  --rev: #2a2f43; --rev-ink: #c0c6da; --star: #f4b545; --star-off: #4a5068; --track: #2a2f43;
  --overlay: rgba(19, 21, 29, .86); --warn-bg: #3d1d1f; --warn-line: #7a3434; --warn-ink: #ffb4ab;
  --thumb-bg: #1c1f2c; --thumb-ink: #c5cadf; --logo-bg: #2e3448;
  --w0: #ff7070; --w1: #74a0ff; --w2: #52cf7a; --w3: #ffa552; --w4: #b892ff; --w5: #3fd3d1; --w6: #ff80c8; --w7: #d39a62; --w-glyph: #13151d; --w-tint: 22%;
  --pp-e: #e6dbb4; --pp-e-ink: #2a2208; --pp-e-line: #e6dbb4; --pp-w-line: #f4f5f8; --pp-k: #b9c0da; --pp-k-ink: #13151d; --pp-w: #f4f5f8; --pp-w-ink: #13151d; --pp-d: #2a7d3e; --pp-d-ink: #ffffff;
  --wy-g: #2a7d3e; --wy-p: #7a45d8; --wy-x: #33384a; --wy-ink: #ffffff; --wy-cur: #ff9a3c; --wy-tile-line: #3e4560; --wy-filled-line: #8a91ad; --wy-key: #666d8a; --wy-key-ink: #ffffff; --wy-hint: #3a2a5c; --wy-rev: #575d78;
  --cw-cell: #30364b; --cw-block: #0b0c12; --cw-inword: #2f3f66; --cw-sel: #4a3d0e; --cw-locked: #6fe0ad; --cw-rev: #ffb37a; --cw-cur-bg: #252a3b;
  --lw-tile: #6b5a36; --lw-tile-ink: #fff6e0; --lw-tile-line: #8a7546; --lw-given: #2e3448; --lw-inword: #22334d; --lw-sel: #4a3d0e;
  --pc-fill: #dde2f3; --pc-cross: #8a91ad; --pc-done: #767d99; --pc-pic-bg: #2a2f43;
  --ws-line-op: .5; --ws-trace: #a68bff; --ws-trace-bg: #2b2350; --ws-trace-ink: #dccfff; --ws-cellline: #2a2f43; --ws-slot: #5d6380;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 6px 18px rgba(0,0,0,.25); --shadow-hover: 0 2px 6px rgba(0,0,0,.5), 0 12px 28px rgba(0,0,0,.35);
}
/* High contrast (optional toggle): stronger lines and text in either theme */
:root[data-contrast="high"] {
  --ink: #000000; --muted: #2e3242; --line: #6b7083; --grid: #000000; --thin: #7c8196; --entry: #0030c0; --note: #24283a;
  --err: #a00000; --cage: #1b1e2b; --cage-sum: #000000; --sign: #8f1d08; --focus: #000000; --pill-ink: #24283a;
  --ws-cellline: #a9a5b8; --star-off: #9a9585; --pc-fill: #000000; --pc-cross: #3a3f50; --pc-done: #5c6172;
  --wy-tile-line: #6b7083; --wy-filled-line: #000000; --wy-x: #3f4352; --wy-cur: #a84f00;
}
:root[data-theme="dark"][data-contrast="high"] {
  --bg: #000000; --card: #0b0c12; --ink: #ffffff; --muted: #dde1ee; --line: #8a90aa; --grid: #ffffff; --thin: #737a98;
  --entry: #b4caff; --note: #e2e6f2; --err: #ffa3a3; --cage: #e6e9f5; --cage-sum: #ffffff; --sign: #ffc0ad; --focus: #ffffff;
  --pill-ink: #e6e9f5; --ws-cellline: #4a5070; --star-off: #6d7390; --pc-fill: #ffffff; --pc-cross: #c3c8da; --pc-done: #a0a6bd;
  --wy-tile-line: #8a90aa; --wy-filled-line: #ffffff; --wy-cur: #ffb366;
}
/* Text size */
:root[data-size="large"] { --fs: 1.2; --note-k: 1.12; }
:root[data-size="xl"] { --fs: 1.4; --note-k: 1.25; }
/* Reduced motion: system setting or the in-app toggle */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation: none !important; transition: none !important; }
/* Visible focus for keyboard users */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.board-focus:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { max-width: 980px; margin: 0 auto; padding: 18px 18px 48px; }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: calc(24px * var(--fs)); letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 5px; background: var(--logo-bg); flex: none; }
.logo-mark i { border-radius: 3px; display: block; }
.logo-mark i:nth-child(1) { background: #4f7cff; } .logo-mark i:nth-child(2) { background: #ef6a5b; }
.logo-mark i:nth-child(3) { background: #2bb39b; } .logo-mark i:nth-child(4) { background: #f4a63b; }
.streak { font-size: calc(14px * var(--fs)); color: var(--muted); }

.datebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 20px; }
.datebar h1 { margin: 0; font-size: calc(clamp(19px, 3.4vw, 26px) * var(--fs)); letter-spacing: -.01em; }
.datebar .sub { color: var(--muted); font-size: calc(14px * var(--fs)); margin-top: 2px; }
.navbtn { width: calc(42px * var(--fs)); height: calc(42px * var(--fs)); border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: calc(20px * var(--fs)); display: grid; place-items: center; flex: none; }
.navbtn:disabled { opacity: .3; cursor: default; }
.navbtn:not(:disabled):hover { background: var(--surface-hover); }
.datecenter { text-align: center; flex: 1; }
.todaylink { border: 0; background: none; color: var(--accent-strong); font-weight: 600; font-size: calc(13px * var(--fs)); padding: 2px 6px; }

.progress { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; margin: 10px auto 0; max-width: 260px; }
.progress > div { height: 100%; background: linear-gradient(90deg, #2bb39b, #4f7cff); border-radius: 99px; transition: width .4s; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(168px * var(--fs)), 1fr)); gap: 16px; }
.card { position: relative; text-align: left; border: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, box-shadow .15s; overflow: hidden; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.card { color: var(--ink); }
.card:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.card .thumb { height: 120px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--type) var(--tint-pct), var(--card)); }
.card .thumb svg { height: 96px; width: auto; }
.card h2 { margin: 0; font-size: calc(18px * var(--fs)); }
.card .meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; font-size: calc(13px * var(--fs)); color: var(--muted); }
.card .meta > span:first-child { white-space: nowrap; }
.stars { color: var(--star); letter-spacing: 1px; font-size: calc(14px * var(--fs)); white-space: nowrap; }
.stars .off { color: var(--star-off); }
.level { font-weight: 700; color: var(--ink); }
.pill { font-size: calc(12px * var(--fs)); font-weight: 700; padding: 4px 9px; border-radius: 99px; background: var(--pill); color: var(--pill-ink); white-space: nowrap; }
.pill.prog { background: var(--prog); color: var(--prog-ink); }
.pill.done { background: var(--done); color: var(--done-ink); }
.pill.rev { background: var(--rev); color: var(--rev-ink); }
.card.is-done::after { content: "✓"; position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--done-ink); color: var(--card); display: grid; place-items: center; font-weight: 800; }

.esttime { white-space: nowrap; font-weight: 600; }
.foot { margin-top: 30px; text-align: center; color: var(--muted); font-size: calc(13px * var(--fs)); }

/* Play view */
.playhead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.back { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 8px 12px; font-weight: 600; font-size: calc(14px * var(--fs)); }
.playtitle { flex: 1; min-width: 0; }
.playtitle h1 { margin: 0; font-size: calc(clamp(19px, 3.6vw, 24px) * var(--fs)); }
.playtitle .sub { font-size: calc(13px * var(--fs)); color: var(--muted); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: calc(18px * var(--fs)); background: var(--card); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow); min-width: 78px; text-align: center; }
.rules { font-size: calc(14px * var(--fs)); color: var(--muted); margin: 0 0 14px; line-height: 1.45; }
.playarea { display: flex; gap: 22px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.boardwrap { position: relative; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.side { display: flex; flex-direction: column; gap: 12px; width: calc(260px * var(--fs)); max-width: 100%; }

/* Generic cell */
.cell { position: relative; width: var(--cell); height: var(--cell); display: grid; place-items: center; font-size: calc(var(--cell) * .56); font-weight: 600; color: var(--entry); background: var(--card); cursor: pointer; font-variant-numeric: tabular-nums; }
.cell.given { color: var(--ink); font-weight: 800; }
.cell.peer { background: var(--peer); }
.cell.same { background: var(--same); }
.cell.sel { background: var(--sel) !important; }
.cell.conflict { color: var(--err); }
.cell.wrong { background: var(--err-bg); color: var(--err); }
.cell.wrong.sel { box-shadow: inset 0 0 0 3px var(--err); }
.cell.revealed { color: var(--revealed); }
.notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); font-size: calc(var(--cell) * .22 * var(--note-k)); font-weight: 700; color: var(--note); line-height: 1; }
.notes span { display: grid; place-items: center; }

/* Sudoku / Killer */
.g9 { display: grid; grid-template-columns: repeat(9, var(--cell)); border: 2.5px solid var(--grid); position: relative; }
.g9 .cell { border-right: 1px solid var(--thin); border-bottom: 1px solid var(--thin); }
.g9 .cell.br { border-right: 2.5px solid var(--grid); }
.g9 .cell.bb { border-bottom: 2.5px solid var(--grid); }
.g9 .cell.lastc { border-right: 0; } .g9 .cell.lastr { border-bottom: 0; }
.cages { position: absolute; inset: 0; pointer-events: none; }
.cages path { fill: none; stroke: var(--cage); stroke-width: 1.4; stroke-dasharray: 4 3; }
.cage-sum { position: absolute; top: 1px; left: 2px; font-size: calc(var(--cell) * .24); font-weight: 800; color: var(--cage-sum); line-height: 1; background: inherit; padding: 1px 1px; z-index: 2; pointer-events: none; }
.killer .cell { font-size: calc(var(--cell) * .5); }
.killer .notes { inset: calc(var(--cell) * .24) 3px 1px 3px; grid-template-rows: repeat(2, 1fr); }

/* Futoshiki */
.fut { display: grid; }
.fut .cell { border: 2px solid var(--grid); border-radius: 8px; }
.fut .sign { display: grid; place-items: center; color: var(--sign); font-weight: 800; font-size: calc(var(--cell) * .42); line-height: 1; pointer-events: none; }

/* Kakuro */
.kak { display: grid; border: 2px solid var(--kak-gap); background: var(--kak-gap); gap: 1px; }
.kak .cell { font-size: calc(var(--cell) * .55); }
.kak .cell.runbad { color: var(--err); }
.kak .clue { position: relative; width: var(--cell); height: var(--cell); background: var(--clue-bg); color: var(--clue-ink); overflow: hidden; }
.kak .clue.diag { background: linear-gradient(to top right, var(--clue-bg) calc(50% - .8px), var(--clue-diag) 50%, var(--clue-bg) calc(50% + .8px)); }
.kak .clue .a, .kak .clue .d { position: absolute; font-size: calc(var(--cell) * .3); font-weight: 800; line-height: 1; }
.kak .clue .a { top: 12%; right: 10%; }
.kak .clue .d { bottom: 10%; left: 12%; }

/* Side controls */
.pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pad button { height: calc(52px * var(--fs)); border-radius: 12px; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: calc(22px * var(--fs)); font-weight: 700; color: var(--entry); }
.pad button:active { transform: scale(.96); }
.pad button.wide { font-size: calc(15px * var(--fs)); color: var(--ink); }
.pad button.erase { color: var(--ink); font-size: calc(20px * var(--fs)); }
.pad button.on { background: var(--accent-strong); color: var(--on-accent); }
.pad button:disabled { opacity: .35; }
/* number complete (all N copies placed): dimmed, with a tick; stays clickable so mistakes can still be fixed */
.pad button[data-d] { position: relative; }
.pad button.done { background: var(--chip); box-shadow: none; color: var(--muted); font-weight: 600; }
.pad button.done::after { content: '✓'; position: absolute; top: 5px; right: 7px; font-size: calc(15px * var(--fs)); font-weight: 800; line-height: 1; color: var(--ok); }
:root[data-contrast="high"] .pad button.done { outline: 2px dashed var(--muted); outline-offset: -3px; }
:root[data-contrast="high"] .pad button.done::after { color: var(--ink); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions button { min-height: calc(44px * var(--fs)); border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: calc(14px * var(--fs)); }
.actions button:hover { background: var(--surface-hover); }
.actions button.span2 { grid-column: span 2; }
.actions button.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.actions button.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.hint { font-size: calc(12px * var(--fs)); color: var(--muted); line-height: 1.5; }
kbd { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: calc(11px * var(--fs)); font-family: inherit; }

/* Solved banner */
.solved { position: absolute; inset: 0; display: grid; place-items: center; background: var(--overlay); backdrop-filter: blur(2px); border-radius: var(--radius); z-index: 5; animation: fade .3s; }
.solved .box { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 22px 24px; text-align: center; max-width: 84%; }
.solved .big { font-size: calc(40px * var(--fs)); }
.solved h2 { margin: 6px 0 4px; }
.solved p { margin: 0 0 14px; color: var(--muted); }
.solved .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.solved button { border-radius: 12px; padding: 10px 14px; font-weight: 700; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.solved button.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.loading { display: grid; place-items: center; min-height: 300px; color: var(--muted); gap: 12px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--track); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: calc(14px * var(--fs)); font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 700px) {
  .wrap { padding: 12px 10px 40px; }
  .side { width: 100%; }
  .boardwrap { padding: 8px; }
  .hint.kb { display: none; }
  .card .thumb { height: 96px; } .card .thumb svg { height: 76px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 12px; }
  .card h2 { font-size: calc(16px * var(--fs)); }
  .card .meta { flex-direction: column; align-items: flex-start; }
}

/* Wordsnake */
.wsgrid { position: relative; display: grid; border: 2.5px solid var(--grid); border-radius: 6px; touch-action: none; }
.wslines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.wslines polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wscell { background: transparent; color: var(--ink); font-weight: 800; font-size: calc(var(--cell) * .48); border-right: 1px solid var(--ws-cellline); border-bottom: 1px solid var(--ws-cellline); z-index: 1; touch-action: none; }
.wscell.found { color: var(--ink); }
.wscell.tr { color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.wscell.bad { color: var(--err); }
.wscell.start::before { content: ""; position: absolute; inset: 12%; border-radius: 50%; border: 3px solid var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.wscell.cur { box-shadow: inset 0 0 0 2px var(--ws-trace); }
@keyframes pulse { 50% { transform: scale(.88); opacity: .6; } }
.wstheme { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.wstheme span { font-size: calc(12px * var(--fs)); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.wstheme b { font-size: calc(20px * var(--fs)); }
.wstrace { min-height: 44px; border-radius: 12px; background: var(--ws-trace-bg); color: var(--ws-trace-ink); font-weight: 800; font-size: calc(20px * var(--fs)); letter-spacing: .12em; display: grid; place-items: center; padding: 6px 10px; text-align: center; word-break: break-all; }
.wstrace.bad { background: var(--err-bg); color: var(--err); }
.wslist { display: flex; flex-wrap: wrap; gap: 6px; }
.wscount { width: 100%; font-size: calc(13px * var(--fs)); color: var(--muted); font-weight: 600; }
.wsword { background: var(--card); color: var(--ink); border-radius: 10px; padding: 6px 9px; font-weight: 800; font-size: calc(14px * var(--fs)); letter-spacing: .05em; box-shadow: var(--shadow); min-height: 32px; display: flex; align-items: center; }
.wsword.got { background: color-mix(in srgb, var(--wc) 22%, var(--card)); color: var(--ink); text-decoration: line-through; text-decoration-color: var(--wc); text-decoration-thickness: 2px; }
.wsword.hinted { color: var(--muted); font-style: italic; }
.wsword .slots { display: flex; gap: 3px; }
.wsword .slots i { font-style: normal; width: calc(12px * var(--fs)); border-bottom: 2px solid var(--ws-slot); text-align: center; font-size: calc(13px * var(--fs)); line-height: 16px; }
.wsword .q { color: var(--muted); margin-left: 2px; }

/* Header actions + settings dialog */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.gear { width: calc(42px * var(--fs)); height: calc(42px * var(--fs)); border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; flex: none; padding: 0; }
.gear:hover { background: var(--surface-hover); }
.gear svg { width: 22px; height: 22px; }
.playhead { flex-wrap: wrap; }
dialog.settings { border: 0; border-radius: 18px; padding: 0; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
dialog.settings::backdrop { background: rgba(10, 12, 20, .45); }
.settings form { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.settings h2 { margin: 0; font-size: calc(20px * var(--fs)); display: flex; align-items: center; justify-content: space-between; }
.settings fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.settings legend { font-weight: 800; font-size: calc(14px * var(--fs)); margin-bottom: 8px; padding: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--pill); padding: 4px; border-radius: 12px; }
.seg label { position: relative; text-align: center; border-radius: 9px; padding: 9px 6px; font-weight: 700; font-size: calc(14px * var(--fs)); cursor: pointer; color: var(--pill-ink); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: calc(15px * var(--fs)); }
.check input { width: 22px; height: 22px; accent-color: var(--accent-strong); }
.settings .note { font-size: calc(12px * var(--fs)); color: var(--muted); margin: -4px 0 0; }
.settings .close { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: calc(14px * var(--fs)); }
.settings .preview { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: calc(13px * var(--fs)); }

/* Large print on small screens: one card per row, no horizontal overflow */
@media (max-width: 700px) {
  :root[data-size="large"] .cards, :root[data-size="xl"] .cards { grid-template-columns: 1fr; }
  :root[data-size="large"] .card .meta, :root[data-size="xl"] .card .meta { flex-direction: row; align-items: center; }
  .playtitle { min-width: 60%; }
}
.pill { white-space: normal; }
.wslines polyline.found { stroke-opacity: var(--ws-line-op); }
.wslines polyline.trace { stroke: var(--ws-trace); stroke-opacity: .75; }
.wslines polyline.trace.bad { stroke: var(--err); }

/* Picture Cross */
.pcgrid { display: grid; grid-auto-rows: var(--cell); --clue-step: calc(var(--cell) * .6); width: max-content; }
.pccorner { grid-row: 1; }
.pcclue { display: flex; color: var(--ink); font-weight: 700; font-size: max(10px, calc(var(--cell) * .46)); font-variant-numeric: tabular-nums; transition: color .2s; }
.pcclue.col { grid-row: 1; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 3px; line-height: var(--clue-step); border-radius: 6px 6px 0 0; }
.pcclue.row { justify-content: flex-end; align-items: center; gap: calc(var(--cell) * .24); padding: 0 calc(var(--cell) * .2) 0 4px; white-space: nowrap; border-radius: 6px 0 0 6px; }
.pcclue.done { color: var(--pc-done); font-weight: 600; }
.pcclue.hl { background: var(--peer); }
.pccell { font-size: 0; border-right: 1px solid var(--thin); border-bottom: 1px solid var(--thin); }
.pccell.l0 { border-left: 2px solid var(--grid); } .pccell.t0 { border-top: 2px solid var(--grid); }
.pccell.r5, .pccell.rE { border-right: 2px solid var(--grid); } .pccell.b5, .pccell.bE { border-bottom: 2px solid var(--grid); }
.pccell.on { background: var(--pc-fill); }
.pccell.x::after { content: "\2715"; color: var(--pc-cross); font-size: calc(var(--cell) * .5); font-weight: 700; line-height: 1; }
.pccell.cur { box-shadow: inset 0 0 0 2px var(--focus); }
.pccell.on.cur { box-shadow: inset 0 0 0 2px var(--focus), inset 0 0 0 4px var(--card); }
.pccell.wrong { background: var(--err-bg); }
.pccell.on.wrong { background: var(--err); }
.pccell.x.wrong::after { color: var(--err); }
.pcgrid.pic .pccell { border-color: transparent; cursor: default; background: var(--pc-pic-bg); }
.pcgrid.pic .pccell.l0, .pcgrid.pic .pccell.t0 { border-color: transparent; }
.pcmodes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pcmodes button { min-height: calc(48px * var(--fs)); border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: calc(15px * var(--fs)); display: flex; align-items: center; justify-content: center; gap: 8px; }
.pcmodes button.on { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.pcmodes .sw { display: inline-grid; place-items: center; width: calc(18px * var(--fs)); height: calc(18px * var(--fs)); font-style: normal; font-size: calc(14px * var(--fs)); }
.pcmodes .sw.fill { background: currentColor; border-radius: 3px; }
.pcclue { cursor: pointer; }
.pcclue.multi.row { gap: calc(var(--cell) * .12); }
.pcclue .chip { display: inline-flex; align-items: baseline; justify-content: center; min-width: calc(var(--cell) * .62); padding: 0 calc(var(--cell) * .1); border-radius: 4px; line-height: 1.3; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.pcclue.col .chip { margin-top: calc(var(--cell) * .06); line-height: calc(var(--clue-step) - var(--cell) * .06); }
.pcclue .chip sub { display: none; font-size: .58em; margin-left: 1px; font-weight: 700; }
:root[data-contrast="high"] .pcclue .chip sub { display: inline; }
:root[data-contrast="high"] .pcclue .chip { box-shadow: inset 0 0 0 2px var(--ink); }
.pcclue.done .chip { opacity: .4; }
.pccell .pcl { font-size: calc(var(--cell) * .42); font-weight: 800; line-height: 1; opacity: .9; }
.pccell.on.wrong .pcl { color: #fff; }
.pcmodes.multi { grid-template-columns: repeat(auto-fit, minmax(calc(92px * var(--fs)), 1fr)); }
.pcmodes .sw[class*="c-"] { border-radius: 4px; font-weight: 800; font-size: calc(12px * var(--fs)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3); }
.pcmodes button.on .sw[class*="c-"] { box-shadow: 0 0 0 2px var(--on-accent); }
.playtitle .variant { font-weight: 700; }
/* dark mode: "Black" in colour Picture Cross is drawn black with a light outline, so it can't be mistaken for Grey */
:root[data-theme="dark"] .pccell.c-k, :root[data-theme="dark"] .pcclue .chip.c-k, :root[data-theme="dark"] .pcmodes .sw.c-k { background-color: #05060a; color: #ffffff; box-shadow: inset 0 0 0 2px #9aa1bd; }
.pccell.c-k, .pcclue .chip.c-k, .pcmodes .sw.c-k { background-color: var(--pp-k); color: var(--pp-k-ink); }
.pccell.c-r, .pcclue .chip.c-r, .pcmodes .sw.c-r { background-color: var(--pp-r); color: var(--pp-r-ink); }
.pccell.c-o, .pcclue .chip.c-o, .pcmodes .sw.c-o { background-color: var(--pp-o); color: var(--pp-o-ink); }
.pccell.c-y, .pcclue .chip.c-y, .pcmodes .sw.c-y { background-color: var(--pp-y); color: var(--pp-y-ink); }
.pccell.c-g, .pcclue .chip.c-g, .pcmodes .sw.c-g { background-color: var(--pp-g); color: var(--pp-g-ink); }
.pccell.c-d, .pcclue .chip.c-d, .pcmodes .sw.c-d { background-color: var(--pp-d); color: var(--pp-d-ink); }
.pccell.c-b, .pcclue .chip.c-b, .pcmodes .sw.c-b { background-color: var(--pp-b); color: var(--pp-b-ink); }
.pccell.c-c, .pcclue .chip.c-c, .pcmodes .sw.c-c { background-color: var(--pp-c); color: var(--pp-c-ink); }
.pccell.c-p, .pcclue .chip.c-p, .pcmodes .sw.c-p { background-color: var(--pp-p); color: var(--pp-p-ink); }
.pccell.c-u, .pcclue .chip.c-u, .pcmodes .sw.c-u { background-color: var(--pp-u); color: var(--pp-u-ink); }
.pccell.c-n, .pcclue .chip.c-n, .pcmodes .sw.c-n { background-color: var(--pp-n); color: var(--pp-n-ink); }
.pccell.c-s, .pcclue .chip.c-s, .pcmodes .sw.c-s { background-color: var(--pp-s); color: var(--pp-s-ink); }
.pccell.c-w, .pcclue .chip.c-w, .pcmodes .sw.c-w { background-color: var(--pp-w); color: var(--pp-w-ink); }
.pcpic { display: grid; width: max-content; margin: 0 auto 8px; padding: 8px; border-radius: 10px; background: var(--pc-pic-bg); }
.pcpic i { display: block; }
.pcname { font-weight: 700; color: var(--muted); font-size: calc(14px * var(--fs)); }

/* Circuits */
.cigrid { position: relative; display: grid; border: 2px solid var(--grid); width: max-content; }
.cicell { border-right: 1px solid var(--thin); border-bottom: 1px solid var(--thin); font-size: 0; touch-action: none; }
.cilines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.cilines .wire { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cilines .wire:not(.done) { stroke-opacity: .85; }
.cterm { position: relative; z-index: 3; display: grid; place-items: center; width: 74%; height: 74%; border-radius: 50%; color: var(--w-glyph); font-size: calc(var(--cell) * .36); font-weight: 900; line-height: 1; box-shadow: 0 0 0 2px var(--card); }
.cicell.linked .cterm { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px currentColor; }
.cterm.c0 { background: var(--w0); } .cilines .c0 { stroke: var(--w0); } .cilines circle.c0 { fill: var(--w0); stroke: var(--card); stroke-width: 2px; } .cicell.f0 { background: color-mix(in srgb, var(--w0) var(--w-tint), var(--card)); } .cicell.linked .cterm.c0 { color: var(--w-glyph); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--w0); }
.cterm.c1 { background: var(--w1); } .cilines .c1 { stroke: var(--w1); } .cilines circle.c1 { fill: var(--w1); stroke: var(--card); stroke-width: 2px; } .cicell.f1 { background: color-mix(in srgb, var(--w1) var(--w-tint), var(--card)); } .cicell.linked .cterm.c1 { color: var(--w-glyph); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--w1); }
.cterm.c2 { background: var(--w2); } .cilines .c2 { stroke: var(--w2); } .cilines circle.c2 { fill: var(--w2); stroke: var(--card); stroke-width: 2px; } .cicell.f2 { background: color-mix(in srgb, var(--w2) var(--w-tint), var(--card)); } .cicell.linked .cterm.c2 { color: var(--w-glyph); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--w2); }
.cterm.c3 { background: var(--w3); } .cilines .c3 { stroke: var(--w3); } .cilines circle.c3 { fill: var(--w3); stroke: var(--card); stroke-width: 2px; } .cicell.f3 { background: color-mix(in srgb, var(--w3) var(--w-tint), var(--card)); } .cicell.linked .cterm.c3 { color: var(--w-glyph); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--w3); }
.cterm.c4 { background: var(--w4); } .cilines .c4 { stroke: var(--w4); } .cilines circle.c4 { fill: var(--w4); stroke: var(--card); stroke-width: 2px; } .cicell.f4 { background: color-mix(in srgb, var(--w4) var(--w-tint), var(--card)); } .cicell.linked .cterm.c4 { color: var(--w-glyph); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--w4); }
.cterm.c5 { background: var(--w5); } .cilines .c5 { stroke: var(--w5); } .cilines circle.c5 { fill: var(--w5); stroke: var(--card); stroke-width: 2px; } .cicell.f5 { background: color-mix(in srgb, var(--w5) var(--w-tint), var(--card)); } .cicell.linked .cterm.c5 { color: var(--w-glyph); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--w5); }
.cterm.c6 { background: var(--w6); } .cilines .c6 { stroke: var(--w6); } .cilines circle.c6 { fill: var(--w6); stroke: var(--card); stroke-width: 2px; } .cicell.f6 { background: color-mix(in srgb, var(--w6) var(--w-tint), var(--card)); } .cicell.linked .cterm.c6 { color: var(--w-glyph); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--w6); }
.cterm.c7 { background: var(--w7); } .cilines .c7 { stroke: var(--w7); } .cilines circle.c7 { fill: var(--w7); stroke: var(--card); stroke-width: 2px; } .cicell.f7 { background: color-mix(in srgb, var(--w7) var(--w-tint), var(--card)); } .cicell.linked .cterm.c7 { color: var(--w-glyph); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--w7); }
.cicell.cur { box-shadow: inset 0 0 0 3px var(--focus); }
.cicell.wrong { background: var(--err-bg) !important; box-shadow: inset 0 0 0 2px var(--err); }
.cicell.spark { background: var(--err-bg) !important; animation: spark .35s 2; }
.cicell.spark::after { content: "\26A1"; position: absolute; z-index: 4; font-size: calc(var(--cell) * .5); }
@keyframes spark { 50% { box-shadow: inset 0 0 0 4px var(--err); } }
.cistatus { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; font-size: calc(14px * var(--fs)); color: var(--muted); line-height: 1.5; }
.cistatus b { color: var(--ink); }
.cistatus .drawing { color: var(--ink); font-weight: 700; }

/* Picture Path */
.ppgrid { position: relative; display: grid; border: 2px solid var(--grid); width: max-content; }
.ppcell { border-right: 1px solid var(--thin); border-bottom: 1px solid var(--thin); font-size: 0; touch-action: none; }
.pplines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.pplines polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pplines polyline.open { stroke-opacity: .8; }
.pplines polyline.done { stroke-opacity: .55; }
.ppn { position: relative; z-index: 3; font-size: max(10px, calc(var(--cell) * .46)); font-weight: 800; line-height: 1; }
/* clue badge: a coloured circle while its path is open, a square once it's joined (1s start as squares) */
.ppcell.clue { display: grid; place-items: center; }
.ppcell.clue .ppn { display: grid; place-items: center; width: calc(var(--cell) * .8); height: calc(var(--cell) * .8); border-radius: 50%; border: max(1.5px, calc(var(--cell) * .05)) solid currentColor; box-sizing: border-box; }
.ppcell.clue.linked .ppn { border-radius: max(2px, calc(var(--cell) * .08)); width: calc(var(--cell) * .86); height: calc(var(--cell) * .86); }
:root[data-contrast="high"] .ppcell.clue .ppn { border-width: max(2.5px, calc(var(--cell) * .08)); }
.ppcell.linked.clue { box-shadow: none; }
.ppgrid.pic .pplines, .ppgrid.pic .ppn { display: none; }
.ppgrid.pic .ppcell { border-color: transparent; cursor: default; }
.ppcell.cur { box-shadow: inset 0 0 0 3px var(--focus); }
.ppcell.wrong { box-shadow: inset 0 0 0 3px var(--err); background-image: linear-gradient(var(--err-bg), var(--err-bg)); }
.ppcell.pc-k .ppn, .ppcell.fill-k, .pcpic i.fill-k { background-color: var(--pp-k); color: var(--pp-k-ink); } .pplines .pc-k { stroke: var(--pp-k); } .pplines .ink-k { stroke: var(--pp-k-ink); }
.ppcell.pc-r .ppn, .ppcell.fill-r, .pcpic i.fill-r { background-color: var(--pp-r); color: var(--pp-r-ink); } .pplines .pc-r { stroke: var(--pp-r); } .pplines .ink-r { stroke: var(--pp-r-ink); }
.ppcell.pc-o .ppn, .ppcell.fill-o, .pcpic i.fill-o { background-color: var(--pp-o); color: var(--pp-o-ink); } .pplines .pc-o { stroke: var(--pp-o); } .pplines .ink-o { stroke: var(--pp-o-ink); }
.ppcell.pc-y .ppn, .ppcell.fill-y, .pcpic i.fill-y { background-color: var(--pp-y); color: var(--pp-y-ink); } .pplines .pc-y { stroke: var(--pp-y); } .pplines .ink-y { stroke: var(--pp-y-ink); }
.ppcell.pc-g .ppn, .ppcell.fill-g, .pcpic i.fill-g { background-color: var(--pp-g); color: var(--pp-g-ink); } .pplines .pc-g { stroke: var(--pp-g); } .pplines .ink-g { stroke: var(--pp-g-ink); }
.ppcell.pc-d .ppn, .ppcell.fill-d, .pcpic i.fill-d { background-color: var(--pp-d); color: var(--pp-d-ink); } .pplines .pc-d { stroke: var(--pp-d); } .pplines .ink-d { stroke: var(--pp-d-ink); }
.ppcell.pc-b .ppn, .ppcell.fill-b, .pcpic i.fill-b { background-color: var(--pp-b); color: var(--pp-b-ink); } .pplines .pc-b { stroke: var(--pp-b); } .pplines .ink-b { stroke: var(--pp-b-ink); }
.ppcell.pc-c .ppn, .ppcell.fill-c, .pcpic i.fill-c { background-color: var(--pp-c); color: var(--pp-c-ink); } .pplines .pc-c { stroke: var(--pp-c); } .pplines .ink-c { stroke: var(--pp-c-ink); }
.ppcell.pc-p .ppn, .ppcell.fill-p, .pcpic i.fill-p { background-color: var(--pp-p); color: var(--pp-p-ink); } .pplines .pc-p { stroke: var(--pp-p); } .pplines .ink-p { stroke: var(--pp-p-ink); }
.ppcell.pc-u .ppn, .ppcell.fill-u, .pcpic i.fill-u { background-color: var(--pp-u); color: var(--pp-u-ink); } .pplines .pc-u { stroke: var(--pp-u); } .pplines .ink-u { stroke: var(--pp-u-ink); }
.ppcell.pc-n .ppn, .ppcell.fill-n, .pcpic i.fill-n { background-color: var(--pp-n); color: var(--pp-n-ink); } .pplines .pc-n { stroke: var(--pp-n); } .pplines .ink-n { stroke: var(--pp-n-ink); }
.ppcell.pc-w .ppn, .ppcell.fill-w, .pcpic i.fill-w { background-color: var(--pp-w); color: var(--pp-w-ink); } .pplines .pc-w { stroke: var(--pp-w-line); } .pplines .ink-w { stroke: var(--pp-w-ink); }
.ppcell.pc-e .ppn, .ppcell.fill-e, .pcpic i.fill-e { background-color: var(--pp-e); color: var(--pp-e-ink); } .pplines .pc-e { stroke: var(--pp-e-line); } .pplines .ink-e { stroke: var(--pp-e-ink); }
.ppcell.pc-s .ppn, .ppcell.fill-s, .pcpic i.fill-s { background-color: var(--pp-s); color: var(--pp-s-ink); } .pplines .pc-s { stroke: var(--pp-s); } .pplines .ink-s { stroke: var(--pp-s-ink); }
.ppcell.pc-t .ppn, .ppcell.fill-t, .pcpic i.fill-t { background-color: var(--pp-t); color: var(--pp-t-ink); } .pplines .pc-t { stroke: var(--pp-t); } .pplines .ink-t { stroke: var(--pp-t-ink); }
/* big grids: thick guide lines every 5 squares, a scrollable zoomable view and its toolbar */
.ppcell { box-sizing: border-box; }
.ppcell.r5 { border-right: 2px solid var(--grid); }
.ppcell.b5 { border-bottom: 2px solid var(--grid); }
.ppgrid.pic .ppcell.r5, .ppgrid.pic .ppcell.b5 { border-color: transparent; }
/* small squares (whole 50x50 on a laptop at Fit): tighter numbers so they stay readable; tiny (< 9px): numbers hidden,
   the coloured badges still show where paths start */
.ppgrid.small .ppn { font-size: calc(var(--cell) * .74); letter-spacing: -.04em; }
.ppgrid.small .ppcell.clue .ppn { width: calc(var(--cell) * .94); height: calc(var(--cell) * .94); border-width: 1px; }
:root[data-contrast="high"] .ppgrid.small .ppcell.clue .ppn { border-width: 1.5px; }
.ppgrid.tiny .ppn { font-size: 0; }
.ppgrid.tiny .ppcell { border-right-width: 0; border-bottom-width: 0; }
.ppgrid.tiny .ppcell.r5 { border-right-width: 1px; } .ppgrid.tiny .ppcell.b5 { border-bottom-width: 1px; }
.ppgrid.panmode, .ppgrid.panmode .ppcell { cursor: grab; }
.wrap.ppwide { max-width: 1400px; }
.ppwrap { min-width: 0; max-width: 100%; }
.ppview { overflow: auto; max-width: 100%; overscroll-behavior: contain; border-radius: 6px; -webkit-overflow-scrolling: touch; }
.ppzoom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.ppzoom button { min-width: 44px; min-height: 40px; font-size: calc(var(--fs, 1) * 1.05rem); font-weight: 700; border-radius: 10px; border: 1.5px solid var(--line, var(--thin)); background: var(--card, var(--bg)); color: var(--ink); cursor: pointer; }
.ppzoom button:disabled { opacity: .45; cursor: default; }
.ppzoom button[aria-pressed="true"] { background: var(--focus); color: var(--bg); border-color: var(--focus); }
.ppzoom .zlabel { font-size: calc(var(--fs, 1) * .85rem); color: var(--muted, var(--ink)); }
:root[data-contrast="high"] .ppzoom button { border-width: 2.5px; border-color: var(--ink); }
/* daily page: the Big picture extra */
.extra { margin-top: 22px; }
.extrahead { font-size: calc(var(--fs, 1) * 1.15rem); margin: 0 0 10px; }
.extranote { font-weight: 500; font-size: .8em; color: var(--muted, var(--ink)); }
.card.wide { display: flex; flex-direction: row; gap: 18px; align-items: center; width: 100%; text-align: left; }
.card.wide .extrabody { flex: 1; min-width: 0; }
.card.wide .thumb { width: 120px; }
@media (max-width: 520px) { .card.wide { flex-direction: column; align-items: stretch; } .card.wide .thumb { width: auto; } }
.card.wide .thumb { flex: 0 0 auto; }
.extrasize { font-weight: 600; font-size: .8em; color: var(--muted, var(--ink)); }

.ppcell.clue:not(.linked) .ppn { text-decoration: none; }

/* ===== Wordy ===== */
.wywrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px; width: min(100%, calc(470px * min(var(--fs), 1.2))); box-sizing: border-box; }
.wygrid { display: flex; flex-direction: column; gap: 6px; max-height: calc(var(--wy-tile) * 8 + 48px); overflow-y: auto; padding: 3px; }
.wyrow { display: flex; gap: 6px; justify-content: center; }
.wytile { width: var(--wy-tile); height: var(--wy-tile); display: flex; align-items: center; justify-content: center; border: 2px solid var(--wy-tile-line);
  border-radius: 8px; font-weight: 800; font-size: calc(var(--wy-tile) * .5); color: var(--ink); background: var(--card); text-transform: uppercase; position: relative; }
.wyrow.current .wytile { cursor: pointer; }
.wytile.filled { border-color: var(--wy-filled-line); }
.wytile.cur { border-color: var(--wy-cur); box-shadow: 0 0 0 2px var(--wy-cur); }
.wytile.hinted { background: var(--wy-hint); }
.wytile.g, .wytile.p, .wytile.x, .wytile.rev { color: var(--wy-ink); }
.wytile.g { background: var(--wy-g); border-color: var(--wy-g); }
.wytile.p { background: var(--wy-p); border-color: var(--wy-p); }
.wytile.x { background: var(--wy-x); border-color: var(--wy-x); }
.wytile.rev { background: var(--wy-rev); border-color: var(--wy-rev); }
.wyrow.flip .wytile { animation: wyflip .5s ease both; animation-delay: var(--d, 0s); }
@keyframes wyflip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.wyrow.shake { animation: wyshake .4s ease; }
@keyframes wyshake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
/* High contrast: shape cues as well as colour (green = bar underneath, purple = dot in the corner) */
:root[data-contrast="high"] .wytile.g::after, :root[data-contrast="high"] .wykey.g::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: 10%; height: 3px; border-radius: 2px; background: currentColor; }
:root[data-contrast="high"] .wytile.p::after, :root[data-contrast="high"] .wykey.p::after { content: ""; position: absolute; right: 10%; top: 10%; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.wykb { display: flex; flex-direction: column; gap: 7px; width: 100%; max-width: calc(500px * var(--fs)); }
.wykrow { display: flex; gap: 5px; justify-content: center; }
.wykey { flex: 1 1 0; min-width: 0; max-width: calc(46px * var(--fs)); height: calc(52px * min(var(--fs), 1.2)); border: 0; border-radius: 7px; background: var(--wy-key); color: var(--wy-key-ink);
  font-weight: 700; font-size: calc(15px * min(var(--fs), 1.25)); padding: 0; position: relative; touch-action: manipulation; }
.wykey.wide { flex: 1.6 1 0; max-width: calc(76px * var(--fs)); font-size: calc(12px * min(var(--fs), 1.2)); text-transform: uppercase; letter-spacing: .02em; }
.wykey:hover:not(:disabled) { filter: brightness(.95); }
.wykey.g, .wykey.p, .wykey.x { color: var(--wy-ink); }
.wykey.g { background: var(--wy-g); } .wykey.p { background: var(--wy-p); } .wykey.x { background: var(--wy-x); }
.wykey:disabled { opacity: .6; }
.wysolved { display: flex; gap: 5px; justify-content: center; margin-bottom: 8px; }
.wysolved i { font-style: normal; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 7px; font-weight: 800; font-size: 20px; color: var(--wy-ink); background: var(--wy-g); }
.wysolved i.rev { background: var(--wy-rev); }

/* ===== Link Words ===== */
.lwwrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 14px; }
.lwtheme { font-size: calc(16px * var(--fs)); color: var(--muted); }
.lwtheme b { color: var(--ink); font-size: calc(19px * var(--fs)); }
.lwgrid { display: grid; gap: 0; }
.lwblank { width: var(--cell); height: var(--cell); }
.lwcell { width: var(--cell); height: var(--cell); box-sizing: border-box; border: 1.5px solid var(--grid); margin: -0.75px; background: var(--card); color: var(--entry);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: calc(var(--cell) * .52); text-transform: uppercase; cursor: pointer; position: relative; }
.lwcell.given { background: var(--lw-given); color: var(--ink); }
.lwcell.inword { background: var(--lw-inword); }
.lwcell.sel { background: var(--lw-sel); box-shadow: inset 0 0 0 2px var(--focus); z-index: 1; }
.lwcell.found { background: var(--done); color: var(--done-ink); }
.lwcell.found.sel { background: var(--done); }
.lwcell.wrong { background: var(--err-bg); color: var(--err); }
:root[data-contrast="high"] .lwcell.found::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: 8%; height: 2px; background: currentColor; }
.lwtray { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: calc(520px * var(--fs)); }
.lwtile { width: calc(36px * min(var(--fs), 1.25)); height: calc(42px * min(var(--fs), 1.25)); border-radius: 7px; border: 1px solid var(--lw-tile-line); background: var(--lw-tile); color: var(--lw-tile-ink);
  font-weight: 800; font-size: calc(18px * min(var(--fs), 1.25)); padding: 0; box-shadow: 0 2px 0 var(--lw-tile-line); touch-action: manipulation; }
.lwtile.used { opacity: .28; box-shadow: none; cursor: default; }
.lwtile:not(.used):hover { filter: brightness(.96); }
.lwsolved { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-width: 300px; margin: 0 auto 8px; }
.lwsolved span { background: var(--done); color: var(--done-ink); border-radius: 6px; padding: 3px 8px; font-weight: 800; font-size: calc(13px * var(--fs)); }

/* ===== Crossword ===== */
.cwwrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px; }
.cwbar { display: flex; align-items: stretch; gap: 6px; width: 100%; max-width: calc(var(--cell) * 13 + 20px); min-width: min(100%, 300px); }
.cwcur { flex: 1; background: var(--cw-cur-bg); border-radius: 10px; padding: 9px 12px; font-size: calc(15px * var(--fs)); color: var(--ink); line-height: 1.35; min-height: calc(2.7em); display: flex; align-items: center; }
.cwcur .enum, .cwclue .enum { color: var(--muted); white-space: nowrap; }
.cwnav { width: calc(36px * var(--fs)); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: calc(20px * var(--fs)); }
.cwgrid { display: grid; border: 2px solid var(--grid); background: var(--grid); gap: 1px; }
.cwblock { width: var(--cell); height: var(--cell); background: var(--cw-block); }
.cwcell { width: var(--cell); height: var(--cell); background: var(--cw-cell); position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cwcell .cwnum { position: absolute; left: 2px; top: 0; font-size: max(8px, calc(var(--cell) * .28)); line-height: 1.1; color: var(--ink); font-weight: 600; }
.cwcell .cwch { font-weight: 700; font-size: calc(var(--cell) * .56); color: var(--entry); text-transform: uppercase; margin-top: calc(var(--cell) * .08); }
.cwgrid.diamond { background: transparent; border: 0; padding: 1px; }
.cwgrid.diamond .cwcell, .cwgrid.diamond .cwblock { box-shadow: 0 0 0 1px var(--grid); }
.cwvoid { width: var(--cell); height: var(--cell); }
.cwcell.inword { background: var(--cw-inword); }
.cwcell.sel { background: var(--cw-sel); }
.cwcell.locked .cwch { color: var(--cw-locked); }
.cwcell.rev .cwch { color: var(--cw-rev); }
.cwcell.wrong { background: var(--err-bg); }
.cwcell.wrong .cwch { color: var(--err); }
:root[data-contrast="high"] .cwcell.locked .cwch { text-decoration: underline; text-decoration-thickness: 2px; }
.cwkb { max-width: calc(440px * var(--fs)); }
.wykey.dim { opacity: .25; }
.cwside { width: calc(300px * var(--fs)); }
.cwside .actions { grid-template-columns: 1fr 1fr; }
.cwlists { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 8px; max-height: calc(420px * var(--fs)); overflow-y: auto; }
.cwlist h3 { margin: 4px 6px 4px; font-size: calc(13px * var(--fs)); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cwlist ol { list-style: none; margin: 0 0 8px; padding: 0; }
.cwclue { width: 100%; text-align: left; border: 0; background: none; color: var(--ink); padding: 5px 8px; border-radius: 8px; font-size: calc(14px * var(--fs)); line-height: 1.35; cursor: pointer; }
.cwclue b { display: inline-block; min-width: 1.6em; }
.cwclue:hover { background: var(--surface-hover); }
.cwclue.cross { background: var(--peer); }
.cwclue.cur { background: var(--cw-inword); box-shadow: inset 3px 0 0 var(--accent-strong); font-weight: 600; }
.cwclue.done { color: var(--muted); }
.cwclue.done:not(.cur) { text-decoration: line-through; text-decoration-color: var(--line); }
@media (max-width: 700px) { .cwside { width: 100%; } .cwlists { max-height: none; } }

/* ---------- Your progress (daily page) ---------- */
.progresspanel { margin-top: 26px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: calc(16px * var(--fs)) calc(18px * var(--fs)); }
.proghead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.proghead h2 { margin: 0; font-size: calc(1.15rem * var(--fs)); }
.progtoggle { display: inline-flex; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.progtoggle button { min-height: 40px; min-width: 76px; padding: 0 14px; border: 0; background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: calc(.95rem * var(--fs)); cursor: pointer; }
.progtoggle button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.progtoggle button + button { border-left: 1.5px solid var(--line); }
.progtitle { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; }
.progtitle h3 { margin: 0; font-size: calc(1rem * var(--fs)); }
.navbtn.small { width: calc(36px * var(--fs)); height: calc(36px * var(--fs)); font-size: calc(18px * var(--fs)); }
.progweek { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pday { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
button.pday:hover { background: var(--surface-hover); }
.pday.future { opacity: .5; cursor: default; }
.pday.full { border-color: var(--ok); border-width: 2.5px; }
.pday.today .pdn { text-decoration: underline; text-underline-offset: 3px; }
.pday.sel { box-shadow: inset 0 0 0 2px var(--focus); }
.pdn { font-weight: 700; font-size: calc(.85rem * var(--fs)); }
.pds { font-weight: 700; font-size: calc(.85rem * var(--fs)); }
.pdt { font-size: calc(.75rem * var(--fs)); color: var(--muted); }
.pbig { font-size: calc(.7rem * var(--fs)); font-weight: 700; color: var(--ink); background: color-mix(in srgb, #f2c230 45%, var(--surface)); border-radius: 6px; padding: 0 4px; }
.pring { width: calc(46px * var(--fs)); height: calc(46px * var(--fs)); }
.pring circle { fill: none; stroke-width: 5; }
.pring-bg { stroke: var(--thin); }
.pring-fg { stroke: var(--ok); stroke-linecap: round; }
.pring text { fill: var(--ink); font-size: 15px; font-weight: 800; }
.progmonth { display: grid; gap: 4px; max-width: calc(460px * var(--fs)); }
.pmrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.pmhead span { text-align: center; font-size: calc(.75rem * var(--fs)); font-weight: 700; color: var(--muted); }
.pmrow > span[role="gridcell"]:not(.pmcell) { display: block; }
.pmcell { position: relative; width: 100%; aspect-ratio: 1; min-height: 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; padding: 0; line-height: 1.05; }
button.pmcell { cursor: pointer; }
.pmcell.blank { border-color: transparent; background: none; }
.pmcell.future { opacity: .45; border-style: dashed; }
.pmn { font-size: calc(.8rem * var(--fs)); font-weight: 700; }
.pms { font-size: calc(.65rem * var(--fs)); font-weight: 700; min-height: 1em; }
.pmbig { position: absolute; top: 1px; right: 3px; font-size: calc(.6rem * var(--fs)); }
.pmcell.pm1 { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); }
.pmcell.pm2 { background: color-mix(in srgb, var(--ok) 34%, var(--surface)); }
.pmcell.pm3 { background: color-mix(in srgb, var(--ok) 52%, var(--surface)); }
.pmcell.pm4 { background: var(--ok); color: var(--on-ok, #ffffff); border-color: var(--ok); }
:root[data-theme="dark"] .pmcell.pm4 { color: #0b1a12; }
.pmcell.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.pmcell.sel { box-shadow: inset 0 0 0 2px var(--focus); }
.pmkey { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 8px; font-size: calc(.75rem * var(--fs)); color: var(--muted); }
.pmkey .pmcell { width: 16px; min-height: 16px; height: 16px; border-radius: 4px; font-size: 10px; }
.progstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(120px * var(--fs)), 1fr)); gap: 8px; margin: 14px 0 0; }
.progstats div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.progstats dt { font-size: calc(.72rem * var(--fs)); color: var(--muted); }
.progstats dd { margin: 2px 0 0; font-weight: 800; font-size: calc(1.05rem * var(--fs)); }
:root[data-contrast="high"] .pday, :root[data-contrast="high"] .pmcell:not(.blank), :root[data-contrast="high"] .progtoggle { border-color: var(--ink); }
:root[data-contrast="high"] .pring-bg { stroke: var(--muted); }
@media (max-width: 520px) { .progweek { gap: 3px; } .pday { padding: 6px 0; border-radius: 9px; } .pdt { font-size: .62rem; } .pbig { font-size: .58rem; padding: 0 2px; } }
.pring { max-width: 100%; height: auto; }
/* per-puzzle times for the viewed day (progress panel, week view) */
.progtimes { margin: 14px 0 0; overflow-x: auto; }
.ptheadrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ptheadrow h3 { margin: 0; font-size: calc(15px * var(--fs)); }
.ptcopy { font: inherit; font-size: calc(13px * var(--fs)); padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line, #ccc); background: var(--card, #fff); color: inherit; cursor: pointer; }
.ptcopy:focus-visible { outline: 3px solid var(--focus, #2563eb); outline-offset: 2px; }
.progtimes table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: calc(13px * var(--fs)); }
.progtimes th, .progtimes td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line, #ddd); }
.progtimes thead th { font-weight: 600; opacity: .8; }
.progtimes td:nth-child(4) { font-variant-numeric: tabular-nums; }
.ptmsg { display: block; min-height: 1em; font-size: calc(12px * var(--fs)); margin-top: 4px; }
@media (max-width: 640px) {
  .progtimes { overflow-x: visible; }
  .progtimes table, .progtimes tbody, .progtimes tr, .progtimes th, .progtimes td { display: block; }
  .progtimes thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .progtimes tr { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--line, #ddd); }
  .progtimes th, .progtimes td { border: 0; padding: 0; overflow-wrap: anywhere; }
  .progtimes th[scope="row"] { flex: 1 0 100%; }
}
/* Share the day's times */
.sharerow { display: flex; justify-content: flex-end; margin: -6px 0 12px; }
.sharebtn { font: inherit; font-size: calc(.9rem * var(--fs)); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; min-height: 40px; }
.sharebtn:hover { box-shadow: var(--shadow); }
.sharebtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sharebtn.inbox { margin-top: 12px; }
[data-contrast="high"] .sharebtn { border-width: 2px; border-color: var(--ink); }
@media (max-width: 640px) { .sharerow { justify-content: stretch; } .sharerow .sharebtn { width: 100%; justify-content: center; } }
/* header link, site footer, About / Feedback pages */
.toplink { font-size: calc(14px * var(--fs)); color: var(--accent-strong, var(--ink)); font-weight: 600; text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.toplink:hover { text-decoration: underline; }
.toplink:focus-visible, .sitefoot a:focus-visible, .infobox a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.sitefoot { margin-top: 10px; text-align: center; font-size: calc(13px * var(--fs)); color: var(--muted); }
.sitefoot a { color: var(--ink); font-weight: 600; }
.sitefoot .privacy { margin: 6px auto 0; max-width: 560px; font-size: calc(12px * var(--fs)); }
.playfoot { margin: 24px 0 8px; }
.infobox { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 24px 28px; max-width: 720px; margin: 0 auto 16px; color: var(--ink); line-height: 1.55; }
.infobox h1 { margin: 0 0 10px; font-size: calc(1.6rem * var(--fs)); }
.infobox h1:focus { outline: none; }
.infobox h2 { margin: 20px 0 4px; font-size: calc(1.1rem * var(--fs)); }
.infobox p { margin: 6px 0; font-size: calc(1rem * var(--fs)); }
.infobox a { color: var(--accent-strong, var(--ink)); }
.primarylink { font-weight: 700; }
.infobox .field { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; flex: 1; min-width: 0; }
.infobox .fieldrow { display: flex; gap: 12px; flex-wrap: wrap; }
.infobox .fieldrow .field { min-width: calc(200px * var(--fs)); }
.infobox label { font-weight: 600; font-size: calc(.95rem * var(--fs)); }
.infobox select, .infobox input, .infobox textarea { font: inherit; font-size: calc(1rem * var(--fs)); padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; box-sizing: border-box; }
.infobox textarea { resize: vertical; min-height: 120px; }
.infobox select:focus-visible, .infobox input:focus-visible, .infobox textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.infobox [aria-invalid="true"] { border-color: var(--err); border-width: 2px; }
.fielderr { color: var(--err); font-size: calc(.85rem * var(--fs)); min-height: 1em; }
.fbnote { color: var(--muted); font-size: calc(.85rem * var(--fs)) !important; }
.infobox .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.infobox button.primary { font: inherit; font-weight: 700; font-size: calc(1rem * var(--fs)); padding: 10px 18px; border-radius: 12px; border: 0; background: var(--ink); color: var(--card); cursor: pointer; min-height: 44px; }
.infobox button.primary:disabled { opacity: .6; }
.fbstatus { min-height: 1.2em; }
[data-contrast="high"] .infobox select, [data-contrast="high"] .infobox input, [data-contrast="high"] .infobox textarea { border: 2px solid var(--ink); }
@media (max-width: 640px) { .infobox { padding: 18px 16px; } }
.fbhp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* share menu */
.sharewrap { position: relative; display: inline-block; }
.sharewrap.inbox { margin-top: 12px; }
.sharebtn .caret { font-size: .8em; opacity: .7; }
.sharemenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; list-style: none; margin: 0; padding: 6px; min-width: calc(220px * var(--fs)); max-width: calc(100vw - 24px);
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); text-align: left; }
.sharemenu[hidden] { display: none; }
.sharewrap.inbox .sharemenu { right: auto; left: 50%; transform: translateX(-50%); }
.shareitem { font: inherit; font-size: calc(.95rem * var(--fs)); display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; min-height: 44px;
  border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer; text-align: left; }
.shareitem:hover, .shareitem:focus-visible { background: var(--surface); }
.shareitem:focus-visible { outline: 3px solid var(--focus); outline-offset: -2px; }
.shareitem svg, .shareitem .shico { width: calc(18px * var(--fs)); height: calc(18px * var(--fs)); flex: none; display: inline-grid; place-items: center; font-size: calc(16px * var(--fs)); }
[data-contrast="high"] .sharemenu { border: 2px solid var(--ink); }
@media (max-width: 640px) { .sharerow .sharewrap { flex: 1; display: flex; flex-direction: column; } .sharerow .sharemenu { left: 0; right: 0; min-width: 0; } }
