/* Echo English - core design system */
:root {
  --bg: #f2f7f5;
  --bg-soft: #e9f2ef;
  --surface: #ffffff;
  --surface-2: #f6faf8;
  --surface-3: #edf5f2;
  --text: #112523;
  --text-soft: #3f5b56;
  --muted: #6d8380;
  --line: #dce9e5;
  --primary: #0f766e;
  --primary-2: #0d9488;
  --primary-3: #14b8a6;
  --primary-soft: #d9f3ef;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --blue: #2563eb;
  --shadow-sm: 0 2px 8px rgba(15, 76, 69, 0.06);
  --shadow: 0 12px 34px rgba(15, 76, 69, 0.10);
  --shadow-lg: 0 24px 60px rgba(15, 76, 69, 0.18);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 26px;
  --sidebar-w: 250px;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}
[data-theme="dark"] {
  --bg: #0b1514;
  --bg-soft: #0f1c1a;
  --surface: #13221f;
  --surface-2: #182b28;
  --surface-3: #1e3531;
  --text: #e8f4f1;
  --text-soft: #bdd3ce;
  --muted: #89a29d;
  --line: #27413c;
  --primary: #2dd4bf;
  --primary-2: #14b8a6;
  --primary-3: #5eead4;
  --primary-soft: #123b36;
  --accent-soft: #3b2f12;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.24);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.42);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(20, 184, 166, 0.11), transparent 28rem),
    radial-gradient(circle at 100% 12%, rgba(245, 158, 11, 0.09), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; }
::selection { background: var(--primary-3); color: #fff; }

.app-shell { min-height: 100vh; }
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
}
.boot-logo { font-size: 38px; font-weight: 900; letter-spacing: -1.5px; color: var(--text); }
.boot-logo span { color: var(--primary); }
.boot-bar { width: 220px; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.boot-bar i { display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--primary); animation: boot 1.1s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-110%); } 50% { transform: translateX(120%); } 100% { transform: translateX(240%); } }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  padding: 22px 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-3));
  color: #fff; font-size: 22px; box-shadow: 0 8px 20px rgba(15, 118, 110, 0.25);
}
.brand-copy strong { display: block; font-size: 17px; letter-spacing: -0.4px; }
.brand-copy small { color: var(--muted); font-size: 11px; }
.side-streak {
  margin: 0 6px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(20, 184, 166, 0.12));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  display: flex; align-items: center; gap: 10px;
}
.side-streak .fire { font-size: 22px; }
.side-streak strong { display: block; font-size: 16px; }
.side-streak small { color: var(--muted); font-size: 11px; }
.nav { display: grid; gap: 5px; margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--text-soft);
  border: 1px solid transparent;
  transition: 0.18s ease;
  font-size: 14px;
  font-weight: 650;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 16%, transparent); }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 17px; }
.nav-item .nav-badge { margin-left: auto; font-size: 11px; background: var(--primary); color: #fff; padding: 1px 7px; border-radius: 99px; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; }
.mini-tip {
  font-size: 12px; color: var(--muted); background: var(--surface-2);
  border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px;
}
.side-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-soft);
  display: grid; place-items: center; transition: 0.18s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 28px 34px 70px;
}
.page { max-width: 1180px; margin: 0 auto; animation: fadeUp 0.35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.topbar { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase; margin-bottom: 6px; }
.page-title { font-size: clamp(25px, 3vw, 36px); line-height: 1.15; letter-spacing: -1px; }
.page-sub { color: var(--muted); margin-top: 8px; max-width: 640px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 42px;
  padding: 9px 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 750; font-size: 14px;
  transition: 0.18s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 8px 20px rgba(15, 118, 110, 0.22); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 10px 24px rgba(15, 118, 110, 0.3); }
.btn-soft { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 12%, transparent); }
.btn-soft:hover { background: color-mix(in srgb, var(--primary-soft) 80%, var(--primary) 20%); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text-soft); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn-wide { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-hover { transition: 0.2s ease; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 13px; }
.section-title h2 { font-size: 18px; letter-spacing: -0.35px; }
.section-title small { color: var(--muted); font-size: 12px; }

.dashboard-grid { display: grid; grid-template-columns: 1.45fr 0.95fr; gap: 18px; align-items: start; }
.hero-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0f766e, #0d9488 58%, #14b8a6);
  color: #fff; border: none; min-height: 232px;
  padding: 28px;
}
.hero-card::after {
  content: ""; position: absolute; width: 260px; height: 260px; right: -80px; top: -110px;
  border-radius: 50%; background: rgba(255,255,255,0.12);
}
.hero-card::before {
  content: ""; position: absolute; width: 180px; height: 180px; right: 80px; bottom: -120px;
  border-radius: 50%; background: rgba(245,158,11,0.22);
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -1px; line-height: 1.15; }
.hero-card p { color: rgba(255,255,255,0.85); margin-top: 9px; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-card .btn-primary { background: #fff; color: var(--primary); box-shadow: 0 12px 30px rgba(0,0,0,0.14); }
.hero-card .btn-ghost { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.35); }
.hero-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; font-size: 12px; color: rgba(255,255,255,0.88); }
.hero-meta span { display: inline-flex; align-items: center; gap: 5px; }

.progress-card { padding: 20px; display: grid; gap: 18px; }
.ring-row { display: flex; align-items: center; gap: 16px; }
.ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-3) 0);
  position: relative; }
.ring::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.ring strong { position: relative; z-index: 1; font-size: 21px; }
.ring small { position: relative; z-index: 1; color: var(--muted); font-size: 10px; }
.ring-label strong { display: block; font-size: 16px; }
.ring-label span { color: var(--muted); font-size: 12px; }
.task-list { display: grid; gap: 9px; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.task-check { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: transparent; font-size: 12px; flex: none; }
.task-row.done .task-check { background: var(--success); color: #fff; border-color: var(--success); }
.task-row.done .task-name { text-decoration: line-through; color: var(--muted); }
.task-name { font-size: 13px; font-weight: 650; }
.task-sub { font-size: 11px; color: var(--muted); }
.task-arrow { margin-left: auto; color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { padding: 16px; display: flex; gap: 12px; align-items: center; }
.stat-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; background: var(--surface-3); }
.stat-card strong { display: block; font-size: 22px; line-height: 1.1; }
.stat-card span { color: var(--muted); font-size: 12px; }

.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.article-card { padding: 18px; display: flex; flex-direction: column; gap: 11px; min-height: 224px; position: relative; overflow: hidden; }
.article-card .emoji { font-size: 30px; }
.article-card h3 { font-size: 16px; line-height: 1.35; letter-spacing: -0.2px; }
.article-card p { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.article-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; color: var(--muted); font-size: 11.5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-soft); font-size: 11px; font-weight: 700; }
.chip.level-A2 { background: #dcfce7; color: #166534; }
.chip.level-B1 { background: #dbeafe; color: #1d4ed8; }
.chip.level-B2 { background: #fef3c7; color: #92400e; }
.chip.done { background: #dcfce7; color: #166534; }
[data-theme="dark"] .chip.level-A2 { background: #143a26; color: #86efac; }
[data-theme="dark"] .chip.level-B1 { background: #172b52; color: #93c5fd; }
[data-theme="dark"] .chip.level-B2 { background: #412f10; color: #fcd34d; }

.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 3px; flex-wrap: wrap; }
.segmented button { border: none; background: transparent; color: var(--muted); padding: 7px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 750; }
.segmented button.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(15,118,110,0.2); }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box input { width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: 11px 14px 11px 38px; outline: none; transition: 0.18s; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.search-box span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.reader-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.reader-title h1 { font-size: clamp(23px, 3.2vw, 34px); line-height: 1.2; letter-spacing: -0.8px; }
.reader-sub { color: var(--muted); margin-top: 8px; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.reader-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.reader-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 16px 0 18px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); position: sticky; top: 12px; z-index: 10; backdrop-filter: blur(14px); }
.article-body { padding: 6px 4px 20px; }
.paragraph { margin-bottom: 22px; }
.sentence { display: inline; border-radius: 6px; transition: background 0.16s; padding: 2px 0; line-height: 2.02; font-size: clamp(17px, 1.5vw, 19.5px); color: var(--text); font-family: Georgia, "Times New Roman", "Songti SC", serif; }
.sentence:hover { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.sentence.active { background: var(--accent-soft); }
.word { cursor: pointer; border-radius: 4px; padding: 0 1px; transition: 0.14s; }
.word:hover { background: var(--primary-soft); color: var(--primary); box-shadow: 0 1px 0 var(--primary); }
.word.saved { background: #fde68a; color: #92400e; }
.zh-line { display: none; margin-top: 3px; padding: 8px 12px; border-left: 3px solid var(--primary-3); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--text-soft); font-size: 13.5px; line-height: 1.7; }
.zh-line.show { display: block; }
.focus-mode .paragraph { display: none; }
.focus-mode .paragraph.active { display: block; }
.focus-mode .sentence { display: block; font-size: 23px; line-height: 1.75; margin-bottom: 12px; padding: 15px 17px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.focus-mode .zh-line { display: none; }
.focus-mode .zh-line.show { display: block; }
.focus-nav { display: none; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 2px; }
.focus-mode .focus-nav { display: flex; }
.focus-progress { color: var(--muted); font-size: 12px; }
.article-side { display: grid; gap: 14px; position: sticky; top: 14px; }
.side-card { padding: 16px; }
.side-card h3 { font-size: 14px; margin-bottom: 10px; }
.vocab-mini { display: grid; gap: 8px; }
.vocab-mini button { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 9px 10px; color: var(--text-soft); }
.vocab-mini button:hover { border-color: var(--primary); background: var(--primary-soft); }
.vocab-mini strong { display: block; color: var(--text); font-size: 13px; }
.vocab-mini span { color: var(--muted); font-size: 11.5px; }
.quiz-box { display: grid; gap: 14px; }
.quiz-q { font-size: 14px; font-weight: 750; }
.quiz-options { display: grid; gap: 8px; }
.quiz-option { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; padding: 10px 12px; color: var(--text-soft); font-size: 13px; transition: 0.16s; }
.quiz-option:hover { border-color: var(--primary); }
.quiz-option.correct { background: #dcfce7; border-color: #22c55e; color: #166534; font-weight: 700; }
.quiz-option.wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.quiz-explain { display: none; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-soft); font-size: 12.5px; }
.quiz-explain.show { display: block; }

.chat-page-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.dialogue-list { display: grid; gap: 9px; }
.dialogue-card { padding: 14px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; transition: 0.18s; }
.dialogue-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.dialogue-card.active { border-color: var(--primary); background: var(--primary-soft); }
.dialogue-card .d-top { display: flex; gap: 9px; align-items: center; }
.dialogue-card .d-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); font-size: 19px; }
.dialogue-card strong { font-size: 13.5px; display: block; }
.dialogue-card small { color: var(--muted); font-size: 11.5px; }
.chat-shell { display: grid; min-height: 650px; }
.chat-head { padding: 17px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.chat-head .avatar { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary) 28%, var(--surface))); font-size: 22px; }
.chat-head h2 { font-size: 17px; }
.chat-head p { color: var(--muted); font-size: 12px; }
.chat-body { padding: 18px; display: flex; flex-direction: column; gap: 13px; overflow: auto; max-height: 520px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.bubble { max-width: min(76%, 620px); padding: 12px 15px; border-radius: 17px; font-size: 14.5px; box-shadow: var(--shadow-sm); }
.bubble.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.bubble .b-zh { display: block; margin-top: 6px; font-size: 12.5px; opacity: 0.78; }
.bubble .b-tools { display: flex; gap: 6px; margin-top: 9px; }
.bubble .b-tools button { border: 1px solid var(--line); background: var(--surface-2); color: var(--text-soft); border-radius: 8px; padding: 3px 8px; font-size: 11px; }
.bubble.user .b-tools button { background: rgba(255,255,255,0.16); color: #fff; border-color: rgba(255,255,255,0.28); }
.chat-hint { margin-top: 10px; padding: 12px 14px; border-radius: 13px; background: var(--accent-soft); color: #92400e; font-size: 13px; }
.chat-composer { padding: 14px 16px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.composer-row { display: flex; gap: 9px; align-items: flex-end; }
.composer-row textarea { flex: 1; resize: vertical; min-height: 46px; max-height: 130px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 13px; padding: 12px 13px; outline: none; font-size: 14px; }
.composer-row textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.mic-btn { width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--primary-soft); color: var(--primary); font-size: 20px; flex: none; transition: 0.18s; }
.mic-btn:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 30%); }
.mic-btn.recording { background: var(--danger); color: #fff; animation: pulse 1.15s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); } 70% { box-shadow: 0 0 0 13px rgba(220, 38, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
.composer-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 11.5px; }
.result-banner { padding: 11px 13px; border-radius: 12px; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.result-banner.good { background: #dcfce7; color: #166534; }
.result-banner.try { background: var(--accent-soft); color: #92400e; }

.vocab-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.flashcard { min-height: 330px; display: grid; place-items: center; text-align: center; padding: 28px; cursor: pointer; user-select: none; }
.flashcard .word-big { font-size: clamp(34px, 6vw, 56px); letter-spacing: -1.5px; font-weight: 900; }
.flashcard .phonetic { color: var(--muted); margin-top: 8px; }
.flashcard .answer-side { display: none; }
.flashcard.flipped .question-side { display: none; }
.flashcard.flipped .answer-side { display: block; animation: fadeUp 0.22s ease; }
.flashcard .meaning { font-size: 22px; font-weight: 800; margin-top: 16px; color: var(--primary); }
.flashcard .example { margin-top: 16px; color: var(--text-soft); font-size: 14px; max-width: 620px; }
.vocab-table { width: 100%; border-collapse: collapse; }
.vocab-table th, .vocab-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: top; }
.vocab-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; }
.vocab-table .w { font-weight: 800; font-size: 14px; }
.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-state .big { font-size: 42px; margin-bottom: 10px; }

.progress-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.chart-card { padding: 18px; }
.bar-chart { height: 160px; display: flex; align-items: flex-end; gap: 9px; margin-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 36px; border-radius: 9px 9px 4px 4px; background: linear-gradient(180deg, var(--primary-3), var(--primary)); min-height: 4px; transition: height 0.6s ease; }
.bar-col small { font-size: 10.5px; color: var(--muted); }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-pill { padding: 12px 4px; text-align: center; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.day-pill.done { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 20%, transparent); color: var(--primary); font-weight: 800; }
.day-pill strong { display: block; font-size: 15px; color: var(--text); }
.record-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.record-item { padding: 16px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.record-item strong { display: block; font-size: 24px; }
.record-item small { color: var(--muted); }

.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
.form-row { display: grid; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 12px; font-weight: 800; color: var(--text-soft); }
.form-row input, .form-row select, .form-row textarea { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 11px; padding: 10px 12px; outline: none; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.form-hint { color: var(--muted); font-size: 11.5px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch { position: relative; width: 46px; height: 26px; border-radius: 99px; background: var(--line); border: none; transition: 0.18s; flex: none; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: 0.18s; box-shadow: 0 2px 5px rgba(0,0,0,0.16); }
.switch.on { background: var(--primary); }
.switch.on::after { left: 23px; }

.modal-root { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px; background: rgba(3, 24, 21, 0.42); backdrop-filter: blur(5px); }
.modal-root[hidden] { display: none; }
.modal { width: min(720px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: modalIn 0.22s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.x-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-soft); }
.shadowing-target { font-size: 22px; line-height: 1.6; padding: 18px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--line); font-family: Georgia, serif; }
.score-ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; margin: 18px auto; display: grid; place-items: center; background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; }
.score-ring::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.score-ring strong { position: relative; z-index: 1; font-size: 29px; }
.score-ring small { display: block; text-align: center; color: var(--muted); font-size: 10px; position: relative; z-index: 1; }
.diff-word { border-radius: 4px; padding: 0 2px; }
.diff-word.ok { background: #dcfce7; color: #166534; }
.diff-word.miss { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.speak-big { width: 72px; height: 72px; border-radius: 50%; border: none; background: var(--primary); color: #fff; font-size: 30px; box-shadow: 0 12px 30px rgba(15,118,110,0.3); }
.speak-big.recording { background: var(--danger); animation: pulse 1.15s infinite; }

.word-popover { position: fixed; z-index: 120; width: min(320px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 14px; }
.word-popover[hidden] { display: none; }
.word-popover .pop-word { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.word-popover .pop-word strong { font-size: 22px; letter-spacing: -0.4px; }
.word-popover .pop-phonetic { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.word-popover .pop-meaning { margin-top: 10px; font-size: 14px; font-weight: 750; color: var(--primary); }
.word-popover .pop-example { margin-top: 8px; color: var(--text-soft); font-size: 12.5px; }
.word-popover .pop-actions { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.word-popover .pop-loading { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.word-popover .pop-error { color: var(--danger); font-size: 12px; margin-top: 8px; }

.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 9px; }
.toast { min-width: 220px; max-width: 360px; background: var(--text); color: var(--surface); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; animation: toastIn 0.22s ease; }
.toast.good { background: #166534; color: #fff; }
.toast.warn { background: #92400e; color: #fff; }
.toast.bad { background: #991b1b; color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hidden { display: none; }
.mobile-nav { display: none; }
@media (max-width: 1120px) {
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .reader-layout { grid-template-columns: 1fr; }
  .article-side { position: static; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-106%); transition: 0.24s ease; width: 248px; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 16px 16px 84px; }
  .topbar { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 16px; }
  .topbar .brand-copy small { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .progress-grid, .settings-grid { grid-template-columns: 1fr; }
  .chat-page-grid { grid-template-columns: 1fr; }
  .mobile-nav { display: flex; position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 50; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); border-radius: 18px; padding: 7px; justify-content: space-around; backdrop-filter: blur(18px); box-shadow: var(--shadow-lg); }
  .mobile-nav a { flex: 1; text-align: center; padding: 7px 3px; border-radius: 12px; color: var(--muted); font-size: 10px; font-weight: 750; }
  .mobile-nav a.active { background: var(--primary-soft); color: var(--primary); }
  .mobile-nav a span { display: block; font-size: 18px; margin-bottom: 1px; }
  .page-title { font-size: 26px; }
  .page-head { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 620px) {
  .article-grid { grid-template-columns: 1fr; }
  .record-box { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .reader-toolbar { position: static; }
  .hero-card { padding: 22px; }
  .bubble { max-width: 92%; }
  .vocab-table .hide-sm { display: none; }
  .section-title { align-items: flex-start; }
}
