/* Still: interactive concept */

:root {
  --bg: #f2f5fb;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --line: #dce3ef;
  --line-strong: #c3cee1;
  --ink: #0e1c3f;
  --ink-2: #33415f;
  --muted: #56637f;
  --cobalt: #2445d6;
  --cobalt-strong: #1a34ad;
  --cobalt-soft: #e6ecfd;
  --cobalt-tint: #c3d1f8;
  --mint: #def4ea;
  --mint-strong: #8fd3b4;
  --mint-ink: #17604a;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --sidebar: 200px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-sm);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 2px;
  border-radius: 6px;
}
[tabindex="-1"]:focus { outline: none; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; line-height: 1.5; }
.fine { font-size: 0.8125rem; color: var(--muted); }

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 14px 22px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: var(--cobalt);
}
.logo { width: 28px; height: 28px; flex: none; }
.logo path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.logo circle { fill: currentColor; }
.brand-name {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.side-nav ul { display: grid; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.95rem;
  font-weight: 520;
  text-align: left;
}
.nav-item svg, .bn-item svg {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] {
  background: var(--cobalt-soft);
  color: var(--cobalt-strong);
  font-weight: 620;
}

.side-foot {
  margin-top: auto;
  padding: 0 10px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.side-note { color: var(--muted); margin-top: 2px; }

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 14px 48px 0;
}
.brand-compact { display: none; }
.concept-tag {
  font-size: 0.8125rem;
  color: var(--muted);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  padding: 18px 48px 56px;
}
main:focus { outline: none; }

.site-foot {
  max-width: 1160px;
  padding: 20px 48px 32px;
  border-top: 1px solid var(--line);
}
.site-foot p { font-size: 0.8125rem; color: var(--muted); max-width: 72ch; }

.bottom-nav { display: none; }

/* ---------- Buttons and fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-strong); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--cobalt); color: var(--cobalt-strong); }
.btn-quiet { background: transparent; color: var(--cobalt-strong); padding-left: 10px; padding-right: 10px; }
.btn-quiet:hover { background: var(--cobalt-soft); }
.btn-large { min-height: 52px; padding: 14px 26px; font-size: 1.02rem; border-radius: 12px; }
.btn-small { min-height: 36px; padding: 7px 12px; font-size: 0.875rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.icon-btn:hover { border-color: var(--cobalt); }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.field-label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.field-label .muted { font-weight: 450; }

.textarea, .input, .select {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.45;
}
.textarea { resize: vertical; min-height: 84px; }
.textarea[readonly] { background: var(--surface-2); color: var(--ink-2); }
.textarea:focus, .input:focus, .select:focus { border-color: var(--cobalt); }
::placeholder { color: #7a86a0; }

/* Native select with an explicitly placed chevron, 16px from the right edge */
.select-wrap { position: relative; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  cursor: pointer;
}
.chev {
  position: absolute;
  right: 16px;
  top: 50%;
  width: 12px; height: 12px;
  transform: translateY(-50%);
  pointer-events: none;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--cobalt-soft);
  color: var(--cobalt-strong);
  font-size: 0.8125rem;
  font-weight: 560;
  line-height: 1.2;
}
.chip-plain, .chip-status-later { background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.chip-new, .chip-status-new, .chip-assist { background: var(--mint); color: var(--mint-ink); }
.chip-catchup, .chip-status-catchup { background: var(--surface); color: var(--cobalt-strong); box-shadow: inset 0 0 0 1px var(--cobalt-tint); }
.chip-status-done { background: var(--surface); color: var(--mint-ink); box-shadow: inset 0 0 0 1px var(--mint-strong); }

.plain-list { display: grid; gap: 8px; }
.plain-list li { font-size: 0.925rem; color: var(--ink-2); }

details > summary {
  cursor: pointer;
  width: fit-content;
  padding: 6px 2px;
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--cobalt-strong);
  border-radius: 6px;
}
details[open] > summary { margin-bottom: 10px; }

/* ---------- Type ---------- */

.display {
  font-size: clamp(2.5rem, 5.4vw, 4.6rem);
  line-height: 1.02;
  font-weight: 640;
  letter-spacing: -0.035em;
  color: var(--ink);
  max-width: 13ch;
}
.display-num { font-variant-numeric: tabular-nums; }
.display-sm {
  font-size: clamp(2rem, 3.6vw, 3rem);
  line-height: 1.06;
  font-weight: 640;
  letter-spacing: -0.03em;
}
.lede {
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 58ch;
}
.hero-date {
  font-size: 0.95rem;
  font-weight: 560;
  color: var(--cobalt-strong);
  margin-bottom: 12px;
}
.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 16px;
}
.sec-head h2, .sec-title, .panel h2, .week h2, .focus h2 {
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.sec-head p { font-size: 0.875rem; }
.sec-title { margin-bottom: 14px; }

.page-head { display: grid; gap: 12px; margin: 18px 0 30px; }

/* ---------- Today ---------- */

.today { display: grid; gap: 28px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.8fr);
  gap: 40px;
  align-items: end;
  padding: 26px 0 8px;
}
.hero-main { display: grid; gap: 18px; }
.hero-main .display { margin-top: -4px; }
.hero-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 28px;
  margin-top: 10px;
}
.hero-go { display: grid; gap: 8px; }
.hero-go-row { display: flex; flex-wrap: wrap; gap: 10px; }

.budget { border: 0; padding: 0; margin: 0; min-width: 0; }
.budget legend { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.seg-opt { position: relative; }
.seg-opt input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.seg-opt span {
  display: grid;
  place-items: center;
  min-width: 76px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.seg-opt:hover span { background: var(--surface-2); }
.seg-opt input:checked + span { background: var(--ink); color: #fff; }
.seg-opt input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }

.nownext {
  display: grid;
  gap: 0;
  padding: 6px 0;
  border-left: 2px solid var(--line);
}
.nn-row {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  padding: 10px 0 10px 18px;
  position: relative;
}
.nn-row::before {
  content: "";
  position: absolute;
  left: -7px; top: 16px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line-strong);
}
.nn-row.is-now::before { background: var(--cobalt); border-color: var(--cobalt); }
.nn-row.is-done::before { background: var(--mint-strong); border-color: var(--mint-strong); }
.nn-tag { font-size: 0.8125rem; font-weight: 650; color: var(--muted); padding-top: 2px; }
.nn-row.is-now .nn-tag { color: var(--cobalt-strong); }
.nn-row.is-done .nn-tag { color: var(--mint-ink); }
.nn-title { font-weight: 620; }
.nn-sub { font-size: 0.875rem; color: var(--muted); }

/* Session timeline */
.timeline-sec {
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.timeline { display: grid; gap: 8px; }
.tl-track {
  display: flex;
  gap: 4px;
  height: 34px;
}
.tl-tick {
  flex: 1 1 0;
  border-radius: 6px;
  background: var(--cobalt);
  transition: background-color 0.2s ease;
}
.tl-tick.k-catchup { background: var(--cobalt-tint); }
.tl-tick.k-new { background: var(--mint-strong); }
.tl-tick.is-done { background: var(--cobalt-soft); box-shadow: inset 0 0 0 1px var(--cobalt-tint); }
.tl-tick.is-done.k-new { background: var(--mint); box-shadow: inset 0 0 0 1px var(--mint-strong); }
.tl-tick.is-current { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.tl-spare {
  border-radius: 6px;
  border: 1.5px dashed var(--line-strong);
}
.tl-labels { display: flex; gap: 4px; }
.tl-label {
  min-width: 0;
  padding-top: 4px;
  border-top: 2px solid var(--ink);
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.tl-label b { font-weight: 650; color: var(--ink); }
.tl-label-spare { border-top-color: var(--line-strong); color: var(--muted); }
.tl-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.later { margin-top: 14px; }
.later li { display: flex; gap: 10px; align-items: baseline; }
.kind-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--cobalt); transform: translateY(-1px); }
.kind-dot.k-catchup { background: var(--cobalt-tint); }
.kind-dot.k-new { background: var(--mint-strong); }

/* Catch-up band */
.catchup {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 1fr);
  gap: 20px 36px;
  padding: 22px 24px;
  background: var(--mint);
  border-radius: var(--r-lg);
}
.catchup h2 { font-size: 1.1rem; font-weight: 650; margin-bottom: 4px; }
.catchup p { color: var(--ink-2); }
.catchup-details { margin-top: 10px; }
.catchup-details summary { color: var(--mint-ink); }
.catchup-choice { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
.catchup-choice legend { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--mint-ink); }
.choice input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--mint-ink); flex: none; }
.choice b { display: block; font-weight: 620; }
.choice small { display: block; font-size: 0.85rem; color: var(--muted); }

/* Lower area */
.today-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(250px, 1fr);
  gap: 28px;
  align-items: start;
}
.today-aside { display: grid; gap: 28px; }

/* Recall rhythm */
.rhythm {
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.rh-grid {
  display: grid;
  grid-template-columns: 150px repeat(15, minmax(0, 1fr));
  align-items: stretch;
}
.rh-day {
  display: grid;
  justify-items: center;
  padding-bottom: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.25;
}
.rh-date { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 560; }
.rh-day.is-today span { color: var(--cobalt-strong); font-weight: 700; }
.rh-label {
  display: grid;
  align-content: center;
  padding-right: 12px;
  min-height: 56px;
  border-top: 1px solid var(--line);
}
.rh-corner { border-top: 0; min-height: 0; }
.rh-topic { font-size: 0.875rem; font-weight: 600; line-height: 1.25; }
.rh-stat { font-size: 0.78rem; color: var(--muted); }
.rh-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  border-top: 1px solid var(--line);
}
.rh-cell::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--line);
}
.rh-cell.is-away { background: var(--surface-2); }
.rh-cell.is-away::before { background: transparent; border-top: 1px dashed var(--line); }
.rh-cell.is-today { background: var(--cobalt-soft); }
.rh-grid .rh-day.is-today { background: var(--cobalt-soft); border-radius: 8px 8px 0 0; padding-top: 4px; }
.rh-grid .rh-day { padding-top: 4px; }

.dot {
  position: relative;
  z-index: 1;
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: none;
}
.dot-good { background: var(--cobalt); }
.dot-hard { background: var(--cobalt-tint); box-shadow: inset 0 0 0 2px var(--cobalt); }
.dot-again { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.dot-assisted { background: var(--mint-strong); border-radius: 3px; transform: rotate(45deg) scale(0.85); }
.dot-plan { background: var(--surface); outline: 1.5px dashed var(--cobalt); outline-offset: -1.5px; }

.rh-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 16px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.rh-legend li { display: flex; align-items: center; gap: 7px; }

/* Week strip */
.week, .focus { padding: 4px 2px 0; }
.week h2, .focus h2 { margin-bottom: 12px; }
.wk-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.wk-day { display: grid; justify-items: center; gap: 6px; }
.wk-name { font-size: 0.75rem; color: var(--muted); }
.wk-mark {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 40px;
  aspect-ratio: 1;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.wk-day.is-studied .wk-mark { background: var(--cobalt); color: #fff; }
.wk-day.is-rest .wk-mark { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.wk-day.is-today .wk-mark { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--cobalt); }
.wk-day.is-today:not(.is-studied) .wk-mark { background: var(--surface); }
.wk-day.is-today .wk-name { color: var(--cobalt-strong); font-weight: 650; }

/* Focus topics */
.focus-list { display: grid; margin-bottom: 10px; border-top: 1px solid var(--line); }
.focus-list li {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.focus-name { font-weight: 620; }
.focus-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Review ---------- */

.review { max-width: 780px; display: grid; gap: 22px; padding-top: 12px; }
.review-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--cobalt-soft);
  overflow: hidden;
}
.progress span { display: block; height: 100%; background: var(--cobalt); border-radius: inherit; transition: width 0.3s ease; }
.progress-text { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.qcard {
  display: grid;
  gap: 14px;
  padding: 30px 32px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.q-unclear { margin-left: auto; }
.question {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1.18;
  font-weight: 620;
  letter-spacing: -0.02em;
  margin-top: 8px;
  max-width: 30ch;
}
.attempt-note { font-size: 0.875rem; color: var(--muted); margin-bottom: 8px; }
.q-actions { margin-top: 4px; }

.answer-block {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--cobalt-soft);
}
.answer-block h2, .answer-block h3 { font-size: 0.875rem; font-weight: 650; color: var(--cobalt-strong); }
.answer-text { font-size: 1.15rem; line-height: 1.5; font-weight: 520; }
.yours { padding-top: 10px; border-top: 1px solid var(--cobalt-tint); }
.yours h3 { font-size: 0.8125rem; font-weight: 650; color: var(--ink-2); }
.yours p { color: var(--ink-2); }

.source-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--cobalt-tint);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
}
.source-link:hover { border-color: var(--cobalt); }
.source-link-main { font-weight: 600; font-size: 0.9rem; color: var(--cobalt-strong); }
.source-link-tag, .source-tag { font-size: 0.8rem; color: var(--mint-ink); font-weight: 560; }
.source-row { display: flex; flex-wrap: wrap; gap: 8px; }

.ratings { border: 0; padding: 0; margin: 6px 0 0; min-width: 0; }
.ratings legend { font-weight: 650; margin-bottom: 10px; padding: 0; }
.rating-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rating {
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 84px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.rating:hover { border-color: var(--cobalt); }
.rating-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.rating-label { font-weight: 680; font-size: 1.02rem; }
.rating-desc { font-size: 0.8125rem; color: var(--muted); line-height: 1.35; }
.rating kbd {
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  text-align: center;
}
.rating.is-chosen { border-color: var(--cobalt); background: var(--cobalt-soft); box-shadow: inset 0 0 0 1px var(--cobalt); }

.after-rate {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.after-rate p { color: var(--ink-2); }

.idle, .complete { display: grid; gap: 18px; max-width: 760px; padding-top: 36px; }
.idle .row, .complete .row { margin-top: 8px; }

.rating-summary { display: grid; gap: 14px; max-width: 560px; }
.rs-bar { display: flex; gap: 4px; height: 16px; }
.rs-seg { border-radius: 5px; }
.rs-again, .rs-key.rs-again { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.rs-hard, .rs-key.rs-hard { background: var(--cobalt-tint); }
.rs-good, .rs-key.rs-good { background: var(--cobalt); }
.rs-easy, .rs-key.rs-easy { background: var(--cobalt-strong); }
.rs-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rs-legend dt { display: flex; align-items: center; gap: 7px; font-size: 0.875rem; color: var(--ink-2); }
.rs-legend dd { font-size: 1.8rem; font-weight: 640; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rs-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.assist-note {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--mint);
  max-width: 760px;
}
.assist-note h2 { font-size: 1rem; font-weight: 650; color: var(--mint-ink); }
.assist-note p { color: var(--ink-2); }

/* ---------- Repair ---------- */

.repair { max-width: 860px; display: grid; gap: 24px; padding-top: 10px; }
.repair .page-head { margin: 0; }
.repair .page-head .hero-date { margin-bottom: 0; }
.repair-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.assist-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--mint-ink);
  font-size: 0.875rem;
  font-weight: 600;
}
.assist-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--mint-ink); transform: rotate(45deg); }
.assist-state.is-logged { box-shadow: inset 0 0 0 1px var(--mint-ink); }

.repair-card {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border-left: 3px solid var(--cobalt);
  background: var(--surface);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.q-small { font-size: 1.1rem; font-weight: 620; line-height: 1.4; }

.compare h2, .explain h2, .practice h2 { font-size: 1.1rem; font-weight: 650; margin-bottom: 12px; }
.compare-cols { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.compare-col { padding: 18px 20px; }
.compare-col + .compare-col { border-left: 1px solid var(--line); }
.compare-col-b { background: var(--cobalt-soft); }
.compare-col h3 { font-size: 0.95rem; font-weight: 650; margin-bottom: 10px; }
.compare-col ul { display: grid; gap: 8px; }
.compare-col li { position: relative; padding-left: 16px; color: var(--ink-2); }
.compare-col li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.compare-col-b li::before { background: var(--cobalt); }

.explain { display: grid; gap: 10px; }
.explain > p:first-of-type { font-size: 1.05rem; max-width: 64ch; }

.practice {
  display: grid;
  gap: 12px;
  padding: 22px 24px;
  border: 1.5px dashed var(--mint-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.practice-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.practice-head h2 { margin: 0; }
.outcome { border: 0; padding: 0; margin: 0; min-width: 0; }
.outcome legend { font-weight: 620; margin-bottom: 8px; padding: 0; }
.practice-result { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r-md); background: var(--mint); }
.practice-result p { color: var(--ink-2); }
.repair-foot { padding-top: 4px; }

.panel {
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.panel > h2 { margin-bottom: 12px; }
.row-list { display: grid; border-top: 1px solid var(--line); }
.row-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.row-list li > div { flex: 1 1 300px; min-width: 0; }
.row-title { font-weight: 600; }

.edit-form { display: grid; gap: 10px; max-width: 700px; }
.edit-form .textarea { margin-bottom: 8px; }
.form-error { color: #9b2c2c; font-size: 0.875rem; min-height: 0; }
.form-error:empty { display: none; }

/* ---------- Progress ---------- */

.progress-view { display: grid; gap: 26px; }
.progress-view .page-head { margin-bottom: 0; }
.measures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.measure { display: grid; gap: 6px; align-content: start; padding: 24px; }
.measure + .measure { border-left: 1px solid var(--line); }
.measure h2 { font-size: 1rem; font-weight: 650; color: var(--ink-2); }
.measure-num {
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  font-weight: 640;
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.measure-desc { font-weight: 560; }
.meters { display: grid; gap: 8px; margin-top: 10px; }
.meters li { display: grid; grid-template-columns: 1fr; gap: 4px; font-size: 0.85rem; color: var(--ink-2); }
.meter { display: block; height: 6px; border-radius: 999px; background: var(--cobalt-soft); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--cobalt); }
.meter-num { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.chart-scroll { overflow-x: auto; border-radius: 8px; }
.chart { display: block; width: 100%; min-width: 560px; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-y { font-size: 11px; fill: var(--muted); text-anchor: end; }
.chart .axis-x { font-size: 11px; fill: var(--ink-2); text-anchor: middle; }
.chart .axis-date { fill: var(--muted); font-size: 10.5px; }
.chart .axis-x.is-today { fill: var(--cobalt-strong); font-weight: 700; }
.chart .bar { fill: var(--cobalt); }
.chart .bar-today { fill: var(--mint-ink); }
.chart .bar-val { font-size: 10.5px; fill: var(--ink-2); text-anchor: middle; font-variant-numeric: tabular-nums; }
.chart .nostudy { fill: var(--line-strong); }

.table-wrap { overflow-x: auto; }
.topic-table { width: 100%; border-collapse: collapse; font-size: 0.925rem; min-width: 520px; }
.topic-table th, .topic-table td { padding: 12px 12px 12px 0; text-align: left; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.topic-table thead th { font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.topic-table tbody th { font-weight: 600; }
.topic-table tbody tr:last-child th, .topic-table tbody tr:last-child td { border-bottom: 0; }

/* ---------- Library ---------- */

.library { display: grid; gap: 30px; }
.library .page-head { margin-bottom: 0; }
.source-list { display: grid; border-top: 1px solid var(--line); }
.source-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.source-mark {
  display: grid;
  place-items: center;
  width: 48px; height: 56px;
  border-radius: 6px 10px 10px 6px;
  background: var(--cobalt-soft);
  border-left: 4px solid var(--cobalt);
  color: var(--cobalt-strong);
  font-weight: 700;
  font-size: 0.85rem;
}
.source-item:nth-child(2) .source-mark { background: var(--mint); border-left-color: var(--mint-ink); color: var(--mint-ink); }
.source-info h3 { font-size: 1.02rem; font-weight: 650; }
.source-info .small { max-width: 70ch; }

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 12px;
  align-items: end;
}
.lib-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; margin: 10px 0 4px; }
.lib-meta p { font-size: 0.875rem; }

.q-list { display: grid; gap: 8px; }
.q-item {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.q-item-main { flex: 1 1 380px; min-width: 0; display: grid; gap: 6px; }
.q-item-prompt { font-weight: 600; line-height: 1.4; }
.q-item-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.q-item-answer { margin-top: 4px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--cobalt-soft); }
.q-item-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px; }
.q-empty { padding: 24px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-md); }

/* ---------- Drawer ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(14, 28, 63, 0.28);
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 50;
  width: min(460px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 40px rgba(14, 28, 63, 0.12);
  overflow-y: auto;
  transform: translateX(24px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.drawer.is-open { transform: none; opacity: 1; }
.drawer-body { display: grid; gap: 18px; padding: 24px 24px 32px; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h2 { font-size: 1.35rem; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; margin-top: 2px; }
.excerpt {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.excerpt h3 { font-size: 1rem; font-weight: 650; }
.excerpt p { color: var(--ink-2); }
.drawer-cards h3, .drawer-sections h3 { font-size: 0.9rem; font-weight: 650; margin-bottom: 8px; }
.drawer-sections ul { display: grid; gap: 4px; }
.section-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-weight: 540;
  color: var(--ink-2);
}
.section-btn:hover { background: var(--surface-2); }
.section-btn[aria-current="true"] { background: var(--cobalt-soft); color: var(--cobalt-strong); font-weight: 640; }
body.drawer-open { overflow: hidden; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 0.925rem;
  font-weight: 520;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; gap: 24px; align-items: start; }
  .nownext { max-width: 560px; }
  .today-lower { grid-template-columns: 1fr; }
  .today-aside { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 900px) {
  .topbar, main { padding-left: 28px; padding-right: 28px; }
  .site-foot { padding-left: 28px; padding-right: 28px; }
  .catchup { grid-template-columns: 1fr; }
  .measures { grid-template-columns: 1fr; }
  .measure + .measure { border-left: 0; border-top: 1px solid var(--line); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field-grow { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar {
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    gap: 6px 12px;
  }
  .brand-compact { display: flex; padding: 0; }
  .brand-compact .logo { width: 24px; height: 24px; }
  .brand-compact .brand-name { font-size: 1.1rem; }
  .concept-tag { order: 3; flex-basis: 100%; font-size: 0.75rem; }
  main { padding: 14px 18px 40px; }
  .site-foot { padding: 18px 18px 96px; margin: 0; }

  .bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .bn-item {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-height: 52px;
    padding: 6px 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 560;
  }
  .bn-item[aria-current="page"] { color: var(--cobalt-strong); background: var(--cobalt-soft); font-weight: 650; }
  .toast { bottom: 88px; }

  .today { gap: 22px; }
  .hero { padding-top: 12px; }
  .hero-controls { flex-direction: column; align-items: stretch; }
  .seg { display: flex; }
  .seg-opt { flex: 1; }
  .seg-opt span { min-width: 0; }
  .hero-go .btn-large { width: 100%; }
  .hero-go-row .btn { flex: 1 1 auto; }
  .today-aside { grid-template-columns: 1fr; }

  .timeline-sec, .rhythm, .panel, .catchup { padding: 18px 16px; border-radius: 14px; }

  .rh-grid { grid-template-columns: repeat(15, minmax(0, 1fr)); }
  .rh-corner { display: none; }
  .rh-label {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    min-height: 0;
    padding: 10px 0 4px;
  }
  .rh-cell { min-height: 44px; border-top: 0; }
  .rh-day { font-size: 0.64rem; }
  .dot { width: 8px; height: 8px; }

  .review-head { grid-template-columns: auto 1fr; }
  .review-head .progress { grid-column: 1 / -1; grid-row: 2; }
  .progress-text { justify-self: end; }
  .qcard { padding: 22px 18px; border-radius: 18px; }
  .rating-row { grid-template-columns: 1fr 1fr; }
  .rating { min-height: 76px; }
  .q-unclear { margin-left: 0; }

  .compare-cols { grid-template-columns: 1fr; }
  .compare-col + .compare-col { border-left: 0; border-top: 1px solid var(--line); }
  .practice { padding: 18px 16px; }

  .rs-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .filters { grid-template-columns: 1fr; }
  .source-item { grid-template-columns: 40px minmax(0, 1fr); }
  .source-item .btn { grid-column: 2; justify-self: start; }
  .source-mark { width: 40px; height: 48px; }

  .drawer { top: auto; width: 100%; max-height: 86vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; transform: translateY(24px); }
  .drawer-body { padding: 20px 18px 28px; }
}

@media (max-width: 420px) {
  .display { font-size: 2.35rem; }
  .row .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .drawer, .toast { transform: none !important; }
  .toast { transform: translate(-50%, 0) !important; }
}

@media (forced-colors: active) {
  .btn, .rating, .seg-opt span, .source-link, .section-btn, .nav-item, .bn-item, .choice { border: 1px solid ButtonText; }
  .seg-opt input:checked + span, .rating.is-chosen, .nav-item[aria-current="page"], .bn-item[aria-current="page"], .section-btn[aria-current="true"] { outline: 2px solid Highlight; }
  .chev { stroke: CanvasText; }
  .dot, .tl-tick, .wk-mark, .rs-seg, .rs-key, .kind-dot { forced-color-adjust: none; }
  :focus-visible { outline-color: Highlight; }
}

.rating[data-rating="again"]{background:#fff0f1;border-color:#e5a5ac;color:#962d40}.rating[data-rating="hard"]{background:#fff5de;border-color:#ddbd73;color:#79510d}.rating[data-rating="good"]{background:#eaf7ef;border-color:#94c7a6;color:#24633d}.rating[data-rating="easy"]{background:#edf2ff;border-color:#9cb3e5;color:#254fa6}.rating.is-chosen{outline:2px solid currentColor;outline-offset:2px}

.answer-text{font-size:clamp(1.6rem,3vw,2.25rem);line-height:1.3;font-weight:620;letter-spacing:-.02em}.card-reading-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:22px;color:#62718a;font-size:13px;font-weight:600}.card-speaker{display:inline-flex;align-items:center;gap:7px;min-height:42px;padding:8px 12px;border:1px solid #b9c9e4;border-radius:9px;background:#f4f7ff;color:#264c99;font:600 13px system-ui;cursor:pointer}.card-speaker svg{fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.card-speaker[aria-pressed="true"]{background:#214cdf;color:white}.card-speaker:focus-visible{outline:3px solid #5f85ff;outline-offset:3px}.card-speaker:disabled{opacity:.5;cursor:not-allowed}.card-audio-status{font-size:13px;color:#62718a;min-height:1.5em;margin-top:16px}
