:root {
  --ink: #121212;
  --ink-soft: #2a2a24;
  --muted: #5b5b52;
  --muted-2: #6b6b5e;
  --body-copy: #4a4a40;
  --cream: #f8f3e4;
  --paper: #ffffff;
  --lime: #e6efc0;
  --blue: #aec2f0;
  --pink: #f4cfe3;
  --mustard: #f0c98a;
  --lavender: #dcccf2;
  --mint: #bfe6d3;
  --aqua: #bde2ef;
  --coral: #f5bdb3;
  --lemon: #f6e8a0;
  --sand: #e9dcc4;
  --slate: #cbd3e1;
  --stone: #e2ded6;
  --dash: 1.5px dashed var(--ink);
  --radius-card: 16px;
  --radius-control: 10px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  color-scheme: light;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.icon svg {
  display: block;
}

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 16px 140px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.muted {
  color: var(--muted);
}

/* Brand + hero */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: var(--dash);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}

/* Course switcher (French course <-> English course) */
.course-switch {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 8px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.course-switch:hover {
  background: var(--lemon);
}
.course-switch-pair {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.08em;
}
/* Google sign-in / account button: the course switch pill, right after it. */
.course-switch.account-switch {
  margin-left: 0;
  padding: 7px 14px 7px 10px;
}
@media (max-width: 520px) {
  .brand .eyebrow {
    display: none;
  }
  .account-label {
    display: none;
  }
  .course-switch.account-switch {
    padding: 7px 10px;
  }
}

/* The English course translates the page before showing it (see i18n.js). */
html.i18n-pending body {
  visibility: hidden;
}

.hero {
  position: relative;
  overflow: hidden;
  background: var(--lime);
  border: var(--dash);
  border-radius: 18px;
  padding: 48px 44px;
}

.stamp {
  position: absolute;
  top: 24px;
  right: 30px;
}

.hero-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
}

.hero-copy {
  flex: 1 1 400px;
  min-width: 260px;
}

.hero-copy .eyebrow {
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(32px, 6vw, 46px);
  line-height: 1.14;
  margin-bottom: 16px;
}

.hero-copy > p {
  font-size: 16px;
  color: var(--body-copy);
  max-width: 420px;
  margin-bottom: 26px;
}

.tag {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 12px;
}

.tag-white {
  background: var(--paper);
  border: var(--dash);
}

.tag-blue {
  background: var(--blue);
}

.tag-pink {
  background: var(--pink);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--body-copy);
  font-size: 14px;
  font-weight: 600;
}

.hero-art {
  position: relative;
  flex: 0 0 360px;
  min-width: 260px;
  height: 320px;
}

.hero-art-bg {
  position: absolute;
  inset: 0;
}

.avatar {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: var(--dash);
  font-family: var(--serif);
  font-weight: 600;
}

.bubble {
  position: absolute;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 2px 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.avatar-m { top: 24px; left: 40px; width: 52px; height: 52px; background: var(--pink); font-size: 19px; transform: rotate(-3deg); }
.bubble-m { top: 6px; left: 88px; transform: rotate(-2deg); }
.avatar-c { top: 66px; right: 26px; width: 60px; height: 60px; background: var(--blue); font-size: 21px; transform: rotate(2deg); }
.bubble-c { top: 46px; right: 92px; transform: rotate(3deg); }
.avatar-s { bottom: 64px; left: 62px; width: 64px; height: 64px; background: var(--mustard); font-size: 22px; transform: rotate(3deg); }
.bubble-s { bottom: 118px; left: 0; transform: rotate(-3deg); }
.avatar-j { bottom: 22px; right: 54px; width: 52px; height: 52px; background: var(--paper); font-size: 19px; transform: rotate(-2deg); }
.bubble-j { bottom: 76px; right: 108px; transform: rotate(2deg); }

.intro {
  text-align: center;
  max-width: 580px;
  margin: 44px auto 28px;
}

.intro .eyebrow {
  margin-bottom: 10px;
}

.intro h2 {
  font-size: 30px;
  margin-bottom: 10px;
}

.intro p {
  font-size: 15px;
  color: var(--muted);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 12px;
}

.module-card {
  background: var(--paper);
  border: var(--dash);
  border-radius: var(--radius-card);
  padding: 26px;
}

.module-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.module-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.module-card p {
  font-size: 13.5px;
  color: var(--muted);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--cream);
  font-weight: 600;
  font-size: 15px;
  padding: 11px 22px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--ink-soft);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.75;
}

.btn-small {
  font-size: 14px;
  padding: 7px 14px;
}

.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  border: var(--dash);
}

.btn-ghost:hover {
  background: var(--cream);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: var(--dash);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--cream);
}

.is-busy::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tabs */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 28px 0 22px;
}

.tabs [role="tab"] {
  --tab-color: var(--stone);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: var(--dash);
  border-radius: 999px;
  padding: 6px 18px 6px 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.tabs [data-tab="today"] {
  --tab-color: var(--mint);
}

.tabs [data-tab="words"] {
  --tab-color: var(--lavender);
}

.tabs [data-tab="reading"] {
  --tab-color: var(--lime);
}

.tabs [data-tab="writing"] {
  --tab-color: var(--pink);
}

.tabs [data-tab="library"] {
  --tab-color: var(--mustard);
}

.tabs [data-tab="education"] {
  --tab-color: var(--blue);
}

.tab-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--tab-color);
}

.tab-icon svg {
  width: 18px;
  height: 18px;
}

.tabs [role="tab"]:hover {
  background: color-mix(in srgb, var(--tab-color) 45%, var(--paper));
  transform: translateY(-1px);
}

.tabs [role="tab"][aria-selected="true"] {
  background: var(--tab-color);
  border-style: solid;
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.tabs [role="tab"][aria-selected="true"] .tab-icon {
  background: var(--paper);
}

@media (max-width: 600px) {
  .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .tabs [role="tab"] {
    flex-direction: column;
    gap: 4px;
    padding: 8px 0 7px;
    border-radius: 14px;
    font-size: 11px;
    letter-spacing: -0.01em;
    line-height: 1.2;
    text-align: center;
  }

  .tabs [role="tab"] > span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tabs [role="tab"][aria-selected="true"] {
    box-shadow: 2px 2px 0 var(--ink);
  }
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0;
}

.module-header-icon {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: var(--dash);
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-header h2 {
  font-size: 26px;
}

.module-header p {
  font-size: 14.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* Cards, forms, notices */

.card,
.expander {
  background: var(--paper);
  border: var(--dash);
  border-radius: var(--radius-card);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-row-story {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}

.field-narrow {
  max-width: 260px;
}

.field input,
.field select,
.field textarea,
.chat-level,
.chat-form input {
  width: 100%;
  border: var(--dash);
  border-radius: var(--radius-control);
  background: var(--paper);
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 400;
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.notice {
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
}

.notice-success { background: var(--lime); }
.notice-info { background: var(--blue); }
.notice-error { background: var(--pink); }
.notice-warning { background: var(--mustard); }

.expander > summary {
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 600;
  list-style-position: inside;
}

.expander[open] > summary {
  border-bottom: var(--dash);
}

.expander > :not(summary) {
  padding: 18px 20px 20px;
}

.expander .stack {
  padding: 18px 20px 20px;
}

/* Story */

.story-title {
  font-size: 26px;
}

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

.listen-voice {
  font-size: 13px;
  color: var(--muted);
}

.voice-select {
  border: var(--dash);
  border-radius: var(--radius-control);
  background: var(--paper);
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}

.credits {
  margin-top: 48px;
  padding-top: 16px;
  border-top: var(--dash);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}

.credits a {
  color: inherit;
}

.analysis-tip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  background: var(--cream);
  border-radius: 12px;
  padding: 10px 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.story-text {
  font-size: 17px;
  line-height: 1.85;
}

.story-text p + p {
  margin-top: 14px;
}

.sent {
  border-radius: 4px;
  transition: background 0.15s ease;
}

.story-text .sent:hover {
  background: rgba(174, 194, 240, 0.35);
}

.sent.speaking {
  background: var(--lime);
}

.sent.loading {
  background: linear-gradient(90deg, var(--lavender), #f3eefb, var(--lavender));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.sent.analyzed {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
  padding: 12px 52px 12px 12px;
  border: var(--dash);
  border-radius: 14px;
  background: var(--paper);
}

.sent.analyzed:hover {
  background: var(--paper);
}

.sent.analyzed.speaking {
  border-style: solid;
  box-shadow: 0 0 0 4px var(--lime);
}

.chunk-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
}

.chunk {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 10px 6px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  font: inherit;
  line-height: 1.35;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.chunk:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 0 var(--ink);
}

.chunk[aria-pressed="true"] {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.chunk:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.chunk-text {
  font-size: 16px;
}

.chunk-gloss {
  font-family: var(--sans);
  font-size: 13px;
  font-style: italic;
  color: var(--ink-soft);
}

.chunk-label {
  margin-top: 2px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a3a33;
}

.role-subject { background: var(--blue); }
.role-verb { background: var(--pink); }
.role-expression { background: var(--lavender); }
.role-direct-object { background: var(--lime); }
.role-indirect-object { background: var(--mint); }
.role-attribute { background: var(--coral); }
.role-adverbial-place { background: var(--aqua); }
.role-adverbial-time { background: var(--mustard); }
.role-adverbial-manner { background: var(--lemon); }
.role-adverbial-cause,
.role-adverbial-purpose,
.role-adverbial-other { background: var(--sand); }
.role-agent { background: var(--slate); }
.role-conjunction { background: var(--stone); }
.role-other {
  background: var(--paper);
  border-style: dashed;
}

.chunk-details {
  display: block;
  padding-top: 10px;
  border-top: var(--dash);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

.chunk-hint {
  font-size: 13px;
  color: var(--muted);
}

.words-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 6px;
}

.words-head .chip {
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.words-head strong {
  font-family: var(--serif);
  font-size: 17px;
}

.words-gloss {
  font-style: italic;
  color: var(--ink-soft);
}

.word-list {
  display: block;
}

.word-row {
  display: grid;
  grid-template-columns: minmax(70px, max-content) minmax(0, 1fr);
  gap: 2px 14px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(18, 18, 18, 0.2);
}

.word-row:last-child {
  border-bottom: 0;
}

.word-fr {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

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

.word-meaning {
  font-weight: 600;
}

.word-pos {
  font-size: 12px;
  color: var(--muted);
}

.word-note {
  font-size: 13px;
  color: var(--body-copy);
}

.seg-error {
  font-size: 14px;
  color: var(--ink);
  padding: 4px 0;
}

.seg-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
}

.story h4,
.result h4 {
  font-size: 18px;
  margin-top: 6px;
}

.story ul,
.result ul {
  margin: 0;
  padding-left: 20px;
}

.story li + li,
.result li + li {
  margin-top: 4px;
}

.translation {
  border: var(--dash);
  border-radius: var(--radius-card);
}

.translation > summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
}

.translation > div {
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.corrections del {
  color: var(--muted);
}

/* Library */

.library-level {
  font-size: 22px;
  margin: 10px 0 2px;
}

.library-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.library-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.library-items li + li {
  border-top: 1px dashed rgba(18, 18, 18, 0.25);
}

.library-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-section + .library-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: var(--dash);
}

.library-section-title {
  font-size: 26px;
  margin: 0;
}

.library-section > .muted {
  margin: -6px 0 4px;
}

.library-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* Education */

.edu-root {
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-margin-top: 16px;
}

.edu-content,
.edu-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edu-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edu-levels,
.edu-sections {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
}

.edu-level,
.edu-section {
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.edu-level {
  min-width: 46px;
}

.edu-level:hover,
.edu-section:hover {
  background: var(--cream);
}

.edu-level[aria-pressed="true"],
.edu-section[aria-pressed="true"] {
  background: var(--ink);
  color: var(--cream);
}

.edu-overview {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
}

.edu-overview-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.edu-overview .edu-progress {
  flex: 0 1 260px;
}

.edu-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--stone);
  overflow: hidden;
}

.edu-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width 0.3s ease;
}

/* Unit grid */

.edu-unit-grid,
.edu-card-grid,
.edu-exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.edu-unit-card,
.edu-resource-card,
.edu-exercise-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-card);
  padding: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.edu-unit-card:not(:disabled):hover,
.edu-resource-card:hover,
.edu-exercise-card:hover {
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 var(--ink);
}

.edu-unit-card:disabled {
  cursor: not-allowed;
  border-style: dashed;
  opacity: 0.55;
}

.edu-unit-card.status-progress {
  background: var(--lemon);
}

.edu-unit-card.status-completed {
  background: var(--mint);
}

.edu-unit-card .edu-progress {
  width: 100%;
  margin-top: auto;
  background: rgba(18, 18, 18, 0.12);
}

.edu-unit-top {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.edu-unit-number {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
}

.edu-unit-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}

.edu-unit-meta,
.edu-unit-steps {
  font-size: 13px;
  color: var(--muted);
}

.edu-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid var(--ink);
  background: var(--paper);
  white-space: nowrap;
}

.badge-completed {
  background: var(--ink);
  color: var(--cream);
}

.badge-progress {
  background: var(--mustard);
}

.badge-locked {
  border-style: dashed;
}

/* Unit lesson */

.edu-back {
  align-self: flex-start;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  padding: 4px 0;
  cursor: pointer;
}

.edu-back:hover {
  text-decoration: underline;
}

.edu-unit-header {
  gap: 8px;
  background: var(--lime);
}

.edu-unit-header h3 {
  font-family: var(--serif);
  font-size: 26px;
  margin: 0;
}

.edu-unit-native {
  margin: 0;
  font-weight: 600;
  color: var(--body-copy);
}

.edu-goals {
  margin: 4px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  color: var(--body-copy);
}

.edu-stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.edu-step {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px dashed var(--ink);
  border-radius: var(--radius-control);
  padding: 9px 10px;
  cursor: pointer;
}

.edu-step[aria-current="step"] {
  border-style: solid;
  box-shadow: 3px 3px 0 var(--ink);
}

.edu-step.is-done {
  background: var(--mint);
}

.edu-step-dot {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-size: 12px;
}

.edu-next {
  display: flex;
  justify-content: flex-end;
}

/* Grammar topic */

.edu-topic h4,
.edu-quiz h4,
.edu-set h4,
.edu-reading h4,
.edu-writing h4,
.edu-correction h4 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0;
}

.edu-topic h5,
.edu-traps h5 {
  font-family: var(--serif);
  font-size: 16px;
  margin: 4px 0 8px;
}

.edu-topic-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edu-category {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.edu-summary-line {
  margin: 0;
  color: var(--body-copy);
}

.edu-rich p {
  margin: 0 0 10px;
}

.edu-rich p:last-child {
  margin-bottom: 0;
}

.edu-bullets,
.edu-rules,
.edu-keypoints {
  margin: 0 0 10px;
  padding-left: 22px;
  display: grid;
  gap: 4px;
}

.edu-formula,
.edu-structure-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.edu-formula-part,
.edu-structure-chip {
  padding: 6px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--ink);
  font-weight: 600;
  font-size: 14.5px;
  background: var(--paper);
}

.edu-formula-part.tone-0 { background: var(--blue); }
.edu-formula-part.tone-1 { background: var(--pink); }
.edu-formula-part.tone-2 { background: var(--lime); }
.edu-formula-part.tone-3 { background: var(--mustard); }
.edu-formula-part.tone-4 { background: var(--lavender); }

.edu-formula-plus {
  font-weight: 700;
}

.edu-conj {
  border-collapse: collapse;
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.edu-conj th,
.edu-conj td {
  text-align: left;
  padding: 7px 12px;
  border-bottom: 1px dashed rgba(18, 18, 18, 0.25);
  font-size: 15px;
}

.edu-conj tr:last-child th,
.edu-conj tr:last-child td {
  border-bottom: none;
}

.edu-conj th {
  width: 38%;
  background: var(--cream);
  font-weight: 600;
  color: var(--body-copy);
}

.edu-conj td {
  font-weight: 600;
}

.edu-conj .edu-conj-speak {
  width: 40px;
  text-align: right;
}

.edu-ending {
  background: var(--pink);
  border-radius: 4px;
  padding: 0 2px;
  color: inherit;
}

.edu-examples {
  display: grid;
  gap: 8px;
}

.edu-example,
.edu-phrase {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--cream);
}

.edu-example p,
.edu-phrase p {
  margin: 0;
}

.edu-example-text,
.edu-phrase-text {
  font-weight: 600;
}

.edu-example-translation,
.edu-phrase-translation {
  color: var(--body-copy);
}

.edu-example-note,
.edu-phrase-context {
  font-size: 13px;
  color: var(--muted);
}

.edu-speak {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.edu-speak:hover {
  background: var(--lemon);
}

.edu-mistakes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.edu-mistakes li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--cream);
}

.edu-wrong {
  text-decoration: line-through;
  text-decoration-color: #b3261e;
  background: var(--coral);
  border-radius: 6px;
  padding: 1px 8px;
}

.edu-right {
  background: var(--mint);
  border-radius: 6px;
  padding: 1px 8px;
  font-weight: 600;
}

.edu-mistake-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.edu-native-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-control);
  border: 1px solid var(--ink);
  background: var(--aqua);
}

.edu-native-card .edu-example {
  background: rgba(255, 255, 255, 0.65);
}

.edu-native-summary {
  margin: 0;
  font-weight: 600;
}

.edu-traps p {
  margin: 0 0 6px;
}

.edu-glossary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0;
}

.edu-glossary dt {
  font-weight: 700;
}

.edu-glossary dd {
  margin: 0;
}

.edu-related,
.edu-useful,
.edu-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.edu-chip-button {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}

.edu-chip-button:hover,
.edu-chip-button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--cream);
}

/* Vocabulary: masculine / feminine / plural colors */

.edu-gender-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.edu-gender-chip {
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
  border: 1px solid var(--ink);
}

.gender-m { --gender: var(--blue); }
.gender-f { --gender: var(--pink); }
.gender-pl { --gender: var(--lavender); }

.edu-gender-chip.gender-m,
.edu-gender-chip.gender-f,
.edu-gender-chip.gender-pl {
  background: var(--gender);
}

.edu-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.edu-word {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(18, 18, 18, 0.2);
  border-left: 6px solid var(--gender, var(--stone));
  background: var(--paper);
}

.edu-word-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 16px;
}

.edu-word-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.edu-pos {
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--stone);
}

.pos-verb { background: var(--lime); }
.pos-adjective { background: var(--mustard); }
.pos-adverb { background: var(--aqua); }
.pos-phrase { background: var(--sand); }

.edu-ipa {
  font-size: 12px;
  color: var(--muted);
}

.edu-word p {
  margin: 0;
}

.edu-word-meaning {
  font-weight: 600;
}

.edu-word-def {
  font-size: 13.5px;
  color: var(--muted);
}

.edu-word-example {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  font: inherit;
  font-size: 13.5px;
  font-style: italic;
  color: var(--body-copy);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.edu-word-example small {
  font-style: normal;
  color: var(--muted);
}

.edu-word-example:hover {
  text-decoration: underline;
}

/* Resources */

.edu-resource-card strong {
  font-family: var(--serif);
  font-size: 17px;
}

.edu-resource-icon {
  font-size: 26px;
}

.edu-preview {
  font-size: 13px;
  color: var(--body-copy);
}

.edu-phrases {
  display: grid;
  gap: 8px;
}

.edu-register {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: middle;
  background: var(--stone);
}

.register-formal { background: var(--blue); }
.register-informal { background: var(--pink); }

/* Reading and writing */

.edu-reading-text {
  font-size: 17px;
  line-height: 1.75;
  margin: 0;
}

.edu-sentence {
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: none;
  padding: 0 2px;
  border-radius: 4px;
  cursor: pointer;
}

.edu-sentence:hover {
  background: var(--lemon);
}

.edu-hint {
  margin: 0;
  font-size: 13px;
}

.edu-translation {
  padding: 12px 14px;
  border-radius: var(--radius-control);
  background: var(--cream);
}

.edu-writing textarea {
  width: 100%;
  font: inherit;
  padding: 12px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--paper);
  resize: vertical;
}

/* Quizzes and exercises */

.edu-question {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edu-question + .edu-question {
  border-top: 1px dashed rgba(18, 18, 18, 0.25);
  padding-top: 14px;
}

.edu-question > p {
  margin: 0;
  font-weight: 600;
}

.edu-options,
.edu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edu-option,
.edu-fragment,
.edu-block,
.edu-pair {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.edu-option:not(:disabled):hover,
.edu-fragment:not(:disabled):hover,
.edu-block:hover,
.edu-pair:not(:disabled):hover {
  background: var(--lemon);
}

.edu-option:disabled,
.edu-fragment:disabled,
.edu-pair:disabled {
  cursor: default;
}

.is-correct,
.is-matched,
.is-found {
  background: var(--mint) !important;
}

.is-wrong {
  background: var(--coral) !important;
}

.edu-feedback {
  margin: 0;
  min-height: 1.4em;
  font-weight: 600;
}

.edu-exercise-card {
  background: var(--lavender);
}

.edu-exercise-card.is-done {
  background: var(--mint);
}

.edu-exercise-icon {
  font-size: 28px;
}

.edu-review-tools {
  display: flex;
  justify-content: flex-end;
}

.edu-exercise {
  gap: 16px;
}

.edu-exercise-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--serif);
  font-size: 18px;
}

.edu-counter {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
}

.edu-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.edu-instruction {
  margin: 0;
  font-weight: 600;
}

.edu-fragments {
  margin: 0;
  line-height: 2.6;
  font-size: 17px;
}

.edu-fragment {
  padding: 4px 8px;
}

.edu-answer-row,
.edu-pool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 10px;
  border-radius: var(--radius-control);
}

.edu-answer-row {
  border: 1.5px dashed var(--ink);
  background: var(--cream);
}

.edu-block.is-placed {
  background: var(--blue);
}

.edu-explain {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.edu-explain .edu-example {
  width: 100%;
}

.edu-pairs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.edu-pair-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edu-pair {
  text-align: left;
}

.edu-pair.is-meaning {
  font-weight: 500;
}

.edu-pair.is-selected {
  background: var(--ink);
  color: var(--cream);
}

.edu-summary {
  text-align: center;
  padding: 10px 0;
}

.edu-summary p {
  margin: 0;
}

.edu-summary-score {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
}

.shake {
  animation: edu-shake 0.35s ease;
}

@keyframes edu-shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

/* Loading states and credits */

.edu-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  padding: 6px 0;
}

.edu-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--stone);
  border-top-color: var(--ink);
  animation: edu-spin 0.8s linear infinite;
}

h4 .edu-async {
  display: inline;
}

h4 .edu-loading {
  display: inline-flex;
  padding: 0;
  vertical-align: middle;
}

@keyframes edu-spin {
  to { transform: rotate(360deg); }
}

.edu-failure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.edu-credits {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.edu-credits a {
  color: inherit;
}

@media (max-width: 640px) {
  .edu-toolbar {
    align-items: stretch;
  }

  .edu-levels,
  .edu-sections {
    border-radius: var(--radius-card);
  }

  .edu-stepper {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .edu-step {
    flex-direction: column;
    gap: 4px;
    padding: 8px 4px;
    font-size: 11.5px;
    text-align: center;
  }

  .edu-overview {
    flex-direction: column;
    align-items: stretch;
  }

  .edu-overview .edu-progress {
    flex-basis: auto;
  }

  .edu-pairs {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .edu-spinner,
  .shake {
    animation: none;
  }
}

/* Chat widget */

.chat-widget {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 50;
}

.chat-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: var(--dash);
  background: var(--lavender);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(18, 18, 18, 0.18);
  transition: transform 0.15s ease;
}

.chat-fab:hover {
  transform: translateY(-2px);
}

.chat-fab .chat-fab-close,
.chat-fab.is-open .chat-fab-open {
  display: none;
}

.chat-fab.is-open .chat-fab-close {
  display: flex;
}

.chat-panel {
  position: absolute;
  left: 0;
  bottom: 74px;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 110px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: var(--dash);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(18, 18, 18, 0.18);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 14px;
  background: var(--lavender);
  border-bottom: var(--dash);
}

.chat-head-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: var(--dash);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.chat-head-title {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.2;
}

.chat-head-title strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.chat-head-title strong,
.chat-head-title small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-title small {
  font-size: 12px;
  color: var(--muted);
}

.chat-head .icon-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-style: solid;
}

.chat-history {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: var(--cream);
}

.chat-history-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-history-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 4px;
  border: var(--dash);
  border-radius: 12px;
  background: var(--paper);
}

.chat-history-list li.is-active {
  background: var(--lavender);
}

.history-open {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.history-open:hover .history-name {
  text-decoration: underline;
}

.history-name {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 12px;
  color: var(--muted);
}

.history-delete {
  width: 32px;
  height: 32px;
}

.chat-history-note {
  margin: 14px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}

.chat-level {
  width: auto;
  padding: 6px 8px;
  font-size: 13px;
}

/* Chat mode switch: the Education section pills, a little smaller. */
.chat-modes {
  display: flex;
  justify-content: center;
  padding: 8px 10px;
  background: var(--cream);
  border-bottom: var(--dash);
}

.chat-modes .edu-section {
  font-size: 13px;
  padding: 5px 12px;
}

/* Tutor mode answers */
.tutor-answer p + p,
.tutor-answer p + ul,
.tutor-answer ul + p {
  margin-top: 6px;
}

.tutor-answer ul {
  margin: 0;
  padding-left: 18px;
}

.tutor-section-title {
  margin: 8px 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.tutor-examples {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tutor-examples li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 8px;
  background: var(--cream);
  border-radius: 8px;
}

.tutor-examples strong {
  font-weight: 600;
}

.tutor-examples small {
  font-size: 13px;
  color: var(--muted);
}

.chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--cream);
}

.chat-empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin: auto 8px;
}

.msg {
  max-width: 85%;
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 15px;
  line-height: 1.45;
}

.msg-user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--cream);
}

.msg-assistant {
  align-self: flex-start;
  background: var(--paper);
  border: var(--dash);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-voice {
  display: inline-flex;
  vertical-align: -3px;
  margin-right: 6px;
  opacity: 0.8;
}

.msg-correction {
  align-self: flex-end;
  max-width: 85%;
  margin-top: -4px;
  padding: 8px 12px;
  border: var(--dash);
  border-radius: 14px;
  background: var(--lime);
  font-size: 13.5px;
  line-height: 1.45;
}

.msg-correction-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.msg-correction-title svg {
  width: 14px;
  height: 14px;
}

.msg-correction-text {
  margin: 2px 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.msg-correction ul {
  margin: 0 0 2px;
  padding-left: 16px;
}

.msg-natural {
  margin: 8px 0 2px;
  padding-top: 8px;
  border-top: 1px dashed rgba(18, 18, 18, 0.35);
}

.msg-rules {
  margin-top: 6px !important;
  font-size: 13px;
}

.msg-rules li + li {
  margin-top: 3px;
}

.trap-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 0 7px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.quick-check {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--paper);
  border: var(--dash);
}

.qc-question {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 13px;
}

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

.qc-option {
  padding: 5px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

.qc-option:hover:not(:disabled) {
  background: var(--blue);
}

.qc-option:disabled {
  cursor: default;
}

.qc-option.is-correct {
  background: #9fd99b;
  animation: qc-flash 0.6s ease 2;
}

.qc-option.is-wrong {
  background: var(--pink);
  text-decoration: line-through;
  opacity: 0.75;
  animation: qc-shake 0.35s ease;
}

.qc-option:disabled:not(.is-correct):not(.is-wrong) {
  opacity: 0.55;
}

.qc-feedback {
  margin: 6px 0 0;
  font-size: 12.5px;
  font-weight: 600;
}

.qc-feedback:empty {
  display: none;
}

@keyframes qc-flash {
  50% { box-shadow: 0 0 0 5px rgba(120, 200, 115, 0.55); }
}

@keyframes qc-shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.hint-box {
  margin-top: 2px;
}

.hint-toggle {
  padding: 2px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline dotted;
  cursor: pointer;
}

.hint-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.hint-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4px 10px;
  border: 1.5px dashed var(--ink);
  border-radius: 10px;
  background: var(--lemon);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.3;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.hint-chip:hover {
  border-style: solid;
}

.hint-chip small {
  font-size: 11.5px;
  color: var(--body-copy);
}

.msg-correction s {
  color: var(--muted);
}

.msg-correction-why {
  display: block;
  font-size: 12.5px;
  color: var(--body-copy);
}

.msg-translation {
  font-size: 13px;
  color: var(--muted);
}

.translation-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.translation-toggle {
  padding: 2px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.translation-toggle::after {
  content: " ▾";
}

.translation-toggle[aria-expanded="true"]::after {
  content: " ▴";
}

.msg-listen {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  padding: 2px 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.msg-live p::after {
  content: "▍";
  margin-left: 2px;
  color: var(--muted);
  animation: live-caret 1s steps(1) infinite;
}

@keyframes live-caret {
  50% { opacity: 0; }
}

.story-draft-note {
  font-size: 14px;
}

.msg-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}

.msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s ease-in-out infinite;
}

.msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.chat-status {
  font-size: 13px;
  padding: 0 14px;
  min-height: 0;
}

.chat-status:not(:empty) {
  padding: 8px 14px;
  border-top: 1px dashed rgba(18, 18, 18, 0.25);
}

.chat-status.is-error {
  background: var(--pink);
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: var(--dash);
}

.chat-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
}

.send-btn {
  background: var(--ink);
  color: var(--cream);
  border-style: solid;
}

.send-btn:hover {
  background: var(--ink-soft);
}

.mic-btn.is-recording {
  background: var(--pink);
  border-style: solid;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 6px rgba(244, 207, 227, 0.6); }
}

.chat-form button:disabled,
.chat-form input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (hover: none) {
  .story-text .sent {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
}

@media (max-width: 720px) {
  .hero {
    padding: 36px 22px;
  }

  .stamp {
    width: 64px;
    height: 64px;
    top: 14px;
    right: 14px;
  }

  .hero-art {
    display: none;
  }

  .form-row,
  .form-row-story {
    grid-template-columns: minmax(0, 1fr);
  }

  .card {
    padding: 20px;
  }

  .library-items li {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Guided program: the "Today" tab (program.js) */

#program-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prog-momentum {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: 20px 22px;
}

.prog-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  flex: 1 1 340px;
}

.prog-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--ink);
  border-radius: 12px;
}

.prog-stat strong {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.1;
}

.prog-stat span {
  font-size: 12.5px;
  color: var(--body-copy);
  line-height: 1.3;
}

.prog-week {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 300px;
}

.prog-ring {
  position: relative;
  flex: none;
  width: 64px;
  height: 64px;
}

.prog-ring svg {
  display: block;
}

.prog-ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}

.prog-week-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
  line-height: 1.4;
}

.prog-goal-options .edu-section {
  font-size: 13px;
  padding: 5px 12px;
}

.prog-unit {
  gap: 8px;
  padding: 20px 22px;
}

.prog-unit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.prog-unit-percent {
  font-weight: 700;
}

.prog-unit-note {
  font-size: 13px;
}

.prog-next-unit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--mint);
  border-radius: 12px;
  font-weight: 600;
}

.prog-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prog-rail-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px dashed var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.prog-rail-step.is-active {
  border-style: solid;
  color: var(--ink);
  background: var(--lemon);
}

.prog-rail-step.is-done {
  color: var(--ink);
  background: var(--mint);
}

.prog-rail-number {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--paper);
  font-size: 12px;
  color: var(--ink);
}

.prog-bridge {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.prog-hint {
  font-size: 13.5px;
}

.prog-word {
  cursor: pointer;
  border-radius: 4px;
}

.prog-word:hover,
.prog-word:focus-visible {
  background: var(--lemon);
}

.prog-word.is-saved {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.prog-tip .prog-saved {
  color: var(--muted);
  font-size: 13px;
}

.prog-choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1.5px dashed var(--ink);
  border-radius: 12px;
  background: var(--lavender);
}

.prog-choice-question {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
}

.prog-choice-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.prog-choice-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--paper);
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.prog-choice-option:hover {
  background: var(--lemon);
}

.prog-choice-option span {
  font-size: 13.5px;
  color: var(--body-copy);
}

.prog-choice-made {
  font-weight: 600;
  color: var(--muted);
  font-size: 14px;
}

.prog-focus {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px dashed var(--ink);
  border-radius: 12px;
}

.prog-focus.is-studied {
  background: var(--cream);
}

.prog-focus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.prog-focus-sentence {
  width: 100%;
}

.prog-rule {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--aqua);
  font-size: 14.5px;
  line-height: 1.5;
}

.prog-rule strong {
  display: inline-block;
  margin-right: 4px;
}

.prog-quiz-count {
  font-size: 13px;
  color: var(--muted);
}

.prog-quiz-word {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-size: 30px;
}

.prog-quiz-word .msg-listen {
  font-family: var(--sans);
}

.prog-context {
  font-style: italic;
  color: var(--body-copy);
}

.prog-context mark {
  background: var(--lemon);
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
  padding: 0 2px;
  border-radius: 3px;
}

.prog-quiz-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.prog-good {
  color: #1f7a4d;
}

.prog-bad {
  color: #a3352a;
}

.prog-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prog-theme {
  font-size: 14.5px;
  padding: 7px 12px;
}

.prog-theme[aria-pressed="true"] {
  border-style: solid;
  background: var(--ink);
  color: var(--cream);
}

.prog-custom-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.prog-custom-input {
  min-width: 220px;
  padding: 7px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
}

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

.prog-settings-label {
  min-width: 56px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.prog-onboarding h3 + .edu-sections,
.prog-onboarding h3 + .prog-themes {
  align-self: flex-start;
}

.prog-welcome {
  gap: 6px;
  padding: 18px 22px;
  background: var(--lemon);
}

.prog-loading {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.prog-summary {
  background: var(--mint);
}

.quest-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quest-badge {
  display: inline-flex;
  flex-direction: column;
  padding: 5px 12px;
  border: 1.5px dashed var(--ink);
  border-radius: 10px;
  background: var(--paper);
  font-weight: 600;
  line-height: 1.3;
}

.quest-badge small {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--body-copy);
}

.quest-badge.is-done {
  border-style: solid;
  background: var(--mint);
}

.chat-quest {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 14px 10px;
  border-bottom: var(--dash);
  background: var(--cream);
}

.chat-quest .quest-badge {
  font-size: 13px;
  padding: 3px 9px;
}

.chat-quest-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

@media (max-width: 620px) {
  .prog-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prog-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .prog-stat {
    padding: 10px;
  }

  .prog-stat strong {
    font-size: 22px;
  }
}

/* Workspace mode: returning learners skip the introduction */

.workspace .hero,
.workspace .intro,
.workspace .module-grid,
.workspace .brand .eyebrow {
  display: none;
}

.about-toggle {
  display: none;
}

.studied .about-toggle {
  display: inline-flex;
}

.about-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--cream);
}

.header-progress {
  display: none;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border: 1.5px dashed var(--ink);
  border-radius: 999px;
  background: var(--mint);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}

.workspace .header-progress:not([hidden]) {
  display: inline-flex;
}

@media (max-width: 720px) {
  .header-progress-week {
    display: none;
  }
}

@media (max-width: 520px) {
  .header-progress-unit {
    display: none;
  }
}

/* Sentence analysis on click / tap */

.sentence-analysis .sent:not(.analyzed) {
  cursor: pointer;
}

.sent.sent-picked {
  background: rgba(174, 194, 240, 0.55);
}

/* The small "Break into blocks" box shown under a tapped sentence */
.split-ask {
  position: absolute;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
}

.split-ask-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.split-ask-close:hover {
  background: var(--cream);
  color: var(--ink);
}

/* Program step 4: the chat inside the Today panel */

.chat-panel.is-embedded {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  height: min(620px, 78vh);
  box-shadow: none;
}

.chat-panel.is-embedded .chat-modes,
.chat-panel.is-embedded .chat-level,
.chat-panel.is-embedded #chat-history-btn,
.chat-panel.is-embedded #chat-new,
.chat-panel.is-embedded #chat-close {
  display: none;
}

.prog-chat-host {
  width: 100%;
}

/* Neural voice download status */

.voice-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 60;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border: var(--dash);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(18, 18, 18, 0.18);
  font-size: 14px;
  font-weight: 600;
}

.voice-toast[hidden] {
  display: none;
}

.voice-toast-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
}

.voice-toast-text small {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}

.voice-toast-bar {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: var(--stone);
  overflow: hidden;
}

.voice-toast-bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ink);
  transition: width 0.2s ease;
}

/* Education: explanations in the learner's language, original on request */

.edu-topic-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.edu-original-toggle {
  font-size: 12.5px;
}

.edu-topic-original,
.edu-unit-original {
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
}

.edu-unit-original {
  display: block;
  margin-top: -4px;
}

/* My words: flashcards */

#words-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.words-summary {
  gap: 14px;
  padding: 20px 22px;
}

.words-summary .prog-stats {
  flex: none;
}

.words-filters {
  align-self: flex-start;
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.word-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 170px;
  border: var(--dash);
  border-radius: var(--radius-card);
  background: var(--paper);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.word-card:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.word-card.is-flipped {
  background: var(--cream);
  border-style: solid;
}

.word-card-face {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 16px 16px 6px;
  border: none;
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.word-card-word {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.2;
  word-break: break-word;
}

.word-card-hint,
.word-card-next {
  font-size: 12px;
  color: var(--muted);
}

.word-card-meaning {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}

.word-card .prog-context {
  margin: 0;
  font-size: 13.5px;
}

.word-card-status {
  padding: 2px 9px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.word-card-status.status-new {
  background: var(--aqua);
}

.word-card-status.status-due {
  background: var(--lemon);
}

.word-card-status.status-learning {
  background: var(--lavender);
}

.word-card-status.status-known {
  background: var(--mint);
}

.word-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 8px 8px;
}

.words-add summary {
  cursor: pointer;
  font-weight: 600;
}

.words-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.words-add-form input {
  flex: 1 1 180px;
  padding: 9px 12px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--paper);
}

.words-empty {
  gap: 6px;
}

.prog-quiz-meaning {
  font-size: 26px;
}

.prog-stat-link {
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.prog-stat-link:hover {
  box-shadow: 2px 2px 0 var(--ink);
}

.prog-link,
.save-word {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.save-word:disabled {
  color: var(--muted);
  text-decoration: none;
  cursor: default;
}

/* Reading: comprehension quiz, translation locked until it is done */

.story-quiz {
  gap: 12px;
  padding: 20px 22px;
  background: var(--lemon);
  border-style: solid;
}

.story-quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.story-quiz-count {
  font-size: 13px;
  color: var(--muted);
}

.story-quiz .edu-progress {
  background: var(--paper);
}

.story-quiz-question {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

.story-quiz-native {
  margin-top: -6px;
  font-size: 14px;
  color: var(--body-copy);
}

.story-quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.story-quiz-options .edu-option {
  text-align: left;
}

.story-quiz-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14.5px;
}

.story-quiz-feedback p {
  flex: 1 1 260px;
}

.translation.is-locked > summary {
  color: var(--muted);
  cursor: not-allowed;
}

/* Privacy and terms pages (privacy.html, terms.html) */

.legal-links {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.brand-home {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.legal-langs {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.legal-langs a {
  padding: 6px 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  background: var(--paper);
}

[data-legal-lang="tr"] .legal-langs [data-lang="tr"],
[data-legal-lang="en"] .legal-langs [data-lang="en"] {
  background: var(--ink);
  color: var(--paper);
}

[data-legal-lang="tr"] .legal-doc#en,
[data-legal-lang="en"] .legal-doc#tr {
  display: none;
}

.legal-doc {
  gap: 12px;
  max-width: 760px;
  margin: 0 auto 24px;
  color: var(--body-copy);
}

.legal-doc h1 {
  font-size: clamp(28px, 5vw, 38px);
  margin-bottom: 4px;
}

.legal-doc h2 {
  font-size: 21px;
  margin-top: 16px;
}

.legal-doc h3 {
  font-size: 16px;
  font-family: var(--sans);
  margin-top: 4px;
}

.legal-doc ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legal-doc strong,
.legal-doc h1,
.legal-doc h2,
.legal-doc h3 {
  color: var(--ink);
}

.legal-doc code {
  font-size: 13.5px;
  background: var(--cream);
  padding: 1px 6px;
  border-radius: 6px;
}

.legal-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: var(--dash);
  font-size: 14px;
}

@media (max-width: 520px) {
  .legal-doc {
    padding: 20px;
  }
}
