:root {
  --bg: #f3f5f1;
  --bg-soft: #e9eee8;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --surface-3: #eef3ef;
  --ink: #15211d;
  --ink-soft: #43524c;
  --muted: #7a8882;
  --line: #dfe6e0;
  --line-strong: #cad6ce;
  --primary: #155f4c;
  --primary-2: #1f7a61;
  --primary-soft: #dcefe8;
  --lime: #c8ee86;
  --blue: #5a84d7;
  --blue-soft: #e7eefc;
  --amber: #e0a043;
  --amber-soft: #fff0d4;
  --red: #c85959;
  --red-soft: #fce8e6;
  --shadow-sm: 0 4px 14px rgba(28, 55, 46, .06);
  --shadow-md: 0 16px 45px rgba(28, 55, 46, .10);
  --shadow-lg: 0 28px 70px rgba(23, 54, 44, .16);
  --sidebar-width: 264px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-en: "Avenir Next", "Segoe UI", Arial, sans-serif;
}

body.dark {
  --bg: #111a17;
  --bg-soft: #17231f;
  --surface: #1a2722;
  --surface-2: #1f2f29;
  --surface-3: #263830;
  --ink: #eef6f1;
  --ink-soft: #b5c4bd;
  --muted: #879a91;
  --line: #2f433a;
  --line-strong: #3f574c;
  --primary: #62c6a2;
  --primary-2: #7ed6b6;
  --primary-soft: #214b3d;
  --lime: #b5df74;
  --blue: #89a9e8;
  --blue-soft: #24354f;
  --amber: #efb45c;
  --amber-soft: #4b3820;
  --red: #ed8d84;
  --red-soft: #4a2926;
  --shadow-sm: 0 5px 18px rgba(0, 0, 0, .18);
  --shadow-md: 0 16px 45px rgba(0, 0, 0, .24);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(25, 123, 96, .25);
  outline-offset: 2px;
}

::selection { color: #fff; background: var(--primary); }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

.ambient-one {
  top: -180px;
  right: 4vw;
  width: 410px;
  height: 410px;
  background: radial-gradient(circle, rgba(187, 229, 199, .45), transparent 68%);
}

.ambient-two {
  bottom: -220px;
  left: 12vw;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(208, 224, 244, .35), transparent 68%);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 20px 22px;
  overflow-y: auto;
  background: rgba(255, 255, 255, .88);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px);
}

body.dark .sidebar { background: rgba(18, 29, 25, .92); }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 14px;
  color: #f3fff9;
  background: linear-gradient(145deg, #1b765e, #0e4b3d);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 10px 25px rgba(21, 95, 76, .25);
  font-family: var(--font-en);
  font-size: 22px;
  font-weight: 800;
}

.brand strong { display: block; font-size: 15px; letter-spacing: -.2px; }
.brand span {
  display: block;
  margin-top: -1px;
  color: var(--muted);
  font-family: var(--font-en);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.main-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  color: var(--ink-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.nav-item:hover { color: var(--primary); background: var(--surface-3); transform: translateX(2px); }
.nav-item.active { color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.nav-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 800;
}

.nav-item.active .nav-icon { color: #f1fff9; background: var(--primary); }
.nav-badge {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 22px;
  padding: 0 7px;
  border-radius: 20px;
  color: var(--primary);
  background: rgba(255,255,255,.68);
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 700;
}

body.dark .nav-badge { background: rgba(0,0,0,.15); }
.sidebar-card {
  margin-top: auto;
  padding: 17px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  color: #eafff7;
  background: linear-gradient(155deg, #196650, #114b3d);
  box-shadow: 0 12px 30px rgba(21, 95, 76, .18);
}

.sidebar-card-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; font-size: 12px; }
.sidebar-card-top strong { font-size: 12px; }
.sidebar-card .progress-track { height: 6px; background: rgba(255,255,255,.2); }
.sidebar-card .progress-track span { background: var(--lime); }
.sidebar-card .text-button { margin-top: 11px; padding: 0; color: #dfffee; font-size: 12px; }
.sidebar-footer { margin-top: 18px; padding: 0 4px; }
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.theme-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: var(--primary);
  background: var(--primary-soft);
}

.sidebar-footer p { margin: 12px 0 0; color: var(--muted); font-size: 10px; letter-spacing: .3px; }

.main-content { min-width: 0; padding: 0 42px 60px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 94px;
  padding: 14px 0;
  background: linear-gradient(to bottom, var(--bg) 72%, transparent);
}

.page-heading .eyebrow { display: block; margin-bottom: 1px; }
.page-heading h1 { margin: 0; font-size: 23px; line-height: 1.3; letter-spacing: -.6px; }
.eyebrow {
  color: rgba(226, 255, 243, .68);
  font-family: var(--font-en);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.7px;
}

.eyebrow.dark { color: var(--primary); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.date-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255,255,255,.55);
  font-size: 12px;
  backdrop-filter: blur(12px);
}

body.dark .date-chip { background: rgba(26,39,34,.62); }
.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4cc38a;
  box-shadow: 0 0 0 4px rgba(76,195,138,.13);
  animation: softPulse 2s infinite;
}

@keyframes softPulse { 50% { box-shadow: 0 0 0 7px rgba(76,195,138,0); } }
.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid var(--surface);
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #d09248, #b36b38);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.mobile-menu { display: none; }
.view {
  display: none;
  max-width: 1420px;
  margin: 0 auto;
  animation: viewIn .38s ease both;
}

.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr);
  gap: 20px;
}

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: center;
  min-height: 344px;
  padding: 42px 46px;
  overflow: hidden;
  border-radius: 30px;
  color: #f4fff9;
  background:
    radial-gradient(circle at 82% 15%, rgba(183, 232, 191, .22), transparent 29%),
    linear-gradient(132deg, #0f4d3e 0%, #17634f 55%, #1e755e 100%);
  box-shadow: 0 26px 58px rgba(18, 80, 64, .2);
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(90deg, transparent, #000);
  pointer-events: none;
}

.hero-copy, .countdown-wrap { position: relative; z-index: 2; }
.hero-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: #d9f6e9;
  background: rgba(255,255,255,.08);
  font-size: 11px;
  font-weight: 700;
}

.hero-copy h2 { margin: 18px 0 12px; font-size: clamp(33px, 4vw, 52px); line-height: 1.1; letter-spacing: -2px; }
.hero-copy h2 em { color: var(--lime); font-style: normal; }
.hero-copy p { max-width: 540px; margin: 0; color: rgba(235,255,247,.72); font-size: 14px; }
.hero-actions { display: flex; gap: 10px; margin-top: 28px; }

.primary-button, .ghost-button, .wide-button, .icon-button, .memory-button {
  border: 0;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 19px;
  border-radius: 13px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(21,95,76,.18);
  font-size: 13px;
  font-weight: 800;
}

.hero-card .primary-button { color: #123e31; background: var(--lime); box-shadow: 0 10px 24px rgba(0,0,0,.16); }
.primary-button:hover, .wide-button:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(21,95,76,.24); }
.primary-button:disabled, .ghost-button:disabled, .icon-button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.primary-button.compact-button { min-height: 40px; padding: 0 17px; }
.ghost-button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 13px;
  font-weight: 750;
}

.ghost-button.light-border { border-color: rgba(255,255,255,.25); color: #edfff8; background: rgba(255,255,255,.07); }
.ghost-button:hover { border-color: var(--primary); color: var(--primary); }
.countdown-wrap { text-align: center; }
.countdown-ring { position: relative; width: 180px; height: 180px; margin: auto; }
.countdown-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown-ring circle { fill: none; stroke-width: 8; }
.ring-bg { stroke: rgba(255,255,255,.12); }
.ring-progress { stroke: var(--lime); stroke-linecap: round; stroke-dasharray: 402; stroke-dashoffset: 260; transition: stroke-dashoffset .6s ease; }
.countdown-value { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.countdown-value strong { font-family: var(--font-en); font-size: 43px; line-height: 1; letter-spacing: -2px; }
.countdown-value span { margin-top: 5px; color: rgba(235,255,247,.68); font-size: 11px; }
.countdown-wrap > p { margin: 10px 0 0; color: rgba(235,255,247,.62); font-size: 10px; }
.hero-orbit { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; pointer-events: none; }
.orbit-one { right: -80px; bottom: -150px; width: 370px; height: 370px; }
.orbit-two { right: 15px; bottom: -55px; width: 210px; height: 210px; }

.today-card {
  display: flex;
  flex-direction: column;
  min-height: 344px;
  padding: 27px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-heading.compact { align-items: center; }
.card-heading h3, .section-title { margin: 2px 0 0; font-size: 18px; line-height: 1.35; letter-spacing: -.4px; }
.streak-pill, .counter-chip, .difficulty-chip, .word-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 29px;
  padding: 0 10px;
  border-radius: 999px;
  color: #9c671f;
  background: var(--amber-soft);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.progress-ring-row { display: flex; align-items: center; gap: 24px; margin: auto 0; }
.progress-ring {
  --progress: 0%;
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0 var(--progress), var(--surface-3) var(--progress) 100%);
  transition: background .5s ease;
}

.progress-ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); }
.progress-ring > div { position: relative; z-index: 1; display: grid; text-align: center; }
.progress-ring strong { font-family: var(--font-en); font-size: 25px; line-height: 1.2; }
.progress-ring span { color: var(--muted); font-size: 10px; }
.focus-metrics { display: grid; flex: 1; gap: 11px; }
.focus-metrics > div { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.focus-metrics > div:last-child { padding-bottom: 0; border-bottom: 0; }
.focus-metrics strong { font-family: var(--font-en); font-size: 18px; }
.focus-metrics span { color: var(--muted); font-size: 11px; }
.wide-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 47px; padding: 0 16px; border-radius: 14px; color: var(--primary); background: var(--primary-soft); font-weight: 800; }

.section-row { display: flex; align-items: flex-end; justify-content: space-between; margin: 38px 2px 16px; }
.section-row .section-title { font-size: 20px; }
.legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary-2); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr) minmax(280px, .8fr); gap: 18px; }
.chart-card, .task-card, .score-card { min-height: 290px; padding: 24px; }
.chart-summary { display: flex; align-items: flex-start; justify-content: space-between; }
.chart-summary strong { display: block; font-family: var(--font-en); font-size: 32px; line-height: 1.2; }
.chart-summary span, .muted-label { color: var(--muted); font-size: 11px; }
.trend { padding: 5px 9px; border-radius: 20px; font-family: var(--font-en); font-size: 11px; font-weight: 800; }
.trend.positive { color: var(--primary); background: var(--primary-soft); }
.bar-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; height: 188px; padding-top: 28px; }
.bar-item { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 7px; }
.bar-value { color: var(--muted); font-family: var(--font-en); font-size: 9px; opacity: 0; transition: opacity .2s ease; }
.bar-item:hover .bar-value { opacity: 1; }
.bar { width: min(100%, 28px); min-height: 5px; border-radius: 8px 8px 3px 3px; background: linear-gradient(to top, var(--primary), #5bb193); transition: height .7s cubic-bezier(.17,.67,.32,1.2), filter .2s ease; }
.bar-item:hover .bar { filter: brightness(1.08); }
.bar-item.today .bar { background: linear-gradient(to top, #d89c42, #efc277); }
.bar-item.today .bar-value { color: var(--amber); opacity: 1; }
.bar-label { color: var(--muted); font-size: 10px; }

.task-list { display: grid; gap: 10px; margin: 18px 0 13px; }
.task-row { display: grid; grid-template-columns: 29px 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: background .18s ease, transform .18s ease; }
.task-row:hover { background: var(--surface-3); transform: translateX(2px); }
.task-check { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line-strong); border-radius: 8px; color: transparent; background: var(--surface); font-size: 12px; font-weight: 900; }
.task-row.done .task-check { border-color: var(--primary); color: #fff; background: var(--primary); }
.task-row.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-title { font-size: 12px; font-weight: 700; }
.task-time { color: var(--muted); font-size: 10px; }
.text-button { border: 0; color: var(--primary); background: transparent; font-size: 12px; font-weight: 800; cursor: pointer; }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-button.light { color: #dfffee; }
.score-list { display: grid; gap: 20px; margin-top: 22px; }
.score-row > div:first-child { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.score-row span { color: var(--muted); font-size: 11px; }
.score-row strong { font-family: var(--font-en); font-size: 11px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--primary-2); transition: width .5s ease; }
.progress-track.accent-blue > span { background: var(--blue); }
.progress-track.accent-amber > span { background: var(--amber); }

.recommend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.recommend-card { position: relative; min-height: 188px; padding: 23px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.recommend-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-5px); }
.recommend-card::after { content: attr(data-index); position: absolute; right: 15px; bottom: -35px; color: var(--surface-3); font-family: var(--font-en); font-size: 108px; font-weight: 900; line-height: 1; pointer-events: none; }
.recommend-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: var(--primary); background: var(--primary-soft); font-family: var(--font-en); font-size: 17px; font-weight: 900; }
.recommend-card h3 { position: relative; z-index: 1; margin: 16px 0 6px; font-size: 16px; }
.recommend-card p { position: relative; z-index: 1; margin: 0; color: var(--muted); font-size: 11px; }
.recommend-footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin-top: 18px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.recommend-footer b { color: var(--primary); }

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin: 4px 0 26px; padding: 25px 28px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-sm); }
.page-intro h2 { margin: 3px 0 4px; font-size: 26px; letter-spacing: -1px; }
.page-intro p { max-width: 660px; margin: 0; color: var(--muted); font-size: 12px; }
.stat-strip { display: flex; align-items: center; gap: 0; }
.stat-strip > div { min-width: 102px; padding: 2px 18px; border-left: 1px solid var(--line); text-align: center; }
.stat-strip strong { display: block; font-family: var(--font-en); font-size: 22px; line-height: 1.2; }
.stat-strip span { color: var(--muted); font-size: 10px; }

.practice-layout { display: grid; gap: 20px; }
.vocab-layout { grid-template-columns: minmax(340px, .82fr) minmax(0, 1.18fr); }
.vocab-book-panel { display: grid; grid-template-columns: minmax(0, 1.25fr) auto; align-items: center; gap: 24px; margin-bottom: 20px; padding: 18px 22px; }
.vocab-book-picker { display: grid; grid-template-columns: auto minmax(220px, 300px) minmax(0, 1fr); align-items: center; gap: 16px; min-width: 0; }
.vocab-book-picker label, .vocab-plan-settings > label { display: block; margin: 2px 0 0; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.vocab-book-picker select { width: 100%; height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: var(--surface-2); font-family: var(--font-en); font-size: 11px; font-weight: 750; cursor: pointer; }
.vocab-book-picker select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.vocab-book-picker p { min-width: 0; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.vocab-plan-settings { display: flex; align-items: flex-end; gap: 8px; }
.vocab-plan-settings > label { align-self: center; white-space: nowrap; }
.word-goal-input { display: flex; align-items: center; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.word-goal-input input { width: 52px; border: 0; outline: 0; color: var(--ink); background: transparent; font-family: var(--font-en); font-size: 13px; font-weight: 850; text-align: center; }
.word-goal-input span { color: var(--muted); font-size: 10px; }
.word-view-toggle { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.word-view-toggle > span { margin-left: auto; color: var(--muted); font-family: var(--font-en); font-size: 10px; font-weight: 750; }

.flashcard-card, .word-bank-card, .quiz-card, .audio-card, .listening-question-card, .passage-card, .reading-questions > .card, .prompt-card, .editor-card, .writing-feedback, .speaking-prompt-card, .recording-card, .speaking-rubric, .weekly-plan-card, .exam-card { padding: 25px; }
.word-bank-card { min-width: 0; }
.search-box { display: flex; align-items: center; gap: 6px; width: 190px; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface-2); }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.filter-row { display: flex; gap: 7px; margin: 18px 0 13px; }
.filter-chip { min-height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 10px; cursor: pointer; }
.filter-chip.active { border-color: var(--primary); color: #fff; background: var(--primary); }

.flashcard { position: relative; min-height: 360px; margin-top: 19px; padding: 22px; overflow: hidden; border-radius: 22px; color: #effff8; background: radial-gradient(circle at 90% 10%, rgba(203,238,136,.18), transparent 34%), linear-gradient(145deg, #124c3e, #1b6c56); box-shadow: 0 20px 45px rgba(21,95,76,.22); cursor: pointer; }
.flashcard::before { content: ""; position: absolute; right: -38px; bottom: -52px; width: 160px; height: 160px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.flashcard-top { display: flex; align-items: center; justify-content: space-between; }
.word-level { color: #d9f7e8; background: rgba(255,255,255,.1); }
.sound-button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--lime); background: rgba(255,255,255,.1); font-size: 13px; }
.word-main { position: absolute; top: 50%; left: 22px; right: 22px; transform: translateY(-56%); text-align: center; transition: transform .25s ease, opacity .25s ease; }
.word-main h3 { margin: 0; font-family: var(--font-en); font-size: clamp(36px, 5vw, 54px); line-height: 1.1; letter-spacing: -2px; }
.word-main > p { margin: 7px 0 16px; color: rgba(235,255,247,.62); font-family: var(--font-en); font-size: 13px; }
.word-meaning { display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 12px; color: #effff8; background: rgba(255,255,255,.09); }
.word-meaning span { color: var(--lime); font-family: var(--font-en); font-size: 11px; font-weight: 800; }
.word-meaning strong { font-size: 13px; }
.word-detail { position: absolute; right: 23px; bottom: 38px; left: 23px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.12); opacity: 0; transition: opacity .25s ease; }
.word-detail p { margin: 0 0 4px; font-family: var(--font-en); font-size: 11px; font-style: italic; }
.word-detail small { color: rgba(235,255,247,.58); font-size: 9px; }
.flashcard.revealed .word-detail { opacity: 1; }
.flashcard.revealed .word-main { transform: translateY(-70%); }
.flip-hint { position: absolute; right: 22px; bottom: 12px; color: rgba(235,255,247,.42); font-size: 9px; }
.flash-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 13px; }
.memory-button { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 41px; border-radius: 12px; font-size: 11px; font-weight: 750; }
.memory-button span { font-family: var(--font-en); font-size: 15px; font-weight: 900; }
.memory-button.unknown { color: var(--red); background: var(--red-soft); }
.memory-button.fuzzy { color: #a57627; background: var(--amber-soft); }
.memory-button.known { color: var(--primary); background: var(--primary-soft); }
.memory-button:hover { transform: translateY(-2px); }
.card-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; }
.icon-button { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-soft); background: var(--surface); font-family: var(--font-en); font-weight: 800; }
.icon-button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.word-list { display: grid; max-height: 424px; padding-right: 5px; overflow-y: auto; gap: 8px; }
.word-list-item { display: grid; grid-template-columns: minmax(110px, .62fr) minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 13px; border: 1px solid transparent; border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.word-list-item:hover, .word-list-item.active { border-color: var(--line-strong); background: var(--surface-3); }
.word-list-item strong { font-family: var(--font-en); font-size: 13px; }
.word-list-item p { margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.memory-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.memory-status.known { background: #4eb187; }
.memory-status.fuzzy { background: var(--amber); }
.memory-status.unknown { background: var(--red); }
.quiz-card { margin-top: 20px; }
.quiz-sentence { margin: 23px 0 15px; color: var(--ink-soft); font-family: var(--font-en); font-size: 16px; line-height: 1.8; }
.quiz-sentence b { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; }
.quiz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quiz-option { min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink-soft); background: var(--surface-2); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.quiz-option:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-1px); }
.quiz-option.correct { border-color: #4caa84; color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.quiz-option.wrong { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.quiz-feedback { min-height: 0; margin-top: 12px; color: var(--muted); font-size: 12px; }
.quiz-feedback.show { min-height: 24px; }
.quiz-feedback.success { color: var(--primary); }
.quiz-feedback.error { color: var(--red); }
.quiz-card .compact-button, .listening-question-card .compact-button { margin-top: 14px; }

.audio-card, .listening-question-card { min-height: 475px; }
.listening-layout { grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); }
.audio-card { position: relative; }
.audio-visual { position: relative; height: 166px; margin: 22px 0 13px; overflow: hidden; border-radius: 20px; background: linear-gradient(135deg, #113f34, #1f6a55); }
.audio-visual canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .72; }
.audio-cover { position: absolute; inset: 0; display: grid; place-items: center; }
.audio-cover span { display: grid; place-items: center; width: 65px; height: 65px; border: 1px solid rgba(255,255,255,.18); border-radius: 22px; color: var(--lime); background: rgba(255,255,255,.08); box-shadow: 0 12px 30px rgba(0,0,0,.12); font-family: var(--font-en); font-size: 29px; font-weight: 800; backdrop-filter: blur(8px); }
.audio-controls { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.round-play { display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; color: #fff; background: var(--primary); box-shadow: 0 9px 18px rgba(21,95,76,.22); cursor: pointer; }
.audio-time { display: flex; justify-content: space-between; margin-bottom: 5px; color: var(--muted); font-family: var(--font-en); font-size: 9px; }
.audio-track { height: 5px; cursor: pointer; }
.speed-control { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.speed-control select { height: 32px; padding: 0 7px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: var(--surface); font-size: 10px; }
.transcript-box { max-height: 0; margin-top: 14px; overflow: hidden; padding: 0 16px; border-radius: 14px; background: var(--surface-2); opacity: 0; transition: max-height .35s ease, opacity .25s ease, padding .25s ease; }
.transcript-box.open { max-height: 240px; padding: 15px 16px; overflow-y: auto; opacity: 1; }
.transcript-box p { margin: 0; color: var(--ink-soft); font-family: var(--font-en); font-size: 12px; line-height: 1.9; }
.listening-question-card h4, .reading-question h4 { margin: 19px 0 12px; font-family: var(--font-en); font-size: 15px; line-height: 1.6; }
.listening-options { display: grid; gap: 8px; }
.listening-options .quiz-option { width: 100%; }
.audio-selector { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 17px; border-top: 1px solid var(--line); }
.audio-selector > span { color: var(--muted); font-size: 10px; }
.audio-selector > div { display: flex; gap: 7px; }
.audio-tab { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); font-size: 10px; cursor: pointer; }
.audio-tab.active { border-color: var(--primary); color: #fff; background: var(--primary); }

.reading-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; padding: 15px 19px; }
.reading-meta { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 11px; }
.reading-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr); gap: 20px; align-items: start; }
.passage-card { font-family: var(--font-en); }
.passage-card h3 { margin: 9px 0 18px; font-size: 24px; letter-spacing: -.7px; }
.passage-card p { margin: 0 0 16px; color: #43514c; font-size: 14px; line-height: 1.95; }
body.dark .passage-card p { color: #bdcbc4; }
.passage-card .passage-lead { padding-left: 15px; border-left: 3px solid var(--primary); color: var(--ink); font-size: 15px; font-weight: 600; }
.reading-questions { display: grid; gap: 18px; }
.reading-question + .reading-question { margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }
.reading-question > p { margin: 0 0 12px; color: var(--ink-soft); font-size: 12px; font-weight: 700; line-height: 1.7; }
.reading-options { display: grid; gap: 7px; }
.reading-options .quiz-option { min-height: 40px; padding: 8px 11px; font-size: 11px; }
.strategy-card ul { margin: 14px 0 0; padding: 0; list-style: none; }
.strategy-card li { position: relative; margin-bottom: 10px; padding-left: 17px; color: var(--muted); font-size: 11px; }
.strategy-card li::before { content: ""; position: absolute; top: 8px; left: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.strategy-card li strong { color: var(--ink-soft); }

.writing-layout { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr); gap: 20px; align-items: start; }
.prompt-card h3 { margin: 10px 0 8px; font-family: var(--font-en); font-size: 20px; line-height: 1.45; }
.prompt-card > p { margin: 0; color: var(--muted); font-family: var(--font-en); font-size: 12px; }
.prompt-checklist { display: flex; flex-wrap: wrap; gap: 7px; margin: 20px 0; }
.prompt-checklist span { padding: 6px 9px; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 10px; font-weight: 700; }
.template-box { padding: 16px; border-radius: 16px; background: var(--surface-2); }
.template-heading { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.template-box ol { display: grid; gap: 9px; margin: 13px 0 0; padding-left: 19px; color: var(--muted); font-size: 10px; }
.template-box li b { color: var(--ink-soft); }
.useful-expressions { display: grid; gap: 7px; margin-top: 17px; }
.useful-expressions span { padding: 8px 10px; border-left: 2px solid var(--blue); color: var(--ink-soft); background: var(--blue-soft); font-family: var(--font-en); font-size: 10px; }
.editor-card { padding: 0; overflow: hidden; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 17px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.editor-toolbar > div:first-child { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.editor-toolbar strong { color: var(--ink-soft); }
.toolbar-actions { display: flex; gap: 7px; }
.toolbar-actions .icon-button { width: 32px; height: 32px; }
#essayEditor { display: block; width: 100%; min-height: 470px; padding: 25px; border: 0; outline: none; resize: vertical; color: var(--ink); background: var(--surface); font-family: var(--font-en); font-size: 14px; line-height: 1.9; }
#essayEditor::placeholder { color: var(--line-strong); }
.editor-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 17px; border-top: 1px solid var(--line); }
.editor-footer > span { color: var(--muted); font-size: 10px; }
.writing-feedback { grid-column: 2; }
.empty-feedback { display: grid; place-items: center; min-height: 160px; color: var(--muted); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 9px; border-radius: 17px; color: var(--primary); background: var(--primary-soft); font-size: 21px; }
.empty-feedback p { max-width: 240px; margin: 0; font-size: 11px; }
.score-result { display: flex; align-items: center; gap: 18px; margin: 17px 0; }
.score-number { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 25px; color: var(--primary); background: var(--primary-soft); font-family: var(--font-en); font-size: 26px; font-weight: 900; }
.score-result h4 { margin: 0 0 3px; font-size: 14px; }
.score-result p { margin: 0; color: var(--muted); font-size: 10px; }
.feedback-list { display: grid; gap: 8px; }
.feedback-item { display: flex; gap: 9px; padding: 9px 10px; border-radius: 11px; color: var(--ink-soft); background: var(--surface-2); font-size: 10px; }
.feedback-item span { color: var(--primary); font-weight: 900; }

.speaking-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(270px, .65fr); gap: 20px; align-items: start; }
.speaking-prompt-card { min-height: 390px; }
.speaking-prompt-card blockquote { position: relative; margin: 30px 0 24px; padding: 24px 28px; border: 0; border-radius: 20px; color: #f0fff8; background: linear-gradient(135deg, #164f40, #23715b); font-family: var(--font-en); font-size: 18px; font-weight: 600; line-height: 1.7; }
.speaking-prompt-card blockquote::before { content: "“"; position: absolute; top: -18px; left: 17px; color: var(--lime); font-family: Georgia, serif; font-size: 78px; line-height: 1; opacity: .58; }
.speaking-structure { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.speaking-structure > div { padding: 13px; border-radius: 14px; background: var(--surface-2); }
.speaking-structure span { display: block; color: var(--primary); font-family: var(--font-en); font-size: 10px; font-weight: 900; }
.speaking-structure strong { display: block; margin-top: 4px; font-size: 11px; }
.speaking-structure p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.speaking-timer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.timer-display { font-family: var(--font-en); font-size: 31px; font-weight: 800; letter-spacing: -1px; }
.timer-actions { display: flex; align-items: center; gap: 8px; }
.timer-actions .ghost-button, .timer-actions .primary-button { min-height: 39px; padding: 0 14px; font-size: 11px; }
.recording-card { min-height: 390px; text-align: center; }
.recording-card h3 { margin: 4px 0 18px; }
.record-visual { display: grid; place-items: center; height: 175px; border-radius: 20px; background: var(--surface-2); }
.record-circle { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 14px rgba(200,89,89,.07); font-size: 19px; transition: box-shadow .25s ease; }
.recording .record-circle { animation: recordPulse 1.5s infinite; }
@keyframes recordPulse { 50% { box-shadow: 0 0 0 24px rgba(200,89,89,0); } }
.record-bars { display: none; align-items: center; gap: 4px; height: 34px; margin-top: 13px; }
.recording .record-bars { display: flex; }
.record-bars i { width: 4px; height: 8px; border-radius: 4px; background: var(--primary-2); animation: soundWave .8s ease-in-out infinite alternate; }
.record-bars i:nth-child(2n) { animation-delay: .15s; }
.record-bars i:nth-child(3n) { animation-delay: .3s; }
@keyframes soundWave { to { height: 30px; } }
.record-status { margin: 16px 0; color: var(--muted); font-size: 10px; }
.recording-card audio { width: 100%; height: 34px; margin: 0 0 12px; }
.record-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.record-actions button { min-height: 40px; padding: 0 15px; font-size: 11px; }
.speaking-rubric { grid-column: 1 / -1; }
.speaking-rubric h3 { margin-top: 5px; }
.speaking-rubric .check-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--primary); }
.speaking-tip { margin-top: 17px; padding: 13px; border-left: 3px solid var(--amber); border-radius: 0 12px 12px 0; background: var(--amber-soft); }
.speaking-tip strong { font-size: 11px; }
.speaking-tip p { margin: 3px 0 0; color: var(--ink-soft); font-size: 10px; }

.roadmap { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 26px; }
.roadmap::before { content: ""; position: absolute; top: 21px; right: 13%; left: 13%; height: 1px; background: var(--line-strong); }
.phase-card { position: relative; z-index: 1; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.phase-index { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 14px; border: 5px solid var(--surface); border-radius: 50%; color: var(--muted); background: var(--surface-3); font-family: var(--font-en); font-size: 11px; font-weight: 900; }
.phase-card.active .phase-index { color: #fff; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.phase-card.done .phase-index { color: #fff; background: #72b89b; }
.phase-card h3 { margin: 0 0 5px; font-size: 14px; }
.phase-card p { margin: 0; color: var(--muted); font-size: 10px; }
.phase-progress { display: flex; align-items: center; gap: 10px; margin-top: 15px; }
.phase-progress .progress-track { flex: 1; }
.phase-progress span { color: var(--muted); font-family: var(--font-en); font-size: 9px; font-weight: 800; }
.plan-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 20px; align-items: start; }
.weekly-tasks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 19px; }
.weekly-task { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; }
.weekly-task.done { border-color: rgba(76,177,135,.3); background: var(--primary-soft); }
.weekly-task.done strong { color: var(--muted); text-decoration: line-through; }
.weekly-task .task-check { width: 24px; height: 24px; }
.weekly-task strong { display: block; font-size: 11px; }
.weekly-task span { color: var(--muted); font-size: 9px; }
.exam-card h3 { margin: 5px 0 20px; }
.exam-card label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.exam-card input { width: 100%; height: 43px; margin-bottom: 20px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-2); }
.big-countdown { display: flex; align-items: baseline; gap: 7px; margin-bottom: 12px; }
.big-countdown strong { color: var(--primary); font-family: var(--font-en); font-size: 52px; line-height: 1; letter-spacing: -3px; }
.big-countdown span { color: var(--muted); font-size: 13px; }
.exam-card p { margin: 0 0 17px; color: var(--muted); font-size: 10px; }
.exam-card p strong { color: var(--ink-soft); }
.exam-card .primary-button { width: 100%; }

.bottom-nav, .sidebar-mask { display: none; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 320px; padding: 13px 17px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; color: #effff8; background: rgba(18, 57, 47, .96); box-shadow: var(--shadow-lg); font-size: 12px; opacity: 0; transform: translateY(15px); pointer-events: none; transition: opacity .25s ease, transform .25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.modal-backdrop { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(13, 27, 22, .48); opacity: 0; visibility: hidden; backdrop-filter: blur(8px); transition: opacity .25s ease, visibility .25s ease; }
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal { position: relative; width: min(420px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow-lg); transform: translateY(15px) scale(.98); transition: transform .25s ease; }
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-close { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); font-size: 18px; cursor: pointer; }
.modal h2 { margin: 5px 0 18px; }
.profile-avatar { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 17px; border-radius: 20px; color: #fff; background: linear-gradient(145deg, #d09248, #b36b38); font-family: var(--font-en); font-size: 17px; font-weight: 900; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.profile-grid > div { padding: 11px 7px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.profile-grid strong { display: block; font-family: var(--font-en); font-size: 18px; }
.profile-grid span { color: var(--muted); font-size: 9px; }
.modal > label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.modal > input { width: 100%; height: 44px; margin-bottom: 15px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-2); }
.modal > .primary-button { width: 100%; }

@media (max-width: 1200px) {
  .main-content { padding-right: 28px; padding-left: 28px; }
  .hero-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); }
  .hero-card { padding: 35px; }
  .countdown-ring { width: 160px; height: 160px; }
  .dashboard-grid { grid-template-columns: 1.3fr 1fr; }
  .score-card { grid-column: 1 / -1; min-height: auto; }
  .score-list { grid-template-columns: repeat(3, 1fr); }
  .recommend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 232px; }
  .main-content { padding-right: 22px; padding-left: 22px; }
  .hero-grid { grid-template-columns: 1fr; }
  .today-card { min-height: auto; }
  .progress-ring-row { margin: 26px 0; }
  .vocab-layout, .listening-layout, .reading-layout, .writing-layout, .speaking-layout, .plan-layout { grid-template-columns: 1fr; }
  .writing-feedback { grid-column: auto; }
  .roadmap { grid-template-columns: 1fr; }
  .roadmap::before { top: 0; bottom: 0; left: 41px; width: 1px; height: auto; }
  .phase-card { display: grid; grid-template-columns: 52px 1fr; align-items: center; }
  .phase-index { grid-row: 1 / 3; margin-bottom: 0; }
  .phase-progress { grid-column: 2; }
}

@media (max-width: 760px) {
  body { padding-bottom: 76px; }
  .app-shell { display: block; }
  .main-content { padding: 0 16px 28px; }
  .sidebar { position: fixed; left: 0; z-index: 80; width: min(82vw, 300px); transform: translateX(-105%); transition: transform .3s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask { position: fixed; inset: 0; z-index: 70; display: block; background: rgba(10, 25, 20, .45); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
  .sidebar-mask.open { opacity: 1; visibility: visible; }
  .mobile-menu { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-soft); background: var(--surface); cursor: pointer; }
  .topbar { min-height: 76px; gap: 12px; }
  .page-heading { flex: 1; }
  .page-heading h1 { font-size: 18px; }
  .page-heading .eyebrow { display: none; }
  .date-chip { display: none; }
  .avatar { width: 39px; height: 39px; border-radius: 12px; }
  .hero-card { display: block; min-height: auto; padding: 29px 25px 32px; border-radius: 24px; }
  .hero-copy h2 { font-size: 37px; }
  .hero-copy p { font-size: 12px; }
  .hero-actions { flex-wrap: wrap; }
  .countdown-wrap { margin-top: 28px; }
  .countdown-ring { width: 142px; height: 142px; }
  .countdown-wrap > p { font-size: 9px; }
  .today-card { padding: 22px; border-radius: 24px; }
  .progress-ring-row { gap: 17px; }
  .progress-ring { width: 112px; height: 112px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .chart-card, .task-card, .score-card { min-height: auto; padding: 20px; }
  .score-card { grid-column: auto; }
  .score-list { grid-template-columns: 1fr; gap: 14px; }
  .recommend-grid { grid-template-columns: 1fr; }
  .section-row { margin-top: 28px; }
  .page-intro { display: block; padding: 21px; }
  .page-intro h2 { font-size: 23px; }
  .stat-strip { justify-content: stretch; margin-top: 18px; }
  .stat-strip > div { flex: 1; min-width: 0; padding: 0 8px; }
  .stat-strip strong { font-size: 18px; }
  .flashcard-card, .word-bank-card, .quiz-card, .audio-card, .listening-question-card, .passage-card, .reading-questions > .card, .prompt-card, .writing-feedback, .speaking-prompt-card, .recording-card, .speaking-rubric, .weekly-plan-card, .exam-card { padding: 19px; }
  .flashcard { min-height: 330px; }
  .search-box { width: 140px; }
  .vocab-book-panel { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  .vocab-book-picker { grid-template-columns: 1fr; gap: 9px; }
  .vocab-book-picker .eyebrow { display: none; }
  .vocab-plan-settings { align-items: center; flex-wrap: wrap; }
  .vocab-plan-settings .compact-button { flex: 1 1 135px; }
  .word-list-item { grid-template-columns: 100px minmax(0, 1fr) auto; gap: 9px; }
  .quiz-options { grid-template-columns: 1fr; }
  .listening-layout { gap: 14px; }
  .audio-controls { grid-template-columns: 44px minmax(0, 1fr); }
  .speed-control { grid-column: 1 / -1; justify-content: flex-end; }
  .reading-toolbar { align-items: flex-start; gap: 14px; }
  .reading-meta { flex-wrap: wrap; gap: 8px 14px; }
  .reading-meta span:not(.difficulty-chip) { display: none; }
  .writing-layout { gap: 14px; }
  #essayEditor { min-height: 390px; padding: 19px; }
  .speaking-structure { grid-template-columns: 1fr; }
  .speaking-timer { display: block; }
  .timer-actions { margin-top: 13px; flex-wrap: wrap; }
  .record-actions { flex-wrap: wrap; }
  .weekly-tasks { grid-template-columns: 1fr; }
  .bottom-nav { position: fixed; right: 10px; bottom: 9px; left: 10px; z-index: 60; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.9); box-shadow: 0 16px 35px rgba(24,50,42,.18); backdrop-filter: blur(16px); }
  body.dark .bottom-nav { background: rgba(26,39,34,.92); }
  .bottom-nav button { display: grid; place-items: center; gap: 1px; height: 50px; border: 0; border-radius: 14px; color: var(--muted); background: transparent; font-size: 9px; }
  .bottom-nav button span { font-family: var(--font-en); font-size: 15px; font-weight: 800; }
  .bottom-nav button.active { color: var(--primary); background: var(--primary-soft); font-weight: 800; }
  .toast { right: 15px; bottom: 84px; left: 15px; max-width: none; }
}

@media (max-width: 400px) {
  .main-content { padding-right: 12px; padding-left: 12px; }
  .hero-copy h2 { font-size: 33px; }
  .hero-actions { display: grid; }
  .hero-actions button { width: 100%; }
  .focus-metrics strong { font-size: 15px; }
  .search-box { width: 110px; }
  .filter-row { overflow-x: auto; }
  .word-list-item { grid-template-columns: 82px minmax(0, 1fr) auto; }
}

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

.trend.neutral {
  color: var(--muted);
  background: var(--surface-3);
  font-weight: 700;
}



.auth-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 7px 0;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.auth-button:hover { color: var(--primary); }
.auth-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  box-shadow: 0 0 0 4px var(--surface-3);
}

.auth-button.signed-in .auth-status-dot {
  background: #4cc38a;
  box-shadow: 0 0 0 4px rgba(76,195,138,.13);
}

.auth-description {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 17px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface-2);
}

.auth-tabs button {
  min-height: 35px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs button.active {
  color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.auth-modal form { display: grid; gap: 7px; }
.auth-modal form label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.auth-modal form input {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface-2);
}

.auth-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.auth-message.error { color: var(--red); }
.auth-message.success { color: var(--primary); }
.auth-submit { width: 100%; margin-top: 3px; }
.auth-signout { width: 100%; margin-top: 10px; }
.auth-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
  text-align: center;
}

.library-trigger[hidden] { display: none; }
.library-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.library-trigger span:first-child {
  color: var(--primary);
  font-family: var(--font-en);
}

.library-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(13, 27, 22, .4);
  opacity: 0;
  visibility: hidden;
  backdrop-filter: blur(5px);
  transition: opacity .25s ease, visibility .25s ease;
}

.library-overlay.open { opacity: 1; visibility: visible; }

.library-drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(560px, 96vw);
  height: 100%;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  transition: transform .3s ease;
}

.library-overlay.open .library-drawer { transform: translateX(0); }
.library-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.library-head h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.8px; }
.library-search-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 20px; }
.library-search { width: 100%; height: 42px; }
.library-search input { font-size: 12px; }
.library-filter-group { margin-top: 17px; }
.library-filter-group > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .6px; }
.library-filter-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.library-filter-row .filter-chip { flex: 0 0 auto; }
.compact-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compact-filters .library-filter-row { flex: 1; min-width: 260px; }
.compact-filters select { height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-soft); background: var(--surface-2); font-size: 10px; }
.saved-only-toggle { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 10px; white-space: nowrap; }
.saved-only-toggle input { accent-color: var(--primary); }
.library-summary { margin: 18px 0 10px; color: var(--muted); font-size: 10px; }
.library-list { display: grid; gap: 10px; overflow-y: auto; padding-right: 4px; }
.library-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); transition: border-color .18s ease, transform .18s ease; }
.library-item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.library-item-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-family: var(--font-en); font-size: 16px; font-weight: 900; }
.library-item h4 { margin: 0 0 3px; font-size: 13px; }
.library-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.library-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.library-tags span { padding: 3px 6px; border-radius: 7px; color: var(--ink-soft); background: var(--surface); font-size: 8px; }
.library-item-actions { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; }
.favorite-button { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); cursor: pointer; }
.favorite-button.saved { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.library-open { min-height: 31px; padding: 0 10px; font-size: 10px; }
.library-empty { padding: 36px 18px; border: 1px dashed var(--line-strong); border-radius: 18px; color: var(--muted); text-align: center; font-size: 11px; }
.plan-heading-actions { display: flex; align-items: center; gap: 12px; }
.weekly-task { grid-template-columns: 26px minmax(0, 1fr) auto; }
.weekly-task-main { min-width: 0; }
.weekly-task-actions { display: flex; align-items: center; gap: 5px; }
.weekly-task-actions button { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--surface); font-size: 11px; cursor: pointer; }
.weekly-task-actions button:hover { border-color: var(--primary); color: var(--primary); }
.weekly-task-actions .delete-task:hover { border-color: var(--red); color: var(--red); }
.plan-task-modal form { display: grid; gap: 8px; }
.plan-task-modal label { margin-top: 3px; color: var(--muted); font-size: 10px; }
.plan-task-modal input,
.plan-task-modal textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-2); }
.plan-task-modal textarea { min-height: 88px; resize: vertical; }
.plan-task-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 10px; }

@media (max-width: 760px) {
  .library-trigger span:last-child { display: none; }
  .library-trigger[hidden] { display: none; }
.library-trigger { width: 39px; padding: 0; justify-content: center; border-radius: 12px; }
  .library-drawer { width: 100%; padding: 22px 18px; }
  .library-search-row { grid-template-columns: 1fr; }
  .library-item { grid-template-columns: 34px minmax(0, 1fr); }
  .library-item-actions { grid-column: 2; flex-direction: row; align-items: center; }
  .compact-filters { display: grid; grid-template-columns: 1fr auto; }
  .compact-filters .library-filter-row { grid-column: 1 / -1; }
  .saved-only-toggle { justify-self: end; }
  .plan-heading-actions { gap: 7px; }
  .weekly-task { grid-template-columns: 26px minmax(0, 1fr) auto; }
}


