:root {
  color-scheme: light;
  --bg: #f7f7f7;
  --panel: #ffffff;
  --ink: #4b4b4b;
  --muted: #777777;
  --line: #e5e5e5;
  --accent: #58cc02;
  --accent-strong: #46a302;
  --accent-soft: #e5f8d2;
  --duo-green: #58cc02;
  --duo-green-dark: #46a302;
  --duo-blue: #1cb0f6;
  --duo-yellow: #ffc800;
  --duo-red: #ff4b4b;
  --gold: #ffc800;
  --danger: #ff4b4b;
  --shadow: 0 12px 0 rgba(229, 229, 229, 0.9), 0 18px 45px rgba(75, 75, 75, 0.08);
  font-family: "Noto Sans Tibetan", Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

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

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: flex-start;
  margin: 0 auto 12px;
  max-width: 1180px;
}

.eyebrow {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}

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

h1 {
  font-size: 32px;
  letter-spacing: 0;
  line-height: 1.1;
  margin-bottom: 0;
}

.bo-heading {
  font-size: 36px;
  line-height: 1.35;
}

.bo-ui {
  font-size: 18px;
  line-height: 1.45;
}

.bo-body {
  font-size: 20px;
  line-height: 1.65;
}

.bo-note {
  font-size: 17px;
  line-height: 1.5;
}

.streak {
  align-items: center;
  background: var(--ink);
  border-radius: 8px;
  color: white;
  display: grid;
  height: 50px;
  justify-items: center;
  min-width: 64px;
  padding: 6px 10px;
}

.streak span {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.streak small {
  color: #dce3de;
  font-size: 13px;
}

.layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 310px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1180px;
}

.mobile-course-nav {
  display: none;
}

.mobile-next-button {
  display: none;
}

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

.lesson-rail {
  align-self: start;
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 16px;
  position: sticky;
  top: 18px;
}

.rail-head,
.section-head,
.today-focus,
.task-row {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.rail-head h2 {
  font-size: 18px;
  margin-bottom: 0;
}

.lesson-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.welcome-card {
  background: #eef3ec;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 14px;
}

.welcome-card h2 {
  margin-bottom: 8px;
}

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

.lesson-item {
  align-items: center;
  background: #f8faf7;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 2px;
  grid-template-columns: 34px 1fr 22px;
  min-height: 58px;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.lesson-item:hover,
.lesson-item.active {
  background: var(--accent-soft);
  border-color: #a9d2ca;
}

.lesson-index {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.lesson-name {
  display: block;
  font-weight: 750;
}

.lesson-topic {
  color: var(--muted);
  font-size: 12px;
}

.done-mark {
  color: var(--accent);
  font-weight: 900;
}

.lesson-panel {
  min-height: 780px;
  padding: 22px;
}

.lesson-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.lesson-meta-main {
  display: flex;
  gap: 12px;
}

.today-focus {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding-bottom: 18px;
}

.focus-label {
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 4px;
}

.today-focus h2 {
  font-size: 34px;
  letter-spacing: 0;
  line-height: 1.35;
  margin-bottom: 8px;
}

.today-focus p {
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 0;
  max-width: 720px;
}

.focus-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 118px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  cursor: pointer;
  min-height: 48px;
}

.primary-button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: white;
  font-weight: 750;
  padding: 0 16px;
  white-space: nowrap;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: var(--ink);
  border: 1px solid var(--ink);
  color: white;
  font-weight: 700;
  padding: 0 14px;
}

.secondary-button.recording {
  background: var(--danger);
  border-color: var(--danger);
}

.ghost-button,
.icon-button {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
  padding: 0 13px;
}

.ghost-button:disabled {
  color: #a6aca8;
  cursor: not-allowed;
}

.icon-button {
  align-items: center;
  display: inline-flex;
  font-size: 15px;
  justify-content: center;
  padding: 0;
  width: 42px;
}

.scene-strip {
  align-items: center;
  background: #eef3ec;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  margin: 18px 0;
  padding: 12px 14px;
}

.comfort-strip {
  background: #fff8e8;
  border: 1px solid #e9cf95;
  border-radius: 8px;
  margin: 0 0 18px;
  padding: 14px;
}

.comfort-strip span {
  color: #8a621a;
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
}

.comfort-strip p {
  color: #5f4c25;
  margin: 0;
}

.comfort-strip.compact {
  margin-top: 14px;
}

.helper-note {
  color: var(--muted);
  margin: 10px 0 0;
}

.visual-card-section {
  border-bottom: 1px solid var(--line);
  padding: 0 0 16px;
}

.visual-card {
  background: #f9fbf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  grid-template-columns: 320px minmax(0, 1fr);
  margin-top: 12px;
  overflow: hidden;
  padding: 14px;
}

.visual-scene {
  aspect-ratio: 16 / 9;
  background: linear-gradient(180deg, #dff5ff 0%, #f1ffdf 63%, #d8f7b7 100%);
  border: 2px solid #b6e8ff;
  border-radius: 14px;
  min-height: 180px;
  overflow: hidden;
  position: relative;
}

.figure {
  border-radius: 999px 999px 18px 18px;
  bottom: 18px;
  box-shadow: 0 8px 0 rgba(20, 60, 45, 0.12);
  position: absolute;
}

.figure::before {
  background: #6f4f37;
  border-radius: 50%;
  content: "";
  height: 32px;
  left: 50%;
  position: absolute;
  top: -28px;
  transform: translateX(-50%);
  width: 32px;
}

.figure span {
  align-items: center;
  background: white;
  border-radius: 50%;
  color: var(--accent);
  display: flex;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  left: 50%;
  position: absolute;
  top: 20px;
  transform: translateX(-50%);
  width: 28px;
}

.learner {
  background: var(--duo-blue);
  height: 70px;
  left: 46px;
  width: 54px;
}

.speaker {
  background: var(--duo-green);
  height: 76px;
  right: 46px;
  width: 58px;
}

.speech {
  background: white;
  border: 2px solid #d8edf6;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(28, 38, 32, 0.12);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 800;
  padding: 7px 10px;
  position: absolute;
}

.person-a {
  right: 20px;
  top: 24px;
}

.person-b {
  left: 22px;
  top: 26px;
}

.scene-sun {
  background: var(--duo-yellow);
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(255, 200, 0, 0.2);
  height: 34px;
  left: 50%;
  position: absolute;
  top: 18px;
  width: 34px;
}

.scene-cloud {
  background: white;
  border-radius: 999px;
  height: 18px;
  opacity: 0.95;
  position: absolute;
  width: 54px;
}

.scene-cloud::before,
.scene-cloud::after {
  background: white;
  border-radius: 50%;
  content: "";
  position: absolute;
}

.scene-cloud::before {
  height: 24px;
  left: 9px;
  top: -10px;
  width: 24px;
}

.scene-cloud::after {
  height: 20px;
  right: 9px;
  top: -7px;
  width: 20px;
}

.cloud-one {
  left: 18px;
  top: 18px;
}

.cloud-two {
  right: 92px;
  top: 58px;
}

.scene-hill {
  border-radius: 50% 50% 0 0;
  bottom: -52px;
  position: absolute;
}

.hill-one {
  background: #89e219;
  height: 110px;
  left: -30px;
  width: 230px;
}

.hill-two {
  background: #b8f45a;
  height: 88px;
  right: -36px;
  width: 250px;
}

.phone-prop {
  align-items: center;
  background: #17211a;
  border: 4px solid #2c3932;
  border-radius: 14px;
  bottom: 22px;
  color: white;
  display: grid;
  height: 92px;
  justify-items: center;
  left: 50%;
  padding: 8px;
  position: absolute;
  transform: translateX(-50%) rotate(-3deg);
  width: 62px;
}

.phone-prop span {
  color: var(--duo-yellow);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.phone-prop small {
  color: #dff5ff;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 11px;
  font-weight: 800;
}

.visual-copy {
  align-self: center;
}

.visual-copy strong {
  color: var(--ink);
  display: block;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 40px;
  letter-spacing: 0;
  line-height: 1.1;
  margin-bottom: 8px;
}

.visual-pinyin {
  color: var(--accent);
  display: block;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 10px;
}

.visual-tibetan {
  color: var(--ink);
  font-weight: 800;
  margin-bottom: 10px;
}

.visual-cue {
  color: var(--muted);
  margin-bottom: 0;
}

.detail-panel {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
}

.detail-panel summary {
  background: #eef3ec;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  padding: 12px 14px;
}

.detail-panel summary::-webkit-details-marker {
  display: none;
}

.scene-strip span {
  background: var(--gold);
  border-radius: 6px;
  color: white;
  font-size: 17px;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}

.scene-strip p {
  line-height: 1.65;
  margin: 0;
}

.band,
.practice-band,
.task-row {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.section-head h3,
.task-row h3 {
  font-size: 22px;
  margin-bottom: 0;
}

.section-head span {
  color: var(--muted);
  font-size: 16px;
}

.phrase-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.phrase {
  align-items: center;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.phrase strong {
  display: block;
  font-size: 24px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.phrase .pinyin {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.phrase .tibetan {
  color: var(--muted);
  font-size: 21px;
  line-height: 1.65;
  margin: 7px 0 0;
}

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

.word-tile {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 118px;
  padding: 12px;
}

.word-tile strong {
  display: block;
  font-size: 25px;
  line-height: 1.25;
  margin-bottom: 8px;
}

.word-tile p {
  color: var(--muted);
  font-size: 19px;
  line-height: 1.6;
  margin-bottom: 0;
}

.word-tile small {
  color: var(--accent);
  display: block;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  margin-top: 8px;
}

.practice-band {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 260px;
}

.quiz-prompt {
  font-size: 21px;
  font-weight: 750;
  line-height: 1.6;
  margin: 16px 0 12px;
}

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

.quiz-option {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  min-height: 48px;
  padding: 10px 12px;
  text-align: left;
}

.quiz-option.correct {
  background: #e3f3df;
  border-color: #8cc27c;
  box-shadow: inset 0 0 0 2px #79b96c;
}

.quiz-option.wrong {
  background: #fae8e5;
  border-color: #d58a80;
}

.phone-sim {
  background: #1b211f;
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 12px;
}

.phone-bar {
  background: #101513;
  border-radius: 999px;
  height: 18px;
  margin: 0 auto 12px;
  width: 82px;
}

.phone-screen {
  background: #f8faf7;
  border-radius: 16px;
  min-height: 265px;
  padding: 16px;
}

.phone-screen p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  min-height: 72px;
}

.phone-buttons {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.phone-choice {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  min-height: 44px;
}

.phone-choice.target {
  border-color: var(--accent);
}

.phone-choice.selected {
  background: var(--accent-soft);
}

.task-row {
  align-items: flex-start;
}

.safety-card {
  background: #fef1ef;
  border: 1px solid #e7b2ab;
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 14px;
}

.safety-card h3 {
  color: var(--danger);
  margin-bottom: 8px;
}

.safety-card ul {
  color: #6c342d;
  margin: 0;
  padding-left: 26px;
}

.safety-card li + li {
  margin-top: 4px;
}

.task-row p {
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 0;
}

.recorder {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 240px;
}

.toast {
  background: var(--accent);
  border-radius: 8px;
  bottom: 20px;
  box-shadow: var(--shadow);
  color: white;
  font-size: 21px;
  font-weight: 800;
  left: 50%;
  line-height: 1.45;
  max-width: min(520px, calc(100vw - 28px));
  opacity: 0;
  padding: 14px 18px;
  pointer-events: none;
  position: fixed;
  text-align: center;
  transform: translate(-50%, 18px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.gentle {
  background: var(--gold);
}

@media (max-width: 920px) {
  body {
    background: var(--bg);
  }

  .app-shell {
    padding: 0 12px 88px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .lesson-rail {
    display: none;
  }

  .mobile-course-nav {
    display: block;
    order: 2;
  }

  .lesson-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    order: 1;
  }

  .mobile-next-button {
    align-items: center;
    background: var(--duo-green);
    border: 0;
    border-radius: 10px;
    bottom: 14px;
    box-shadow: 0 8px 0 var(--duo-green-dark);
    color: white;
    cursor: pointer;
    display: flex;
    font-weight: 800;
    justify-content: center;
    left: 14px;
    min-height: 58px;
    padding: 8px 16px;
    position: fixed;
    right: 14px;
    z-index: 18;
  }

  .mobile-next-button small {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    font-weight: 800;
    margin-left: 8px;
    opacity: 0.92;
  }

  .practice-band {
    grid-template-columns: 1fr;
  }

  .visual-card {
    grid-template-columns: 1fr;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-top: 8px;
    padding: 12px;
  }

  .visual-scene {
    justify-self: center;
    max-width: 520px;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .topbar {
    display: none;
  }

  h1 {
    font-size: 25px;
  }

  .bo-heading {
    font-size: 28px;
  }

  .bo-body {
    font-size: 19px;
  }

  .visual-copy strong {
    font-size: 34px;
  }

  .focus-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }

  .visual-card-section .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .visual-card {
    gap: 12px;
    padding: 12px;
  }

  .visual-scene {
    min-height: 148px;
  }

  .streak {
    height: 48px;
    min-width: 60px;
  }

  .lesson-panel {
    min-height: auto;
    padding: 12px 0 0;
  }

  .lesson-meta {
    border-bottom: 1px solid var(--line);
    color: var(--duo-blue);
    margin: 0 0 10px;
    padding: 0 0 8px;
  }

  .lesson-meta-main {
    color: var(--duo-blue);
    font-size: 15px;
  }

  .streak {
    background: var(--duo-blue);
    border: 0;
    border-radius: 8px;
    height: 42px;
    min-width: 58px;
  }

  .streak span {
    font-size: 20px;
  }

  .streak small {
    font-size: 12px;
  }

  .today-focus,
  .task-row {
    align-items: stretch;
    flex-direction: column;
  }

  .today-focus {
    border-bottom: 1px solid var(--line);
    padding: 12px 0 16px;
  }

  .today-focus > div:first-child {
    display: none;
  }

  .focus-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .focus-actions #completeButton {
    display: none;
  }

  #quickPlayButton {
    background: white;
    border: 2px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 0;
    height: 76px;
    justify-self: center;
    min-height: 76px;
    padding: 0;
    position: relative;
    width: 76px;
  }

  #quickPlayButton::before {
    border-bottom: 20px solid transparent;
    border-left: 31px solid var(--ink);
    border-top: 20px solid transparent;
    content: "";
    left: 28px;
    position: absolute;
    top: 18px;
  }

  .visual-card-section {
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .visual-card-section .section-head {
    display: none;
  }

  .visual-copy {
    order: -1;
    text-align: center;
  }

  .visual-copy strong {
    color: var(--duo-green);
    font-size: 40px;
    margin-bottom: 8px;
  }

  .visual-pinyin {
    color: var(--duo-blue);
    font-size: 20px;
  }

  .visual-tibetan {
    color: var(--ink);
    font-size: 38px;
    font-weight: 850;
    line-height: 1.35;
    margin-top: 12px;
  }

  .visual-cue {
    color: var(--muted);
    display: block;
    font-size: 34px;
    font-weight: 750;
    line-height: 1.45;
    margin-top: 14px;
  }

  .visual-scene {
    border-color: #b6e8ff;
    border-radius: 12px;
    margin: 10px auto 0;
    max-width: 86vw;
    min-height: 142px;
  }

  .comfort-strip,
  .detail-panel {
    display: none;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .lesson-list,
  .word-grid {
    grid-template-columns: 1fr;
  }

  .phrase {
    grid-template-columns: 1fr;
  }

  .recorder {
    justify-content: stretch;
    min-width: 0;
  }

  .scene-strip {
    align-items: flex-start;
    flex-direction: column;
  }
}
