:root {
  --ink: #24313d;
  --muted: #66717d;
  --paper: #fffdf8;
  --soft: #f5efe4;
  --line: #ded8cc;
  --coral: #ef6f61;
  --teal: #138b86;
  --mint: #dff2e8;
  --yellow: #f6c859;
  --blue: #3f6fb5;
  --shadow: 0 18px 40px rgba(36, 49, 61, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(239, 111, 97, 0.1), transparent 34%),
    linear-gradient(270deg, rgba(19, 139, 134, 0.1), transparent 38%),
    var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.eyebrow,
.today-label,
.panel-heading p,
.target-label {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3.25rem);
  line-height: 1;
}

.streak-card {
  display: grid;
  min-width: 126px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(36, 49, 61, 0.08);
  text-align: center;
}

.streak-number {
  color: var(--coral);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.streak-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.58fr);
  align-items: stretch;
  min-height: 180px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(16px, 2.4vw, 24px);
}

.mode-tabs {
  display: inline-flex;
  width: fit-content;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  margin-bottom: 18px;
}

.mode-tab {
  min-width: 84px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}

.mode-tab.active {
  background: var(--ink);
  color: #fff;
}

.hero-copy h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  line-height: 1;
}

.topic-summary {
  display: none;
}

.topic-picker {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.topic-chip {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  padding: 8px 13px;
}

.topic-chip.active {
  border-color: var(--teal);
  background: var(--mint);
}

.hero-art {
  width: 100%;
  height: 100%;
  min-height: 180px;
  max-height: 220px;
  object-fit: cover;
}

.daily-plan-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(36, 49, 61, 0.08);
  padding: 18px;
}

.daily-plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.daily-plan-head h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.15;
}

.daily-day-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 950;
  padding: 8px 12px;
}

.daily-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.daily-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 12px;
}

.daily-step span,
.phrase-tag {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.daily-step p {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.38;
}

.daily-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.lesson-rail,
.practice-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(36, 49, 61, 0.08);
}

.lesson-rail {
  padding: 18px;
}

.practice-stage {
  display: none;
  min-height: 0;
  padding: clamp(18px, 3vw, 30px);
}

.practice-stage.active {
  display: block;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1.08;
}

.conversation-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -4px 0 18px;
}

.turn-pill,
.free-talk-toggle,
.small-action {
  min-height: 38px;
  border-radius: 6px;
  font-weight: 850;
}

.turn-pill {
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  background: var(--mint);
  color: var(--teal);
}

.small-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 0 13px;
}

.free-talk-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  padding: 0 12px;
}

.free-talk-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.phrase-list,
.mission-list {
  display: grid;
  gap: 12px;
}

.phrase-card,
.mission-card,
.word-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 14px;
}

.daily-phrase,
.daily-mission {
  border-color: rgba(19, 139, 134, 0.35);
  background: var(--mint);
}

.phrase-card button,
.word-card button {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
}

.phrase-en,
.word-en {
  margin: 0 0 5px;
  font-size: 1.1rem;
  font-weight: 900;
}

.phrase-vi,
.word-vi,
.mission-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.buddy-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.buddy-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 950;
  box-shadow: inset 0 -5px 0 rgba(36, 49, 61, 0.1);
}

.buddy-bubble {
  flex: 1;
  border: 2px solid rgba(19, 139, 134, 0.28);
  border-radius: 8px;
  background: var(--mint);
  padding: 18px 20px;
}

.buddy-bubble p {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.9rem);
  font-weight: 850;
  line-height: 1.22;
}

.reply-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.dialogue-log {
  display: grid;
  gap: 10px;
  max-height: 230px;
  overflow: auto;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dialogue-line {
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: start;
  gap: 10px;
}

.dialogue-speaker {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dialogue-text {
  margin: 0;
  line-height: 1.45;
}

.dialogue-text.child {
  color: var(--coral);
  font-weight: 900;
}

.dialogue-text.buddy {
  color: var(--teal);
  font-weight: 850;
}

.reply-button {
  min-height: 58px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 14px;
  text-align: left;
  font-weight: 900;
  line-height: 1.35;
}

.reply-button.active {
  border-color: var(--coral);
  background: #fff0ed;
  box-shadow: inset 0 0 0 2px rgba(239, 111, 97, 0.35);
}

.speaking-card {
  border: 2px solid rgba(239, 111, 97, 0.22);
  border-radius: 8px;
  background: var(--soft);
  padding: 18px;
}

.target-text {
  min-height: 38px;
  margin: 0 0 16px;
  font-size: clamp(1.35rem, 4vw, 2.15rem);
  font-weight: 950;
  line-height: 1.12;
}

.speech-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-button,
.primary-action,
.secondary-action {
  min-height: 52px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
  padding: 0 18px;
}

.icon-button {
  background: var(--blue);
  color: #fff;
}

.primary-action {
  background: var(--coral);
  color: #fff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary-action.recording {
  background: var(--ink);
}

.speech-result {
  display: grid;
  gap: 6px;
  min-height: 76px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: #fff;
}

.speech-result p,
.speech-result strong {
  margin: 0;
}

.speech-result p {
  color: var(--muted);
}

.speech-result strong {
  color: var(--teal);
}

.assessment-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.assessment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.assessment-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.assessment-status {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 900;
  padding: 7px 10px;
}

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

.skill-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 12px;
}

.skill-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.skill-heading strong {
  font-size: 0.92rem;
}

.skill-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: right;
}

.skill-meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfce;
}

.skill-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--yellow), var(--teal));
}

.parent-note {
  margin-top: 12px;
  border-left: 4px solid var(--teal);
  background: var(--mint);
  color: var(--ink);
  line-height: 1.48;
  padding: 12px;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.word-card {
  min-height: 178px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.word-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 950;
}

.mission-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.mission-check {
  width: 24px;
  height: 24px;
  accent-color: var(--teal);
}

.mission-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.mission-card .minutes {
  color: var(--coral);
  font-weight: 900;
}

.idea-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mint);
  padding: 18px;
}

.idea-box h3 {
  margin: 0 0 10px;
}

.idea-box ol {
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
  line-height: 1.65;
}

@media (max-width: 900px) {
  .hero-panel,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .hero-art {
    max-height: 240px;
  }

  .lesson-rail {
    order: 2;
  }

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

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

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .hero-art {
    display: none;
  }

  .streak-card {
    min-width: 96px;
    padding: 12px 10px;
  }

  .mode-tabs,
  .daily-actions,
  .speech-actions,
  .conversation-tools {
    width: 100%;
  }

  .mode-tab,
  .icon-button,
  .primary-action,
  .secondary-action,
  .small-action,
  .free-talk-toggle,
  .turn-pill {
    flex: 1;
  }

  .daily-plan-head {
    flex-direction: column;
  }

  .daily-steps {
    grid-template-columns: 1fr;
  }

  .reply-grid,
  .skill-grid,
  .word-grid {
    grid-template-columns: 1fr;
  }

  .assessment-head {
    align-items: stretch;
    flex-direction: column;
  }

  .assessment-status {
    width: fit-content;
  }

  .mission-card {
    grid-template-columns: auto 1fr;
  }

  .mission-card .minutes {
    grid-column: 2;
  }

  .dialogue-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
