:root {
  color-scheme: light;
  --ink: #17352f;
  --ink-soft: #52625d;
  --cream: #f4f0e7;
  --paper: #fffdf7;
  --line: #d9d4c9;
  --coral: #d66b4d;
  --coral-dark: #b95339;
  --sage: #dbe4da;
  --gold: #e7b958;
  --success: #2f745c;
  --danger: #a84536;
  --shadow: 0 24px 60px rgba(27, 51, 44, 0.11);
  font-family: "DM Sans", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 12%, rgba(214, 107, 77, 0.08), transparent 26rem),
    var(--cream);
}

button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.03em; font-size: 1.1rem; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--paper); background: var(--ink); font-family: "Libre Caslon Display", Georgia, serif; font-size: 1.35rem; }
.main-nav { display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid rgba(23, 53, 47, 0.12); border-radius: 999px; background: rgba(255,255,255,0.38); }
.nav-button { border: 0; border-radius: 999px; padding: 9px 17px; background: transparent; cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.nav-button.is-active { color: var(--paper); background: var(--ink); }

.view { padding: 56px 0 80px; }
.center-card { width: min(520px, 100%); margin: 70px auto; padding: 42px; background: var(--paper); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
.center-card h1 { margin: 8px 0 16px; font: 3rem/1.05 "Libre Caslon Display", Georgia, serif; letter-spacing: -0.04em; }
.center-card p { line-height: 1.7; color: var(--ink-soft); }
.center-card form { display: grid; gap: 12px; margin-top: 28px; }
.center-card label { font-weight: 700; font-size: 0.9rem; }
.center-card input { width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: white; outline: none; }
.center-card input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 53, 47, 0.11); }
.form-error { min-height: 1.3em; margin: 0 !important; color: var(--danger) !important; font-size: 0.9rem; }

.eyebrow { margin: 0; color: var(--coral-dark); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.hero-grid { display: grid; grid-template-columns: 1.45fr 0.75fr; gap: clamp(44px, 8vw, 110px); align-items: center; min-height: 465px; }
.hero-copy h1 { max-width: 760px; margin: 16px 0 24px; font: clamp(3.8rem, 7vw, 6.5rem)/0.94 "Libre Caslon Display", Georgia, serif; letter-spacing: -0.055em; }
.hero-copy h1 em { color: var(--coral); font-style: normal; }
.hero-description { max-width: 600px; margin: 0 0 32px; color: var(--ink-soft); font-size: 1.12rem; line-height: 1.7; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 18px; min-height: 50px; border: 0; border-radius: 13px; padding: 0 22px; color: white; background: var(--coral); box-shadow: 0 8px 20px rgba(181, 73, 48, 0.19); cursor: pointer; font-weight: 700; transition: transform .15s ease, background .15s ease; }
.primary-button:hover { background: var(--coral-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.full-width { width: 100%; }
.today-card { position: relative; padding: 32px; border-radius: 26px; background: var(--ink); color: white; overflow: hidden; box-shadow: var(--shadow); }
.today-card::after { content: ""; position: absolute; width: 190px; height: 190px; right: -80px; bottom: -110px; border: 34px solid rgba(255,255,255,.05); border-radius: 50%; }
.card-label { margin: 0 0 25px; color: #b9c9c3; text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; font-weight: 700; }
.rhythm-row { display: flex; gap: 20px; align-items: center; }
.rhythm-number { width: 52px; font: 3.4rem/1 "Libre Caslon Display", Georgia, serif; color: var(--gold); }
.rhythm-row strong, .rhythm-row small { display: block; }
.rhythm-row strong { font-size: 1.05rem; }
.rhythm-row small { margin-top: 4px; color: #aebfba; }
.rhythm-divider { height: 1px; margin: 24px 0; background: rgba(255,255,255,.12); }
.time-pill { display: inline-block; margin-top: 28px; padding: 8px 12px; border-radius: 999px; color: #c9d6d2; background: rgba(255,255,255,.08); font-size: .8rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 38px 0 76px; }
.stat-card { padding: 24px 26px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,253,247,.55); }
.stat-card span { font: 2.2rem/1 "Libre Caslon Display", Georgia, serif; }
.stat-card p { margin: 8px 0 0; color: var(--ink-soft); font-size: .87rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading h1, .section-heading h2 { margin: 7px 0 0; font: 2.3rem/1.1 "Libre Caslon Display", Georgia, serif; letter-spacing: -.03em; }
.text-button { padding: 8px; border: 0; border-bottom: 1px solid var(--ink); background: transparent; cursor: pointer; font-weight: 600; }
.data-actions { display: flex; gap: 18px; align-items: center; }
.session-list { border-top: 1px solid var(--line); }
.session-row { display: grid; grid-template-columns: 1fr auto auto; gap: 40px; align-items: center; padding: 20px 4px; border-bottom: 1px solid var(--line); }
.session-row time { font-weight: 600; }
.session-row span { color: var(--ink-soft); font-size: .9rem; }
.empty-state { padding: 32px 0; color: var(--ink-soft); }

.study-view { width: min(850px, 100%); margin: 0 auto; padding: 25px 0 80px; }
.study-header { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; margin-bottom: 58px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 1.3rem; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #dcd8cf; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--coral); transition: width .35s ease; }
#progress-label { color: var(--ink-soft); font-size: .84rem; font-weight: 700; }
.question-card, .feedback-card, .complete-card { padding: clamp(28px, 6vw, 60px); border: 1px solid var(--line); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.question-meta { display: flex; align-items: center; gap: 14px; color: var(--ink-soft); font-size: .85rem; }
.tag { padding: 7px 11px; border-radius: 999px; color: var(--coral-dark); background: #f8e1d9; font-weight: 700; }
.question-card h1 { white-space: pre-line; margin: 32px 0 36px; font: clamp(2rem, 5vw, 3.5rem)/1.18 "Libre Caslon Display", Georgia, serif; letter-spacing: -.04em; }
.answer-options { display: grid; gap: 12px; }
.answer-button { position: relative; width: 100%; padding: 17px 19px 17px 56px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: white; cursor: pointer; line-height: 1.5; transition: border .15s ease, transform .15s ease, background .15s ease; }
.answer-button::before { content: attr(data-letter); position: absolute; left: 17px; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); font-size: .75rem; font-weight: 700; }
.answer-button:hover { border-color: var(--ink); transform: translateX(2px); background: #fbfaf5; }
.answer-button:disabled { cursor: wait; opacity: .65; }
.feedback-status { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.feedback-status.correct { color: var(--success); background: #dcebe5; }
.feedback-status.incorrect { color: var(--danger); background: #f4ded8; }
.feedback-card h2 { margin: 24px 0 3px; font: 3.8rem/1 "Libre Caslon Display", Georgia, serif; letter-spacing: -.04em; }
.pronunciation { margin: 0 0 24px; color: var(--coral-dark); font-weight: 600; }
.word-details { display: grid; gap: 16px; margin: 30px 0; }
.word-details div { padding-left: 15px; border-left: 3px solid var(--sage); }
.word-details dt { color: var(--ink-soft); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.word-details dd { margin: 5px 0 0; line-height: 1.55; }
.sample-list { margin: 8px 0 0; padding-left: 1.25rem; }
.sample-list li { margin: 7px 0; line-height: 1.5; }
.complete-card { text-align: center; padding-block: 70px; }
.completion-mark { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 28px; border-radius: 50%; color: white; background: var(--success); font-size: 2rem; }
.complete-card h1 { margin: 12px 0; font: 4rem/1 "Libre Caslon Display", Georgia, serif; }
.complete-card p:not(.eyebrow) { margin: 0 auto 30px; max-width: 430px; color: var(--ink-soft); line-height: 1.65; }

.word-bank-heading { align-items: center; margin-bottom: 35px; }
.search-box { display: flex; gap: 8px; align-items: center; min-width: 250px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.word-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.word-card { padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,253,247,.72); }
.word-card-top { display: flex; justify-content: space-between; gap: 20px; }
.word-card h2 { margin: 0; font: 1.75rem/1.1 "Libre Caslon Display", Georgia, serif; }
.word-card .pos { margin-top: 4px; color: var(--coral-dark); font-size: .78rem; }
.word-card .mastery { color: var(--ink-soft); font-size: .78rem; white-space: nowrap; }
.word-card > p { color: var(--ink-soft); line-height: 1.55; }
.word-reference { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.word-reference strong { display: block; margin-top: 12px; color: var(--coral-dark); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.word-reference p { margin: 6px 0; color: var(--ink-soft); line-height: 1.5; font-size: .9rem; }
.word-reference .sample-list { color: var(--ink-soft); font-size: .9rem; }
.mastery-track { height: 5px; margin-top: 18px; overflow: hidden; border-radius: 99px; background: var(--line); }
.mastery-track span { display: block; height: 100%; background: var(--success); }
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 20px; padding: 12px 18px; border-radius: 10px; color: white; background: var(--ink); opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.is-visible { opacity: 1; translate: -50% 0; }

@media (max-width: 800px) {
  .app-shell { width: min(100% - 28px, 680px); }
  .topbar { height: 74px; }
  .hero-grid { grid-template-columns: 1fr; min-height: 0; gap: 45px; }
  .hero-copy h1 { font-size: clamp(3.2rem, 14vw, 5rem); }
  .view { padding-top: 35px; }
  .stats-grid { margin-bottom: 55px; }
  .word-list { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .brand > span:last-child { display: none; }
  .nav-button { padding-inline: 13px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card:last-child { grid-column: 1 / -1; }
  .section-heading { align-items: start; flex-direction: column; }
  .word-bank-heading .search-box { width: 100%; }
  .session-row { grid-template-columns: 1fr auto; gap: 10px; }
  .session-row span:last-child { grid-column: 1 / -1; }
  .question-card, .feedback-card, .complete-card { border-radius: 20px; }
  .question-card h1 { font-size: 2rem; }
  .answer-button { font-size: .92rem; }
  .center-card { margin-top: 35px; padding: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
