:root {
  color-scheme: light;
  --brand: #3157d5;
  --brand-dark: #2345b6;
  --brand-soft: #e8edff;
  --ink: #172033;
  --muted: #657087;
  --line: #e4e8f1;
  --surface: #ffffff;
  --canvas: #f4f6fb;
  --green: #15936c;
  --green-soft: #e4f7ef;
  --yellow-soft: #fff6d9;
  --danger: #c53f55;
  --shadow: 0 12px 35px rgba(40, 56, 96, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }

html {
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--canvas);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(68px + env(safe-area-inset-top));
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  background: rgba(244, 246, 251, .9);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0;
  color: inherit;
  text-align: left;
  border: 0;
  background: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  border-radius: 14px;
  background: linear-gradient(145deg, #708cff, var(--brand));
  box-shadow: 0 8px 18px rgba(49, 87, 213, .25);
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .04em; }

.install-button {
  padding: 9px 13px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(49, 87, 213, .15);
  border-radius: 999px;
  background: var(--brand-soft);
}

#app {
  min-height: calc(100vh - 148px);
  padding: 8px 16px calc(102px + env(safe-area-inset-bottom));
  outline: none;
}

.page { animation: page-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(29px, 8vw, 40px); line-height: 1.12; letter-spacing: -.035em; }
h2 { margin-bottom: 10px; font-size: 22px; letter-spacing: -.015em; }
h3 { margin-bottom: 7px; font-size: 17px; }
p { line-height: 1.62; }
.muted { color: var(--muted); }
.compact { margin-bottom: 0; }

.hero {
  position: relative;
  overflow: hidden;
  min-height: 242px;
  padding: 28px 24px;
  color: #fff;
  border-radius: 28px;
  background: linear-gradient(145deg, #718cff 0%, #3157d5 52%, #213ea5 100%);
  box-shadow: 0 20px 42px rgba(45, 76, 181, .22);
}

.hero::after {
  position: absolute;
  right: -55px;
  bottom: -72px;
  width: 210px;
  height: 210px;
  content: "";
  border: 36px solid rgba(255,255,255,.1);
  border-radius: 50%;
}

.hero .eyebrow { color: rgba(255,255,255,.72); }
.hero h1 { max-width: 420px; }
.hero p { max-width: 430px; color: rgba(255,255,255,.78); }

.hero-actions, .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-button, .secondary-button, .ghost-button, .danger-button {
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 750;
  border-radius: 14px;
  cursor: pointer;
}

.primary-button { color: #fff; border: 0; background: var(--brand); box-shadow: 0 7px 16px rgba(49,87,213,.2); }
.hero .primary-button { color: var(--brand-dark); background: #fff; box-shadow: none; }
.secondary-button { color: var(--brand); border: 1px solid #cfd8fb; background: var(--brand-soft); }
.ghost-button { color: var(--ink); border: 1px solid var(--line); background: #fff; }
.danger-button { color: var(--danger); border: 1px solid #ffd5dc; background: #fff0f3; }
.full { width: 100%; }
button:disabled { cursor: default; opacity: .48; }

.section { margin-top: 27px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2, .section-heading p { margin-bottom: 0; }
.text-button { padding: 4px; color: var(--brand); font-weight: 700; border: 0; background: transparent; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stat {
  padding: 16px 12px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  background: rgba(255,255,255,.1);
}

.stat strong, .stat small { display: block; }
.stat strong { font-size: 22px; }
.stat small { margin-top: 3px; color: rgba(255,255,255,.7); font-size: 11px; }

.card {
  padding: 18px;
  border: 1px solid rgba(228, 232, 241, .9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 11px; }
.card.soft-blue { border-color: #dce3ff; background: #eef2ff; box-shadow: none; }
.card.soft-green { border-color: #d4efe5; background: var(--green-soft); box-shadow: none; }
.card.soft-yellow { border-color: #f3e6b7; background: var(--yellow-soft); box-shadow: none; }

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,.22);
}
.progress-track.dark { background: #e8ebf3; }
.progress-fill { height: 100%; border-radius: inherit; background: #fff; transition: width .3s ease; }
.progress-track.dark .progress-fill { background: linear-gradient(90deg, var(--brand), #728bff); }

.task-list { display: grid; gap: 10px; }
.task {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  width: 100%;
  padding: 15px;
  color: inherit;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.task.is-done { border-color: #cde9df; background: #f0faf6; }
.task-check { display: grid; width: 26px; height: 26px; place-items: center; color: #fff; font-weight: 900; border: 2px solid #cfd5e2; border-radius: 50%; }
.task.is-done .task-check { border-color: var(--green); background: var(--green); }
.task strong, .task small { display: block; }
.task small { margin-top: 4px; color: var(--muted); line-height: 1.45; }
.task em { display: block; margin-top: 7px; color: #42506d; font-size: 12px; font-style: normal; line-height: 1.45; }

.vocab-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.vocab-stats div { padding: 14px 8px; text-align: center; border: 1px solid #dce3ff; border-radius: 16px; background: var(--brand-soft); }
.vocab-stats strong, .vocab-stats small { display: block; }
.vocab-stats strong { color: var(--brand); font-size: 20px; }
.vocab-stats small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.load-more { margin-top: 14px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.quick-card {
  min-height: 128px;
  padding: 18px;
  color: inherit;
  text-align: left;
  border: 0;
  border-radius: 22px;
}
.quick-card span { display: grid; width: 38px; height: 38px; margin-bottom: 16px; place-items: center; color: #fff; font-weight: 800; border-radius: 13px; background: var(--brand); }
.quick-card strong, .quick-card small { display: block; }
.quick-card small { margin-top: 5px; color: var(--muted); line-height: 1.4; }

.page-header { padding: 10px 3px 8px; }
.page-header h1 { font-size: 32px; }
.page-header p { margin-bottom: 10px; color: var(--muted); }

.search-bar {
  position: relative;
  margin-bottom: 13px;
}
.search-bar input, .text-input, .chat-input, textarea {
  width: 100%;
  padding: 13px 15px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  background: #fff;
}
.search-bar input:focus, .text-input:focus, .chat-input:focus, textarea:focus { border-color: #9aacef; box-shadow: 0 0 0 4px rgba(49,87,213,.08); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 8px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.chip.is-active { color: #fff; border-color: var(--brand); background: var(--brand); }

.word-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.word-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.word-title strong { font-size: 21px; }
.phonetic { color: var(--brand); font-size: 14px; }
.tag { display: inline-flex; padding: 4px 8px; color: var(--brand); font-size: 11px; font-weight: 750; border-radius: 99px; background: var(--brand-soft); }
.favorite { width: 42px; height: 42px; color: #9ba4b7; font-size: 22px; border: 0; border-radius: 14px; background: #f4f6fa; }
.favorite.is-active { color: #ef9d20; background: #fff4db; }
.example { margin: 14px 0 5px; font-weight: 650; line-height: 1.55; }
.translation { margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.collocations { color: var(--muted); font-size: 13px; line-height: 1.55; }

.mode-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; padding: 5px; border-radius: 16px; background: #e9edf5; }
.mode-tab { min-height: 38px; padding: 6px; color: var(--muted); font-size: 13px; border: 0; border-radius: 12px; background: transparent; }
.mode-tab.is-active { color: var(--ink); font-weight: 750; background: #fff; box-shadow: 0 3px 9px rgba(32,44,76,.09); }

.lesson-card { overflow: hidden; padding: 0; }
.lesson-visual {
  min-height: 160px;
  display: grid;
  align-content: end;
  padding: 20px;
  color: #fff;
  background: radial-gradient(circle at 78% 15%, rgba(120,143,255,.9), transparent 30%), linear-gradient(145deg, #111a33, #243d8f);
}
.lesson-visual small { color: rgba(255,255,255,.65); }
.lesson-body { padding: 20px; }
.sentence-number { color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.english-line { margin: 12px 0 8px; font-size: 23px; font-weight: 780; line-height: 1.4; }
.chinese-line { margin-bottom: 16px; color: var(--muted); }
.masked-line { letter-spacing: .04em; }
.player-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.control { min-height: 52px; padding: 6px; color: var(--ink); border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.control.primary { color: #fff; border-color: var(--brand); background: var(--brand); }
.control small { display: block; margin-top: 2px; color: inherit; font-size: 10px; opacity: .7; }
.result-box { margin-top: 12px; padding: 13px; white-space: pre-line; border-radius: 14px; background: #f3f5fa; }

.record-orb {
  display: grid;
  width: 112px;
  height: 112px;
  margin: 24px auto;
  place-items: center;
  color: #fff;
  font-size: 36px;
  border: 10px solid #e3e9ff;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 12px 28px rgba(49,87,213,.23);
}
.record-orb.is-recording { border-color: #ffdce2; background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.045); } }
.timer { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.target-sentence { margin: 16px 0; text-align: center; font-size: 23px; font-weight: 780; line-height: 1.45; }
.tip-list { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.8; }

.chat-log { display: grid; gap: 10px; margin: 15px 0; }
.bubble { max-width: 86%; padding: 12px 14px; line-height: 1.5; border-radius: 17px 17px 17px 5px; background: #fff; box-shadow: 0 5px 16px rgba(41,54,88,.07); }
.bubble.user { justify-self: end; color: #fff; border-radius: 17px 17px 5px 17px; background: var(--brand); }
.correction { padding: 14px; color: #16664f; border: 1px solid #cceadd; border-radius: 16px; background: var(--green-soft); }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.chat-compose button { padding-inline: 17px; }

.day-selector { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; margin-bottom: 13px; }
.day-selector button { height: 44px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.day-display { text-align: center; }
.day-display strong, .day-display small { display: block; }
.day-display strong { font-size: 20px; }
.day-display small { margin-top: 3px; color: var(--muted); }
.phase-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 16px 0; }
.phase { padding: 9px 5px; color: var(--muted); font-size: 11px; text-align: center; border-radius: 10px; background: #edf0f6; }
.phase.is-active { color: #fff; font-weight: 750; background: var(--brand); }

.target-card { color: #fff; border: 0; background: linear-gradient(135deg, #2948b6, #5877e8); }
.target-card .eyebrow, .target-card p { color: rgba(255,255,255,.82); }
.target-card h2 { margin: 5px 0 8px; color: #fff; }
.plan-phase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.plan-phase-card { display: flex; min-height: 112px; padding: 12px 9px; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.plan-phase-card strong { color: var(--brand); font-size: 12px; }
.plan-phase-card span { font-size: 14px; font-weight: 800; }
.plan-phase-card small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.plan-phase-card.is-active { border-color: #9baded; background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(49,87,213,.08); }
.day-jump { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 5px 0 16px; color: var(--muted); font-size: 13px; }
.day-jump input { width: 58px; height: 38px; padding: 6px; text-align: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.day-jump button { min-height: 38px; padding: 7px 12px; }
.schedule-grid { display: grid; gap: 10px; }
.plan-details { margin-top: 10px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.plan-details > summary { padding: 16px 18px; color: var(--text); font-weight: 800; cursor: pointer; }
.plan-details[open] > summary { color: var(--brand); border-bottom: 1px solid var(--line); }
.plan-detail-body { padding: 17px 18px; }
.plan-detail-body h4 { margin: 16px 0 6px; color: var(--brand); }
.plan-detail-body h4:first-of-type { margin-top: 13px; }
.plan-detail-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.answer-details { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #f4f7ff; }
.answer-details summary { color: var(--brand); font-size: 13px; font-weight: 750; cursor: pointer; }
.answer-details p { margin-top: 9px; color: var(--text); }

.import-zone { padding: 24px 18px; text-align: center; border: 2px dashed #cdd5e5; border-radius: 20px; background: #f9faff; }
.import-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.import-zone label { display: inline-block; margin-top: 8px; }
.local-video { display: none; width: 100%; margin-top: 15px; border-radius: 16px; background: #10131b; }
.local-video.has-source { display: block; }

.video-stage {
  overflow: hidden;
  border-radius: 24px;
  background: #10162a;
  box-shadow: 0 18px 42px rgba(24, 33, 62, .2);
}

.featured-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050812;
  object-fit: contain;
}

.video-now { padding: 18px 19px 20px; color: #fff; }
.video-now h2 { margin: 10px 0 6px; font-size: 20px; line-height: 1.35; }
.video-now p { margin: 0; color: #aeb9d4; font-size: 13px; }
.video-now .tag { color: #dfe5ff; background: rgba(111, 140, 255, .25); }

.video-list { display: grid; gap: 10px; }
.video-item {
  display: grid;
  grid-template-columns: 86px 1fr 18px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  color: inherit;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.video-item.is-active { border-color: #aebcf1; background: #f0f3ff; }
.video-thumb {
  display: grid;
  aspect-ratio: 16 / 10;
  place-items: center;
  color: #fff;
  border-radius: 12px;
  background: radial-gradient(circle at 75% 20%, #7f98ff, transparent 28%), linear-gradient(145deg, #182343, #3157d5);
}
.video-thumb span { display: grid; width: 30px; height: 30px; place-items: center; padding-left: 2px; border-radius: 50%; background: rgba(255,255,255,.2); }
.video-copy { min-width: 0; }
.video-copy strong, .video-copy small { display: block; }
.video-copy strong { overflow: hidden; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.video-copy small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.video-chevron { color: #9ba5ba; font-size: 25px; }

.install-sheet {
  width: min(calc(100% - 24px), 520px);
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15,23,42,.28);
}
.install-sheet::backdrop { background: rgba(10, 18, 38, .42); backdrop-filter: blur(4px); }
.install-sheet form { padding: 10px 22px 24px; }
.sheet-handle { width: 42px; height: 5px; margin: 2px auto 20px; border-radius: 99px; background: #dfe3eb; }
.sheet-icon { display: grid; width: 54px; height: 54px; margin-bottom: 14px; place-items: center; color: #fff; font-size: 25px; border-radius: 17px; background: var(--brand); }
.install-steps { display: grid; gap: 12px; margin: 18px 0; padding: 0; list-style: none; }
.install-steps li { display: flex; gap: 11px; align-items: center; }
.install-steps span { display: grid; flex: 0 0 30px; height: 30px; place-items: center; color: var(--brand); font-weight: 800; border-radius: 50%; background: var(--brand-soft); }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  max-width: calc(100% - 40px);
  padding: 11px 16px;
  color: #fff;
  font-size: 13px;
  border-radius: 999px;
  background: rgba(22,30,49,.94);
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: min(100%, 760px);
  min-height: calc(72px + env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(220,225,236,.9);
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
}

.nav-item {
  display: grid;
  gap: 2px;
  place-content: center;
  min-width: 0;
  color: #8b94a8;
  border: 0;
  border-radius: 15px;
  background: transparent;
}
.nav-item span { min-height: 24px; font-size: 18px; font-weight: 750; line-height: 24px; }
.nav-item small { font-size: 10px; }
.nav-item.is-active { color: var(--brand); background: #f0f3ff; }

@media (min-width: 680px) {
  #app { padding-inline: 26px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .topbar { padding-inline: 28px; }
}

@media (display-mode: standalone) {
  .install-button { display: none; }
}

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