@font-face { font-family: "Lora"; src: url("/assets/fonts/lora.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/assets/fonts/poppins-700.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
:root {
  --bg: #eef4f1; --surface: #fbfefd; --ink: #0d2b2c; --muted: #58706f; --line: #cddbd6; --line-strong: #0d2b2c;
  --accent: #0a7a74; --accent-ink: #ffffff; --accent-soft: #d5ece8; --warm: #f2a900;
  --edge: #b9cdc7; --edge-accent: #064f4b;
  --cell: #fbfefd; --given: #0d2b2c; --typed: #0a7a74; --peer: #e3f0ec; --same: #b9e3da; --sel: #ffd966;
  --bad: #cc3a2b; --bad-bg: #fde1dc; --ok: #0a7a74; --hint: #e7f5b8; --diag: #e4f1f6;
  --radius: 16px; --shadow: 0 8px 22px rgba(13, 43, 44, .10);
  --serif: "Lora", Georgia, "Times New Roman", serif; --num: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #09191a; --surface: #0f2527; --ink: #e4f3f0; --muted: #8fb0ac; --line: #1f3d3f; --line-strong: #9bd9d1;
  --accent: #37c9bb; --accent-ink: #06201f; --accent-soft: #12373a; --warm: #ffc233;
  --edge: #040b0c; --edge-accent: #1b8076;
  --cell: #0f2527; --given: #e4f3f0; --typed: #52d6c9; --peer: #14302f; --same: #1d4a49; --sel: #6b5410;
  --bad: #ff7a68; --bad-bg: #46211d; --ok: #52d6c9; --hint: #3a4513; --diag: #112b33; --shadow: 0 8px 22px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #09191a; --surface: #0f2527; --ink: #e4f3f0; --muted: #8fb0ac; --line: #1f3d3f; --line-strong: #9bd9d1;
  --accent: #37c9bb; --accent-ink: #06201f; --accent-soft: #12373a; --warm: #ffc233;
  --edge: #040b0c; --edge-accent: #1b8076;
  --cell: #0f2527; --given: #e4f3f0; --typed: #52d6c9; --peer: #14302f; --same: #1d4a49; --sel: #6b5410;
  --bad: #ff7a68; --bad-bg: #46211d; --ok: #52d6c9; --hint: #3a4513; --diag: #112b33; --shadow: 0 8px 22px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom); -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* header */
.site-header { background: var(--bg); border-bottom: 2px solid var(--ink); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.logo { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 700; font-size: 1.3rem; color: var(--ink); letter-spacing: -.015em; }
.logo:hover { text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { padding: 6px 11px; border-radius: 999px; color: var(--ink); font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--accent-soft); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.hdr-tools { display: flex; gap: 8px; align-items: center; }
.icon-btn { background: var(--surface); border: 1.5px solid var(--ink); border-radius: 11px; padding: 6px 10px; cursor: pointer; font-weight: 700; box-shadow: 0 2px 0 var(--ink); }
.icon-btn:hover { background: var(--accent-soft); } .icon-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.langs { position: relative; }
.langs summary { list-style: none; cursor: pointer; border: 1.5px solid var(--ink); background: var(--surface); border-radius: 11px; padding: 6px 10px; font-weight: 700; box-shadow: 0 2px 0 var(--ink); }
.langs summary::-webkit-details-marker { display: none; }
.langs ul { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; list-style: none; margin: 0; padding: 6px; min-width: 150px; box-shadow: var(--shadow); z-index: 30; }
.langs li a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink); }
.langs li a:hover, .langs li a[aria-current] { background: var(--accent-soft); text-decoration: none; }
#install { background: var(--accent); color: var(--accent-ink); border-color: var(--ink); }

/* layout */
main { padding: 18px 0 40px; }
h1, h2, h3 { font-family: var(--serif); }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1.15; margin: 6px 0 6px; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 1.4rem; margin: 30px 0 8px; font-weight: 600; } h3 { font-size: 1.1rem; margin: 18px 0 4px; font-weight: 600; }
.lead { color: var(--muted); margin: 0 0 14px; max-width: 70ch; }
.prose { max-width: 72ch; } .prose p, .prose li { margin: 8px 0; }
.card { background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--radius); box-shadow: 0 5px 0 var(--ink); }
.ad-slot:empty { display: none; } .ad-slot { margin: 18px 0; text-align: center; }

/* game */
.game { display: grid; gap: 14px; grid-template-columns: 1fr; justify-items: center; margin-top: 10px; }
.board-col, .side-col { width: 100%; max-width: 560px; }
.gbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.gbar select { background: var(--surface); border: 1.5px solid var(--ink); border-radius: 11px; padding: 6px 10px; font-weight: 700; }
.stat { font-family: var(--num); font-size: .9rem; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.stat b { color: var(--ink); }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 0 var(--edge-accent); transition: transform .06s, box-shadow .06s; }
.btn:hover { filter: brightness(1.07); } .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge-accent); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); padding: 8.5px 16.5px; }
.btn.ghost:active { box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.board { display: grid; grid-template-columns: repeat(9, 1fr); width: 100%; aspect-ratio: 1; border: 3px solid var(--line-strong); border-radius: 16px; overflow: hidden; background: var(--cell); box-shadow: 0 6px 0 var(--ink); user-select: none; touch-action: manipulation; }
.cell { position: relative; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--cell); padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: clamp(1.2rem, 5.6vw, 2.2rem); font-weight: 500; color: var(--typed); min-width: 0; }
.cell.bl { border-left: 2px solid var(--line-strong); } .cell.bt { border-top: 2px solid var(--line-strong); }
.cell:nth-child(9n) { border-right: 0; } .cell:nth-child(n+73) { border-bottom: 0; }
.cell.dg { background: var(--diag); }
.cell.given { color: var(--given); font-weight: 700; }
.cell.sel { color: var(--ink); }
.cell.peer { background: var(--peer); } .cell.same { background: var(--same); } .cell.sel { background: var(--sel); }
.cell.bad { color: var(--bad); background: var(--bad-bg); } .cell.hint { background: var(--hint); }
.cell.solved { color: var(--ok); }
.cell:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; z-index: 2; }
.notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); font-size: clamp(.5rem, 1.9vw, .78rem); line-height: 1; color: var(--muted); font-weight: 600; pointer-events: none; }
.notes span { display: flex; align-items: center; justify-content: center; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; padding-bottom: 3px; }
.tool { background: var(--surface); border: 1.5px solid var(--ink); border-radius: 13px; padding: 8px 4px; cursor: pointer; font-weight: 700; font-size: .82rem; display: flex; flex-direction: column; align-items: center; gap: 3px; box-shadow: 0 3px 0 var(--ink); transition: transform .06s, box-shadow .06s; }
.tool:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.tool .ic { display: block; width: 22px; height: 22px; } .tool .ic svg { width: 22px; height: 22px; display: block; } .tool[aria-pressed="true"] { background: var(--warm); color: #0d2b2c; }
.tool:hover { background: var(--accent-soft); } .tool[aria-pressed="true"]:hover { background: var(--warm); filter: brightness(1.05); }
.numpad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 7px; margin-top: 14px; padding-bottom: 4px; }
.num { background: var(--surface); border: 1.5px solid var(--ink); border-radius: 12px; aspect-ratio: 3/4; cursor: pointer; font-family: var(--num); font-size: clamp(1.25rem, 5.6vw, 1.8rem); font-weight: 700; color: var(--typed); position: relative; box-shadow: 0 4px 0 var(--ink); transition: transform .06s, box-shadow .06s; }
.num:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.num small { position: absolute; right: 5px; bottom: 3px; font-family: var(--num); font-size: .5em; color: var(--muted); font-weight: 700; }
.num:hover { background: var(--accent-soft); } .num:disabled { opacity: .25; cursor: default; box-shadow: 0 2px 0 var(--ink); }
.msg { min-height: 1.6em; margin-top: 8px; text-align: center; color: var(--muted); font-weight: 600; }

@media (min-width: 900px) {
  .game { grid-template-columns: minmax(0, 560px) 300px; justify-content: center; align-items: start; gap: 28px; }
  .game .side-col { max-width: none; }
  .game.solo { grid-template-columns: minmax(0, 560px); }
  .numpad { grid-template-columns: repeat(3, 1fr); } .num { aspect-ratio: 1.6; }
  .tools { grid-template-columns: repeat(4, 1fr); }
}

/* modals */
.modal { position: fixed; inset: 0; background: rgba(10, 8, 30, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal .card { width: 100%; max-width: 440px; padding: 22px; max-height: 92vh; overflow: auto; }
.modal h2 { margin: 0 0 6px; font-size: 1.6rem; } .modal .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.modal input[type=text] { width: 100%; border: 1.5px solid var(--ink); background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 10px 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--num); font-weight: 700; text-align: right; }
.err { color: var(--bad); font-weight: 600; margin-top: 8px; } .okmsg { color: var(--ok); font-weight: 700; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 16px; border-radius: 12px; z-index: 120; box-shadow: var(--shadow); max-width: 90vw; font-weight: 600; }

/* leaderboard */
.lb { margin-top: 26px; } .lb h2 { margin-top: 0; }
.tiers { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.tier { border: 1.5px solid var(--ink); background: var(--surface); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-weight: 700; box-shadow: 0 2px 0 var(--ink); }
.tier:active { transform: translateY(2px); box-shadow: none; }
.tier[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.lb-me { padding: 12px 14px; margin: 10px 0; border-radius: 12px; background: var(--accent-soft); font-weight: 700; }
.lb-list { max-height: 520px; overflow: auto; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--surface); }
.lb-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); align-items: center; font-variant-numeric: tabular-nums; }
.lb-row:last-child { border-bottom: 0; } .lb-row.me { background: var(--accent-soft); font-weight: 800; }
.lb-row .rk { font-family: var(--num); font-weight: 700; color: var(--muted); } .lb-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row.p1 .rk, .lb-row.p2 .rk, .lb-row.p3 .rk { font-size: 1.15rem; color: var(--ink); }
.ghost-tag { font-size: .75rem; color: var(--muted); margin-left: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.small { font-size: .85rem; color: var(--muted); }

/* solver / printable */
.panel { padding: 14px; } .panel .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.panel select, .panel input[type=number] { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.sheets { display: grid; gap: 22px; margin-top: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.sheet { background: #fff; color: #000; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.sheet h3 { margin: 0 0 8px; font-size: .95rem; color: #333; }
table.pz { border-collapse: collapse; width: 100%; table-layout: fixed; margin: 0 auto; border: 2.5px solid #000; }
table.pz td { border: 1px solid #555; text-align: center; aspect-ratio: 1; font-size: clamp(14px, 3.5vw, 22px); font-weight: 600; padding: 0; height: 2em; }
table.pz td.bl { border-left: 2.5px solid #000; } table.pz td.bt { border-top: 2.5px solid #000; }
.solutions { margin-top: 24px; } .solutions .sheets { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.solutions table.pz td { font-size: 12px; height: 1.6em; }

/* footer */
.site-footer { border-top: 2px solid var(--ink); background: var(--bg); padding: 22px 0; color: var(--muted); font-size: .92rem; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); } .site-footer a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .nav a { padding: 5px 8px; font-size: .88rem; }
  .game { margin-top: 4px; }
}
@media print {
  .site-header, .site-footer, .panel, .ad-slot, .toast, .modal, .no-print, .lead, h1 { display: none !important; }
  body { background: #fff; } main { padding: 0; } .wrap { max-width: none; padding: 0; }
  .sheets { grid-template-columns: 1fr 1fr; gap: 14mm; } .sheet { border: 0; break-inside: avoid; padding: 0; }
  .sheet:nth-child(4n+1) { break-before: page; } .sheet:first-child { break-before: auto; }
  table.pz td { height: 9.5mm; font-size: 15pt; }
  .solutions { break-before: page; } .solutions .sheets { grid-template-columns: repeat(3, 1fr); } .solutions table.pz td { height: 6mm; font-size: 10pt; }
}

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; }
.chip { border: 1.5px solid var(--ink); background: var(--surface); border-radius: 999px; padding: 5px 14px; font-weight: 700; color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.chip:hover { background: var(--accent-soft); text-decoration: none; } .chip[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* phones: compact header and game bar so the whole game fits on the first screen */
@media (max-width: 640px) {
  .site-header .wrap { gap: 4px 10px; min-height: 0; padding-top: 8px; padding-bottom: 4px; }
  .logo { flex: 1; }
  .hdr-tools { order: 2; }
  .nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin: 0 -6px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; }
  h1 { font-size: 1.3rem; margin: 2px 0 8px; }
  .lead.hide-m { display: none; }
  main { padding-top: 10px; }
  .gbar { flex-wrap: nowrap; gap: 6px; font-size: .9rem; }
  .gbar .btn { padding: 7px 12px; white-space: nowrap; }
  .gbar select { padding: 5px 8px; }
  .tools { margin-top: 10px; gap: 6px; } .tool { padding: 7px 2px; }
}
@media (max-width: 640px) { .num small { top: 1px; right: 3px; bottom: auto; font-size: .46em; } .num { font-size: clamp(1.1rem, 5vw, 1.5rem); padding-top: 4px; } .tools { margin-top: 6px; } .msg { min-height: 1.2em; margin-top: 6px; } }

/* ---------- share buttons ---------- */
.share { margin: 14px 0 4px; }
.share-h { font-weight: 700; margin-bottom: 8px; }
.share-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sh { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 12px; border-radius: 11px; border: 1.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.sh:hover { border-color: var(--accent); }
.sh[hidden] { display: none; }
.sh-x { background: #000; color: #fff; border-color: #000; }
.sh-fb { background: #1877f2; color: #fff; border-color: #1877f2; }
.sh-vk { background: #0077ff; color: #fff; border-color: #0077ff; }
.sh-ok { background: #ee8208; color: #fff; border-color: #ee8208; }
.sh-line { background: #06c755; color: #fff; border-color: #06c755; }
.sh-tg { background: #229ed9; color: #fff; border-color: #229ed9; }
.sh-wa { background: #25d366; color: #0b2b16; border-color: #25d366; }
.sh-rd { background: #ff4500; color: #fff; border-color: #ff4500; }
.sh-li { background: #0a66c2; color: #fff; border-color: #0a66c2; }
.sh-pin { background: #e60023; color: #fff; border-color: #e60023; }
.share.flash { animation: shflash 1.2s ease 2; border-radius: 12px; }
@keyframes shflash { 50% { box-shadow: 0 0 0 4px var(--accent-soft); } }
.share-site { margin-bottom: 14px; }
.site-footer .share-site .share-h { font-size: 14px; color: var(--muted); }
@media print { .share, .share-site { display: none !important; } }
.ad-slot .ad-label { display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
