:root {
  --bg: #0e0f13;
  --bg-elev: #181a22;
  --fg: #e9eaf0;
  --fg-dim: #9aa0b0;
  --line: #2a2d39;
  --accent: #ffb84a;
  --accent-2: #ff5d8f;
  --ok: #4ade80;
  --bad: #f87171;
  --radius: 14px;
  --max-w: 760px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

main#root {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 18px 80px;
  min-height: calc(100vh - 60px);
}

.site-footer {
  text-align: center;
  font-size: 12px;
  color: var(--fg-dim);
  padding: 18px 12px 28px;
  border-top: 1px solid var(--line);
}

/* loading */
.loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 120px 0 60px; color: var(--fg-dim);
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
  margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* shared */
h1.title { font-size: 32px; margin: 0 0 4px; letter-spacing: 1px; }
.title-sub {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--fg-dim);
  opacity: 0.78;
  text-transform: uppercase;
  font-style: italic;
}
h2 { font-size: 22px; margin: 28px 0 12px; }
h3 { font-size: 17px; margin: 18px 0 8px; }
p  { line-height: 1.7; color: var(--fg); }
.subtitle { color: var(--fg-dim); margin-bottom: 18px; line-height: 1.7; }

/* Rotating dynamic-content tip strip. Fades between tips every 6s. */
.tip-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(255,184,74,0.08), rgba(255,93,143,0.08));
  border: 1px solid rgba(255,184,74,0.22);
  border-radius: 10px;
  font-size: 13px;
  color: var(--fg);
  overflow: hidden;
}
.tip-strip .tip-icon {
  flex: 0 0 auto;
  font-size: 14px;
  filter: saturate(1.2);
}
.tip-strip .tip-text {
  flex: 1;
  min-width: 0;
  line-height: 1.55;
  transition: opacity .28s ease, transform .28s ease;
  opacity: 1;
  transform: translateY(0);
}
.tip-strip .tip-text.tip-fading {
  opacity: 0;
  transform: translateY(-4px);
}

/* Inline dynamic-content badge next to section headers. */
.dyn-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: rgba(255,184,74,0.10);
  border: 1px solid rgba(255,184,74,0.32);
  border-radius: 999px;
  vertical-align: middle;
  cursor: help;
}
.dyn-countdown {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.6px;
}
.dyn-countdown.dyn-soon {
  color: var(--accent-2);
  background: rgba(255,93,143,0.12);
  border-color: rgba(255,93,143,0.45);
  animation: dyn-pulse 1.4s ease-in-out infinite;
}
.dyn-countdown.dyn-rotating {
  color: #fff;
  background: linear-gradient(90deg, rgba(255,184,74,0.55), rgba(255,93,143,0.55));
  border-color: transparent;
  animation: dyn-pulse 1.0s ease-in-out infinite;
}
@keyframes dyn-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* Custom-style hint rotating example */
.custom-hint-eg {
  display: inline-block;
  color: var(--accent);
  transition: opacity .22s ease, transform .22s ease;
  opacity: 1;
  transform: translateY(0);
  font-variant-numeric: tabular-nums;
}
.custom-hint-eg.hint-eg-fading {
  opacity: 0;
  transform: translateY(-3px);
}

button {
  font: inherit; cursor: pointer; border-radius: 10px;
  padding: 12px 18px; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--fg);
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
button:hover { background: #20232c; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #1a1206; font-weight: 600;
}
button.primary:hover { filter: brightness(1.07); }
button.ghost { background: transparent; }

/* intro */
.stats-banner {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 16px;
  padding: 10px 14px;
  background: rgba(255,184,74,0.07);
  border: 1px solid rgba(255,184,74,0.25);
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-dim);
}
.stats-banner .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
.stats-banner .stats-text { color: var(--fg); }
@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

/* Lobby live board — the "门诊大厅" simulated info display.
   Header (LED + title) → 5-row scrolling list → footer with totals. */
.lobby-board {
  margin: 0 0 22px;
  background:
    linear-gradient(180deg, rgba(255,184,74,0.05), rgba(255,93,143,0.04) 40%, rgba(15,17,21,0.0)),
    var(--bg-elev);
  border: 1px solid rgba(255,184,74,0.22);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,184,74,0.05) inset;
}
.lobby-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 8px;
  border-bottom: 1px dashed rgba(255,184,74,0.18);
}
.lobby-led {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
.lobby-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1.5px;
}
.lobby-subtitle {
  font-size: 11px;
  color: var(--fg-dim);
  margin-left: auto;
}
.lobby-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  font-variant-numeric: tabular-nums;
  transition: min-height .25s ease;
}
/* Only reserve vertical space when we actually have rows. Empty state
   collapses to a single compact line. */
.lobby-list:not(.is-empty) {
  min-height: 220px;
}
.lobby-list.is-empty {
  min-height: 0;
  padding: 0;
}
/* Historical rows (synthesized from snapshots/ratings when the live ring is
   sparse) read slightly dimmer so the eye still finds fresh activity first. */
.lobby-row.is-historical {
  opacity: 0.78;
}
.lobby-row.is-historical .lobby-time::before {
  content: '· 历史 · ';
  color: var(--fg-dim);
  opacity: 0.7;
}
.lobby-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.45;
  border-left: 2px solid transparent;
  transition: background .25s ease, border-color .25s ease;
}
.lobby-row.tone-started   { border-left-color: rgba(255,184,74,0.55); }
.lobby-row.tone-completed { border-left-color: rgba( 74,222,128,0.55); }
.lobby-row.tone-rated     { border-left-color: rgba(255, 93,143,0.55); }
.lobby-row.is-new {
  animation: lobby-flash .9s ease-out;
}
@keyframes lobby-flash {
  0%   { background: rgba(255,184,74,0.18); transform: translateX(-4px); }
  100% { background: transparent;            transform: translateX(0); }
}
.lobby-icon { flex: 0 0 auto; font-size: 14px; }
.lobby-msg  { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-doc  { color: var(--fg); font-weight: 600; }
.lobby-subject { color: var(--fg-dim); margin-right: 4px; }
.lobby-verb { color: var(--fg-dim); margin: 0 4px; }
.lobby-style {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 2px;
  font-size: 11px;
  color: var(--accent);
  background: rgba(255,184,74,0.10);
  border: 1px solid rgba(255,184,74,0.30);
  border-radius: 4px;
  vertical-align: middle;
}
.lobby-stars {
  margin-left: 4px;
  color: var(--accent-2);
  letter-spacing: 1px;
}
.lobby-stars-empty { color: rgba(255,255,255,0.18); }
.lobby-time {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.5px;
}
.lobby-empty {
  justify-content: center;
  color: var(--fg-dim);
  font-size: 12px;
  padding: 14px;
  border-left: none;
}
.lobby-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-top: 1px dashed rgba(255,184,74,0.18);
  font-size: 12px;
  color: var(--fg-dim);
}
.lobby-foot .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

/* Roster换班 lockdown — full-screen overlay + the underlying intro becomes
   non-interactive. Triggered when the live countdown crosses zero. */
.intro-locked {
  pointer-events: none;
  user-select: none;
  filter: grayscale(0.55) brightness(0.6);
  transition: filter .35s ease;
}
.intro-locked button,
.intro-locked input,
.intro-locked textarea,
.intro-locked select,
.intro-locked .doc-card,
.intro-locked .style-chip {
  pointer-events: none !important;
  cursor: not-allowed !important;
}
.roster-rotating-overlay {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at center, rgba(20,18,12,0.78), rgba(0,0,0,0.92));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: overlay-fade .25s ease-out;
}
@keyframes overlay-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.roster-rotating-overlay .rotating-card {
  max-width: 420px;
  width: 100%;
  padding: 28px 24px 22px;
  background: var(--bg-elev);
  border: 1px solid rgba(255,184,74,0.35);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,184,74,0.10) inset;
  text-align: center;
}
.rotating-spinner {
  display: flex; justify-content: center; gap: 8px;
  margin: 4px 0 18px;
  height: 16px;
}
.rotating-spinner span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  animation: rotating-bounce 1.0s ease-in-out infinite;
}
.rotating-spinner span:nth-child(2) { animation-delay: 0.18s; }
.rotating-spinner span:nth-child(3) { animation-delay: 0.36s; }
@keyframes rotating-bounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.55; }
  40%           { transform: translateY(-8px); opacity: 1; }
}
.rotating-title {
  margin: 0 0 10px;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--accent);
}
.rotating-line {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--fg);
  line-height: 1.6;
}
.rotating-line.rotating-sub {
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 16px;
}
.rotating-progress {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 0 12px;
}
.rotating-progress-fill {
  position: absolute;
  top: 0; left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  animation: rotating-sweep 1.6s linear infinite;
}
@keyframes rotating-sweep {
  from { left: -40%; }
  to   { left: 100%; }
}
.rotating-hint {
  margin: 0;
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.intro-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 18px; margin-bottom: 18px;
}
.intro-card h3 { margin: 0 0 10px; }

.option-row { display: flex; flex-wrap: wrap; gap: 10px; }
.option-row .opt { flex: 1 1 calc(50% - 10px); min-width: 120px; }

.opt {
  padding: 12px;
  background: #1f222b; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer;
  transition: all .12s ease;
}
.opt:hover { border-color: var(--accent); }
.opt.selected {
  background: linear-gradient(135deg, rgba(255,184,74,0.15), rgba(255,93,143,0.15));
  border-color: var(--accent);
}
.opt strong { display: block; color: var(--accent); margin-bottom: 4px; font-size: 13px; }
.opt small  { color: var(--fg-dim); font-size: 12px; line-height: 1.5; display: block; }
.opt .eta   { display: block; margin-top: 6px; font-size: 11px; color: var(--fg-dim); opacity: .75; letter-spacing: .2px; }
.opt.selected .eta { opacity: 1; color: var(--accent); }

.count-row { display: flex; gap: 8px; }
.count-row .opt { flex: 1; text-align: center; }

/* Count slider — replaces the old 3-card radio. Range 20~80, ticks every 10. */
.count-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 2px 4px;
}
.count-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.count-slider-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.count-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--line) 0%, var(--line) 100%);
  outline: none;
  cursor: pointer;
}
.count-slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(255,184,74,0.55), rgba(255,93,143,0.55));
}
.count-slider::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(255,184,74,0.55), rgba(255,93,143,0.55));
}
.count-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 2px solid #1a1206;
  box-shadow: 0 0 0 2px rgba(255,184,74,0.35), 0 2px 6px rgba(0,0,0,0.45);
  margin-top: -8px;
  cursor: grab;
  transition: transform .12s ease;
}
.count-slider::-webkit-slider-thumb:active { transform: scale(1.1); cursor: grabbing; }
.count-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 2px solid #1a1206;
  box-shadow: 0 0 0 2px rgba(255,184,74,0.35), 0 2px 6px rgba(0,0,0,0.45);
  cursor: grab;
}
.count-slider:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}
.count-slider-out {
  min-width: 56px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  background: #1f222b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-variant-numeric: tabular-nums;
}
.count-ticks {
  position: relative;
  height: 22px;
  margin: 0 11px; /* offset by half-thumb so labels align with the thumb center */
  pointer-events: none; /* never eat clicks meant for the slider above */
}
.count-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.count-tick-mark {
  width: 1px;
  height: 6px;
  background: var(--fg-dim);
  opacity: 0.55;
}
.count-tick-label {
  margin-top: 2px;
  font-size: 11px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.start-btn-row { margin-top: 28px; }
.start-btn-row button { width: 100%; padding: 16px; font-size: 16px; }

.hint { color: var(--fg-dim); font-size: 13px; margin-top: 10px; }

/* test */
.progress-wrap { position: sticky; top: 0; background: var(--bg);
  padding: 12px 0; z-index: 10; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.progress-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s ease; width: 0; }
.progress-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--fg-dim); margin-top: 6px; }

/* Test screen sticky header — gives the answering page a "病历夹" feel
   matching the doctor/clinic theme used throughout the app. */
.test-progress-wrap {
  background: linear-gradient(180deg, rgba(14,15,19,0.96), rgba(14,15,19,0.88));
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  padding: 12px 14px 10px;
  margin: -10px -14px 18px;
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 6px 18px -14px rgba(0,0,0,0.7);
}
.test-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
  font-size: 12px; letter-spacing: 1px;
}
.test-header-left { display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.test-doctor-tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,184,74,0.18), rgba(255,93,143,0.18));
  border: 1px solid rgba(255,184,74,0.45);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.test-style-tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--fg-dim);
  white-space: nowrap;
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
.test-header-right { flex: 0 0 auto; }
.test-progress-num {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--fg-dim);
}
.test-progress-num strong { color: var(--accent); font-weight: 700; }

.q-list { display: flex; flex-direction: column; gap: 14px; }

.q-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,184,74,0.04), rgba(255,93,143,0.025)),
    var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 0;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.q-card::before {
  /* tiny accent ribbon on the left edge — feels like a tabbed file card */
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.55;
}
.q-card:hover { border-color: rgba(255,184,74,0.35); }
.q-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255,184,74,0.18);
}
.q-card.is-hidden {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255,184,74,0.2);
  background:
    linear-gradient(180deg, rgba(255,184,74,0.10), rgba(255,93,143,0.06)),
    var(--bg-elev);
}
.q-card.is-hidden::before {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  opacity: 1;
  width: 4px;
}
.q-card.q-missing {
  border-color: var(--bad);
  box-shadow: 0 0 0 2px rgba(248,113,113,0.25);
}
.q-card.q-missing::before { background: var(--bad); opacity: 1; }
.q-card.q-missing-flash {
  animation: q-flash 0.6s ease-in-out 0s 2;
}
@keyframes q-flash {
  0%, 100% { box-shadow: 0 0 0 2px rgba(248,113,113,0.25); }
  50%      { box-shadow: 0 0 0 4px rgba(248,113,113,0.55); }
}
/* Hidden questions appear mid-test with a soft fade + glow so the user
   notices something new just slipped onto the page. */
.q-card.q-reveal {
  animation: q-reveal 1.4s ease-out;
}
@keyframes q-reveal {
  0%   { opacity: 0; transform: translateY(-8px); box-shadow: 0 0 0 4px rgba(255,184,74,0.55); }
  60%  { opacity: 1; transform: translateY(0);    box-shadow: 0 0 0 6px rgba(255,184,74,0.35); }
  100% { opacity: 1; transform: translateY(0);    box-shadow: 0 0 0 1px rgba(255,184,74,0.2); }
}

.missing-hint {
  background: rgba(248,113,113,0.10);
  border: 1px solid var(--bad);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: 10px;
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.6;
}
.missing-hint strong { color: var(--bad); }
.q-card .q-text {
  margin: 0 0 14px;
  line-height: 1.7;
  font-size: 16px;
  color: var(--fg);
  font-weight: 500;
}
.q-card .q-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 11px; color: var(--fg-dim);
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.q-card .q-meta .badge {
  display: inline-block;
  background: var(--line);
  padding: 3px 9px;
  border-radius: 999px;
  margin-right: 0;
  font-size: 11px;
  letter-spacing: 1px;
}
.q-card .q-meta .badge-num {
  background: rgba(255,184,74,0.12);
  color: var(--accent);
  border: 1px solid rgba(255,184,74,0.35);
  font-weight: 600;
}
.q-card .q-meta .badge-dim {
  background: transparent;
  color: var(--fg-dim);
  border: 1px dashed var(--line);
}
.q-card .q-meta .badge.hidden {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1206;
  border: none;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.q-options { display: flex; flex-direction: column; gap: 8px; }
.q-options .opt-row {
  display: block;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .12s ease;
  line-height: 1.5;
  margin-bottom: 0;
}
.q-options .opt-row:hover {
  border-color: rgba(255,184,74,0.55);
  background: rgba(255,184,74,0.05);
  transform: translateX(2px);
}
.q-options .opt-row:active { transform: translateX(2px) scale(0.997); }
.q-options input[type=radio] {
  /* visually hidden but keyboard-accessible */
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.q-options .opt-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.q-options .opt-letter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  transition: background .14s ease, color .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.q-options .opt-text {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--fg);
  font-size: 14.5px;
  line-height: 1.55;
}
.q-options .opt-check {
  flex: 0 0 auto;
  width: 18px;
  font-size: 14px;
  color: var(--accent);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity .18s ease, transform .18s ease;
  text-align: right;
}
.q-options .opt-row:has(input:checked) {
  background: linear-gradient(135deg, rgba(255,184,74,0.18), rgba(255,93,143,0.14));
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255,184,74,0.35), 0 4px 18px -10px rgba(255,184,74,0.4);
}
.q-options .opt-row:has(input:checked) .opt-letter {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #1a1206;
  box-shadow: 0 0 0 3px rgba(255,184,74,0.18);
}
.q-options .opt-row:has(input:checked) .opt-text {
  color: var(--fg);
  font-weight: 500;
}
.q-options .opt-row:has(input:checked) .opt-check {
  opacity: 1;
  transform: scale(1);
}
.q-options input[type=radio]:focus-visible + .opt-body .opt-letter {
  box-shadow: 0 0 0 3px rgba(255,184,74,0.4);
}

.test-bottom {
  display: flex; gap: 10px; margin-top: 24px;
  flex-wrap: wrap;
}
.test-bottom button { flex: 1 1 140px; padding: 14px; }
.test-bottom #submitBtn { flex: 1 1 100%; order: -1; padding: 16px; font-size: 15px; }

@media (max-width: 480px) {
  .test-progress-wrap { margin-left: -8px; margin-right: -8px; padding-left: 12px; padding-right: 12px; }
  .test-header { font-size: 11px; }
  .q-card { padding: 16px 14px 14px; }
  .q-card .q-text { font-size: 15px; }
  .q-options .opt-body { padding: 11px 12px; gap: 10px; }
  .q-options .opt-letter { width: 24px; height: 24px; }
  .q-options .opt-text { font-size: 14px; }
}

/* result */
.result-hero {
  background: linear-gradient(135deg, var(--bg-elev), #20212a);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 20px; margin-bottom: 18px; text-align: center;
  position: relative; overflow: hidden;
}
.result-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,184,74,0.15), transparent 60%);
  pointer-events: none;
}
.result-hero .emoji { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.result-hero .code { font-size: 32px; font-weight: 700; letter-spacing: 2px; margin: 0; }
.result-hero .cn { font-size: 18px; color: var(--fg-dim); margin: 4px 0 14px; }
.result-hero .intro { font-size: 14px; font-style: italic; color: var(--accent); margin-bottom: 12px; }
.result-hero .tagline { font-size: 13px; color: var(--fg-dim); }
.result-hero .byline {
  position: relative;
  margin-top: 14px;
  font-size: 12px;
  color: var(--fg-dim);
  letter-spacing: 1px;
}

.section {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px;
}
.section h2 { margin-top: 0; font-size: 18px; }
.section .body { line-height: 1.85; white-space: pre-wrap; }

/* Rich-text rendering used by the diagnosis paragraphs.
   - paragraphs get real spacing instead of the previous wall-of-text
   - inline q-cite blocks expand the question + user's answer fully so
     they're readable both on screen and in exported poster images.
*/
.rich { white-space: normal; }
.rich p { margin: 0 0 14px; line-height: 1.85; }
.rich p:last-child { margin-bottom: 0; }
.rich strong { color: var(--accent); font-weight: 600; }

/* Inline citation: 「题目」 → 答案
   Uses a subtle accent-tinted pill so it visually breaks out of the
   surrounding prose without being noisy. Wraps gracefully on narrow
   viewports because it's display: inline. */
.q-cite {
  display: inline;
  padding: 2px 8px;
  margin: 0 2px;
  border-radius: 6px;
  background: rgba(255,184,74,0.10);
  border: 1px solid rgba(255,184,74,0.28);
  font-size: 0.94em;
  line-height: 1.55;
  color: var(--fg, #f3e9d8);
  /* Allow the pill to break across lines naturally rather than overflow. */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.q-cite-q { color: var(--fg, #f3e9d8); }
.q-cite-arrow { color: var(--accent); margin: 0 4px; opacity: 0.8; }
.q-cite-a { color: var(--accent); font-weight: 500; }

.q-cite-missing {
  background: rgba(248,113,113,0.12);
  border-color: rgba(248,113,113,0.45);
  color: #f87171;
}

/* ======================================================================
   Streaming UI: paginator, generation status, skeleton placeholders,
   section fade-ins. Keeps "loading" feel calm and intentional rather
   than panicked-spinner.
   ====================================================================== */

/* Pagination header on the test screen. */
.page-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 14px;
  font-size: 13px;
  color: var(--fg-dim, #b9ad9a);
}
.page-info .gen-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  transition: opacity 0.6s;
}
.page-info .gen-status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent, #ffb84a);
  opacity: 0.4;
  animation: gen-blink 1.2s infinite ease-in-out;
}
.page-info .gen-status .dot:nth-child(2) { animation-delay: 0.15s; }
.page-info .gen-status .dot:nth-child(3) { animation-delay: 0.30s; }
.page-info .gen-status .gen-ok    { color: var(--accent, #ffb84a); }
.page-info .gen-status .gen-error { color: var(--bad, #f87171); }
@keyframes gen-blink {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40%           { opacity: 1;    transform: scale(1.0);  }
}

/* Test screen pager (Prev / Next). */
.test-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 16px;
  padding: 12px 14px;
  background:
    linear-gradient(135deg, rgba(255,184,74,0.06), rgba(255,93,143,0.04));
  border: 1px solid var(--line, #2a221a);
  border-radius: var(--radius, 12px);
}
.test-pager button { min-width: 96px; }
.test-pager .pager-count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: var(--fg-dim, #b9ad9a);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
}

/* Loading skeleton for analysis sections. */
.skeleton { display: flex; flex-direction: column; gap: 10px; }
.skeleton .sk-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(255,184,74,0.06) 0%,
    rgba(255,184,74,0.18) 50%,
    rgba(255,184,74,0.06) 100%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.6s infinite linear;
}
.skeleton .sk-line:nth-child(odd)  { width: 92%; }
.skeleton .sk-line:nth-child(even) { width: 76%; }
@keyframes sk-shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* Streaming section: subtle pulsing border so the user knows "this is
   still cooking". When a field arrives we flip to .section-just-arrived
   for a soft glow. */
.section-streaming {
  position: relative;
}
.section-streaming::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255,184,74,0.15) inset;
  animation: sec-pulse 2s infinite ease-in-out;
}
@keyframes sec-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,184,74,0.10) inset; }
  50%      { box-shadow: 0 0 0 1px rgba(255,184,74,0.32) inset; }
}
.section-just-arrived {
  animation: sec-arrived 1.6s ease-out;
}
@keyframes sec-arrived {
  0%   { box-shadow: 0 0 0 4px rgba(255,184,74,0.45); }
  60%  { box-shadow: 0 0 0 6px rgba(255,184,74,0.20); }
  100% { box-shadow: 0 0 0 0   rgba(255,184,74,0);    }
}

.stream-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--fg-dim, #b9ad9a);
}
.stream-hint .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent, #ffb84a);
  opacity: 0.4;
  animation: gen-blink 1.2s infinite ease-in-out;
}
.stream-hint .dot:nth-child(2) { animation-delay: 0.15s; }
.stream-hint .dot:nth-child(3) { animation-delay: 0.30s; }

.models-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.model-card {
  background: #1f222b; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px;
}
.model-card .label { font-size: 12px; color: var(--accent); margin-bottom: 6px; letter-spacing: 1px; }
.model-card .text { font-size: 13px; line-height: 1.6; color: var(--fg); }

.defining-list .def-item {
  border-left: 3px solid var(--accent); padding: 8px 12px; margin-bottom: 12px;
  background: #1f222b; border-radius: 6px;
}
.defining-list .def-item .q { font-size: 13px; color: var(--fg-dim); margin-bottom: 4px; }
.defining-list .def-item .a { font-size: 13px; color: var(--accent); margin-bottom: 6px; }
.defining-list .def-item .why { font-size: 13px; line-height: 1.6; }

.similar-list { display: grid; gap: 12px; }
.similar-card {
  background: #1f222b; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px;
}
.similar-card .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.similar-card .top .name { font-weight: 600; }
.similar-card .top .sim { color: var(--accent); font-size: 13px; }
.similar-card .row { font-size: 13px; line-height: 1.6; margin-bottom: 4px; }
.similar-card .row strong { color: var(--fg-dim); margin-right: 6px; }

.share-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.share-row button { flex: 1 1 140px; }
/* "给大夫打分" — visually warmer ghost variant so users notice the new
   action sitting next to plain share/poster buttons. */
.rate-doctor-btn {
  border-color: rgba(255, 184, 74, 0.55) !important;
  color: var(--accent) !important;
  background: rgba(255, 184, 74, 0.08) !important;
}
.rate-doctor-btn:hover { background: rgba(255, 184, 74, 0.18) !important; }
.rate-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-dim);
  font-style: italic;
  letter-spacing: 0.5px;
}
.share-link {
  margin-top: 12px; padding: 10px; background: #1f222b;
  border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--accent); word-break: break-all;
}

/* radar */
svg.radar { width: 100%; max-width: 480px; height: auto; display: block; margin: 0 auto; }
svg.radar .grid { fill: none; stroke: var(--line); stroke-width: 1; }
svg.radar .axis { stroke: var(--line); stroke-width: 1; }
svg.radar .label { fill: var(--fg-dim); font-size: 10px; text-anchor: middle; dominant-baseline: middle; }
svg.radar .user-poly { fill: rgba(255,184,74,0.25); stroke: var(--accent); stroke-width: 1.5; }
svg.radar .user-dot { fill: var(--accent); }

/* error */
.err { background: rgba(248,113,113,0.1); border: 1px solid var(--bad);
  color: var(--bad); padding: 12px; border-radius: 8px; }

/* ======================================================================
   Doctor badges (intro screen): tier-stratified clinic-ID-card style.
   The visual hierarchy intentionally escalates as rank increases
   (regular → vice → director → specialist), so the user feels挂的"号"是
   越来越稀罕的.
   ====================================================================== */

.doc-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}
.doc-row-vice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .doc-row-vice { grid-template-columns: 1fr; }
}

.doc-card {
  position: relative;
  background: #1c1f29;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  outline: none;
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
}
.doc-card:hover { transform: translateY(-1px); border-color: rgba(255,184,74,0.55); }
.doc-card:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.doc-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255,184,74,0.45);
}

.doc-card-head {
  display: flex; gap: 12px; align-items: center;
}
.doc-avatar {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; line-height: 1;
  border-radius: 50%;
  background: #262a36;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.doc-id { flex: 1; min-width: 0; }
.doc-name {
  font-size: 17px; font-weight: 600; line-height: 1.2;
  margin-bottom: 4px; color: var(--fg);
}
.doc-sub {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-size: 12px; color: var(--fg-dim);
}
.doc-arche { color: var(--fg-dim); }

.rank-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 1px;
  border: 1px solid var(--line);
  background: #262a36;
  color: var(--fg-dim);
}
.rank-badge.rank-specialist {
  color: #2a1a00;
  background: linear-gradient(135deg, #ffd76b, #ff9d2c);
  border-color: rgba(255,215,107,0.7);
  font-weight: 600;
}
.rank-badge.rank-director {
  color: #1a1a22;
  background: linear-gradient(135deg, #f1f1f7, #c7c9d9);
  border-color: rgba(241,241,247,0.6);
  font-weight: 600;
}
.rank-badge.rank-vice {
  color: #d6e3ff;
  background: rgba(70,110,200,0.18);
  border-color: rgba(120,160,255,0.5);
}
.rank-badge.rank-regular {
  color: var(--fg-dim);
  background: #262a36;
}

.doc-blurb {
  margin: 10px 0 8px;
  font-size: 13px; line-height: 1.6;
  color: #cdd1de;
}
.doc-foot {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 6px;
  font-size: 12px; color: var(--fg-dim);
  border-top: 1px dashed rgba(255,255,255,0.08);
  padding-top: 8px;
}
.doc-spec { color: #d8c596; }
.card-eta { color: var(--fg-dim); font-size: 11px; }

/* "特技" 行 — 在 blurb 下、foot 上,告诉用户挂这位的号能多得到什么 */
.doc-perk {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
  margin: 6px 0 10px;
  padding: 8px 10px;
  font-size: 12px; line-height: 1.5;
  background: rgba(255,184,74,0.06);
  border: 1px dashed rgba(255,184,74,0.35);
  border-radius: 8px;
}
.doc-perk .perk-icon {
  color: var(--accent); font-size: 11px;
}
.doc-perk .perk-name {
  color: var(--accent); font-weight: 600; letter-spacing: 1px;
}
.doc-perk .perk-desc {
  color: #d6d8e0; flex: 1; min-width: 0;
}

/* tier-specific perk treatments */
.doc-card.tier-vice .doc-perk {
  background: rgba(120,160,255,0.08);
  border-color: rgba(120,160,255,0.35);
}
.doc-card.tier-vice .doc-perk .perk-icon,
.doc-card.tier-vice .doc-perk .perk-name { color: #a8c4ff; }

.doc-card.tier-director .doc-perk {
  background: linear-gradient(135deg, rgba(241,241,247,0.08), rgba(212,175,106,0.10));
  border-color: rgba(212,175,106,0.45);
  border-style: solid;
}
.doc-card.tier-director .doc-perk .perk-icon,
.doc-card.tier-director .doc-perk .perk-name {
  background: linear-gradient(135deg, #ffeac0, #d4af6a);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.doc-card.tier-specialist .doc-perk {
  background: rgba(255,184,74,0.14);
  border-color: rgba(255,215,107,0.55);
  border-style: solid;
  box-shadow: inset 0 0 14px rgba(255,184,74,0.10);
}
.doc-card.tier-specialist .doc-perk .perk-icon,
.doc-card.tier-specialist .doc-perk .perk-name {
  color: #ffd76b;
  text-shadow: 0 0 6px rgba(255,184,74,0.4);
}

/* --- tier: regular (普通号 = 挂号入口卡) --------------------------------- */
.doc-card.tier-regular {
  background: #1a1d26;
  border-style: dashed;
}
.doc-card.tier-regular .doc-name { font-size: 16px; }
.doc-mini-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 8px;
}
.doc-mini {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px;
  background: #232735;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
  min-width: 0;
}
.mini-avatar { font-size: 22px; line-height: 1; }
.mini-name {
  font-size: 12px; color: var(--fg); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.mini-arche {
  font-size: 11px; color: var(--accent); opacity: 0.85;
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.mini-spec {
  font-size: 11px; color: var(--fg-dim); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

/* --- tier: vice (副主任) ---------------------------------------------------- */
.doc-card.tier-vice {
  background: linear-gradient(160deg, #1f2535 0%, #1a1d29 100%);
  border-color: rgba(120,160,255,0.35);
}
.doc-card.tier-vice .doc-avatar {
  background: rgba(70,110,200,0.18);
  border-color: rgba(120,160,255,0.55);
}
.doc-card.tier-vice .doc-name { font-size: 16px; }

/* --- tier: director (主任) ------------------------------------------------- */
.doc-card.tier-director {
  background:
    radial-gradient(circle at 0% 0%, rgba(241,241,247,0.10), transparent 55%),
    linear-gradient(140deg, #25283a 0%, #1a1c28 100%);
  border-color: rgba(241,241,247,0.45);
  box-shadow: 0 4px 18px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.doc-card.tier-director .doc-avatar {
  background: linear-gradient(135deg, #f1f1f7, #b9bbcd);
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 0 12px rgba(241,241,247,0.35);
  color: #1a1a22;
}
.doc-card.tier-director .doc-name {
  font-size: 19px;
  background: linear-gradient(135deg, #ffeac0, #d4af6a);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}
.doc-card.tier-director .doc-blurb { font-size: 13.5px; color: #e3e6f1; }

/* --- tier: specialist (客座专家) ------------------------------------------ */
.doc-card.tier-specialist {
  background:
    radial-gradient(circle at 100% 0%, rgba(255,215,107,0.18), transparent 55%),
    linear-gradient(135deg, #2c2415 0%, #1a1a22 100%);
  border-color: rgba(255,215,107,0.65);
  box-shadow:
    0 0 28px rgba(255,184,74,0.30),
    0 4px 22px rgba(0,0,0,0.45),
    inset 0 0 0 1px rgba(255,215,107,0.18);
  padding: 18px 18px 16px;
}
.doc-card.tier-specialist::before {
  content: "✦ 今日客座 ✦";
  position: absolute; top: 10px; right: 12px;
  font-size: 10px; letter-spacing: 2px;
  color: #2a1a00;
  background: linear-gradient(135deg, #ffd76b, #ff9d2c);
  padding: 2px 10px; border-radius: 999px;
  box-shadow: 0 0 10px rgba(255,184,74,0.5);
}
.doc-card.tier-specialist .doc-avatar {
  width: 54px; height: 54px; font-size: 30px;
  background: linear-gradient(135deg, #ffd76b, #ff7e3a);
  border-color: rgba(255,215,107,0.85);
  box-shadow: 0 0 18px rgba(255,184,74,0.55);
  color: #2a1a00;
}
.doc-card.tier-specialist .doc-name {
  font-size: 22px; letter-spacing: 1px;
  background: linear-gradient(135deg, #fff1c2, #ffb84a);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.doc-card.tier-specialist .doc-blurb { font-size: 14px; color: #f3e9d8; }
.doc-card.tier-specialist.is-selected {
  box-shadow:
    0 0 0 2px var(--accent),
    0 0 36px rgba(255,184,74,0.55),
    inset 0 0 0 1px rgba(255,215,107,0.28);
}

/* tier-director already carries its own box-shadow stack, so the generic
   .is-selected rule's shadow gets overridden — give it an explicit selected
   shadow that layers a bright accent ring on top of the existing pearl glow. */
.doc-card.tier-director.is-selected {
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px var(--accent),
    0 0 22px rgba(255,184,74,0.35),
    0 4px 18px rgba(0,0,0,0.35),
    inset 0 0 0 1px rgba(255,255,255,0.08);
}

/* tier-vice — same idea, give it an unambiguous "selected" treatment so
   single-row vice cards show selection clearly. */
.doc-card.tier-vice.is-selected {
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px var(--accent),
    0 0 18px rgba(255,184,74,0.30);
}

/* ---------------------------------------------------------------
   Style picker — 3-tab layout (大夫推荐 / 通用风格 / 我自己写)
   --------------------------------------------------------------- */
.style-card .style-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.style-tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--fg-dim);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all .12s ease;
}
.style-tab:hover { color: var(--fg); }
.style-tab.is-active {
  color: var(--accent);
  background: var(--bg-elev);
  border-color: var(--line);
  border-bottom: 1px solid var(--bg-elev);
  margin-bottom: -1px;
  font-weight: 600;
}

.style-tab-panel { padding-top: 4px; }

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.style-chip {
  padding: 12px;
  background: #1f222b;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: all .12s ease;
  position: relative;
}
.style-chip:hover { border-color: var(--accent); }
.style-chip.is-selected {
  background: linear-gradient(135deg, rgba(255,184,74,0.15), rgba(255,93,143,0.15));
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.style-chip strong { display: block; color: var(--accent); margin-bottom: 4px; font-size: 13px; }
.style-chip small  { color: var(--fg-dim); font-size: 12px; line-height: 1.5; display: block; }

.style-tab[hidden] { display: none !important; }
.style-chip.is-random {
  background: linear-gradient(135deg, rgba(255,184,74,0.10), rgba(255,93,143,0.10));
  border-style: dashed;
}
.style-chip.is-random:hover {
  background: linear-gradient(135deg, rgba(255,184,74,0.18), rgba(255,93,143,0.18));
}
.style-chip.is-random.is-selected {
  border-style: solid;
}

.style-tab-panel[data-panel="doctor"] .style-chip::after {
  content: "专属";
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(255,184,74,0.12);
  border: 1px solid rgba(255,184,74,0.4);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Custom-write panel */
.custom-style { display: flex; flex-direction: column; gap: 8px; }
.custom-label { font-size: 13px; color: var(--fg-dim); line-height: 1.6; }
.custom-label #customDoctorName { color: var(--accent); font-weight: 600; }
#customStyleInput {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  background: #1f222b;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  font-family: inherit;
  box-sizing: border-box;
}
#customStyleInput:focus { outline: none; border-color: var(--accent); }
.custom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.custom-counter { font-size: 12px; color: var(--fg-dim); }
#customDeriveBtn {
  padding: 8px 16px;
  font-size: 13px;
}
#customDeriveBtn:disabled { opacity: 0.5; cursor: not-allowed; }
.custom-error {
  background: rgba(248,113,113,0.10);
  border: 1px solid var(--bad);
  color: var(--fg);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin: 0;
}
.custom-preview { margin-top: 4px; }
.custom-preview .style-chip { max-width: 480px; }
.style-chip.is-custom strong { color: var(--accent-2, #ff5d8f); }
.custom-voice {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--fg-dim);
  line-height: 1.6;
  font-style: italic;
}

/* ---------------------------------------------------------------
   Result page — tier-aware visual hierarchy
   --------------------------------------------------------------- */

/* Rank tag pinned top-left of hero, so the user immediately sees who's
   actually diagnosing them — director vs regular look very different. */
.result-hero { position: relative; }
.rank-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  z-index: 2;
}
.rank-tag.rank-specialist {
  color: #2a1a00;
  background: linear-gradient(135deg, #ffd76b, #ff9d2c);
  border-color: rgba(255,215,107,0.7);
  font-weight: 600;
}
.rank-tag.rank-director {
  color: #1a1a22;
  background: linear-gradient(135deg, #f1f1f7, #c7c9d9);
  border-color: rgba(241,241,247,0.6);
  font-weight: 600;
}
.rank-tag.rank-vice {
  color: #d6e3ff;
  background: rgba(70,110,200,0.25);
  border-color: rgba(120,160,255,0.5);
}
.rank-tag.rank-regular {
  color: var(--fg-dim);
  background: #262a36;
}

/* Director: silver/gold double-frame, Renaissance medallion mood */
.result-hero.tier-director {
  background:
    linear-gradient(135deg, rgba(241,241,247,0.06), rgba(199,201,217,0.04)),
    linear-gradient(180deg, var(--bg-elev), #1d1f28);
  border: 1px solid rgba(241,241,247,0.35);
  box-shadow:
    0 0 0 1px rgba(241,241,247,0.18) inset,
    0 0 28px rgba(199,201,217,0.10),
    0 6px 22px rgba(0,0,0,0.45);
}
.result-hero.tier-director::before {
  background: radial-gradient(circle at 50% 0%, rgba(241,241,247,0.22), transparent 65%);
}
.result-hero.tier-director .code {
  background: linear-gradient(135deg, #f1f1f7 0%, #c7c9d9 60%, #f1f1f7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Vice: cool steel-blue */
.result-hero.tier-vice {
  background: linear-gradient(180deg, var(--bg-elev), #1d2230);
  border: 1px solid rgba(120,160,255,0.35);
  box-shadow: 0 0 18px rgba(70,110,200,0.18), 0 6px 22px rgba(0,0,0,0.45);
}
.result-hero.tier-vice::before {
  background: radial-gradient(circle at 50% 0%, rgba(120,160,255,0.20), transparent 65%);
}

/* Specialist: warm gold */
.result-hero.tier-specialist {
  background: linear-gradient(180deg, var(--bg-elev), #261a08);
  border: 1px solid rgba(255,215,107,0.55);
  box-shadow: 0 0 24px rgba(255,157,44,0.20), 0 6px 22px rgba(0,0,0,0.45);
}
.result-hero.tier-specialist::before {
  background: radial-gradient(circle at 50% 0%, rgba(255,215,107,0.30), transparent 65%);
}

/* Regular keeps default — no overrides needed */

.result-hero .byline {
  display: flex; gap: 6px; justify-content: center; align-items: center;
  flex-wrap: wrap;
}
.byline-arche {
  font-size: 11px;
  color: var(--fg-dim);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0.5px;
}

/* ----- Chosen-style strip on result hero ----- */
.style-strip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--fg-dim);
  background: rgba(255,255,255,0.04);
  border: 1px dashed var(--line);
  border-radius: 999px;
  cursor: help;
}
.style-strip-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--accent);
  opacity: 0.85;
}
.style-strip-name {
  color: #fff;
  font-weight: 600;
}
.style-strip-blurb {
  color: var(--fg-dim);
  opacity: 0.85;
}
.style-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
  border: 1px solid var(--line);
}
.style-badge-random  { color: #ffd76b; border-color: rgba(255,215,107,0.4); }
.style-badge-custom  { color: #b39bff; border-color: rgba(179,155,255,0.4); }

/* ----- Tiered sections: specialty (vice/director) and erudition (director) ----- */
.section-flag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
  background: rgba(255,184,74,0.10);
  color: var(--accent);
  border: 1px solid rgba(255,184,74,0.35);
}

.section.section-specialty {
  position: relative;
  border: 1px solid var(--accent);
  box-shadow: 0 0 16px rgba(255,184,74,0.10);
  background:
    linear-gradient(180deg, rgba(255,184,74,0.04), transparent 60%),
    var(--bg-elev);
}
.section.section-specialty.tier-vice .section-flag {
  background: rgba(120,160,255,0.10);
  color: #b8c8ff;
  border-color: rgba(120,160,255,0.45);
}
.section.section-specialty.tier-vice {
  border-color: rgba(120,160,255,0.55);
  box-shadow: 0 0 16px rgba(70,110,200,0.18);
}
.section.section-specialty.tier-director .section-flag {
  background: rgba(241,241,247,0.08);
  color: #e8e9f4;
  border-color: rgba(241,241,247,0.45);
}
.section.section-specialty.tier-director {
  border-color: rgba(241,241,247,0.55);
  box-shadow: 0 0 18px rgba(241,241,247,0.10);
}

.section.section-erudition {
  position: relative;
  border: 1px solid rgba(241,241,247,0.45);
  background:
    linear-gradient(180deg, rgba(241,241,247,0.04), transparent 60%),
    var(--bg-elev);
  box-shadow: 0 0 18px rgba(241,241,247,0.10);
}
.section.section-erudition .section-flag {
  background: rgba(241,241,247,0.08);
  color: #e8e9f4;
  border-color: rgba(241,241,247,0.5);
}

/* ----- Quote cards: typeset like a classical reader ----- */
.quotes-list { display: flex; flex-direction: column; gap: 12px; }
.quote-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px 14px 22px;
}
.quote-card .quote-mark {
  position: absolute;
  top: 4px; left: 8px;
  font-size: 28px;
  color: var(--accent);
  opacity: 0.55;
  line-height: 1;
  font-family: "STKaiti", "KaiTi", serif;
}
.quote-card .quote-text {
  font-family: "STKaiti", "KaiTi", "Georgia", serif;
  font-size: 16px;
  line-height: 1.9;
  color: #efe8d4;
  margin: 0 0 4px;
  letter-spacing: 1px;
}
.quote-card .quote-source {
  text-align: right;
  font-size: 12px;
  color: #d8c596;
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.quote-card .quote-rel {
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg);
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

/* ----- Poem scroll: distinct from regular prose ----- */
.poem-scroll {
  position: relative;
  margin: 16px auto 0;
  max-width: 480px;
  padding: 22px 24px 18px;
  background:
    radial-gradient(circle at 12% 50%, rgba(216,197,150,0.10), transparent 35%),
    radial-gradient(circle at 88% 50%, rgba(216,197,150,0.10), transparent 35%),
    linear-gradient(180deg, #2a2118, #211a13);
  border: 1px solid rgba(216,197,150,0.4);
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(216,197,150,0.10) inset,
    0 4px 18px rgba(0,0,0,0.5);
}
.poem-scroll::before,
.poem-scroll::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 6px;
  background: linear-gradient(180deg, #6b4a2a, #3a2515);
  border-radius: 3px;
}
.poem-scroll::before { left: -8px; box-shadow: 1px 0 4px rgba(0,0,0,0.4); }
.poem-scroll::after  { right: -8px; box-shadow: -1px 0 4px rgba(0,0,0,0.4); }
.poem-seal {
  position: absolute;
  top: -10px; right: 12px;
  background: #8b1a1a;
  color: #fff5e1;
  font-size: 11px;
  letter-spacing: 4px;
  padding: 3px 10px;
  border-radius: 2px;
  font-family: "STKaiti", "KaiTi", serif;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.poem-body {
  font-family: "STKaiti", "KaiTi", "Georgia", serif;
  color: #efe8d4;
  font-size: 16px;
  line-height: 2;
  margin: 0;
  white-space: pre-wrap;
  text-align: center;
  letter-spacing: 2px;
}

/* ----- Dim chips fallback for fiveModels when LLM gave us a dim-map ----- */
.dim-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dim-chip {
  font-size: 11px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--line);
  color: var(--fg-dim);
  border: 1px solid transparent;
}
.dim-chip.dim-L { color: #94d4ff; border-color: rgba(148,212,255,0.3); }
.dim-chip.dim-M { color: #e8d7b0; border-color: rgba(232,215,176,0.3); }
.dim-chip.dim-H { color: #ffb84a; border-color: rgba(255,184,74,0.4); }

/* defining-list prose-only fallback */
.def-item.def-item-prose .why { font-size: 14px; }
.similar-card .row.note { color: var(--fg); }

/* small screens */
@media (max-width: 480px) {
  h1.title { font-size: 26px; }
  .option-row .opt { flex: 1 1 100%; }
  .doc-card.tier-specialist .doc-name { font-size: 19px; }
  .doc-card.tier-director   .doc-name { font-size: 17px; }
  .style-grid { grid-template-columns: 1fr; }
  .style-tab { padding: 8px 10px; font-size: 12px; }
  .quote-card .quote-text { font-size: 15px; }
  .poem-body { font-size: 14px; letter-spacing: 1px; }
}

/* ----- Rating modal (post-share / post-download) ----- */
.rate-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: rate-fade 0.18s ease-out;
}
@keyframes rate-fade { from { opacity: 0; } to { opacity: 1; } }
.rate-modal {
  position: relative;
  width: 100%; max-width: 380px;
  background: #1b1c22;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 22px 18px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.55);
  animation: rate-pop 0.22s cubic-bezier(.2,1.2,.4,1);
}
@keyframes rate-pop { from { transform: translateY(8px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.rate-modal-close {
  position: absolute; top: 8px; right: 10px;
  width: 28px; height: 28px;
  border: none; background: transparent;
  color: var(--fg-dim); font-size: 22px; line-height: 1;
  cursor: pointer; border-radius: 6px;
}
.rate-modal-close:hover { color: #fff; background: rgba(255,255,255,0.06); }
.rate-modal-title {
  font-size: 17px; font-weight: 600; color: #fff; margin-bottom: 4px;
}
.rate-modal-sub {
  font-size: 13px; color: var(--fg-dim); margin-bottom: 16px;
}
.rate-modal-foot {
  margin-top: 14px;
  display: flex; justify-content: center;
}
.rate-modal-skip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
}
.rate-modal-skip:hover { color: #fff; }

/* rating widget itself (shared between modal and any inline mount) */
.rate-row {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 0;
}
.rate-label { font-size: 14px; color: #ddd; }
.rate-stars { display: flex; gap: 6px; }
.rate-star {
  font-size: 30px; line-height: 1;
  color: #4a4a52;
  cursor: pointer; user-select: none;
  transition: color 0.12s, transform 0.12s;
}
.rate-star.lit { color: #ffd76b; text-shadow: 0 0 8px rgba(255,215,107,0.4); }
.rate-star:not(.locked):hover { transform: scale(1.15); }
.rate-star.locked { cursor: default; }
.rate-hint { font-size: 11px; color: var(--fg-dim); }
.rate-thanks { font-size: 13px; color: #ffd76b; }
.rate-err { font-size: 13px; color: #ff7676; }

/* ----- Regular-slot style lockout (主治大夫拒绝改风格) ----- */
.lock-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(255, 118, 118, 0.06);
  border: 1px dashed rgba(255, 118, 118, 0.45);
  border-radius: 8px;
  color: #ffd7d7;
  animation: lock-fadein 0.25s ease-out;
}
@keyframes lock-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.lock-banner .lock-icon { font-size: 16px; }
.lock-banner .lock-text { flex: 1 1 200px; color: #fff; }
.lock-banner .lock-hint {
  font-size: 11px;
  color: var(--fg-dim);
  border-left: 1px solid var(--line);
  padding-left: 8px;
  letter-spacing: 0.5px;
}
.style-card-locked .style-tab-panel { opacity: 0.55; }
.style-card-locked .style-tab[data-tab="random"] { /* random tab still usable */ }
.style-chip.chip-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.style-chip.chip-disabled:hover { transform: none; }
.style-chip.chip-shake {
  animation: chip-shake 0.32s ease-in-out;
}
@keyframes chip-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-4px); }
  40%     { transform: translateX(4px); }
  60%     { transform: translateX(-3px); }
  80%     { transform: translateX(3px); }
}
