/* 老版 Next QuizShell 样式 — 迁入 GA 主区（无 iframe） */
.mode-quiz.view-quiz-card #chat-body {
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.12), transparent 30%),
    radial-gradient(circle at 92% 14%, rgba(14, 165, 233, 0.1), transparent 32%),
    linear-gradient(135deg, #f8fafc 0%, #eef6ff 100%);
}

.mode-quiz.view-quiz-card #message-list {
  padding: 0 !important;
  overflow-y: auto !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  background: transparent;
}

.quiz-legacy-shell {
  --ql-bg-0: #f8fafc;
  --ql-bg-1: #eef6ff;
  --ql-panel: rgba(255, 255, 255, 0.92);
  --ql-line: rgba(37, 99, 235, 0.14);
  --ql-text: #172033;
  --ql-muted: #5f6f89;
  --ql-brand: #2b5cff;
  --ql-brand-2: #4ea1ff;
  --ql-ok: #16a34a;
  --ql-ok-soft: rgba(34, 197, 94, 0.14);
  --ql-bad: #dc2626;
  --ql-bad-soft: rgba(239, 68, 68, 0.12);

  position: relative;
  flex: 1 1 auto;
  min-height: 100%;
  width: 100%;
  padding: 1rem 1.25rem 1.5rem;
  box-sizing: border-box;
  color: var(--ql-text);
  line-height: 1.55;
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.12), transparent 30%),
    radial-gradient(circle at 92% 14%, rgba(14, 165, 233, 0.1), transparent 32%),
    linear-gradient(135deg, var(--ql-bg-0) 0%, var(--ql-bg-1) 100%);
}

.quiz-legacy-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.04) 1px, transparent 1px);
  background-size: 3.25rem 3.25rem;
}

.quiz-legacy-shell > * {
  position: relative;
  z-index: 1;
  max-width: 46rem;
  margin-left: auto;
  margin-right: auto;
}

.ql-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 1rem;
  z-index: 40;
}

.ql-header-main {
  min-width: 0;
  flex: 1;
}

.ql-section-picker {
  position: relative;
  flex-shrink: 0;
  z-index: 60;
}

.ql-section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.52rem 0.78rem;
  border: 1px solid rgba(43, 92, 255, 0.28);
  border-radius: 0.78rem;
  background: rgba(43, 92, 255, 0.08);
  color: var(--ql-brand);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.ql-section-toggle:hover:not(:disabled) {
  background: rgba(43, 92, 255, 0.14);
  border-color: rgba(43, 92, 255, 0.42);
}

.ql-section-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ql-section-toggle-icon {
  font-size: 0.7rem;
  line-height: 1;
}

.ql-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.15rem, 3.5vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.ql-meta {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ql-muted);
}

.ql-progress-wrap {
  margin: 0.2rem auto 0.95rem;
  padding: 0.85rem 0.95rem;
  border-radius: 1rem;
  background: var(--ql-panel);
  border: 1px solid var(--ql-line);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.ql-progress {
  height: 0.42rem;
  margin-top: 0.65rem;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

.ql-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ql-brand), var(--ql-brand-2));
  transition: width 0.24s ease;
}

.ql-card {
  border: 1px solid var(--ql-line);
  border-radius: 1.2rem;
  padding: 1.15rem 1.2rem;
  background: var(--ql-panel);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.1);
}

.ql-question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.ql-question-badge {
  display: inline-flex;
  align-items: center;
  height: 1.55rem;
  padding: 0 0.56rem;
  border-radius: 999px;
  background: rgba(43, 92, 255, 0.1);
  border: 1px solid rgba(43, 92, 255, 0.22);
  color: var(--ql-brand);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.ql-stem {
  margin: 0;
  font-size: 1.02rem;
  white-space: pre-wrap;
}

.ql-options {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.ql-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.86rem 0.95rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ql-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.ql-option-btn strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.55rem;
  background: rgba(43, 92, 255, 0.1);
  color: var(--ql-brand);
  font-size: 0.78rem;
}

.ql-option-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(43, 92, 255, 0.45);
  background: rgba(43, 92, 255, 0.06);
}

.ql-option-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.ql-option-correct {
  border-color: rgba(34, 197, 94, 0.65);
  background: var(--ql-ok-soft);
  opacity: 1;
}

.ql-option-correct strong {
  background: rgba(34, 197, 94, 0.18);
  color: var(--ql-ok);
}

.ql-option-wrong {
  border-color: rgba(239, 68, 68, 0.65);
  background: var(--ql-bad-soft);
  opacity: 1;
}

.ql-option-wrong strong {
  background: rgba(239, 68, 68, 0.15);
  color: var(--ql-bad);
}

.ql-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.ql-ghost-btn {
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.65rem;
  background: transparent;
  color: var(--ql-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.ql-ghost-btn:hover {
  color: var(--ql-brand);
  background: rgba(43, 92, 255, 0.06);
}

.ql-feedback {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--ql-line);
  font-size: 0.93rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.ql-verdict {
  display: inline-flex;
  margin: 0 0 0.55rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
}

.ql-verdict.is-ok { color: var(--ql-ok); background: var(--ql-ok-soft); }
.ql-verdict.is-bad { color: var(--ql-bad); background: var(--ql-bad-soft); }

.ql-feedback-body { color: var(--ql-text); line-height: 1.65; }
.ql-feedback-body p { margin: 0.45rem 0; }

.ql-next-row {
  margin: 0.85rem auto 0;
  display: flex;
  justify-content: center;
}

.ql-primary-btn {
  min-width: 8.5rem;
  padding: 0.76rem 1.15rem;
  border: none;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, var(--ql-brand), #1f4dde);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(43, 92, 255, 0.22);
}

.ql-primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ql-loading {
  margin-top: 1rem;
  padding: 1rem;
  text-align: center;
  color: var(--ql-muted);
  font-size: 0.9rem;
}

/* 成绩卡 — 对齐 Next SectionScoreCard（浅色） */
.ql-finished-card {
  margin-top: 0.25rem;
  padding: 1.35rem;
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at 18% 0%, rgba(37, 99, 235, 0.12), transparent 34%),
    radial-gradient(circle at 100% 20%, rgba(14, 165, 233, 0.1), transparent 30%),
    linear-gradient(160deg, #ffffff 0%, #f4f8ff 54%, #eef6ff 100%);
  border: 1px solid var(--ql-line);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.1);
  text-align: center;
}

.ql-finished-hero {
  margin-bottom: 1.15rem;
}

.ql-finished-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4rem;
  height: 2rem;
  margin-bottom: 0.7rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  background: rgba(43, 92, 255, 0.1);
  border: 1px solid rgba(43, 92, 255, 0.22);
  color: var(--ql-brand);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.ql-finished-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 780;
  letter-spacing: -0.035em;
  color: var(--ql-text);
}

.ql-finished-section {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--ql-muted);
}

.ql-finished-main-score {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 1.12rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.92));
  border: 1px solid rgba(37, 99, 235, 0.15);
  display: grid;
  grid-template-columns: minmax(8rem, 10rem) 1fr;
  align-items: center;
  gap: 1rem;
  text-align: left;
}

.ql-finished-dial {
  --ql-dial-size: 8.5rem;
  --ql-dial-inner: calc(var(--ql-dial-size) * 0.767);
  position: relative;
  width: var(--ql-dial-size);
  height: var(--ql-dial-size);
  display: grid;
  place-items: center;
}

.ql-finished-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ql-finished-ring-track,
.ql-finished-ring-value {
  fill: none;
  stroke-width: 8;
}

.ql-finished-ring-track {
  stroke: rgba(148, 163, 184, 0.2);
}

.ql-finished-ring-value {
  stroke: var(--ql-brand);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  filter: drop-shadow(0 0 5px rgba(37, 99, 235, 0.36));
  stroke-dasharray: 0 100;
  animation: ql-finished-ring-fill 1.4s cubic-bezier(0.18, 1, 0.32, 1) forwards;
}

@keyframes ql-finished-ring-fill {
  to {
    stroke-dasharray: var(--ql-score-pct) 100;
  }
}

.ql-finished-dial-inner {
  position: relative;
  z-index: 1;
  width: var(--ql-dial-inner);
  height: var(--ql-dial-inner);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(37, 99, 235, 0.14);
  box-shadow:
    inset 0 0 0 1px rgba(37, 99, 235, 0.08),
    0 8px 20px rgba(37, 99, 235, 0.1);
}

.ql-finished-value {
  font-size: clamp(1.45rem, 5.5vw, 1.9rem);
  font-weight: 820;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ql-text);
}

.ql-finished-unit {
  margin-top: 0.12rem;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ql-muted);
}

.ql-finished-copy {
  min-width: 0;
}

.ql-finished-copy-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ql-brand);
}

.ql-finished-mastery {
  margin: 0.32rem 0 0;
  font-size: clamp(1.55rem, 6vw, 2.25rem);
  line-height: 1.1;
  font-weight: 820;
  letter-spacing: -0.04em;
  color: var(--ql-text);
}

.ql-finished-hint {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  color: var(--ql-muted);
}

.ql-finished-insight {
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(37, 99, 235, 0.12);
  text-align: left;
}

.ql-finished-insight-label {
  display: block;
  margin-bottom: 0.22rem;
  color: var(--ql-brand);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.12em;
}

.ql-finished-insight-text {
  margin: 0;
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.55;
}

.ql-finished-nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.ql-finished-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 7.3rem;
  padding: 0.66rem 0.95rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.82);
  color: #1d4ed8;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.ql-finished-nav-btn:hover:not(:disabled) {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.32);
}

.ql-finished-nav-spacer {
  min-width: 7.3rem;
}

.ql-finished-retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 16rem;
  margin: 0 auto;
  padding: 0.8rem 1.2rem;
  border: none;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, var(--ql-brand), #1f4dde);
  color: #fff;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 760;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(43, 92, 255, 0.3);
}

.ql-finished-retry-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

@media (max-width: 520px) {
  .ql-finished-main-score {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ql-finished-ring-value {
    animation: none;
    stroke-dasharray: var(--ql-score-pct) 100;
  }
}
