:root {
  color-scheme: light dark;
  --bg: #f4f3ec;
  --surface: #fffef9;
  --ink: #253126;
  --muted: #627064;
  --line: #d8dcd2;
  --accent: #3d5840;
  --accent-soft: #e5ebdf;
  --inverse: #fffef9;
  --again: #913f32;
  --hard: #805a27;
  --shadow: 0 12px 48px #25312608;
  --radius: 20px;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191d19;
    --surface: #222822;
    --ink: #e5ebe1;
    --muted: #acb8a8;
    --line: #3b453a;
    --accent: #b6d0a5;
    --accent-soft: #344330;
    --inverse: #20291c;
    --again: #f1a494;
    --hard: #e6c18c;
    --shadow: 0 12px 48px #0002;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  touch-action: manipulation;
}
a {
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button,
input,
select {
  min-height: 44px;
}
button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 600;
}
button:hover {
  background: var(--accent-soft);
}
button.primary {
  background: var(--accent);
  color: var(--inverse);
  border-color: var(--accent);
}
button.primary:hover {
  filter: brightness(1.08);
}
button.quiet {
  background: transparent;
  border-color: transparent;
}
button.danger {
  color: var(--again);
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.skip-link {
  position: fixed;
  top: -80px;
  left: 12px;
  padding: 10px;
  background: var(--surface);
  z-index: 99;
}
.skip-link:focus {
  top: 12px;
}
.site-header {
  max-width: 1060px;
  padding: 26px 32px 12px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.wordmark {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  letter-spacing: -1px;
  font-weight: 650;
  min-height: 44px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--inverse);
  font-family: Georgia, serif;
  font-size: 29px;
  text-align: center;
  line-height: 30px;
}
.brand-caption {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--muted);
  margin-left: 12px;
  font-weight: 500;
}
.sync-status {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  display: flex;
  align-items: center;
  gap: 7px;
}
.sync-status::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
}
.sync-status[data-state="offline"]::before,
.sync-status[data-state="pending"]::before {
  background: var(--hard);
}
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 28px 130px;
  min-height: 75vh;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -1.4px;
  line-height: 1.13;
}
h1 {
  font-size: clamp(36px, 6vw, 54px);
  margin-bottom: 20px;
}
h2 {
  font-size: 30px;
  margin-bottom: 12px;
}
h3 {
  font-size: 18px;
  line-height: 1.35;
  margin-bottom: 6px;
}
p {
  margin-bottom: 16px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  margin-bottom: 18px;
}
.lede {
  color: var(--muted);
  max-width: 520px;
}
.hero {
  padding-bottom: 26px;
}
.counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 24px;
}
.count {
  padding: 18px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.count strong {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 36px;
  line-height: 1.3;
  display: block;
}
.count span {
  font-size: 12px;
  color: var(--muted);
}
.study-call {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 38px;
}
.study-call .primary {
  padding: 14px 30px;
  min-width: 200px;
  font-size: 17px;
}
.subtle {
  font-size: 13px;
  color: var(--muted);
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-heading h2 {
  font-size: 24px;
  margin: 0;
}
.deck-list {
  display: grid;
  gap: 12px;
}
.deck-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  box-shadow: var(--shadow);
}
.deck-row p {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0 14px;
}
.deck-row .deck-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}
.pill {
  font-size: 11px;
  letter-spacing: 0.3px;
  background: var(--accent-soft);
  color: var(--ink);
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.progress-track {
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.progress-track span {
  height: 100%;
  display: block;
  background: var(--accent);
  border-radius: 4px;
}
.progress-caption {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  gap: 10px;
}
.navigation {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  max-width: 880px;
  width: 100%;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.navigation a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  text-decoration: none;
  font-size: 11px;
  color: var(--muted);
  border-radius: 12px;
}
.navigation a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--ink);
}
.navigation svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.study-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.study-header p {
  margin: 0;
}
.study-header button {
  margin-left: -14px;
}
.session-progress {
  margin-bottom: 24px;
}
.study-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px 36px;
  min-height: 300px;
  box-shadow: var(--shadow);
  animation: arrive 0.18s ease-out;
}
.card-label {
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}
.question {
  font-size: clamp(22px, 4vw, 28px);
  line-height: 1.55;
  font-family: Georgia, serif;
}
.question p:last-child {
  margin-bottom: 0;
}
.reveal-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 30px;
}
.answer {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  font-size: 18px;
}
.answer p:last-child {
  margin-bottom: 0;
}
.explanation {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 8px;
}
.explanation summary {
  padding: 12px 0;
  min-height: 44px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
}
.explanation .markdown {
  font-size: 15px;
  padding: 8px 0;
}
.study-controls {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 880px;
  padding: 18px 28px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  z-index: 30;
}
.reveal-button {
  width: 100%;
  padding: 15px;
}
.grade-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 4px;
  gap: 2px;
  min-height: 70px;
}
.grade span {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.grade[data-rating="1"] {
  color: var(--again);
}
.grade[data-rating="2"] {
  color: var(--hard);
}
.grade[data-rating="3"] {
  background: var(--accent);
  color: var(--inverse);
  border-color: var(--accent);
}
.grade[data-rating="3"] span {
  color: var(--inverse);
}
.study-tools {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}
.study-tools button {
  font-size: 12px;
  padding: 7px 10px;
}
.keyboard-hint {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin: 8px 0 0;
}
.empty {
  text-align: center;
  padding: 60px 10px;
}
.empty h1 {
  font-size: 40px;
}
.empty-symbol {
  font-family: Georgia, serif;
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 12px;
}
.empty p {
  color: var(--muted);
  max-width: 440px;
  margin: 0 auto 24px;
}
.empty button + button {
  margin-left: 10px;
}
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.toolbar label {
  flex: 1;
  min-width: 140px;
}
.toolbar label.search {
  flex: 2;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}
input,
select {
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--accent);
  margin: 0;
}
.browse-list {
  display: grid;
  gap: 10px;
}
.browse-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 4px 20px;
}
.browse-card summary {
  cursor: pointer;
  min-height: 64px;
  padding: 14px 0;
  list-style: none;
}
.browse-card summary::-webkit-details-marker {
  display: none;
}
.browse-title {
  font-family: Georgia, serif;
  font-size: 18px;
  display: block;
}
.browse-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}
.browse-body {
  padding: 10px 0 18px;
  border-top: 1px solid var(--line);
}
.browse-body .answer {
  margin-top: 12px;
  padding-top: 14px;
}
.tag {
  font-size: 11px;
  color: var(--muted);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 26px 0;
}
.stat-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
}
.stat-panel strong {
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  display: block;
}
.stat-panel span {
  font-size: 12px;
  color: var(--muted);
}
.chart-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
}
.chart-panel h2 {
  font-size: 25px;
}
.chart {
  width: 100%;
  height: auto;
  display: block;
  color: var(--accent);
}
.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  margin-top: 20px;
}
.settings-panel h2 {
  font-size: 26px;
}
.settings-form {
  display: grid;
  gap: 20px;
}
.settings-form small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}
.settings-form button {
  justify-self: start;
}
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 10px 0;
  cursor: pointer;
}
.toggle + .toggle {
  border-top: 1px solid var(--line);
}
.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.import-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  min-height: 44px;
  font-size: 14px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.import-label input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.import-label:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(102px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  width: max-content;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.markdown p {
  overflow-wrap: anywhere;
}
.markdown pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
}
.markdown code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.88em;
  background: var(--accent-soft);
  padding: 2px 5px;
  border-radius: 4px;
}
.markdown pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.markdown ul,
.markdown ol {
  padding-left: 24px;
}
.math-display {
  display: block;
  overflow-x: auto;
  margin: 18px 0;
}
.katex {
  font-size: 1.07em !important;
}
.syntax-keyword {
  color: var(--again);
}
.syntax-string {
  color: var(--accent);
}
.syntax-number {
  color: var(--hard);
}
.syntax-comment {
  color: var(--muted);
  font-style: italic;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}
[hidden] {
  display: none !important;
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 600px) {
  .site-header {
    padding: 18px 20px 8px;
  }
  .brand-caption {
    display: none;
  }
  .sync-status {
    font-size: 11px;
  }
  main {
    padding: 30px 20px 120px;
  }
  .count {
    padding: 14px 18px;
  }
  .count strong {
    font-size: 32px;
  }
  .study-call {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .study-call .primary {
    width: 100%;
  }
  .deck-row {
    padding: 18px;
    gap: 12px;
  }
  .deck-row .deck-action button {
    font-size: 13px;
    padding: 9px 14px;
  }
  .progress-caption {
    font-size: 10px;
  }
  .study-surface {
    padding: 26px 24px;
    min-height: 280px;
  }
  .study-controls {
    padding: 12px 16px calc(10px + env(safe-area-inset-bottom));
  }
  .keyboard-hint {
    display: none;
  }
  .stats-grid {
    gap: 8px;
  }
  .stat-panel {
    padding: 15px 12px;
  }
  .stat-panel strong {
    font-size: 28px;
  }
  .stat-panel span {
    font-size: 11px;
  }
  .settings-panel,
  .chart-panel {
    padding: 20px;
  }
  .grade-grid {
    gap: 6px;
  }
  .grade {
    font-size: 14px;
  }
  .question {
    font-size: 23px;
  }
  body.studying main {
    padding-bottom: 190px;
  }
}
@media (min-width: 601px) {
  body.studying main {
    padding-bottom: 210px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
