:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-soft: #f2f1eb;
  --border: #e5e2d9;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-soft: #e6f7f5;
  --success: #16a34a;
  --success-soft: #ecfdf3;
  --amber: #d97706;
  --amber-bright: #f59e0b;
  --amber-soft: #fef3c7;
  --danger: #e11d48;
  --danger-soft: #fff1f2;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 6px 22px rgba(15, 23, 42, 0.05);
  --font-cn: -apple-system, BlinkMacSystemFont, "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-en: "Nunito", "Inter", "Segoe UI", -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #e9e6dc;
  color: var(--text);
  font-family: var(--font-cn);
  line-height: 1.5;
  min-height: 100%;
}

.app-shell {
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(15, 23, 42, 0.12);
}

@media (max-width: 500px) {
  body {
    background: var(--bg);
  }
  .app-shell {
    max-width: 100%;
    box-shadow: none;
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 245, 240, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--amber-soft);
  color: #b45309;
  font-weight: 800;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 999px;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.icon-btn:active {
  transform: scale(0.96);
}

.main-scroll {
  flex: 1;
  padding: 14px 14px 86px;
  overflow-y: auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.card-soft {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}

.encourage-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.encourage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 13.5px;
  color: #92400e;
  margin-bottom: 4px;
}

.encourage-text {
  font-size: 13.5px;
  color: #78350f;
  margin: 0 0 8px;
}

/* 首页主计划卡片 */
.quest-hero {
  background: linear-gradient(150deg, #0d9488 0%, #0f766e 100%);
  color: #ffffff;
  border: none;
  padding: 20px 18px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.tag-chip-dark {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.tag-chip-amber {
  background: var(--amber-soft);
  color: #b45309;
}

.tag-chip-ok {
  background: var(--success-soft);
  color: #166534;
}

.tag-chip-danger {
  background: var(--danger-soft);
  color: #9f1239;
}

.quest-title {
  margin: 10px 0 6px;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.3;
}

.quest-sub {
  margin: 0 0 14px;
  font-size: 13.5px;
  opacity: 0.94;
  line-height: 1.55;
}

.progress-track {
  width: 100%;
  height: 9px;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  overflow: hidden;
}

.progress-track-light {
  background: #e2e8f0;
}

.progress-fill {
  height: 100%;
  background: #fde047;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-fill-teal {
  background: var(--primary);
}

/* 词网关联芯片 */
.word-chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.word-pill {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 11px;
  font-family: var(--font-en);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.word-pill:active {
  transform: scale(0.96);
}

.word-pill.done {
  background: var(--success-soft);
  border-color: #86efac;
  color: #166534;
}

.word-pill.weak {
  background: var(--danger-soft);
  border-color: #fda4af;
  color: #9f1239;
}

.word-pill-zh {
  font-family: var(--font-cn);
  font-size: 12px;
  font-weight: 600;
  opacity: 0.78;
}

/* 触感按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 15px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.15s;
  font-family: inherit;
}

.btn:active {
  transform: translateY(2px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--primary-dark);
}

.btn-amber {
  background: var(--amber-bright);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--amber);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 11px;
}

/* 极简双栏底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 6px 12px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}

.nav-item {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 4px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.nav-item .nav-icon {
  font-size: 20px;
  line-height: 1.1;
}

.nav-item.active {
  color: var(--primary);
}

/* =========================================
   核心页面：主动语音带读 & 深层词网联系卡
   ========================================= */
.syllable-word {
  font-family: var(--font-en);
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.4px;
  text-align: center;
  margin: 6px 0 4px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.syllable-part {
  padding: 2px 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
}

.syllable-part.stressed {
  background: #ccfbf1;
  color: #0f766e;
  box-shadow: inset 0 -3px 0 #14b8a6;
}

.syllable-dot {
  color: #94a3b8;
  font-size: 20px;
}

.ipa-line {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-en);
  font-size: 14.5px;
  margin-bottom: 6px;
}

.meaning-big {
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 12px;
}

/* 深层联系高亮面板 */
.deep-link-box {
  background: linear-gradient(180deg, #f0fdfa 0%, #f8fafc 100%);
  border: 1.5px solid #99f6e4;
  border-radius: 16px;
  padding: 13px;
  margin-bottom: 12px;
}

.bridge-line {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.deep-text {
  font-size: 13.8px;
  color: #134e4a;
  line-height: 1.58;
  margin: 0;
}

.sibling-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.sibling-pill {
  border: 1px solid #5eead4;
  background: #ffffff;
  color: #0f766e;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.sibling-pill:active {
  transform: scale(0.95);
}

/* 主动带读教练气泡 */
.companion-bubble {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}

.companion-bubble.proactive-active {
  border-color: var(--primary);
  background: #f0fdfa;
}

.companion-bubble.nudge-shake {
  animation: gentleShake 0.45s ease;
  border-color: var(--amber-bright);
  background: #fffbeb;
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.companion-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 900;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.companion-msg {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  flex: 1;
}

/* 麦克风交互区 */
.mic-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.mic-btn {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #14b8a6, #0d9488);
  color: #ffffff;
  font-size: 30px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(13, 148, 136, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.mic-btn.ready-pulse {
  animation: pulseRing 1.5s infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.45); }
  70% { box-shadow: 0 0 0 15px rgba(13, 148, 136, 0); }
  100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0); }
}

.mic-btn.recording {
  background: linear-gradient(145deg, #f43f5e, #e11d48);
  box-shadow: 0 0 0 12px rgba(244, 63, 94, 0.2);
  transform: scale(1.06);
  animation: none;
}

.wave-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 22px;
}

.wave-bar {
  width: 5px;
  height: 6px;
  border-radius: 99px;
  background: var(--primary);
  transition: height 0.08s ease;
}

/* 通用表单 & 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  max-height: 84dvh;
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.input-field,
.select-field,
.textarea-field {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

.textarea-field {
  min-height: 80px;
  resize: vertical;
}

.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  z-index: 90;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  max-width: 90vw;
  text-align: center;
}

/* 督学端 */
.admin-shell {
  max-width: 760px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: 40px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}

.stat-num {
  font-size: 21px;
  font-weight: 900;
  color: var(--primary-dark);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
