:root{
  --bg:#0e1116; --panel:#151a21; --panel-2:#1b222b; --text:#e8edf4; --muted:#8b97a8;
  --line:#262e39; --line-strong:#3b4553; --accent:#7cb0ff; --ok:#4a8f5b;
  --cell:clamp(23px, 7.1vw, 31px);
  --clue:42px;
}
html.light{--bg:#f5f6f8;--panel:#fff;--panel-2:#eef1f5;--text:#12161c;--muted:#5d6879;--line:#d9dee6;--line-strong:#bcc4cf}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
html{touch-action:manipulation;-webkit-text-size-adjust:100%;overscroll-behavior:none}
body{margin:0;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,sans-serif;display:flex;justify-content:center;min-height:100vh;min-height:100dvh;padding:14px;-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none}
.wrap{width:100%;max-width:520px;display:flex;flex-direction:column;gap:10px;margin:auto}

.top{display:flex;align-items:center;gap:10px}
.home{display:grid;place-items:center;width:30px;height:30px;border-radius:8px;color:var(--muted);background:var(--panel);border:1px solid var(--line);flex:none}
.home svg{width:15px;height:15px}
.brand{flex:1;min-width:0}
.brand h1{margin:0;font-size:18px;font-weight:700;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sub{margin:2px 0 0;color:var(--muted);font-size:10px}
.langs{display:flex;gap:2px;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:2px;flex:none}
.langbtn{min-width:30px;height:24px;border-radius:6px;font-size:11px;font-weight:600;color:var(--muted)}
.langbtn.on{background:var(--panel-2);color:var(--text)}

.status{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--muted)}
.status .grow{flex:1}
.timer{font-variant-numeric:tabular-nums;font-family:ui-monospace,Menlo,monospace;font-size:10.5px}
.link{color:var(--muted);text-decoration:underline;text-underline-offset:3px;font-size:10.5px}

.nono{
  display:grid;
  direction:ltr;
  grid-template-columns:var(--clue) repeat(10, var(--cell));
  grid-template-rows:var(--clue) repeat(10, var(--cell));
  justify-content:center;
  margin:0 auto;
  touch-action:none;
  -webkit-user-select:none;user-select:none;
}
.clue{
  display:flex;align-items:flex-end;justify-content:flex-end;
  font-size:9.5px;line-height:1;color:var(--muted);
  font-variant-numeric:tabular-nums;
}
.clue.col{flex-direction:column;justify-content:flex-end;align-items:center;padding-bottom:3px}
.clue.col span{display:block}
.clue.row{padding-right:4px;gap:3px}
.clue.row span{display:block}
.clue.done{color:var(--muted);opacity:.4}

.cell{
  border:1px solid var(--line);
  background:var(--panel);
  display:grid;place-items:center;
  transition:background .08s;
}
.cell.t{border-top-color:var(--line-strong);border-top-width:1.5px}
.cell.l{border-left-color:var(--line-strong);border-left-width:1.5px}
.cell.r{border-right-color:var(--line-strong);border-right-width:1.5px}
.cell.b{border-bottom-color:var(--line-strong);border-bottom-width:1.5px}
.cell.on{background:var(--text)}
html.light .cell.on{background:#1d2530}
.cell.x{color:var(--muted);font-size:10px}
.cell.x::after{content:"✕";opacity:.55}
.cell.solved{background:color-mix(in srgb, var(--ok) 32%, var(--panel))}

.tools{display:flex;gap:8px;justify-content:center}
.tool{display:flex;align-items:center;gap:6px;padding:7px 14px;border-radius:9px;border:1px solid var(--line);background:var(--panel);color:var(--muted);font-size:11.5px;font-weight:600}
.tool.on{border-color:var(--accent);color:var(--text);background:var(--panel-2)}
.sw{display:grid;place-items:center;width:14px;height:14px;border-radius:3px;font-size:9px;font-weight:700}
.sw.fill{background:var(--text)}
.sw.mark{border:1px solid var(--line-strong)}
.note{margin:0;text-align:center;font-size:10.5px;color:var(--muted);min-height:13px;line-height:1.5}

.modal{position:fixed;inset:0;background:rgba(6,10,15,.7);display:grid;place-items:center;padding:20px;z-index:30;backdrop-filter:blur(3px)}
.sheet{width:100%;max-width:330px;background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:24px;text-align:center}
.sheet h2{margin:0 0 8px;font-size:19px}
.sheet p{margin:0 0 18px;color:var(--muted);font-size:13px;line-height:1.6}
.m-actions{display:flex;flex-direction:column;gap:8px}
.m-actions button{padding:11px;border-radius:10px;background:var(--accent);color:#08111c;font-weight:650;font-size:13px}
.m-actions .ghost{background:transparent;border:1px solid var(--line);color:var(--muted);font-weight:500}

/* iOS Safari floats its bottom bar over the page — keep content clear of it. */
@supports (-webkit-touch-callout: none){
  body{padding-bottom:calc(16px + env(safe-area-inset-bottom, 0px) + 40px)}
}
