/* Scenes · 情景小课 — LingoFruit Chinese
 * Layered over /tokens.css and /site.css. */

/* ---- Hero (home) ---- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.85fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  padding: clamp(32px, 5vw, 64px) 0 var(--s-6);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-h1);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: var(--s-3) 0 var(--s-4);
}

.art {
  padding: var(--s-6);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  min-height: 260px;
}

.sheet {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  width: min(100%, 260px);
  padding: var(--s-5);
  text-align: center;
}

.sheet .han {
  width: 108px;
  height: 108px;
  margin: var(--s-3) auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--gridline);
  border-radius: var(--r-sm);
  background:
    linear-gradient(90deg, transparent 49.5%, var(--gridline) 50%, transparent 50.5%),
    linear-gradient(transparent 49.5%, var(--gridline) 50%, transparent 50.5%),
    var(--surface);
  font-family: var(--font-zh);
  font-size: 64px;
  line-height: 1;
}

.sheet b { color: var(--ochre); }

/* mini decorative sheet (scene header) */
.art-mini { min-height: 0; padding: var(--s-3); border-radius: var(--r-md); }
.sheet-mini { width: 150px; padding: var(--s-3); }
.sheet-mini .han { width: 64px; height: 64px; font-size: 38px; margin: 6px auto; }
.sheet-mini b { color: var(--ochre); font-size: var(--text-sm); }

/* ---- Progress overview ---- */
.overview {
  border-top: 1px solid var(--rule);
  padding: var(--s-5) 0 var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.overview .stat {
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.overview .stat b {
  color: var(--accent);
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
}

.bar {
  flex: 1 1 200px;
  height: 8px;
  appearance: none;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  overflow: hidden;
}

.bar::-webkit-progress-bar {
  background: var(--surface-3);
  border-radius: var(--r-sm);
}

.bar::-webkit-progress-value {
  background: var(--accent);
  border-radius: var(--r-sm);
}

.bar::-moz-progress-bar {
  background: var(--accent);
  border-radius: var(--r-sm);
}

/* ---- Scene grid ---- */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-5);
  padding: var(--s-3) 0 var(--s-6);
}

.scene-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-6);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.scene-card:hover {
  border-color: var(--accent-mid);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.scene-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-2);
}

.scene-card .num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ochre);
}

.scene-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--accent);
}

.scene-card .icon svg {
  width: 20px;
  height: 20px;
}

.scene-card h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.625rem;
  line-height: 1.18;
  margin: 0;
  color: var(--ink);
}

.scene-card .zh {
  font-family: var(--font-zh);
  color: var(--accent-mid);
  font-weight: 500;
  margin: 0;
}

.scene-card .desc {
  color: var(--ink-2);
  font-size: var(--text-sm);
  margin: var(--s-1) 0 var(--s-4);
  flex: 1 0 auto;
}

.pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  background: var(--surface-2);
}

.pill.done { color: var(--ok); border-color: var(--ok-rule); background: var(--ok-bg); }
.pill.progress { color: var(--ochre); border-color: var(--ochre-rule); background: var(--ochre-soft); }

/* ---- Scene detail ---- */
.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: var(--s-4) 0 0;
  color: var(--accent);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
}

.backlink:hover { text-decoration: underline; }

.scene-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
  flex-wrap: wrap;
  padding: var(--s-3) 0 var(--s-3);
}

.scene-head-title {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.scene-head-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--accent);
  flex-shrink: 0;
}

.scene-head-ico svg { width: 24px; height: 24px; }

.scene-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-h1);
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 0;
}

.scene-head .zh {
  display: block;
  margin-top: 6px;
  font-family: var(--font-zh);
  color: var(--accent-mid);
  font-size: 1.5rem;
  font-weight: 500;
}

.intro {
  max-width: 62ch;
  color: var(--ink-2);
  font-size: var(--text-lead);
  margin: var(--s-3) 0 0;
}

/* ---- Toolbar / pinyin toggle ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin: var(--s-5) 0 var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}

.toolbar .lbl {
  font-size: var(--text-xs);
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pinyin-toggle {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pinyin-toggle button {
  min-height: 44px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  color: var(--ink-2);
  padding: 0 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
}

.pinyin-toggle button:hover { border-color: var(--accent-mid); color: var(--ink); }
.pinyin-toggle button.active { background: var(--accent); color: var(--surface); border-color: var(--accent); }

/* Pinyin display modes: html[data-pinyin] */
html[data-pinyin="hanzi"] .pyline, html[data-pinyin="hanzi"] .dl-py { display: none !important; }
html[data-pinyin="pinyin"] .hanline, html[data-pinyin="pinyin"] .dl-zh { display: none !important; }

/* ---- Sections ---- */
section.block { margin: var(--s-7) 0 0; }

.section-title {
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 var(--s-4);
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}

.section-title .zh {
  color: var(--ochre);
  font-family: var(--font-zh);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ---- Chunks ---- */
.chunks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--s-4);
}

.chunk {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chunk-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: var(--s-5) var(--s-4) var(--s-4);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: center;
  transition: background var(--t-fast) var(--ease);
}

.chunk-main:hover { background: var(--paper); }

.chunk .speaker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--ink-4);
  margin-bottom: 4px;
}

.chunk .hanline {
  font-family: var(--font-zh);
  font-size: 2rem;
  line-height: 1.25;
  color: var(--ink);
}

.chunk .pyline {
  color: var(--ochre);
  font-weight: 600;
  font-size: var(--text-sm);
}

.chunk .enline {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.chunk .exline {
  color: var(--ink-3);
  font-family: var(--font-zh);
  font-size: 13px;
  margin-top: var(--s-2);
  border-top: 1px solid var(--rule-soft);
  padding-top: var(--s-2);
  width: 100%;
}

.chunk .star {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ochre);
  border-radius: var(--r-sm);
}

.chunk .star:hover { background: var(--ochre-soft); }
.chunk .star.off { color: var(--ink-4); }

.hint {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--ink-3);
  font-size: var(--text-sm);
  margin: var(--s-3) 0 0;
}

.hint svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---- Dialogue ---- */
.dialogue {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.dl-line {
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.dl-line:hover {
  border-color: var(--accent-mid);
  background: var(--paper);
}

.dl-who {
  flex: 0 0 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--surface);
  background: var(--accent);
}

.dl-line.b .dl-who { background: var(--ochre); }

.dl-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dl-zh { font-family: var(--font-zh); font-size: var(--zh-body); line-height: 1.45; color: var(--ink); }
.dl-py { color: var(--ochre); font-weight: 500; font-size: var(--text-sm); }
.dl-en { color: var(--ink-3); font-size: var(--text-sm); }

/* ---- Grammar chips ---- */
.grammar { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.gram {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  text-decoration: none;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 0 14px;
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.gram:hover { border-color: var(--accent-mid); background: var(--accent-soft); }
.gram .zh { color: var(--ink-3); font-family: var(--font-zh); font-weight: 400; }
.gram-note { color: var(--ink-3); font-size: var(--text-sm); margin: var(--s-3) 0 0; }

/* ---- Quiz ---- */
.quiz {
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  padding: clamp(20px, 4vw, 32px);
  margin-top: var(--s-3);
  box-shadow: var(--shadow-sm);
}

.q-head {
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ochre);
}

.q-en {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 2.6vw, 1.75rem);
  margin: var(--s-3) 0 4px;
  color: var(--ink);
}

.q-sub { color: var(--ink-3); font-size: var(--text-sm); margin: 0 0 var(--s-4); }

.build-area {
  min-height: 68px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
  padding: var(--s-3);
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--r-md);
  background: var(--paper);
}

.build-placeholder { color: var(--ink-4); font-size: var(--text-sm); }

.token {
  min-height: 44px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-family: var(--font-zh);
  font-size: 1.125rem;
  cursor: pointer;
  font-weight: 500;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.token:hover { border-color: var(--accent-mid); background: var(--accent-soft); }
.token.built { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--accent); }

.bank {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: var(--s-4) 0 var(--s-2);
  min-height: 44px;
  align-items: center;
}

.bank-empty { color: var(--ink-4); font-size: var(--text-sm); }
.quiz-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-4); }

/* ---- Feedback ---- */
.feedback { margin-top: var(--s-4); min-height: 28px; }
.feedback.checking { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-3); font-size: var(--text-sm); }

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  flex: 0 0 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.feedback.correct,
.feedback.wrong {
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
}

.feedback.correct { background: var(--ok-bg); border: 1px solid var(--ok-rule); }
.feedback.wrong { background: var(--err-bg); border: 1px solid var(--err-rule); }

.fb-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: var(--text-base);
  margin-bottom: var(--s-2);
}

.feedback.correct .fb-title { color: var(--ok); }
.feedback.wrong .fb-title { color: var(--err); }
.fb-label { font-size: var(--text-sm); color: var(--ink-3); margin-bottom: var(--s-2); }

.replay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  padding: 6px 14px;
  font-family: var(--font-zh);
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--ink);
}

.replay:hover { border-color: var(--accent-mid); }
.fb-py { color: var(--ochre); font-weight: 600; font-size: var(--text-sm); margin-top: var(--s-2); }
.fb-en { color: var(--ink-2); font-size: var(--text-sm); margin-top: 2px; }
.fb-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-4); }

/* ---- Completion ---- */
.complete {
  text-align: center;
  padding: clamp(28px, 5vw, 48px) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  margin-top: var(--s-4);
}

.complete .big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--ok-bg);
  color: var(--ok);
  margin-bottom: var(--s-3);
}

.complete .big svg { width: 28px; height: 28px; }
.complete h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--text-h2); margin: 0 0 var(--s-2); }
.complete p { color: var(--ink-2); margin: 0 0 var(--s-2); }
.complete .score { color: var(--accent); font-weight: 700; }
.complete .actions { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; margin-top: var(--s-5); }

/* ---- Scene actions (export) ---- */
.scene-actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin: var(--s-7) 0 0;
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}

.scene-actions p {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--text-sm);
  flex: 1 1 240px;
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--s-5);
  }

  .art {
    min-height: 0;
    padding: var(--s-5);
  }

  .scene-grid {
    grid-template-columns: 1fr;
  }

  .chunks {
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
    gap: var(--s-3);
  }

  .dl-line {
    padding: var(--s-3) var(--s-4);
  }

  .dl-zh {
    font-size: 1.125rem;
  }
}

.gram-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chunk-links {
  display: flex;
  gap: 6px;
  padding: 0 12px 10px;
  flex-wrap: wrap;
}
