/* Sudoku Daily — styles. CSS only, no images, no webfonts. */

:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #cbd5e1;
  --line-strong: #0f172a;
  --accent: #0284c7;
  --given: #0f172a;
  --user: #0369a1;
  --conflict: #dc2626;
  --peer: #e0f2fe;
  --same: #bae6fd;
  --sel: #0ea5e9;
  --btn: #ffffff;
  --btn-ink: #0f172a;
  --btn-line: #94a3b8;
  --banner-h: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f16;
    --panel: #131a26;
    --ink: #e2e8f0;
    --ink-soft: #94a3b8;
    --line: #334155;
    --line-strong: #e2e8f0;
    --accent: #38bdf8;
    --given: #e2e8f0;
    --user: #7dd3fc;
    --conflict: #f87171;
    --peer: #14293d;
    --same: #123a52;
    --sel: #38bdf8;
    --btn: #1e293b;
    --btn-ink: #e2e8f0;
    --btn-line: #475569;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

body {
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px calc(12px + var(--banner-h));
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100vh;
}

/* ------------------------------------------------------------ topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-mark svg { width: 30px; height: 30px; display: block; }
.brand-word { font-size: 17px; letter-spacing: 0.2px; }
.brand-word span { color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 6px; }

.icon-button {
  min-width: 44px; min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-size: 16px;
}
.about-button {
  min-height: 44px; padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-weight: 600; font-size: 14px;
}

/* --------------------------------------------------------------- HUD */

.hud {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.3px;
}
.hud-item strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.status {
  font-size: 12.5px;
  color: var(--ink-soft);
  min-height: 17px;
  padding: 0 2px;
}

/* ------------------------------------------------------------- board */

.stage { display: flex; flex-direction: column; gap: 6px; }

.board-wrap {
  background: var(--panel);
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  padding: 2px;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  height: 100%;
}

.cell {
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 4.4vw, 22px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
}
.cell.box-left { border-left: 2px solid var(--line-strong); }
.cell.box-top { border-top: 2px solid var(--line-strong); }
.cell:nth-child(9n) { border-right: 0; }
.cell:nth-child(n+73) { border-bottom: 0; }
.cell.given { color: var(--given); font-weight: 700; }
.cell:not(.given) .cell-value { color: var(--user); font-weight: 600; }
.cell.peer { background: var(--peer); }
.cell.same { background: var(--same); }
.cell.selected { background: var(--sel); color: #fff; }
.cell.selected.given, .cell.selected .cell-value { color: #fff; }
.cell.conflict .cell-value { color: var(--conflict); }
.cell.selected.conflict .cell-value { color: #fff; }

.cell-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%; height: 100%;
  font-size: clamp(7px, 1.75vw, 10px);
  font-weight: 500;
  color: var(--ink-soft);
  font-style: normal;
}
.cell-notes i {
  display: flex; align-items: center; justify-content: center;
  font-style: normal;
  line-height: 1;
}

.board-hint { font-size: 11.5px; color: var(--ink-soft); text-align: center; }

/* ---------------------------------------------------------- controls */

.controls { display: flex; flex-direction: column; gap: 8px; }

.pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
}
.pad-btn {
  min-height: 46px;
  border-radius: 9px;
  border: 1px solid var(--btn-line);
  background: var(--btn);
  color: var(--btn-ink);
  font-size: 19px;
  font-weight: 600;
  position: relative;
}
.pad-btn.done { opacity: 0.42; }
.pad-btn::after {
  content: attr(data-left);
  position: absolute;
  right: 3px; bottom: 1px;
  font-size: 8.5px;
  font-weight: 500;
  color: var(--ink-soft);
}

.controls-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.ctl-btn {
  min-height: 44px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-size: 13.5px; font-weight: 600;
}
.ctl-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctl-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctl-btn.ctl-wide { flex: 1 1 auto; }
.ctl-label { font-size: 12.5px; color: var(--ink-soft); }
.ctl-select {
  min-height: 44px; padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-size: 13.5px;
}

/* ------------------------------------------------------------ sheets */

.sheet {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
.sheet-center { align-items: center; padding: 16px; }
.sheet-card {
  background: var(--panel);
  color: var(--ink);
  border-radius: 14px;
  padding: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.35);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { margin: 0 0 8px; font-size: 18px; }
.sheet-card h1 { margin: 0 0 8px; font-size: 20px; }
.about-body { font-size: 13.5px; line-height: 1.5; color: var(--ink); margin: 8px 0; }
.about-meta { font-size: 11.5px; color: var(--ink-soft); margin: 8px 0 0; }
.button {
  display: block; width: 100%;
  min-height: 46px; margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn); color: var(--btn-ink);
  font-size: 15px; font-weight: 600;
}
.button-primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%; bottom: calc(20px + var(--banner-h));
  transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 9px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  z-index: 80;
  max-width: 90vw;
  text-align: center;
}
