:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c1f24;
  --muted: #5d6470;
  --line: #dfe3e8;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --warn: #9a5b00;
  --error: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1a1e24;
    --text: #e8eaed;
    --muted: #a0a7b2;
    --line: #2c323b;
    --accent: #4c8dff;
    --warn: #e0a54a;
    --error: #ff7b72;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.8rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.privacy { margin: 0 0 16px; color: var(--muted); font-size: 0.95rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.row { margin: 0 0 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-weight: 600; font-size: 0.95rem; }
input[type="date"], textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
}
fieldset { border: 0; padding: 0; }
legend { font-weight: 700; margin-bottom: 6px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; min-height: 36px; }
.check.sub { padding-left: 26px; color: var(--muted); font-size: 0.9rem; }
.check input, .day input { width: 18px; height: 18px; margin: 0; flex: none; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; min-height: 44px; font-weight: 600;
}
.mode:has(input:checked) { border-color: var(--accent); }
.mode input { width: 18px; height: 18px; margin: 0; flex: none; }
input[type="number"] {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; min-height: 44px;
}
[hidden] { display: none !important; }
.toggles { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.block { margin-top: 8px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.day {
  display: flex; align-items: center; gap: 6px;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 44px;
}
button { font: inherit; cursor: pointer; border-radius: 8px; min-height: 44px; }
.go { width: 100%; border: 0; background: var(--accent); color: var(--accent-text); font-weight: 700; padding: 12px; }
.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); padding: 8px 14px; }
.result .big { font-size: 2rem; font-weight: 800; margin: 0; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); margin: 4px 0 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px; }
.stats div { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 0; font-weight: 700; font-size: 1.2rem; }
details { margin-bottom: 12px; }
details ul { margin: 8px 0 0; padding-left: 20px; }
.warn { color: var(--warn); }
.error { color: var(--error); font-weight: 600; }
.notes ul { padding-left: 20px; color: var(--muted); }
@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .two, .modes { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}
