:root {
  --bg: #070a12;
  --bg-soft: #0b0f1a;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e9edf7;
  --muted: #8d97b0;
  --faint: #616c86;
  --gold: #e0b567;
  --gold-soft: rgba(224, 181, 103, 0.14);
  --teal: #5eead4;
  --teal-soft: rgba(94, 234, 212, 0.12);
  --ok: #4ade80;
  --bad: #fb7185;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 11px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-ui: "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-display: "Sora", "Noto Sans SC", system-ui, sans-serif;
  --shell: 1120px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Backdrop ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -20%, #0e1526 0%, #070a12 55%),
    var(--bg);
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}

.blob-1 {
  width: 44vw;
  height: 44vw;
  min-width: 380px;
  min-height: 380px;
  top: -14vw;
  left: -8vw;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.5), transparent 68%);
  animation: float-a 22s var(--ease) infinite alternate;
}

.blob-2 {
  width: 38vw;
  height: 38vw;
  min-width: 320px;
  min-height: 320px;
  top: 4vw;
  right: -10vw;
  background: radial-gradient(circle, rgba(224, 181, 103, 0.42), transparent 68%);
  animation: float-b 26s var(--ease) infinite alternate;
}

.blob-3 {
  width: 40vw;
  height: 40vw;
  min-width: 320px;
  min-height: 320px;
  bottom: -18vw;
  left: 28vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35), transparent 70%);
  animation: float-c 30s var(--ease) infinite alternate;
}

@keyframes float-a {
  to { transform: translate3d(6vw, 5vw, 0) scale(1.12); }
}
@keyframes float-b {
  to { transform: translate3d(-7vw, 7vw, 0) scale(1.08); }
}
@keyframes float-c {
  to { transform: translate3d(4vw, -6vw, 0) scale(1.15); }
}

.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(90% 70% at 50% 20%, #000 20%, transparent 80%);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 1rem 1.75rem;
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.9), rgba(7, 10, 18, 0.45) 70%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.brand-glyph {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(94, 234, 212, 0.16), rgba(224, 181, 103, 0.12));
  color: var(--teal);
  transition: transform 0.4s var(--ease), border-color 0.3s;
}

.brand-glyph svg {
  width: 21px;
  height: 21px;
}

.brand:hover .brand-glyph {
  transform: rotate(-8deg) scale(1.05);
  border-color: var(--line-strong);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.brand-text small {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.session-chip,
.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.timer-chip {
  color: var(--gold);
  border-color: rgba(224, 181, 103, 0.3);
  background: var(--gold-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.timer-chip svg {
  width: 15px;
  height: 15px;
}

.timer-chip.is-urgent {
  color: var(--bad);
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.55; }
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  color: var(--bad);
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.1);
}

/* ---------- Layout ---------- */
main {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0.5rem 1.75rem 5rem;
}

.view[hidden] {
  display: none !important;
}

.view {
  animation: view-in 0.5s var(--ease) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 3.5rem 0 2.75rem;
  max-width: 44rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.85rem 0.32rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.15);
}

.hero-title {
  margin: 1.5rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 300;
  line-height: 1.16;
  letter-spacing: -0.01em;
}

.hero-title em {
  font-style: normal;
  font-weight: 600;
  background: linear-gradient(100deg, var(--teal) 0%, #a5b4fc 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shine 7s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

.hero-desc {
  margin: 1.35rem 0 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.02rem;
  font-weight: 300;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2.75rem;
  margin: 2.5rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--line);
}

.hero-stats .stat {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.2rem;
}

.hero-stats dt {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--faint);
}

.hero-stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(160deg, #fff, var(--muted));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Panels ---------- */
.panel {
  margin-top: 2.75rem;
  padding: 1.9rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel-head p {
  margin: 0.25rem 0 0;
  color: var(--faint);
  font-size: 0.88rem;
}

.panel-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ---------- Bank cards ---------- */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
  margin-top: 1.4rem;
}

.bank-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.25rem 1.3rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.3s var(--ease), background 0.3s, transform 0.3s var(--ease);
}

.bank-card::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(120% 80% at 20% 0%, rgba(94, 234, 212, 0.16), transparent 60%);
  transition: opacity 0.35s;
  pointer-events: none;
}

.bank-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
}

.bank-card:hover::after {
  opacity: 0.7;
}

.bank-card.is-active {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(94, 234, 212, 0.07);
}

.bank-card.is-active::after {
  opacity: 1;
}

.bank-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--teal);
}

.bank-icon svg {
  width: 18px;
  height: 18px;
}

.bank-card h3 {
  margin: 0.3rem 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.bank-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 300;
  line-height: 1.55;
}

.bank-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.76rem;
  color: var(--faint);
  letter-spacing: 0.06em;
}

.bank-best {
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 600;
}

.bank-check {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  transition: background 0.25s, border-color 0.25s;
}

.bank-check svg {
  width: 11px;
  height: 11px;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.25s, transform 0.25s var(--ease);
  color: #04140f;
}

.bank-card.is-active .bank-check {
  background: var(--teal);
  border-color: var(--teal);
}

.bank-card.is-active .bank-check svg {
  opacity: 1;
  transform: none;
}

/* ---------- Config ---------- */
.config-list {
  margin-top: 1.4rem;
  display: flex;
  flex-direction: column;
}

.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.05rem 0;
  border-top: 1px solid var(--line);
}

.config-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.config-row[hidden] {
  display: none;
}

.config-label strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
}

.config-label span {
  display: block;
  color: var(--faint);
  font-size: 0.82rem;
  font-weight: 300;
}

.segmented {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}

.segmented-3 .seg {
  min-width: 64px;
}

.seg {
  position: relative;
  z-index: 1;
  min-width: 74px;
  padding: 0.45rem 1rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: color 0.25s;
}

.seg.is-active {
  color: #05121a;
  font-weight: 600;
}

.seg-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  border-radius: 999px;
  background: linear-gradient(120deg, var(--teal), #7dd3fc);
  transition: transform 0.4s var(--ease), width 0.4s var(--ease);
  pointer-events: none;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.22s, border-color 0.22s, background 0.22s, transform 0.22s var(--ease);
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.chip.is-active {
  color: var(--teal);
  border-color: rgba(94, 234, 212, 0.5);
  background: var(--teal-soft);
  font-weight: 600;
}

.chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.4rem;
  padding: 1.1rem 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(94, 234, 212, 0.28);
  background: linear-gradient(120deg, rgba(94, 234, 212, 0.1), rgba(224, 181, 103, 0.06));
}

.resume-copy strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
}

.resume-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 300;
}

.resume-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.start-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.start-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 300;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, box-shadow 0.25s, opacity 0.25s;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-lg {
  padding: 0.9rem 1.9rem;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(120deg, #5eead4, #67e8f9);
  color: #04141b;
  font-weight: 600;
  box-shadow: 0 14px 34px -14px rgba(94, 234, 212, 0.75);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 18px 40px -14px rgba(94, 234, 212, 0.9);
}

.btn-gold {
  background: linear-gradient(120deg, #e0b567, #f3d9a4);
  color: #1d1403;
  font-weight: 600;
  box-shadow: 0 14px 34px -14px rgba(224, 181, 103, 0.7);
}

.btn-outline {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
}

/* ---------- Quiz ---------- */
.quiz-head {
  position: sticky;
  top: 66px;
  z-index: 20;
  padding: 1rem 0 1.1rem;
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.94) 60%, transparent);
  backdrop-filter: blur(10px);
}

.progress-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.5s var(--ease);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  color: var(--faint);
}

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  gap: 1.5rem;
  align-items: start;
}

.question-card {
  padding: 2rem 2.1rem 1.6rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.014));
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 1);
}

.question-card.is-swapping {
  animation: q-swap 0.42s var(--ease);
}

@keyframes q-swap {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

.q-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag {
  padding: 0.24rem 0.7rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.tag-type {
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(224, 181, 103, 0.28);
}

.tag-cat {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(94, 234, 212, 0.25);
}

.q-index {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1;
  color: rgba(255, 255, 255, 0.07);
  font-variant-numeric: tabular-nums;
}

.q-stem {
  margin: 1.1rem 0 1.5rem;
  font-size: clamp(1.12rem, 2.3vw, 1.35rem);
  font-weight: 500;
  line-height: 1.62;
  letter-spacing: 0.005em;
}

.q-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.option {
  position: relative;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 0.85rem;
  align-items: start;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s var(--ease);
  animation: opt-in 0.4s var(--ease) both;
}

@keyframes opt-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.option:hover:not(.is-locked) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(3px);
}

.option.is-locked {
  cursor: default;
}

.option-key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.option-text {
  padding-top: 0.16rem;
  font-size: 0.97rem;
  font-weight: 300;
  line-height: 1.6;
  color: #d5dcec;
}

.option.is-selected {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(94, 234, 212, 0.08);
}

.option.is-selected .option-key {
  background: var(--teal);
  border-color: var(--teal);
  color: #04141b;
}

.option.is-correct {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.09);
}

.option.is-correct .option-key {
  background: var(--ok);
  border-color: var(--ok);
  color: #04180c;
}

.option.is-wrong {
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.09);
}

.option.is-wrong .option-key {
  background: var(--bad);
  border-color: var(--bad);
  color: #22060c;
}

.q-feedback {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.15rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  animation: opt-in 0.35s var(--ease) both;
}

.q-feedback[hidden] {
  display: none;
}

.q-feedback.is-ok {
  border-color: rgba(74, 222, 128, 0.32);
  background: rgba(74, 222, 128, 0.07);
}

.q-feedback.is-bad {
  border-color: rgba(251, 113, 133, 0.32);
  background: rgba(251, 113, 133, 0.07);
}

.fb-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
}

.q-feedback.is-ok .fb-icon {
  background: rgba(74, 222, 128, 0.18);
  color: var(--ok);
}

.q-feedback.is-bad .fb-icon {
  background: rgba(251, 113, 133, 0.18);
  color: var(--bad);
}

.fb-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.fb-body strong {
  font-size: 0.93rem;
  font-weight: 600;
}

.q-feedback.is-ok .fb-body strong { color: var(--ok); }
.q-feedback.is-bad .fb-body strong { color: var(--bad); }

.fb-body span {
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 300;
}

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.6rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
}

.nav-right {
  display: flex;
  gap: 0.6rem;
}

.kbd-hint {
  margin: 1rem 0 0;
  font-size: 0.76rem;
  color: var(--faint);
  font-weight: 300;
  letter-spacing: 0.04em;
}

kbd {
  display: inline-block;
  padding: 0.05rem 0.36rem;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- Answer sheet ---------- */
.sheet-panel {
  position: sticky;
  top: 152px;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  backdrop-filter: blur(18px);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sheet-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.sheet-collapse {
  border: 0;
  background: none;
  color: var(--faint);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.2s;
}

.sheet-collapse:hover {
  color: var(--teal);
}

.sheet-body[hidden] {
  display: none;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 0.4rem;
}

.sheet-dot {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--faint);
  font: inherit;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s, color 0.2s;
}

.sheet-dot:hover {
  transform: scale(1.08);
  color: var(--text);
  border-color: var(--line-strong);
}

.sheet-dot.is-answered {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.09);
}

.sheet-dot.is-correct {
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.12);
}

.sheet-dot.is-wrong {
  color: var(--bad);
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
}

.sheet-dot.is-current {
  color: #04141b;
  background: var(--teal);
  border-color: var(--teal);
  font-weight: 700;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin: 1.1rem 0 0;
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: 0.74rem;
  color: var(--faint);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.dot-current { background: var(--teal); }
.dot-answered { background: rgba(255, 255, 255, 0.35); }
.dot-correct { background: var(--ok); }
.dot-wrong { background: var(--bad); }

/* ---------- Result ---------- */
.result-hero {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex-wrap: wrap;
  padding: 3rem 0 2rem;
}

.score-ring {
  position: relative;
  width: 200px;
  height: 200px;
  flex: none;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 10;
}

.ring-fg {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 540;
  stroke-dashoffset: 540;
  transition: stroke-dashoffset 1.3s var(--ease);
  filter: drop-shadow(0 0 10px rgba(94, 234, 212, 0.35));
}

.score-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
}

.score-value {
  font-family: var(--font-display);
  font-size: 3.6rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(150deg, #fff, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.score-unit {
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  color: var(--faint);
}

.result-info {
  flex: 1 1 300px;
}

.result-info h1 {
  margin: 1.1rem 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 300;
}

.result-info p {
  margin: 0;
  color: var(--muted);
  font-weight: 300;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
}

.metric {
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.028);
  animation: view-in 0.5s var(--ease) both;
}

.metric-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.metric-value {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric-value.tone-ok { color: var(--ok); }
.metric-value.tone-bad { color: var(--bad); }
.metric-value.tone-gold { color: var(--gold); }

.metric-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--faint);
  font-weight: 300;
}

.metric-bar {
  height: 3px;
  margin-top: 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.metric-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.9s var(--ease);
}

/* ---------- Review ---------- */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.review-item {
  padding: 1.2rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.024);
  border-left: 2px solid var(--line-strong);
}

.review-item.is-ok {
  border-left-color: var(--ok);
}

.review-item.is-bad {
  border-left-color: var(--bad);
}

.review-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.review-no {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--faint);
  letter-spacing: 0.08em;
}

.review-item h3 {
  margin: 0 0 0.8rem;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.6;
}

.review-answers {
  display: grid;
  gap: 0.4rem;
  font-size: 0.87rem;
  font-weight: 300;
}

.review-answers div {
  display: grid;
  grid-template-columns: 5.4rem 1fr;
  gap: 0.5rem;
}

.review-answers dt {
  color: var(--faint);
}

.ans-ok { color: var(--ok); }
.ans-bad { color: var(--bad); }

.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--faint);
  font-weight: 300;
}

.empty-actions {
  display: flex;
  justify-content: center;
  padding-bottom: 2rem;
}

.identity-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.identity-box input {
  width: 190px;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.identity-box input:focus {
  border-color: rgba(94, 234, 212, 0.5);
}

.identity-box input.is-missing {
  border-color: rgba(251, 113, 133, 0.55);
}

.identity-state {
  color: var(--ok);
  font-size: 0.78rem;
}

.footer-link {
  margin-left: 1rem;
  color: rgba(255, 255, 255, 0.28);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--teal);
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 1.75rem 2.5rem;
  color: rgba(255, 255, 255, 0.22);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

/* ---------- Modal ---------- */
.modal-host {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.modal-host[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  animation: fade-in 0.3s ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
}

.modal {
  position: relative;
  width: min(400px, 100%);
  padding: 1.8rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: linear-gradient(165deg, #131826, #0b0f19);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 1);
  animation: modal-in 0.4s var(--ease) both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
}

.modal h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.modal p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 300;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(19, 24, 38, 0.94);
  backdrop-filter: blur(12px);
  font-size: 0.88rem;
  color: var(--text);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 1);
  animation: toast-in 0.35s var(--ease) both;
}

.toast.is-out {
  animation: toast-out 0.3s var(--ease) both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(10px); }
}

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .quiz-layout {
    grid-template-columns: 1fr;
  }

  .sheet-panel {
    position: static;
    order: 2;
  }
}

@media (max-width: 640px) {
  .topbar,
  main,
  .site-footer {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  .brand-text small { display: none; }

  .hero {
    padding: 2.25rem 0 1.75rem;
  }

  .hero-stats {
    gap: 1.75rem;
  }

  .panel {
    padding: 1.35rem;
  }

  .question-card {
    padding: 1.4rem 1.3rem 1.2rem;
  }

  .quiz-head {
    top: 60px;
  }

  .config-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented,
  .chip-row {
    width: 100%;
  }

  .seg {
    flex: 1;
    min-width: 0;
  }

  .quiz-nav {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .nav-right {
    flex-direction: column-reverse;
  }

  .nav-right .btn,
  .quiz-nav > .btn {
    width: 100%;
  }

  .result-hero {
    gap: 1.75rem;
    padding-top: 2rem;
  }

  .score-ring {
    width: 158px;
    height: 158px;
  }

  .score-value {
    font-size: 2.8rem;
  }

  .review-answers div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .search-box {
    flex-wrap: wrap;
    row-gap: 0.55rem;
  }

  .search-scope {
    order: 3;
    width: 100%;
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 0.55rem;
  }

  .search-scope .chip {
    flex: 1;
  }

  .browse-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .browse-item-actions {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Nav / Search / Wrong book ---------- */
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.nav-badge {
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.2rem;
  padding: 0.45rem 0.5rem 0.45rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: rgba(94, 234, 212, 0.45);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.1);
}

.search-icon {
  display: inline-flex;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--faint);
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.search-box input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
}

.search-box input::placeholder {
  color: var(--faint);
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.search-clear:hover {
  background: rgba(251, 113, 133, 0.18);
  color: var(--bad);
}

.search-scope {
  flex: none;
  padding-left: 0.55rem;
  border-left: 1px solid var(--line);
}

.search-scope .chip {
  padding: 0.32rem 0.72rem;
  font-size: 0.8rem;
}

.search-box-sticky {
  position: sticky;
  top: 66px;
  z-index: 15;
  margin-top: 0;
  backdrop-filter: blur(12px);
  background: rgba(11, 15, 26, 0.9);
}

.search-recent {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--faint);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--bad);
}

.quick-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.quick-label {
  color: var(--faint);
  font-size: 0.8rem;
}

.tool-chip-solid {
  border-style: solid;
  color: var(--text);
}

.search-tip {
  margin: 0.75rem 0 0;
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 300;
}

.search-tip kbd {
  padding: 0.1rem 0.38rem;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--font-display, inherit);
  font-size: 0.75rem;
}

.tool-chip {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.tool-chip:hover {
  color: var(--teal);
  border-color: rgba(94, 234, 212, 0.45);
  background: var(--teal-soft);
}

.browse-hero {
  padding: 1.5rem 0 1.2rem;
}

.browse-hero h1 {
  margin: 0.8rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 300;
}

.browse-hero p {
  margin: 0;
  color: var(--muted);
  font-weight: 300;
}

.browse-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.1rem 0 0.9rem;
  color: var(--faint);
  font-size: 0.88rem;
}

.browse-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.browse-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.browse-item {
  padding: 1.2rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.028);
}

.browse-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.browse-item h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.6;
}

.browse-item h3 mark,
.browse-opt mark {
  background: rgba(224, 181, 103, 0.28);
  color: var(--gold);
  border-radius: 3px;
  padding: 0 0.12rem;
}

.browse-opts {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.browse-opt {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 300;
}

.browse-opt.is-answer {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
  color: var(--ok);
}

.browse-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.browse-answer {
  margin: 0.85rem 0 0;
  color: var(--ok);
  font-size: 0.9rem;
  font-weight: 500;
}

.tag-wrong {
  background: rgba(251, 113, 133, 0.12);
  color: var(--bad);
  border: 1px solid rgba(251, 113, 133, 0.28);
  padding: 0.24rem 0.7rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}
