:root {
  --bg: #fafafa;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --card: #fff;
  --accent: #16a34a;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
  --r: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #f5f5f5;
    --muted: #9a9a9a;
    --line: #222;
    --card: #141414;
    --accent: #22c55e;
    --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}
#app {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bot) + 24px);
}
h1 { font-size: 32px; font-weight: 800; margin: 4px 0 16px; letter-spacing: -.02em; }
h2 { font-size: 13px; font-weight: 600; margin: 24px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
button, input { font: inherit; color: inherit; }
button {
  background: var(--fg);
  color: var(--bg);
  border: 0;
  border-radius: var(--r);
  padding: 18px 20px;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  font-size: 18px;
}
button.ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
}
button.danger { background: var(--danger); color: #fff; }
button:active { transform: scale(.98); }
input[type=number], input[type=password], input[type=text] {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  width: 100%;
  font-size: 22px;
  font-weight: 600;
  appearance: none;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.card {
  background: var(--card);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  border: 1px solid var(--line);
}
.row { display: flex; align-items: center; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; }
.big { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.huge { font-size: 56px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stack > * + * { margin-top: 10px; }
.stack-lg > * + * { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* check button */
.check {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: transparent;
  flex: 0 0 56px;
  padding: 0;
  display: grid; place-items: center;
  transition: background .12s, border-color .12s;
}
.check.on {
  background: var(--accent);
  border-color: var(--accent);
}
.check.on::after {
  content: "";
  width: 22px; height: 12px;
  border-left: 4px solid #fff;
  border-bottom: 4px solid #fff;
  transform: rotate(-45deg) translate(2px,-3px);
}

/* progress */
.bar {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* move list */
.move {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 10px;
}
.move .info { flex: 1; min-width: 0; }
.move .name { font-weight: 700; font-size: 18px; }
.move .meta { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* schedule pills */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 14px;
}
.pill.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* graph */
.graph { width: 100%; height: 180px; display: block; }
.graph .axis { stroke: var(--line); stroke-width: 1; }
.graph .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.graph .dot { fill: var(--accent); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bot) + 24px);
  transform: translateX(-50%);
  background: var(--fg); color: var(--bg);
  padding: 12px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  z-index: 100;
}
.toast.show { opacity: 1; }

/* tabs */
.tabs {
  position: sticky; top: 0;
  display: flex; gap: 4px;
  background: var(--bg);
  padding: 8px 0 12px;
  z-index: 10;
}
.tabs button {
  flex: 1;
  padding: 12px;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
}
.tabs button.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* hide */
.hidden { display: none !important; }
