:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #657386;
  --line: #d8e0e7;
  --surface: #ffffff;
  --soft: #f4f7f8;
  --teal: #006d77;
  --teal-dark: #004b55;
  --red: #bd2332;
  --gold: #d59636;
  --green: #167b54;
  --shadow: 0 18px 48px rgba(23, 33, 43, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef3f4;
  color: var(--ink);
}

body.study-view {
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  background: #18252c;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(13, 24, 29, 0.88), rgba(13, 24, 29, 0.62) 42%, rgba(13, 24, 29, 0.08));
}

.hero-overlay {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 40px));
  padding: 48px 0 54px;
  margin-left: clamp(20px, 7vw, 96px);
  color: #fff;
}

.eyebrow {
  margin: 0 0 16px;
  color: #f6ca74;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  max-width: 680px;
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 5vw, 4.7rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action,
.ghost-action {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 6px;
  padding: 0 18px;
  cursor: pointer;
}

.primary-action {
  background: #fff;
  color: var(--teal-dark);
  font-weight: 800;
}

.ghost-action {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  width: min(1120px, calc(100% - 40px));
  margin: -30px auto 22px;
  position: relative;
  z-index: 2;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.study-view .dashboard {
  width: min(1120px, calc(100% - 24px));
}

.home-view .dashboard,
.home-view .workspace {
  display: none;
}

.study-view .hero,
.study-view .home-scenes {
  display: none;
}

.study-view .dashboard {
  margin-top: 12px;
  margin-bottom: 10px;
}

.home-scenes {
  width: min(1120px, calc(100% - 40px));
  margin: 26px auto 48px;
}

.home-scenes .section-heading {
  margin-bottom: 16px;
}

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

.home-lesson-card {
  display: grid;
  gap: 10px;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 26px rgba(23, 33, 43, 0.08);
  cursor: pointer;
}

.home-lesson-card:hover {
  border-color: var(--teal);
}

.home-lesson-card .lesson-icon {
  margin-bottom: 6px;
}

.home-lesson-card strong {
  font-size: 1.25rem;
}

.home-lesson-card span:not(.lesson-icon),
.home-lesson-card small {
  color: var(--muted);
  line-height: 1.45;
}

.stat {
  min-height: 108px;
  padding: 24px;
  background: var(--surface);
}

.study-view .stat {
  min-height: 54px;
  padding: 8px 16px;
}

.stat-value {
  display: block;
  margin-bottom: 4px;
  color: var(--teal);
  font-size: 2rem;
  font-weight: 850;
}

.study-view .stat-value {
  display: inline;
  margin: 0 8px 0 0;
  font-size: 1.2rem;
}

.study-view .stat-label {
  font-size: 0.82rem;
}

.stat-label,
.muted {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 48px;
}

.study-view .workspace {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  height: calc(100vh - 94px);
  width: min(1120px, calc(100% - 24px));
  margin-bottom: 0;
}

.lesson-list,
.lesson-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.lesson-list {
  padding: 20px;
  align-self: start;
}

.study-view .lesson-list {
  height: 100%;
  padding: 12px;
}

.section-heading p {
  margin-bottom: 6px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
}

.section-heading h2 {
  margin-bottom: 16px;
  font-size: 1.35rem;
}

.study-view .section-heading p {
  margin-bottom: 3px;
  font-size: 0.72rem;
}

.study-view .section-heading h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.lesson-buttons {
  display: grid;
  gap: 10px;
}

.lesson-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.study-view .lesson-button {
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 56px;
  padding: 8px;
}

.lesson-button.active {
  border-color: var(--teal);
  background: #edf8f7;
}

.lesson-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}

.study-view .lesson-icon {
  width: 34px;
  height: 34px;
  font-size: 0.78rem;
}

.lesson-button:nth-child(2) .lesson-icon {
  background: var(--red);
}

.lesson-button:nth-child(3) .lesson-icon {
  background: var(--gold);
}

.lesson-button:nth-child(4) .lesson-icon {
  background: var(--green);
}

.lesson-button:nth-child(5) .lesson-icon {
  background: #394a5d;
}

.lesson-button strong {
  display: block;
  margin-bottom: 4px;
}

.study-view .lesson-button strong {
  margin-bottom: 2px;
  font-size: 0.92rem;
}

.lesson-button span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.study-view .lesson-button span:last-child {
  font-size: 0.78rem;
  line-height: 1.2;
}

.lesson-panel {
  min-height: 650px;
  padding: clamp(22px, 4vw, 36px);
}

.study-view .lesson-panel {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 14px;
}

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

.study-view .lesson-topline {
  margin-bottom: 8px;
}

.back-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--teal-dark);
  font-weight: 800;
  cursor: pointer;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 11px;
  background: #f7e8ea;
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 800;
}

.lesson-panel h2 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 0;
}

.study-view .lesson-panel h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.intro {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.study-view .intro {
  display: none;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 28px 0 20px;
  border-bottom: 1px solid var(--line);
}

.study-view .tabs {
  margin: 10px 0 10px;
}

.tab {
  min-height: 42px;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.study-view .tab {
  min-height: 34px;
  padding: 0 12px;
}

.tab.active {
  border-color: var(--teal);
  color: var(--ink);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

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

.phrase-card {
  display: grid;
  gap: 12px;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--soft);
}

.spanish {
  color: var(--teal-dark);
  font-size: 1.12rem;
  font-weight: 850;
  line-height: 1.5;
}

.chinese,
.note {
  color: var(--muted);
  line-height: 1.6;
}

.note {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.94rem;
}

.learned-button,
.primary-check,
.quiz-option {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.learned-button.done {
  border-color: #a6d7c3;
  background: #e8f7ef;
  color: var(--green);
  font-weight: 800;
}

.vocab-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 26px);
  background: var(--soft);
}

.study-view .vocab-card,
.study-view .challenge-card {
  padding: 14px;
}

.study-view .vocab-card > .muted {
  display: none;
}

.vocab-progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--teal-dark);
  font-weight: 850;
}

.study-view .vocab-progress {
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.word-prompt {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.study-view .word-prompt {
  gap: 5px;
  margin-top: 10px;
  padding: 11px 12px;
}

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

.word-prompt strong {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.1;
}

.typing-form {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.study-view .typing-form {
  margin-top: 12px;
}

.typing-form label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.typing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
}

.typing-row input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 1.05rem;
}

.study-view .typing-row input {
  min-height: 42px;
}

.typing-row input:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(0, 109, 119, 0.14);
}

.typing-row input[readonly] {
  background: #eef6f6;
  color: var(--muted);
}

.primary-check {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 850;
}

.typing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.study-view .typing-actions {
  gap: 8px;
  margin-top: 9px;
}

.typing-actions .learned-button {
  padding: 0 14px;
}

.speak-button {
  border-color: #b9d8df;
  background: #eaf7f8;
  color: var(--teal-dark);
  font-weight: 850;
}

.answer-card {
  margin-top: 14px;
  border-left: 4px solid var(--green);
  padding: 14px 16px;
  background: #fff;
}

.study-view .answer-card {
  margin-top: 10px;
  padding: 10px 12px;
}

.challenge-card .answer-card {
  margin-bottom: 16px;
  border-left-color: var(--gold);
}

.answer-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.answer-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 1.5rem;
}

.study-view .answer-card strong {
  font-size: 1.28rem;
}

.study-view .answer-card p {
  font-size: 0.9rem;
  line-height: 1.35;
}

.answer-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.example-line {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.example-line span {
  margin-bottom: 0;
  color: var(--gold);
}

.example-line strong {
  margin-bottom: 0;
  color: var(--teal-dark);
  font-size: 1.02rem;
  line-height: 1.35;
}

.example-line p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.study-view .example-line {
  margin-top: 8px;
  padding-top: 8px;
}

.study-view .example-line strong {
  font-size: 0.96rem;
}

.challenge-card,
.script-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 26px);
  background: var(--soft);
}

.challenge-top,
.script-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.study-view .challenge-top {
  margin-bottom: 10px;
}

.challenge-top h3,
.script-head h3 {
  margin: 4px 0 0;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
}

.study-view .challenge-top h3 {
  font-size: 1.2rem;
}

.xp-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff2d7;
  color: #8b5a0d;
  font-size: 0.86rem;
  font-weight: 900;
  white-space: nowrap;
}

.challenge-dots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.study-view .challenge-dots {
  gap: 6px;
  margin-bottom: 10px;
}

.dot {
  height: 8px;
  border-radius: 999px;
  background: #d5dde4;
}

.dot.done {
  background: var(--green);
}

.dot.current {
  background: var(--gold);
}

.challenge-prompt {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  color: var(--teal-dark);
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  font-weight: 850;
  line-height: 1.45;
}

.study-view .challenge-prompt {
  min-height: 54px;
  margin-bottom: 0;
  padding: 12px;
  font-size: 1.28rem;
  line-height: 1.3;
}

.script-lines {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.script-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.script-line .prompt-label,
.script-line strong,
.script-line .script-answer {
  grid-column: 1 / -1;
}

.script-line input,
.script-notes {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
}

.script-line input {
  min-height: 42px;
}

.script-line.correct {
  border-color: #90cbb3;
}

.script-line.wrong {
  border-color: #e6a8af;
}

.script-answer {
  margin: 0;
  color: var(--teal-dark);
  font-weight: 800;
}

.script-notes-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.script-notes {
  min-height: 180px;
  padding: 12px;
  line-height: 1.55;
  resize: vertical;
}

.dialogue-card,
.quiz-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--soft);
}

.dialogue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
}

.dialogue-lines {
  display: grid;
  gap: 14px;
}

.line {
  border-left: 4px solid var(--teal);
  padding: 12px 14px;
  background: #fff;
}

.line:nth-child(even) {
  border-left-color: var(--red);
}

.speaker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.quiz-card h3 {
  margin-bottom: 18px;
  font-size: 1.3rem;
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-option {
  padding: 12px 14px;
  text-align: left;
}

.quiz-option.correct {
  border-color: #90cbb3;
  background: #e8f7ef;
}

.quiz-option.wrong {
  border-color: #e6a8af;
  background: #fff0f1;
}

.feedback {
  min-height: 28px;
  margin: 16px 0 0;
  font-weight: 800;
}

.study-view .feedback {
  min-height: 22px;
  margin-top: 10px;
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  body.study-view {
    overflow: auto;
  }

  .hero {
    min-height: 390px;
  }

  .hero::after {
    background: linear-gradient(180deg, rgba(13, 24, 29, 0.82), rgba(13, 24, 29, 0.42));
  }

  .hero-overlay {
    padding-top: 50px;
  }

  .dashboard,
  .workspace,
  .phrase-grid,
  .home-lesson-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .dashboard,
  .workspace,
  .home-scenes {
    width: calc(100% - 24px);
  }

  .hero-overlay {
    width: calc(100% - 24px);
    margin-left: 12px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .lesson-topline,
  .tabs {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    border-bottom: 0;
  }

  .tab {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    text-align: left;
  }

  .tab.active {
    border-color: var(--teal);
  }

  .typing-row {
    grid-template-columns: 1fr;
  }

  .challenge-top,
  .script-head {
    flex-direction: column;
  }

  .script-line {
    grid-template-columns: 1fr;
  }
}
