:root {
  --bg: #f3efe6;
  --bg-accent: #e7efea;
  --ink: #1a2e24;
  --muted: #5c6b63;
  --card: rgba(255, 252, 246, 0.92);
  --line: rgba(26, 46, 36, 0.12);
  --accent: #2f6f4e;
  --accent-soft: #d7ebe0;
  --warn: #9a5b2f;
  --done: #2f6f4e;
  --shadow: 0 10px 30px rgba(26, 46, 36, 0.08);
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dfeee6 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #f0e2d2 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
a { color: var(--accent); }

#app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 20px 16px calc(88px + var(--safe-bottom));
}

.top { margin-bottom: 18px; }
.brand {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.tagline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.view { display: grid; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card h2, .card h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.muted { color: var(--muted); }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat {
  background: var(--bg-accent);
  border-radius: 14px;
  padding: 12px;
}
.stat .num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
}
.stat .label { color: var(--muted); font-size: 0.85rem; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(26, 46, 36, 0.08);
  overflow: hidden;
  margin-top: 10px;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3f8f64, #1f5a3d);
}

.list { display: grid; gap: 10px; }
.item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fffdf8;
  display: grid;
  gap: 4px;
}
.item:active { transform: scale(0.995); }
.item .title {
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.badge.todo { background: #f3e2d2; color: var(--warn); }
.badge.done { background: var(--accent-soft); color: var(--done); }

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.examples, .approach, .note-body {
  background: #f7f3ea;
  border-radius: 12px;
  padding: 12px;
  overflow-x: auto;
}
.examples pre, .note-body pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.note-body h1, .note-body h2, .note-body h3 {
  font-family: var(--font-display);
  margin: 1rem 0 0.4rem;
}
.note-body p { margin: 0.5rem 0; }
.note-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(26, 46, 36, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}
.note-body pre code { background: none; padding: 0; }

.toggle {
  margin-top: 12px;
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--ink);
  color: #f7f3ea;
  font-weight: 500;
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: rgba(243, 239, 230, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.tab {
  border-radius: 12px;
  padding: 10px 8px;
  color: var(--muted);
  font-weight: 600;
}
.tab.is-active {
  background: var(--ink);
  color: #f7f3ea;
}

.hidden { display: none !important; }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}
