/* ============================================================
   知行英语 · ZhiXing English Tutor — shared styles
   Warm, confidence-building palette: cream / deep teal / soft coral.
   NO harsh red anywhere — mistakes use soft amber.
   ============================================================ */

:root {
  --cream:        #FBF6EC;
  --cream-deep:   #F4ECDC;
  --card:         #FFFFFF;
  --teal:         #0E6E66;
  --teal-dark:    #0A534D;
  --teal-soft:    #E2F0EE;
  --teal-mid:     #3E9189;
  --coral:        #F08A6E;
  --coral-deep:   #E0704F;
  --coral-soft:   #FCEDE7;
  --amber:        #B07B22;
  --amber-deep:   #96650F;
  --amber-soft:   #FBF1DC;
  --amber-border: #EAD3A2;
  --ink:          #2E3B3A;
  --muted:        #75847F;
  --line:         #ECE3D2;
  --shadow:       0 6px 24px rgba(46, 59, 58, 0.07);
  --shadow-lift:  0 10px 32px rgba(46, 59, 58, 0.12);
  --radius:       18px;
  --radius-sm:    12px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  font-size: 16px;
}

img { max-width: 100%; }

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); }

::selection { background: var(--teal-soft); }

/* ---------- layout ---------- */

.container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 22px 18px 80px;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(12, 1fr);
}
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }

@media (max-width: 760px) {
  .col-8, .col-6, .col-4 { grid-column: span 12; }
}

/* ---------- top nav ---------- */

.zx-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 246, 236, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1020px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal), var(--teal-mid));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 19px;
  box-shadow: var(--shadow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: var(--teal-dark); font-size: 16px; }
.brand-text small { color: var(--muted); font-size: 10.5px; letter-spacing: 0.04em; }

.nav-links {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 12px;
  border-radius: 12px;
  white-space: nowrap;
  color: var(--ink);
  line-height: 1.25;
  transition: background 0.15s ease;
}
.nav-link small { font-size: 10px; color: var(--muted); }
.nav-link:hover { background: var(--teal-soft); color: var(--teal-dark); }
.nav-link.active { background: var(--teal); color: #fff; }
/* logout: an action, styled like a quiet nav link with an amber accent on hover */
.nav-logout { opacity: .85; }
.nav-logout:hover { background: var(--amber-soft); color: var(--amber-deep); }

/* segmented control (shared: coach subject tabs, subject page 题型/题量) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: none; background: var(--card); padding: 6px 12px; cursor: pointer; font-size: 13.5px; color: var(--ink); border-right: 1px solid var(--line); font-family: var(--font); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--teal); color: #fff; }
.nav-link.active small { color: rgba(255,255,255,0.75); }

@media (max-width: 640px) {
  .brand-text small { display: none; }
  .nav-link { padding: 5px 10px; font-size: 14px; }
}

/* ---------- headings & text ---------- */

.page-head { margin: 8px 0 20px; }
.page-head h1 { font-size: 26px; color: var(--teal-dark); font-weight: 700; }
.page-head .en-sub {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.page-head .lede { color: var(--muted); margin-top: 6px; font-size: 14.5px; }

.section-title {
  font-size: 18px;
  color: var(--teal-dark);
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.section-title small { color: var(--muted); font-size: 11.5px; font-weight: 400; letter-spacing: 0.04em; }

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

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  border: 1px solid rgba(236, 227, 210, 0.6);
}

.card.tinted { background: linear-gradient(160deg, #FFFFFF 30%, var(--teal-soft)); }
.card.coral-tint { background: linear-gradient(160deg, #FFFFFF 30%, var(--coral-soft)); }

.card + .card { margin-top: 18px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 15px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: var(--teal-soft);
  color: var(--teal-dark);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  user-select: none;
  line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }

.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover { background: var(--coral-deep); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--teal-mid); color: var(--teal-dark); }

.btn-amber { background: var(--amber-soft); color: var(--amber-deep); border-color: var(--amber-border); }

.btn-big {
  font-size: 17px;
  padding: 14px 34px;
  font-weight: 600;
}

.btn-block { width: 100%; }

.btn-sm { font-size: 13px; padding: 6px 14px; }

.btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-family: var(--font); font-size: 13.5px;
  padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:hover { color: var(--teal-dark); }

/* ---------- chips / badges / dots ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.chip.coral { background: var(--coral-soft); color: var(--coral-deep); }
.chip.amber { background: var(--amber-soft); color: var(--amber-deep); }
.chip.plain { background: var(--cream-deep); color: var(--muted); }

.sev-dots { display: inline-flex; gap: 3px; align-items: center; }
.sev-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cream-deep);
}
.sev-dot.on-1 { background: #E8C277; }
.sev-dot.on-2 { background: #E5A04F; }
.sev-dot.on-3 { background: var(--coral); }

/* ---------- stat tiles ---------- */

.stat-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat-tile {
  flex: 1 1 110px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: center;
}
.stat-tile .num { font-size: 24px; font-weight: 700; color: var(--teal-dark); line-height: 1.2; }
.stat-tile .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-tile.coral .num { color: var(--coral-deep); }
.stat-tile.clickable {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
.stat-tile.clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow); background: var(--cream-deep); }
.stat-tile.clickable:focus-visible { outline: 2px solid var(--teal-mid); outline-offset: 2px; }

/* ---------- word list (bucket viewer) ---------- */

.word-list li { padding: 10px 0; }
.word-list .word-en { font-weight: 600; color: var(--teal-dark); font-size: 15px; }

/* ---------- progress ring ---------- */

.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring-box { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.ring-box svg { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--cream-deep); stroke-width: 11; }
.ring-bar {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-center .big { font-size: 30px; font-weight: 700; color: var(--teal-dark); line-height: 1.1; }
.ring-center .sub { font-size: 11.5px; color: var(--muted); }

/* ---------- progress bar ---------- */

.bar {
  height: 10px;
  background: var(--cream-deep);
  border-radius: 999px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-mid), var(--teal));
  transition: width 0.4s ease;
}
.bar.coral > span { background: linear-gradient(90deg, var(--coral), var(--coral-deep)); }

/* ---------- lists ---------- */

.list-plain { list-style: none; }
.list-plain li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.list-plain li:last-child { border-bottom: none; }

/* ---------- forms ---------- */

label.fld { display: block; margin-bottom: 12px; }
label.fld .fld-name { font-size: 13.5px; color: var(--muted); margin-bottom: 4px; display: block; }

input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--teal-mid); }
textarea { resize: vertical; min-height: 84px; }

/* ---------- feedback boxes ---------- */

.note-box {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14.5px;
  margin: 10px 0;
}
.note-teal  { background: var(--teal-soft); color: var(--teal-dark); }
.note-amber { background: var(--amber-soft); color: var(--amber-deep); border: 1px solid var(--amber-border); }
.note-coral { background: var(--coral-soft); color: var(--coral-deep); }
.note-plain { background: var(--cream-deep); color: var(--muted); }

.error-card {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--amber-deep);
}
.error-card p { margin-bottom: 12px; }

/* ---------- toast ---------- */

.zx-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  background: var(--teal-dark);
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  pointer-events: none;
  max-width: 90vw;
}
.zx-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.zx-toast.amber { background: var(--amber-deep); }

/* ---------- flashcards (vocab) ---------- */

.flash-stage { perspective: 1200px; max-width: 460px; margin: 0 auto; }
.flash-card {
  position: relative;
  width: 100%;
  min-height: 280px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.1, 0.2, 1);
  cursor: pointer;
}
.flash-card.flipped { transform: rotateY(180deg); }
.flash-card.context-card { min-height: 350px; }
.flash-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  border: 1px solid rgba(236,227,210,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px;
  text-align: center;
  overflow-y: auto;
}
.flash-face.back { transform: rotateY(180deg); background: linear-gradient(160deg, #fff 30%, var(--teal-soft)); }
.flash-word { font-size: 34px; font-weight: 700; color: var(--teal-dark); }
/* smaller headword echoed on the card back so word + 音标 + meaning are seen together */
.flash-word-sm { font-size: 22px; font-weight: 700; color: var(--teal-dark); }
.flash-pos { color: var(--muted); font-size: 13px; margin-top: 4px; font-style: italic; }
.flash-zh { font-size: 24px; font-weight: 600; color: var(--teal-dark); }
.flash-example { margin-top: 14px; font-size: 15px; color: var(--ink); }
.flash-example-zh { font-size: 13px; color: var(--muted); margin-top: 4px; }
.flash-face.context-front, .flash-face.context-back { justify-content: flex-start; padding-top: 24px; overflow-y: auto; }
.flash-context-example, .flash-translation, .flash-memory {
  width: 100%; margin-top: 16px; padding: 12px 14px; border-radius: 10px;
  text-align: left; line-height: 1.65;
}
.flash-context-example { background: rgba(39,121,114,.07); font-family: Georgia, 'Times New Roman', serif; font-size: 17px; }
.flash-translation { background: rgba(255,255,255,.64); color: var(--ink); font-size: 14px; }
.flash-memory { background: var(--amber-soft); color: var(--ink); font-size: 14px; }
.flash-context-label { display: block; margin-bottom: 3px; color: var(--teal); font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.flash-context-pending { margin-top: 18px; padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); color: var(--muted); font-size: 13px; }
.flash-hint { margin-top: 18px; font-size: 12.5px; color: var(--muted); }
/* WordRabbit additions: phonetic on the front, etymology breakdown on the back */
.flash-phon { color: var(--muted); font-size: 15px; margin-top: 6px; font-family: Georgia, 'Times New Roman', serif; }
.flash-etym { margin-top: 12px; font-size: 13.5px; color: var(--teal); line-height: 1.6; background: rgba(0,0,0,.03); border-radius: 8px; padding: 8px 10px; }
/* on-page AI helper */
#ai-panel .ai-render { font-size: 14px; line-height: 1.7; color: var(--ink); }
#ai-panel .ai-render p { margin: 6px 0; }
#ai-panel .ai-ask { padding: 7px 10px; border: 1px solid var(--line, #e2ddd0); border-radius: 8px; font-size: 14px; }
.ai-out { min-height: 4px; }

.grade-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 460px;
  margin: 18px auto 0;
}
.grade-btn {
  font-family: var(--font);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.grade-btn small { font-size: 10.5px; opacity: 0.75; }
.grade-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.grade-btn.g1 { background: var(--amber-soft); color: var(--amber-deep); border-color: var(--amber-border); }
.grade-btn.g3 { background: var(--cream-deep); color: var(--ink); }
.grade-btn.g4 { background: var(--teal-soft); color: var(--teal-dark); }
.grade-btn.g5 { background: var(--teal); color: #fff; }

@media (max-width: 420px) {
  .grade-row { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- session stepper & timer ---------- */

.stepper { display: flex; gap: 8px; margin: 14px 0 20px; }
.step {
  flex: 1;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.step .s-name { font-weight: 600; font-size: 14px; }
.step .s-min { font-size: 11.5px; color: var(--muted); }
.step.active { border-color: var(--teal); background: var(--teal-soft); }
.step.active .s-name { color: var(--teal-dark); }
.step.done { border-color: var(--teal-mid); background: #fff; }
.step.done .s-name::after { content: " ✓"; color: var(--teal-mid); }

.timer-bar {
  position: sticky;
  top: 62px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.timer-num { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 19px; color: var(--teal-dark); }
.timer-bar.overtime .timer-num { color: var(--amber-deep); }
.timer-label { font-size: 13px; color: var(--muted); flex: 1; }

/* ---------- exercise (questions) ---------- */

.passage {
  white-space: pre-wrap;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  font-size: 15.5px;
  line-height: 1.8;
  margin: 12px 0;
}

.q-block { padding: 14px 0; border-top: 1px dashed var(--line); }
.q-text { font-weight: 600; margin-bottom: 10px; }
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt-btn {
  font-family: var(--font);
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 14.5px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  color: var(--ink);
}
.opt-btn:hover { border-color: var(--teal-mid); }
.opt-btn.correct { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); font-weight: 600; }
.opt-btn.almost { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber-deep); }
.opt-btn:disabled { cursor: default; }

.q-feedback { margin-top: 8px; font-size: 14px; border-radius: var(--radius-sm); padding: 8px 14px; display: none; }
.q-feedback.show { display: block; }
.q-feedback.good { background: var(--teal-soft); color: var(--teal-dark); }
.q-feedback.soft { background: var(--amber-soft); color: var(--amber-deep); }

.reveal-panel {
  margin-top: 10px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14.5px;
}

details.fold {
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin: 12px 0;
}
details.fold summary { cursor: pointer; color: var(--teal-dark); font-weight: 600; font-size: 14.5px; }
details.fold[open] summary { margin-bottom: 8px; }
details.fold pre {
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- rating ---------- */

.rate-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rate-btn {
  font-family: var(--font);
  flex: 1 1 70px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  cursor: pointer;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.3;
  transition: border-color 0.15s ease, background 0.15s ease;
  color: var(--ink);
}
.rate-btn .r-num { font-size: 18px; font-weight: 700; display: block; color: var(--muted); }
.rate-btn.on { border-color: var(--teal); background: var(--teal-soft); }
.rate-btn.on .r-num { color: var(--teal-dark); }

/* ---------- celebration overlay ---------- */

.celebrate-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(165deg, rgba(251,246,236,0.97), rgba(226,240,238,0.97));
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  animation: fadeIn 0.4s ease;
}
.celebrate-inner {
  max-width: 520px;
  width: 100%;
  text-align: center;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-lift);
  padding: 38px 30px;
  position: relative;
  z-index: 2;
  animation: popUp 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.celebrate-inner h2 { color: var(--teal-dark); font-size: 28px; margin-bottom: 10px; }
.celebrate-inner .enc { font-size: 16.5px; margin: 12px 0 18px; }

.confetti {
  position: absolute;
  top: -16px;
  width: 10px; height: 16px;
  border-radius: 3px;
  opacity: 0.9;
  animation: confettiFall linear forwards;
  z-index: 1;
}

@keyframes confettiFall {
  0%   { transform: translateY(-5vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(108vh) rotate(720deg); opacity: 0.4; }
}
@keyframes popUp {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- chat (coach) ---------- */

.chat-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 320px;
  max-height: 56vh;
  overflow-y: auto;
  padding: 6px 2px;
}
.bubble {
  max-width: 84%;
  padding: 11px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.7;
  word-break: break-word;
}
.bubble.user {
  align-self: flex-end;
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.bubble.coach {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow);
}
.bubble-name { font-size: 11.5px; color: var(--muted); margin: 0 8px 2px; }
.bubble-name.right { align-self: flex-end; }

.typing-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal-mid);
  animation: blink 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat-input-row { display: flex; gap: 10px; margin-top: 14px; }
.chat-input-row textarea { flex: 1; min-height: 48px; max-height: 130px; }

/* ---------- coach: two-pane day browser ---------- */

.coach-shell { display: flex; gap: 0; padding: 0; overflow: hidden; }

.coach-pane-left {
  width: 232px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--cream);
  padding: 16px 12px;
  max-height: 74vh;
  overflow-y: auto;
}
.coach-pane-right {
  flex: 1;
  min-width: 0;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}

.day-list-head {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  padding: 2px 6px 10px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.day-list-head small { font-size: 10.5px; font-weight: 400; letter-spacing: 0.04em; }

.day-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.day-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.day-item:hover { background: var(--teal-soft); }
.day-item.active { background: var(--teal-soft); border-color: var(--teal-mid); }
.di-date {
  font-weight: 600;
  color: var(--teal-dark);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.di-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  flex-shrink: 0;
}
.di-badge.archived { background: var(--cream-deep); color: var(--muted); }
.di-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.coach-pane-right .chat-box { max-height: 56vh; }

.day-banner-today {
  padding: 8px 12px 12px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 10px;
}
.day-banner-today strong { color: var(--teal-dark); font-size: 15px; }

/* archived-day summary card */
.day-summary {
  background: linear-gradient(160deg, #fff 30%, var(--teal-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.ds-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--teal-dark);
  font-weight: 600;
  font-size: 14.5px;
}
.ds-head small { color: var(--muted); font-size: 10.5px; font-weight: 400; letter-spacing: 0.05em; }
.ds-text { font-size: 14px; margin: 8px 0 10px; }
.ds-label {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  padding-left: 8px;
  border-left: 3px solid var(--teal-mid);
  color: var(--teal-dark);
}
.ds-label.coral { border-left-color: var(--coral); color: var(--coral-deep); }
.ds-label.amber { border-left-color: var(--amber-border); color: var(--amber-deep); }
.ds-list { margin: 2px 0 0; padding-left: 8px; }
.ds-list li { border-bottom: none; padding: 2px 0; }

/* usage & cost */
.usage-summary { cursor: pointer; color: var(--teal-dark); font-weight: 600; font-size: 16px; list-style: revert; }
.usage-summary small { color: var(--muted); font-size: 11.5px; font-weight: 400; letter-spacing: 0.04em; margin-left: 6px; }
.usage-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.usage-table-wrap { overflow-x: auto; margin-top: 12px; }
.usage-table { width: 100%; border-collapse: collapse; }
.usage-table th, .usage-table td { text-align: left; padding: 6px 10px; border-bottom: 1px dashed var(--line); white-space: nowrap; }
.usage-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.usage-table td.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; color: var(--teal-dark); }

@media (max-width: 760px) {
  .coach-shell { flex-direction: column; }
  .coach-pane-left {
    width: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .day-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .day-item { flex: 0 0 auto; min-width: 150px; }
  .di-sub { -webkit-line-clamp: 1; }
}

/* ---------- upload ---------- */

.drop-zone {
  border: 2px dashed var(--amber-border);
  background: var(--cream);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--teal-mid); background: var(--teal-soft); }
.drop-zone .dz-icon { font-size: 34px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.thumb {
  position: relative;
  width: 86px; height: 86px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--cream-deep);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(46,59,58,0.65);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

/* ---------- weakness / upgrade list ---------- */

.weak-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px dashed var(--line);
  align-items: flex-start;
  flex-wrap: wrap;
}
.weak-item:first-child { border-top: none; }
.weak-main { flex: 1; min-width: 220px; }
.weak-area { font-weight: 600; color: var(--teal-dark); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.weak-desc { font-size: 14px; margin-top: 3px; }
.weak-evid { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.weak-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.weak-actions .btn { padding: 6px 14px; font-size: 13px; }

/* ---------- misc ---------- */

.divider { border: none; border-top: 1px dashed var(--line); margin: 18px 0; }

.skeleton {
  background: linear-gradient(90deg, var(--cream-deep) 25%, #fff 50%, var(--cream-deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  min-height: 18px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.fade-in { animation: fadeIn 0.35s ease; }

footer.zx-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 26px 0 34px;
}
.zx-build { opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ---------- vocab sprint coverage banner ---------- */
.plan-banner {
  display: flex; align-items: center; flex-wrap: wrap;
  font-size: 13px; color: var(--teal-dark);
  background: var(--teal-soft); border-radius: var(--radius-sm);
  padding: 9px 12px; line-height: 1.5;
}
.plan-banner.amber { background: var(--amber-soft); color: var(--amber-deep); }

/* ---------- "already know" meaning quiz ---------- */
.quiz-word { font-size: 30px; font-weight: 700; color: var(--teal-dark); text-align: center; margin: 4px 0 16px; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
  font-family: var(--font); font-size: 15px; text-align: left;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--cream); color: var(--ink);
  cursor: pointer; transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.quiz-opt:hover { transform: translateY(-1px); border-color: var(--teal-mid); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); }
.quiz-opt.wrong { background: var(--coral-soft); border-color: var(--coral); color: var(--coral-deep); }

/* 补全词根 fill-in: the masked word with one underscore slot per missing letter.
   Slots share the fixed letters' serif font/size; a typed letter is black when it
   matches the answer, red when it doesn't (live). */
.spell-word { display: flex; align-items: flex-end; justify-content: center; gap: 5px; margin-top: 10px;
  font-size: 30px; font-weight: 700; color: var(--teal-dark); font-family: Georgia, 'Times New Roman', serif; line-height: 1.15; }
.spell-fixed { letter-spacing: 1px; }
.spell-slots { display: inline-flex; align-items: flex-end; gap: 6px; }
/* NB: selectors are qualified with input. so they out-weigh the base
   input[type="text"] rule (which would otherwise force 15px + a full border). */
.spell-word input.spell-cell {
  font: inherit;                     /* same big serif family/size/weight as the fixed letters */
  width: 1em; height: auto; text-align: center; color: var(--ink); letter-spacing: 0;
  border: none; border-bottom: 3px solid var(--teal-mid); border-radius: 0;
  background: transparent; padding: 0 0 3px; margin: 0; outline: none; caret-color: var(--teal); box-shadow: none;
}
.spell-word input.spell-cell:focus { border-bottom-color: var(--teal); }
.spell-word input.spell-cell.ok  { color: #111; }              /* correct letter → black */
.spell-word input.spell-cell.bad { color: var(--coral-deep); } /* wrong letter → red */
.spell-word input.spell-cell:disabled { -webkit-text-fill-color: currentColor; opacity: 1; }
.spell-hint { color: var(--teal); font-size: 14px; }

/* ============================================================
   句子精讲 sentence card — shared by study.html (句子精讲 page) and
   session.html (今日学习 · sentence part). Rendered by js/sentenceCard.js.
   ============================================================ */
.sentence-card { margin: 4px 0; }
.st-badge { display:inline-block; background:var(--teal-soft); color:var(--teal-dark); font-weight:700; font-size:.78rem; border-radius:8px; padding:2px 10px; margin-bottom:10px; font-variant-numeric:tabular-nums; }
.st-en { font-family: Georgia, "Times New Roman", serif; font-size:1.5rem; line-height:1.5; color:var(--ink); margin:4px 0; }
.st-zh { color:var(--muted); font-size:1.02rem; margin-bottom:14px; }
.st-grammar-chips { display:flex; flex-wrap:wrap; gap:7px; margin:10px 0; }
.gchip { background:var(--teal-soft); color:var(--teal-dark); border-radius:999px; padding:3px 12px; font-size:.82rem; font-weight:600; }
.st-note { background:var(--cream); border:1px solid var(--line); border-radius:var(--radius-sm); padding:12px 14px; font-size:.93rem; color:var(--ink); line-height:1.7; margin:12px 0; }
.st-note strong { color:var(--teal-dark); }

/* audio player — teal, on-brand */
.ap { display:flex; align-items:center; gap:14px; background:linear-gradient(135deg, var(--teal-soft), var(--cream-deep)); border:1px solid var(--line); border-radius:var(--radius-sm); padding:14px 16px; margin:14px 0; }
.ap-btn { flex:none; width:50px; height:50px; border-radius:50%; border:none; background:var(--teal); color:#fff; font-size:1.15rem; cursor:pointer; display:flex; align-items:center; justify-content:center; box-shadow:0 3px 10px rgba(14,110,102,.35); transition:transform .1s; }
.ap-btn:active { transform:scale(.93); }
.ap-main { flex:1; min-width:0; }
.ap-track { position:relative; height:8px; border-radius:4px; background:rgba(14,110,102,.15); cursor:pointer; }
.ap-fill { position:absolute; left:0; top:0; bottom:0; border-radius:4px; background:linear-gradient(90deg, var(--teal), var(--teal-mid)); width:0; }
.ap-thumb { position:absolute; top:50%; width:16px; height:16px; border-radius:50%; background:#fff; border:2px solid var(--teal); transform:translate(-50%,-50%); left:0; box-shadow:0 1px 4px rgba(46,59,58,.3); }
.ap-meta { display:flex; justify-content:space-between; font-size:.78rem; color:var(--muted); margin-top:7px; font-variant-numeric:tabular-nums; }
.ap-speed { flex:none; background:var(--card); border:1px solid var(--line); border-radius:999px; padding:4px 12px; font-size:.8rem; cursor:pointer; color:var(--teal-dark); font-weight:600; }

.st-section-h { font-weight:700; color:var(--teal-dark); margin:20px 0 8px; padding-bottom:5px; border-bottom:2px solid var(--teal-soft); }
.theme-h { font-weight:600; color:var(--amber-deep); margin:16px 0 4px; }
.wrow { display:flex; gap:9px; align-items:baseline; padding:7px 0; border-bottom:1px solid var(--line); flex-wrap:wrap; }
.wrow .w { font-weight:700; color:var(--ink); }
.wrow .ph { color:var(--teal-mid); font-size:.86rem; }
.wrow .ps { color:var(--muted); font-style:italic; font-size:.84rem; }
.wrow .mn { color:var(--ink); font-size:.92rem; }

.st-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:18px; }
.quiz-q { padding:12px 0; border-top:1px solid var(--line); }
.quiz-opt { display:block; width:100%; text-align:left; margin:6px 0; padding:10px 13px; border:1px solid var(--line); border-radius:10px; background:var(--card); cursor:pointer; transition:background .12s; }
.quiz-opt:hover { background:var(--cream); }
.quiz-opt.ok { background:var(--teal-soft); border-color:var(--teal-mid); color:var(--teal-dark); font-weight:600; }
.quiz-opt.no { background:var(--amber-soft); border-color:var(--amber-border); color:var(--amber-deep); }   /* never harsh red */
.ai-render { margin-top:12px; background:var(--cream); border:1px solid var(--line); border-radius:var(--radius-sm); padding:14px 16px; font-size:.94rem; line-height:1.75; }
.ai-render h3 { color:var(--teal-dark); font-size:1rem; margin:12px 0 4px; }
.ai-render h4 { color:var(--amber-deep); font-size:.92rem; margin:10px 0 3px; }
.ai-render p { margin:6px 0; }
.ai-render ul { margin:6px 0 6px 20px; }
.ai-render li { margin:3px 0; }
.ai-render strong { color:var(--ink); }
.ai-render code { background:var(--teal-soft); border-radius:5px; padding:1px 5px; font-family:Georgia,serif; }
