/* ============================================================
   IELTS Practice Platform — 设计系统
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0e0e1a;
  --surface: #16162a;
  --surface-2: #1e1e38;
  --surface-3: #0c1828;
  --border: #2a2a48;
  --border-soft: #20263a;
  --accent: #00d4ff;
  --accent-2: #7c4dff;
  --green: #4caf50;
  --orange: #ffa726;
  --red: #ff5252;
  --purple: #b478ff;
  --text: #e8e8f0;
  --muted: #8a8aa8;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,0.35);
}
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.app { display: flex; min-height: 100vh; }

/* ===== 侧边栏 ===== */
.sidebar {
  width: 230px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px;
  position: fixed; height: 100vh; z-index: 100; transition: transform 0.3s;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.brand .logo { font-size: 26px; }
.brand-text { font-size: 18px; font-weight: 700; color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 10px; color: var(--muted); cursor: pointer; font-size: 15px;
  transition: all 0.18s; text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(0,212,255,0.15), rgba(124,77,255,0.1)); color: var(--accent); font-weight: 600; }
.ni-icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-foot { padding: 14px 10px 0; border-top: 1px solid var(--border); }
.streak-mini { font-size: 13px; color: var(--orange); }

/* ===== 主区 ===== */
.main { flex: 1; margin-left: 230px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}
.menu-btn { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; }
.page-title { font-size: 20px; flex: 1; }
.topbar-date { font-size: 13px; color: var(--muted); }
.view { padding: 28px; max-width: 1100px; width: 100%; margin: 0 auto; }

/* ===== 通用组件 ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset; }
.card-title { font-size: 17px; margin-bottom: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 16px; }

.btn {
  background: var(--accent); color: #02121a; border: none; padding: 11px 22px;
  border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all 0.18s; font-family: inherit;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-green { background: var(--green); color: #04140a; }
.btn-red { background: var(--red); color: #1a0303; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-purple { background: var(--purple); color: #160426; }

.pill { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill-accent { background: rgba(0,212,255,0.15); color: var(--accent); }
.pill-green { background: rgba(76,175,80,0.15); color: var(--green); }
.pill-orange { background: rgba(255,167,38,0.15); color: var(--orange); }
.pill-red { background: rgba(255,82,82,0.15); color: var(--red); }
.pill-purple { background: rgba(180,120,255,0.15); color: var(--purple); }

/* 进度条 */
.bar-bg { width: 100%; height: 12px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; border-radius: 99px; transition: width 0.5s ease; background: linear-gradient(90deg,var(--accent),var(--green)); }

/* 选项（听力/阅读） */
.option {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; margin: 8px 0;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: all 0.15s;
}
.option:hover { border-color: var(--accent); background: var(--surface-2); }
.option:has(input:checked) { border-color: rgba(0,212,255,0.75); background: rgba(0,212,255,0.07); }
.option input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; }
.option.correct { border-color: var(--green); background: rgba(76,175,80,0.1); }
.option.wrong { border-color: var(--red); background: rgba(255,82,82,0.1); }
.option .opt-label { flex: 1; }

.question { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px dashed var(--border); }
.question:last-child { border-bottom: none; }
.q-stem { font-weight: 600; margin-bottom: 6px; }
.feedback { font-size: 14px; margin-top: 8px; padding: 8px 12px; border-radius: 8px; display: none; }
.feedback.show { display: block; }
.feedback.ok { background: rgba(76,175,80,0.1); color: var(--green); }
.feedback.no { background: rgba(255,82,82,0.1); color: var(--red); }

/* 分数结果 */
.result-banner { text-align: center; padding: 26px; border-radius: var(--radius); margin-bottom: 22px; border: 1px solid var(--border); }
.result-banner .score { font-size: 46px; font-weight: 800; }
.result-banner .band { font-size: 18px; margin-top: 4px; }

/* 文本输入 */
input[type=text], textarea, select {
  width: 100%; background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 11px 14px; font-family: inherit;
  font-size: 15px; transition: border 0.15s;
}
input[type=text]:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

/* 空状态 */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 听力：音频播放器 ===== */
.practice-hero {
  display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 18px; align-items: stretch;
  background: linear-gradient(135deg, rgba(0,212,255,0.13), rgba(124,77,255,0.08));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
}
.practice-hero h2 { font-size: 22px; margin-bottom: 8px; }
.practice-hero p { color: var(--muted); font-size: 14px; max-width: 68ch; }
.hero-meta { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.meta-tile { background: rgba(12,24,40,0.78); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; }
.meta-tile span { display: block; color: var(--muted); font-size: 12px; }
.meta-tile b { display: block; margin-top: 2px; font-size: 16px; }
.practice-score {
  background: rgba(14,14,26,0.45); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 16px; display: flex; flex-direction: column; justify-content: center; gap: 10px;
}
.mini-stat { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.mini-stat b { color: var(--text); font-size: 16px; }
.module-shell { display: grid; grid-template-columns: minmax(0,1fr) 250px; gap: 18px; align-items: start; }
.practice-side { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 14px; }
.side-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.side-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.qnav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.qnav button {
  height: 36px; border: 1px solid var(--border); background: var(--surface-3); color: var(--muted);
  border-radius: 10px; cursor: pointer; font-weight: 700;
}
.qnav button.answered { border-color: rgba(0,212,255,0.8); color: var(--accent); background: rgba(0,212,255,0.08); }
.qnav button.reviewed { border-color: rgba(76,175,80,0.8); color: var(--green); background: rgba(76,175,80,0.1); }
.audio-player { background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.ap-controls { display: flex; align-items: center; gap: 14px; }
.ap-btn { width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--accent); color: #02121a; font-size: 20px; cursor: pointer; flex-shrink: 0; transition: all 0.18s; }
.ap-btn:hover { filter: brightness(1.1); }
.ap-info { flex: 1; }
.ap-status { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.ap-speed { display: flex; gap: 6px; margin-top: 10px; }
.ap-speed button { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.ap-speed button.active { background: var(--accent); color: #02121a; border-color: var(--accent); }
.transcript-toggle { margin-top: 12px; font-size: 13px; color: var(--accent); cursor: pointer; }
.transcript-box { display: none; margin-top: 12px; padding: 14px; background: var(--surface); border-radius: 10px; font-size: 14px; color: var(--muted); white-space: pre-wrap; }
.transcript-box.show { display: block; }
.answer-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.answer-progress .bar-bg { flex: 1; height: 8px; }
.answer-progress span { color: var(--muted); font-size: 13px; min-width: 66px; text-align: right; }
.question-tools { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 8px; }
.clear-answer { color: var(--muted); background: transparent; border: none; cursor: pointer; font-size: 13px; }
.clear-answer:hover { color: var(--accent); }
.submit-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.submit-hint { color: var(--muted); font-size: 13px; }

/* ===== 阅读：双栏 ===== */
.reading-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.passage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; max-height: 75vh; overflow-y: auto; position: sticky; top: 90px; }
.passage h3 { color: var(--accent); margin-bottom: 12px; }
.passage p { margin-bottom: 12px; font-size: 15px; }
.passage .para-num { color: var(--accent-2); font-weight: 700; margin-right: 6px; }
.qpanel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; max-height: 75vh; overflow-y: auto; }

/* ===== 写作 ===== */
.writing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.writing-prompt { background: var(--surface-3); border-left: 3px solid var(--orange); padding: 14px 18px; border-radius: 0 10px 10px 0; margin-bottom: 16px; }
.writing-editor { width: 100%; min-height: 360px; resize: vertical; line-height: 1.8; font-size: 15px; }
.editor-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; flex-wrap: wrap; gap: 10px; }
.word-count { font-size: 14px; color: var(--muted); }
.word-count b { color: var(--accent); font-size: 16px; }
.word-count.ok b { color: var(--green); }
.save-status { font-size: 13px; color: var(--green); opacity: 0; transition: opacity 0.3s; }
.save-status.show { opacity: 1; }
.task-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.task-tab { padding: 9px 18px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.task-tab.active { background: var(--orange); color: #1a1000; border-color: var(--orange); font-weight: 600; }
.field-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.writing-layout select { margin-bottom: 14px; }
.writing-assistant { position: sticky; top: 86px; }
.assistant-score {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: rgba(255,167,38,0.1); border: 1px solid rgba(255,167,38,0.28);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 12px;
}
.assistant-score span { color: var(--muted); font-size: 13px; }
.assistant-score b { color: var(--orange); font-size: 34px; line-height: 1; }
.btn-block { width: 100%; margin-top: 10px; }
.assistant-feedback { margin-top: 14px; }
.criteria-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.criteria-card { background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.criteria-card span { display: block; color: var(--muted); font-size: 12px; }
.criteria-card b { display: block; color: var(--orange); font-size: 20px; margin: 2px 0; }
.criteria-card small { color: var(--muted); font-size: 11px; line-height: 1.4; display: block; }
.feedback-section { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; font-size: 13px; }
.feedback-section h4 { font-size: 14px; margin-bottom: 6px; }
.feedback-section ul { padding-left: 18px; }
.feedback-section li { margin-bottom: 6px; color: var(--muted); }
.sentence-fix { background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; color: var(--muted); }
.sentence-fix b { color: var(--text); }
.revision-box { margin-top: 12px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.revision-box summary { cursor: pointer; color: var(--text); font-weight: 700; margin-bottom: 8px; }

/* ===== 口语 ===== */
.topic-card { background: var(--surface-3); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; border: 1px solid var(--border); }
.topic-card .cue { margin: 10px 0 0 0; }
.topic-card .cue li { margin-left: 20px; color: var(--muted); }
.timer-display { font-size: 40px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; color: var(--accent); margin: 10px 0; }
.timer-label { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.rec-controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.transcript-live { background: var(--surface-3); border-radius: 10px; padding: 16px; margin-top: 16px; min-height: 90px; font-size: 15px; line-height: 1.8; }
.transcript-live .interim { color: var(--muted); }

/* ===== 词汇：闪卡 ===== */
.flashcard { perspective: 1200px; height: 260px; margin-bottom: 18px; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform 0.5s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; border: 1px solid var(--border); }
.flashcard-front { background: var(--surface); }
.flashcard-back { background: var(--surface-2); transform: rotateY(180deg); }
.flashcard .word { font-size: 32px; font-weight: 700; color: var(--accent); }
.flashcard .pos { color: var(--muted); font-size: 14px; margin-top: 4px; }
.flashcard .def { font-size: 18px; margin-bottom: 12px; }
.flashcard .example { font-size: 14px; color: var(--muted); font-style: italic; }
.flashcard .hint { position: absolute; bottom: 12px; font-size: 12px; color: var(--muted); }
.fc-nav { display: flex; justify-content: space-between; align-items: center; gap: 14px; }

/* ===== Dashboard ===== */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card .sc-icon { font-size: 22px; }
.stat-card .sc-name { font-size: 13px; color: var(--muted); margin: 6px 0 2px; }
.stat-card .sc-val { font-size: 26px; font-weight: 800; }
.stat-card .sc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.skill-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.skill-row .skill-name { width: 90px; font-size: 14px; }
.skill-row .bar-bg { flex: 1; }
.skill-row .skill-val { width: 70px; text-align: right; font-size: 14px; font-weight: 600; }
.weak-tag { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,82,82,0.1); color: var(--red); padding: 8px 14px; border-radius: 10px; margin: 4px 8px 4px 0; font-size: 14px; }

/* ===== 官方资源 ===== */
.official-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: stretch;
  background: linear-gradient(135deg, rgba(0,212,255,0.12), rgba(180,120,255,0.08));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.official-hero h2 { font-size: 24px; margin: 10px 0 8px; }
.official-hero p { color: var(--muted); font-size: 14px; max-width: 70ch; }
.official-note {
  background: rgba(12,24,40,0.72); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 16px; display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.official-note b { color: var(--accent); }
.official-note span { color: var(--muted); font-size: 13px; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.resource-card {
  min-height: 210px; background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column;
  justify-content: space-between; gap: 16px;
}
.resource-card h3 { font-size: 17px; margin: 10px 0 6px; line-height: 1.35; }
.resource-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.resource-card a { text-align: center; text-decoration: none; }
.copyright-card p { color: var(--muted); font-size: 14px; }

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .reading-layout { grid-template-columns: 1fr; }
  .passage { position: static; max-height: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .practice-hero, .module-shell { grid-template-columns: 1fr; }
  .practice-side { position: static; }
  .writing-layout { grid-template-columns: 1fr; }
  .writing-assistant { position: static; }
  .official-hero { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .view { padding: 18px 14px; }
  .topbar { padding: 14px 16px; }
  .hero-meta { grid-template-columns: 1fr; }
  .ap-controls { align-items: flex-start; }
  .ap-info { min-width: 0; }
}
