  :root {
    --bg: #fdfaf6;
    --bg-2: #f7efe6;
    --surface: #ffffff;
    --surface-2: #f4e9dc;
    --border: #e8dccc;
    --text: #2a1f1a;
    --text-dim: #5c4a40;
    --text-muted: #9e8a7d;
    --accent: #c44569;
    --accent-2: #8b2e4a;
    --accent-glow: rgba(196, 69, 105, 0.4);
    --accent-warm: #e8a87c;
    --accent-deep: #1e3a5f;
    --danger: #d83232;
    --danger-bg: rgba(216, 50, 50, 0.08);
    --success: #3d8b6e;
    --success-bg: rgba(61, 139, 110, 0.08);
    --warning: #d97706;
    --display: 'Cormorant Garamond', Georgia, serif;
    --body: 'Inter', system-ui, sans-serif;
  }

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

  html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--body);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }

  body {
    background:
      radial-gradient(ellipse at top left, rgba(30, 115, 190, 0.06), transparent 50%),
      radial-gradient(ellipse at bottom right, rgba(10, 77, 140, 0.04), transparent 50%),
      var(--bg);
  }

  button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
  input { font-family: inherit; }

  /* =================== HERO / LANDING — magazine style =================== */
  .screen { display: none !important; min-height: 100vh; }
  .screen.active { display: block !important; }
  #hero.screen.active { display: flex !important; }

  #hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    overflow: hidden;
    background:
      radial-gradient(ellipse at top left, rgba(232, 168, 124, 0.18), transparent 55%),
      radial-gradient(ellipse at bottom right, rgba(196, 69, 105, 0.14), transparent 55%),
      var(--bg);
  }

  /* Soft animated orbs in background */
  .hero-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
  }
  .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    will-change: transform;
    translate: var(--ox, 0px) var(--oy, 0px);
    transition: translate 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  .orb-1 {
    width: 480px; height: 480px;
    top: -120px; left: -120px;
    background: radial-gradient(circle, var(--accent-warm), transparent 70%);
    animation: orbDrift 18s ease-in-out infinite;
  }
  .orb-2 {
    width: 560px; height: 560px;
    bottom: -180px; right: -180px;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    animation: orbDrift 22s ease-in-out infinite reverse;
  }
  .orb-3 {
    width: 360px; height: 360px;
    top: 35%; left: 55%;
    background: radial-gradient(circle, var(--accent-deep), transparent 70%);
    opacity: 0.18;
    animation: orbDrift 26s ease-in-out infinite 3s;
  }
  @keyframes orbDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -30px) scale(1.08); }
    66% { transform: translate(-30px, 40px) scale(0.95); }
  }

  .hero-content {
    position: relative;
    z-index: 2;
    max-width: 760px;
    width: 100%;
    text-align: center;
  }

  /* Kicker — small label with horizontal lines on each side, magazine-style */
  .hero-kicker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    opacity: 0;
    animation: fadeUp 0.8s 0.2s forwards ease-out;
  }
  .kicker-line {
    flex: 0 0 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent));
  }
  .kicker-line:last-child {
    background: linear-gradient(90deg, var(--accent), transparent);
  }
  .kicker-text {
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
  }

  /* Hero title — big editorial */
  .hero-title {
    font-family: var(--display);
    line-height: 1;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeUp 1s 0.4s forwards ease-out;
  }
  .hero-eyebrow {
    display: block;
    font-family: var(--body);
    font-size: clamp(0.85rem, 1.6vw, 1.05rem);
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    margin-bottom: 1.25rem;
    font-style: normal;
  }
  .hero-headline {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4em;
    font-size: clamp(2.8rem, 8vw, 5.5rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
  }
  .hero-headline .accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-warm) 40%, var(--accent-2) 70%, var(--accent) 100%);
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 600;
    animation: accentGradientShift 5s linear infinite;
  }
  @keyframes accentGradientShift {
    0%   { background-position: 0% center; }
    100% { background-position: 220% center; }
  }

  .hero-amp {
    font-family: var(--display);
    font-style: italic;
    color: var(--accent-warm);
    font-weight: 400;
    font-size: 0.85em;
    margin: 0 0.1em;
    transform: translateY(-0.04em);
    display: inline-block;
  }
  .hero-tagline {
    display: block;
    font-family: var(--display);
    font-style: italic;
    font-size: clamp(1.4rem, 3.5vw, 2.2rem);
    font-weight: 400;
    color: var(--text);
    margin-top: 1rem;
    letter-spacing: -0.01em;
  }

  .hero-sub {
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    color: var(--text-dim);
    max-width: 540px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
    opacity: 0;
    animation: fadeUp 1s 0.6s forwards ease-out;
  }

  .hero-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 420px;
    margin: 0 auto;
    opacity: 0;
    animation: fadeUp 1s 0.8s forwards ease-out;
  }

  .name-input {
    width: 100%;
    padding: 1.1rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 1rem;
    font-family: var(--body);
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 2px 12px rgba(196, 69, 105, 0.06);
  }
  .name-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(196, 69, 105, 0.15), 0 4px 20px rgba(196, 69, 105, 0.12);
  }
  .name-input::placeholder { color: var(--text-muted); font-style: italic; }

  .btn-primary {
    padding: 1.1rem 2rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 999px;
    letter-spacing: 0.04em;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(196, 69, 105, 0.3);
  }
  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(196, 69, 105, 0.42);
  }
  .btn-primary:active { transform: translateY(0); }
  .btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.28), transparent);
    animation: btnShimmer 4s ease-in-out infinite 3s;
    pointer-events: none;
  }
  @keyframes btnShimmer {
    0%   { left: -100%; }
    100% { left: 220%; }
  }

  /* Hero stats — softened, with vertical dividers */
  .hero-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 3.5rem;
    opacity: 0;
    animation: fadeUp 1s 1s forwards ease-out;
  }
  .hero-stat { text-align: center; }
  .hero-stat .num {
    font-family: var(--display);
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.02em;
  }
  .hero-stat .lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-top: 0.5rem;
    font-weight: 500;
  }
  .hero-stat-divider {
    width: 1px;
    height: 36px;
    background: linear-gradient(180deg, transparent, var(--border), transparent);
    flex-shrink: 0;
  }

  /* Subtle scroll hint at bottom */
  .hero-scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 40px;
    background: linear-gradient(180deg, transparent, var(--accent));
    opacity: 0;
    animation: fadeIn 1s 1.5s forwards ease-out;
    overflow: hidden;
  }
  .hero-scroll-hint span {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 12px;
    background: var(--accent);
    animation: scrollDown 2s ease-in-out infinite;
  }
  @keyframes scrollDown {
    0% { transform: translateY(-12px); }
    50% { transform: translateY(40px); }
    100% { transform: translateY(40px); }
  }
  @keyframes fadeIn {
    to { opacity: 1; }
  }

  /* Floating micro-particles */
  .hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
  }
  .hero-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat var(--dur, 9s) ease-in-out infinite var(--delay, 0s);
  }
  @keyframes particleFloat {
    0%   { opacity: 0;              transform: translateY(0) scale(0.6); }
    12%  { opacity: var(--op, 0.3); }
    88%  { opacity: var(--op, 0.3); }
    100% { opacity: 0;              transform: translateY(-110vh) scale(1.3); }
  }

  @media (max-width: 540px) {
    .hero-stats { gap: 1.25rem; }
    .hero-stat .num { font-size: 1.9rem; }
    .kicker-line { flex-basis: 30px; }
    .hero-kicker { gap: 0.6rem; margin-bottom: 1.75rem; }
    .hero-headline { gap: 0.2em; }
    #hero { padding: 4rem 1.25rem 3rem; }
    .hero-scroll-hint { display: none; }
  }


  .script-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.25rem;
    padding: 0.3rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 999px;
    z-index: 10;
  }
  .script-toggle button {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    border-radius: 999px;
    color: var(--text-dim);
    transition: all 0.25s;
    font-weight: 500;
  }
  .script-toggle button.active {
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
  }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
  }
  @keyframes drift {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
  }
  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
  }
  @keyframes rotate {
    from { transform: rotate(0); }
    to { transform: rotate(360deg); }
  }
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
  }

  /* =================== MENU / SETUP =================== */
  #setup {
    min-height: 100vh;
    padding: 3rem 1.5rem;
  }
  .setup-wrap {
    max-width: 880px;
    margin: 0 auto;
  }
  .setup-header {
    text-align: center;
    margin-bottom: 3rem;
  }
  .greeting {
    font-family: var(--display);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .greeting .italic {
    color: var(--accent);
    font-weight: 700;
  }
  .greeting-sub {
    color: var(--text-dim);
    margin-top: 0.5rem;
  }

  .mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
  }

  .mode-card {
    padding: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    text-align: left;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
  }
  .mode-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(15, 34, 56, 0.08);
  }
  .mode-card.selected {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
    box-shadow: 0 0 0 2px var(--accent), 0 12px 28px rgba(15, 34, 56, 0.1);
  }
  .mode-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 1rem;
    color: var(--accent);
  }
  .mode-title {
    font-family: var(--display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
  }
  .mode-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .config-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.75rem;
    margin-bottom: 1rem;
  }
  .config-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
  }
  .chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .chip {
    padding: 0.65rem 1.1rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.9rem;
    color: var(--text-dim);
    transition: all 0.2s;
    font-weight: 500;
  }
  .chip:hover { border-color: var(--accent); color: var(--text); }
  .chip.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    font-weight: 600;
  }
  .custom-timer {
    margin-top: 0.75rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
  }
  .custom-timer.show { display: flex; }
  .custom-timer input {
    width: 80px;
    padding: 0.55rem 0.75rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
  }
  .custom-timer input:focus { outline: none; border-color: var(--accent); }
  .timer-unit { color: var(--text-muted); font-size: 0.9rem; }

  .search-input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.95rem;
  }
  .search-input:focus { outline: none; border-color: var(--accent); }

  .search-results {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    display: none;
  }
  .search-results.show { display: block; }
  .search-result {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
  }
  .search-result:hover { background: var(--surface-2); }
  .search-result .num {
    color: var(--accent);
    font-weight: 600;
    margin-right: 0.6rem;
  }

  .start-bar {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
  }
  .start-bar .btn-primary { flex: 1; min-width: 200px; }
  .btn-secondary {
    padding: 1.1rem 1.8rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-weight: 600;
    transition: all 0.3s;
  }
  .btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

  /* =================== QUIZ SCREEN =================== */
  #quiz {
    min-height: 100vh;
    padding: 1.5rem;
  }
  .quiz-wrap {
    max-width: 820px;
    margin: 0 auto;
  }

  .quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .quiz-user {
    display: flex;
    flex-direction: column;
  }
  .quiz-user-name {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.1rem;
  }
  .quiz-user-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
  }

  .quiz-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
  }
  .timer-display {
    font-family: var(--display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    padding: 0.4rem 0.9rem;
    background: rgba(30, 115, 190, 0.1);
    border-radius: 10px;
    min-width: 90px;
    text-align: center;
    letter-spacing: 0.05em;
  }
  .timer-display.warn { color: var(--warning); background: rgba(217, 119, 6, 0.1); }
  .timer-display.danger { color: var(--danger); background: rgba(216, 50, 50, 0.1); animation: pulse 1s infinite; }

  .icon-btn {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all 0.2s;
  }
  .icon-btn:hover { color: var(--accent); border-color: var(--accent); }
  .icon-btn.active { color: var(--warning); border-color: var(--warning); background: rgba(217, 119, 6, 0.1); }

  .progress-wrap {
    margin-bottom: 2rem;
  }
  .progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
  }
  .progress-info .pct {
    color: var(--accent);
    font-weight: 600;
  }
  .progress-bar {
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
  }
  .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
    border-radius: 999px;
    transition: width 0.4s ease;
  }

  .question-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
  }

  .question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
  }
  .q-number {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.78rem;
  }
  .q-flag {
    color: var(--text-muted);
    font-size: 0.8rem;
  }

  .question-prompt {
    font-family: var(--display);
    font-size: clamp(1.15rem, 2.5vw, 1.5rem);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 1.75rem;
    letter-spacing: -0.01em;
  }

  .options-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: left;
    width: 100%;
    line-height: 1.5;
  }
  .option:hover:not(.disabled) {
    border-color: var(--accent);
    transform: translateX(4px);
  }
  .option.disabled { cursor: default; }
  .option-letter {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--display);
    font-size: 0.95rem;
    transition: all 0.25s;
  }
  .option:hover:not(.disabled) .option-letter {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
  }
  .option-text {
    flex: 1;
    font-size: 1rem;
    color: var(--text);
  }

  .option.correct {
    background: var(--success-bg);
    border-color: var(--success);
  }
  .option.correct .option-letter {
    background: var(--success);
    color: #ffffff;
    border-color: var(--success);
  }
  .option.incorrect {
    background: var(--danger-bg);
    border-color: var(--danger);
    animation: shake 0.4s;
  }
  .option.incorrect .option-letter {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
  }

  .feedback {
    display: none;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 14px;
    animation: fadeUp 0.4s ease-out;
  }
  .feedback.show { display: block; }
  .feedback.wrong { border-left-color: var(--danger); }
  .feedback-title {
    font-family: var(--display);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  .feedback-correct {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
  }
  .feedback-correct strong { color: var(--accent); }

  .quiz-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }
  .quiz-footer button { flex: 1; }

  /* =================== RESULTS SCREEN =================== */
  #results {
    min-height: 100vh;
    padding: 3rem 1.5rem;
  }
  .results-wrap {
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
  }
  .result-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(30, 115, 190, 0.1);
    border: 1px solid rgba(30, 115, 190, 0.3);
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 2rem;
  }
  .result-title {
    font-family: var(--display);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
  }
  .result-title .italic { color: var(--accent); font-weight: 700; }
  .score-circle {
    margin: 2rem auto;
    position: relative;
    width: 220px; height: 220px;
  }
  .score-circle svg { transform: rotate(-90deg); width: 100%; height: 100%; }
  .score-circle .track { fill: none; stroke: var(--surface-2); stroke-width: 8; }
  .score-circle .fill {
    fill: none;
    stroke: url(#scoreGrad);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s ease-out;
  }
  .score-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .score-pct {
    font-family: var(--display);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
  }
  .score-lbl {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-top: 0.25rem;
  }

  .result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
  }
  .result-stat {
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
  }
  .result-stat .v {
    font-family: var(--display);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
  }
  .result-stat .v.good { color: var(--success); }
  .result-stat .v.bad { color: var(--danger); }
  .result-stat .l {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-top: 0.4rem;
  }

  .review-btn {
    margin-top: 2rem;
    padding: 0.65rem 1.2rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
  }
  .review-btn:hover { color: var(--accent); border-color: var(--accent); }

  .wrong-review {
    margin-top: 1.5rem;
    text-align: left;
    display: none;
  }
  .wrong-review.show { display: block; }
  .wrong-item {
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 0.75rem;
  }
  .wrong-item-q {
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
  }
  .wrong-item-nums {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
  }
  .wrong-item-ans {
    font-size: 0.9rem;
  }
  .wrong-item-ans .ok { color: var(--success); }
  .wrong-item-ans .no { color: var(--danger); text-decoration: line-through; }

  /* =================== STATS / PROFILE =================== */
  .stats-link {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.7rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    z-index: 50;
    cursor: pointer;
  }
  .stats-link:hover { color: var(--accent); border-color: var(--accent); }

  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 34, 56, 0.45);
    backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }
  .modal-overlay.show { display: flex; }
  .modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
  }
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
  }
  .modal-title {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 700;
  }
  .modal-close {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--bg-2);
    color: var(--text-dim);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .modal-close:hover { background: var(--surface-2); color: var(--text); }

  .dialog-modal {
    max-width: 400px;
    text-align: center;
  }
  .dialog-msg {
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: 1.5rem;
  }
  .dialog-btns {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
  }

  .stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }
  .stat-grid > div {
    padding: 1rem;
    background: var(--bg-2);
    border-radius: 12px;
  }
  .stat-grid .v {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
  }
  .stat-grid .l {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
  }

  .session-list {
    max-height: 300px;
    overflow-y: auto;
  }
  .session-item {
    padding: 0.85rem 1rem;
    background: var(--bg-2);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
  }
  .session-item .date { color: var(--text-muted); font-size: 0.8rem; }
  .session-item .pct { font-weight: 700; font-family: var(--display); }
  .session-item .pct.good { color: var(--success); }
  .session-item .pct.ok { color: var(--warning); }
  .session-item .pct.bad { color: var(--danger); }

  .topic-list {
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
  }
  .topic-item {
    padding: 0.6rem 0.9rem;
    background: var(--bg-2);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
  }
  .topic-item-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.35rem;
    gap: 0.5rem;
  }
  .topic-item-name { font-weight: 600; color: var(--text); }
  .topic-item-meta { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }
  .topic-item-pct { font-weight: 700; font-family: var(--display); font-size: 0.95rem; }
  .topic-item-pct.good { color: var(--success); }
  .topic-item-pct.ok { color: var(--warning); }
  .topic-item-pct.bad { color: var(--danger); }
  .topic-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
  }
  .topic-bar-fill {
    height: 100%;
    transition: width 0.4s ease;
    border-radius: 3px;
  }
  .topic-bar-fill.good { background: var(--success); }
  .topic-bar-fill.ok { background: var(--warning); }
  .topic-bar-fill.bad { background: var(--danger); }
  .topic-empty {
    color: var(--text-muted);
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
  }

  .danger-zone {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
  }
  .btn-danger {
    padding: 0.65rem 1rem;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
  }
  .btn-danger:hover { background: rgba(216, 50, 50, 0.1); }

  /* =================== RESOURCES SCREEN =================== */
  #resources {
    min-height: 100vh;
    padding: 2rem 1.5rem;
  }
  .res-wrap {
    max-width: 1100px;
    margin: 0 auto;
  }
  .res-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 3.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
  }
  .res-title {
    font-family: var(--display);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .res-title .italic { font-style: italic; color: var(--accent); font-weight: 400; }

  .res-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: flex-start;
  }
  .res-nav {
    position: sticky;
    top: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  .res-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    color: var(--text-dim);
    font-size: 0.92rem;
    text-align: left;
    transition: all 0.2s;
    font-weight: 500;
  }
  .res-nav-btn:hover { background: var(--bg-2); color: var(--text); }
  .res-nav-btn.active {
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
  }
  .res-nav-btn .nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
  }

  .res-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2rem;
  }
  .res-section { display: none; animation: fadeUp 0.3s ease-out; }
  .res-section.active { display: block; }

  .res-section h2 {
    font-family: var(--display);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
  }
  .res-section .lead {
    color: var(--text-dim);
    font-size: 1rem;
    margin-bottom: 1.75rem;
    line-height: 1.55;
  }
  .res-section h3 {
    font-family: var(--display);
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.75rem;
    margin-bottom: 0.85rem;
    color: var(--accent);
  }
  .res-section h3:first-of-type { margin-top: 0; }
  .res-section p { line-height: 1.65; margin-bottom: 0.85rem; color: var(--text); }
  .res-section ul, .res-section ol { padding-left: 1.4rem; line-height: 1.7; }
  .res-section li { margin-bottom: 0.4rem; }
  .res-section a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border 0.15s; }
  .res-section a:hover { border-bottom-color: var(--accent); }

  .info-card {
    padding: 1.25rem 1.4rem;
    background: var(--bg-2);
    border-radius: 12px;
    border-left: 3px solid var(--accent);
    margin-bottom: 1rem;
  }
  .info-card .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
  }
  .info-card .value {
    font-size: 1.05rem;
    font-weight: 500;
  }
  .info-card a { color: var(--accent); }

  .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 1.5rem;
  }

  .program-detail {
    padding: 1.25rem;
    background: var(--bg-2);
    border-radius: 14px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
  }
  .program-detail h4 {
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.4rem;
  }
  .program-detail .badge {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.2rem 0.55rem;
    background: rgba(40, 74, 112, 0.1);
    color: var(--accent);
    border-radius: 999px;
    margin-bottom: 0.65rem;
    font-weight: 600;
  }
  .program-detail p {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 0.6rem;
  }
  .program-detail .career {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-style: italic;
  }

  /* Floating "Resources" button */
  .res-link {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    padding: 0.7rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    z-index: 50;
    cursor: pointer;
  }
  .res-link:hover { color: var(--accent); border-color: var(--accent); }

  @media (max-width: 768px) {
    .res-layout { grid-template-columns: 1fr; }
    .res-nav { position: relative; flex-direction: row; overflow-x: auto; }
    .res-nav-btn { white-space: nowrap; flex-shrink: 0; }
    .res-link { left: 1rem; bottom: 1rem; font-size: 0.8rem; }
  }

  /* =================== SCROLLBAR =================== */
  /* =================== SCROLLBAR =================== */
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: var(--bg); }
  ::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--accent); }

  @media (max-width: 640px) {
    .hero-stats { gap: 1.5rem; }
    .quiz-header { flex-direction: column; align-items: stretch; }
    .quiz-right { justify-content: space-between; }
    .quiz-footer { flex-direction: column; }
    .script-toggle { top: 1rem; right: 1rem; }
    .stats-link { bottom: 1rem; right: 1rem; font-size: 0.8rem; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
    .orb { animation: none; }
    .hero-kicker, .hero-title, .hero-sub, .hero-form, .hero-stats, .hero-scroll-hint {
      opacity: 1;
      animation: none;
    }
    #scoreFill { transition: none; }
  }
