:root {
  color-scheme: dark;
  --bg: #10151f;
  --surface: #18212e;
  --surface-soft: #1d2938;
  --surface-lift: #29394f;
  --text: #f4f6fa;
  --muted: #abb8c9;
  --faint: #76869a;
  --line: rgba(219, 233, 248, .14);
  --accent: #9ce7ba;
  --accent-ink: #082717;
  --accent-soft: rgba(156, 231, 186, .13);
  --danger: #ffb1a4;
  --shadow: 0 14px 35px rgba(0, 0, 0, .2);
  font-family: ui-rounded, "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f7f3;
    --surface: #ffffff;
    --surface-soft: #edf2ec;
    --surface-lift: #e1ebe3;
    --text: #152019;
    --muted: #506257;
    --faint: #75847a;
    --line: rgba(23, 51, 31, .13);
    --accent: #25754b;
    --accent-ink: #ffffff;
    --accent-soft: rgba(37, 117, 75, .12);
    --danger: #ab4035;
    --shadow: 0 12px 30px rgba(30, 55, 38, .09);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-soft: #edf2ec;
  --surface-lift: #e1ebe3;
  --text: #152019;
  --muted: #506257;
  --faint: #75847a;
  --line: rgba(23, 51, 31, .13);
  --accent: #25754b;
  --accent-ink: #ffffff;
  --accent-soft: rgba(37, 117, 75, .12);
  --danger: #ab4035;
  --shadow: 0 12px 30px rgba(30, 55, 38, .09);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 94% 0%, rgba(95, 158, 122, .17), transparent 31rem),
    radial-gradient(circle at 0 14%, rgba(80, 135, 188, .12), transparent 28rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 940px);
  min-height: 100vh;
  margin: auto;
  padding: 22px 16px 52px;
}

.topbar,
.brand,
.word-heading,
.word-topline,
.quiz-top,
.browse-head,
.live-heading,
.live-word,
.result-heading {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 20px rgba(70, 185, 117, .23);
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

.eyebrow,
.date-label,
.detail-label {
  margin: 0;
  color: var(--faint);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.2rem;
  line-height: 1.1;
  letter-spacing: -.03em;
}

.icon-button,
.say-button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.icon-button {
  display: grid;
  width: 44px;
  place-items: center;
  border-radius: 50%;
}

.icon-button svg,
.say-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.icon-button.muted {
  color: var(--faint);
}

.daily-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 21px;
  border: 1px solid rgba(156, 231, 186, .28);
  border-radius: 20px;
  background: linear-gradient(125deg, rgba(156, 231, 186, .17), rgba(80, 139, 113, .06));
  box-shadow: var(--shadow);
}

.daily-banner h2 {
  max-width: 520px;
  margin: 5px 0 7px;
  font-size: clamp(1.4rem, 5vw, 2rem);
  line-height: 1.1;
  letter-spacing: -.045em;
}

.daily-banner p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .92rem;
}

.progress-orbit {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex: 0 0 65px;
  width: 65px;
  height: 65px;
  border: 5px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-weight: 850;
}

.progress-orbit span {
  font-size: 1.35rem;
}

.progress-orbit small {
  font-size: .74rem;
}

.tabs {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 4px;
  margin: 23px 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.tab {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 750;
}

.tab.active {
  background: var(--surface-lift);
  color: var(--text);
}

.section-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 4px 16px;
}

.section-intro > div {
  max-width: 670px;
}

.section-intro p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .91rem;
  line-height: 1.5;
}

.text-button {
  min-height: 44px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: .84rem;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.word-list {
  display: grid;
  gap: 14px;
}

.word-card,
.quiz-card,
.review-hero,
.empty-state,
.atlas-panel,
.live-results {
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.word-card {
  padding: 19px;
  overflow: hidden;
}

.word-topline {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.word-number {
  color: var(--faint);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .12em;
}

.learn-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: .77rem;
  font-weight: 800;
}

.learn-button.learned {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.word-heading {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.word-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.72rem, 6vw, 2.3rem);
  letter-spacing: -.045em;
}

.part-of-speech {
  margin: 3px 0 0;
  color: var(--faint);
  font-size: .84rem;
  font-style: italic;
}

.say-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 800;
}

.say-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.definition {
  margin-bottom: 17px;
  font-size: 1rem;
  font-weight: 620;
  line-height: 1.55;
}

.language-details {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
}

.detail,
.swap-box {
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.detail-label {
  display: block;
  margin-bottom: 7px;
  font-size: .61rem;
}

.phonetic,
.spelling {
  display: block;
  color: var(--text);
  font-size: .92rem;
  line-height: 1.3;
}

.ipa {
  display: block;
  margin-top: 4px;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .71rem;
}

.spelling {
  color: var(--accent);
  letter-spacing: .02em;
}

.swap-box {
  margin-top: 10px;
}

.synonyms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.synonym {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .77rem;
}

.example {
  margin: 15px 0 7px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.5;
}

.usage-note {
  margin: 0;
  color: var(--muted);
  font-size: .83rem;
  line-height: 1.45;
}

.quiz-card {
  margin-top: 16px;
  padding: 19px;
}

.quiz-top {
  justify-content: space-between;
  gap: 10px;
}

.quiz-status {
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
}

.quiz-card h2 {
  margin: 12px 0 5px;
  font-size: 1.14rem;
  letter-spacing: -.02em;
}

.quiz-card h2 em {
  color: var(--accent);
  font-family: Georgia, serif;
  font-style: normal;
}

.quiz-card > p {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
}

.quiz-options {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.quiz-option {
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: .84rem;
  line-height: 1.4;
  text-align: left;
}

.quiz-option.correct {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  color: var(--danger);
  opacity: .72;
}

.quiz-feedback {
  min-height: 1.25em;
  margin: 13px 0 0 !important;
  color: var(--accent) !important;
  font-weight: 650;
}

.browse-head {
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.browse-head h2,
.review-hero h2 {
  margin: 4px 0 0;
  font-size: 1.45rem;
  letter-spacing: -.035em;
}

.search-field {
  width: min(54%, 350px);
}

.search-field input {
  width: 100%;
  min-height: 45px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
}

.search-field input::placeholder {
  color: var(--faint);
}

.atlas-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 16px;
  background:
    linear-gradient(120deg, var(--surface-soft), transparent),
    var(--surface);
}

.atlas-panel > div:first-child {
  min-width: 0;
}

.atlas-panel strong {
  display: block;
  font-size: .93rem;
}

.atlas-panel p {
  max-width: 585px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.search-mode {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.mode-button {
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 750;
}

.mode-button.active {
  background: var(--surface-lift);
  color: var(--text);
}

.browse-result-count {
  margin: 0 3px 12px;
  color: var(--faint);
  font-size: .8rem;
  font-weight: 700;
}

.compact-list .word-card {
  box-shadow: none;
}

.live-results {
  margin-top: 16px;
  padding: 18px;
}

.live-heading,
.result-heading {
  justify-content: space-between;
  gap: 12px;
}

.live-heading h3 {
  margin: 4px 0 0;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}

.live-empty {
  max-width: 640px;
}

.live-empty h3 {
  margin: 6px 0;
  font-size: 1.1rem;
}

.live-empty p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.live-word-list {
  display: grid;
  gap: 9px;
  margin-top: 15px;
}

.live-word {
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.live-word h3 {
  margin: 0 0 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.16rem;
}

.live-word p {
  max-width: 570px;
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.4;
}

.live-word .secondary-button {
  margin: 0;
  color: var(--accent);
}

.live-detail {
  margin-top: 16px;
}

.live-detail .word-list {
  margin-top: 10px;
}

.review-hero {
  padding: 22px;
  margin-bottom: 15px;
  background: linear-gradient(135deg, var(--surface), var(--surface-soft));
}

.review-hero > p:not(.eyebrow) {
  max-width: 570px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.secondary-button {
  min-height: 44px;
  margin-top: 16px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 750;
}

.empty-state {
  padding: 27px 20px;
  text-align: center;
  box-shadow: none;
}

.empty-state h3 {
  margin-bottom: 7px;
  font-size: 1rem;
}

.empty-state p {
  max-width: 430px;
  margin: auto;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

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

@media (min-width: 680px) {
  .app-shell {
    padding: 34px 28px 58px;
  }

  .word-card {
    padding: 23px;
  }

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

@media (max-width: 560px) {
  .atlas-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-mode {
    width: 100%;
  }

  .mode-button {
    flex: 1;
  }

  .live-word {
    flex-direction: column;
    gap: 8px;
  }

  .live-word .secondary-button {
    width: 100%;
  }
}

@media (max-width: 470px) {
  .app-shell {
    padding-inline: 12px;
  }

  .section-intro,
  .browse-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .text-button {
    padding-left: 0;
  }

  .language-details {
    grid-template-columns: 1fr;
  }

  .daily-banner {
    padding: 17px;
  }
}
