/*!
 * Testipy Design System — testipy.css  v1.0
 * "Answer Bubble" brand. Light + dark themes, tokens, base, components.
 *
 * Fonts (add to <head>):
 * <link rel="preconnect" href="https://fonts.googleapis.com">
 * <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 * <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap" rel="stylesheet">
 *
 * Theme: light by default, follows the OS, force with <html data-theme="dark|light">.
 */

/* =========================================================
   1. PRIMITIVE TOKENS  (raw palette — don't use directly in UI)
   ========================================================= */
:root {
  /* Ink — the wordmark colour */
  --tp-ink-950: #0B1120;
  --tp-ink-900: #111827;
  --tp-ink-800: #1F2937;
  --tp-ink-700: #374151;
  --tp-ink-600: #4B5563;
  --tp-ink-500: #6B7280;
  --tp-ink-400: #9CA3AF;
  --tp-ink-300: #D1D5DB;
  --tp-ink-200: #E5E7EB;
  --tp-ink-100: #F3F4F6;
  --tp-ink-50:  #F9FAFB;

  /* Bubble Orange — the answer-bubble colour */
  --tp-orange-900: #7C2D12;
  --tp-orange-800: #9A3412;
  --tp-orange-700: #C2410C;   /* text/buttons on white (5.2:1) */
  --tp-orange-600: #EA580C;   /* BRAND — logo dot, bubbles, graphics */
  --tp-orange-500: #F97316;
  --tp-orange-400: #FB923C;   /* accent on dark */
  --tp-orange-200: #FED7AA;
  --tp-orange-100: #FFEDD5;
  --tp-orange-50:  #FFF7ED;

  /* Status (follows Indian exam-portal conventions) */
  --tp-green-700:  #15803D;  --tp-green-500:  #22C55E;  --tp-green-50:  #F0FDF4;
  --tp-red-700:    #B91C1C;  --tp-red-500:    #EF4444;  --tp-red-50:    #FEF2F2;
  --tp-amber-700:  #B45309;  --tp-amber-500:  #F59E0B;  --tp-amber-50:  #FFFBEB;
  --tp-violet-700: #6D28D9;  --tp-violet-500: #8B5CF6;  --tp-violet-50: #F5F3FF;
  --tp-blue-700:   #1D4ED8;  --tp-blue-500:   #3B82F6;  --tp-blue-50:   #EFF6FF;

  /* Type */
  --tp-font-display: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --tp-font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --tp-font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Type scale — 1.25 major third, 16px base */
  --tp-text-xs: 0.75rem;     /* 12 */
  --tp-text-sm: 0.875rem;    /* 14 */
  --tp-text-md: 1rem;        /* 16 */
  --tp-text-lg: 1.125rem;    /* 18 */
  --tp-text-xl: 1.25rem;     /* 20 */
  --tp-text-2xl: 1.5rem;     /* 24 */
  --tp-text-3xl: 1.875rem;   /* 30 */
  --tp-text-4xl: 2.5rem;     /* 40 */
  --tp-text-5xl: 3.25rem;    /* 52 */
  --tp-text-6xl: 4rem;       /* 64 */
  --tp-leading-tight: 1.1;
  --tp-leading-snug: 1.3;
  --tp-leading-normal: 1.55;
  --tp-tracking-display: -0.035em;
  --tp-tracking-caps: 0.08em;

  /* Spacing — 4px grid */
  --tp-space-0: 0;
  --tp-space-1: 0.25rem;  --tp-space-2: 0.5rem;   --tp-space-3: 0.75rem;
  --tp-space-4: 1rem;     --tp-space-5: 1.25rem;  --tp-space-6: 1.5rem;
  --tp-space-8: 2rem;     --tp-space-10: 2.5rem;  --tp-space-12: 3rem;
  --tp-space-16: 4rem;    --tp-space-20: 5rem;    --tp-space-24: 6rem;

  /* Radius — friendly, bubble-inspired */
  --tp-radius-xs: 4px;
  --tp-radius-sm: 8px;
  --tp-radius-md: 12px;
  --tp-radius-lg: 16px;
  --tp-radius-xl: 24px;
  --tp-radius-full: 999px;

  /* Motion */
  --tp-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --tp-ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --tp-dur-fast: 120ms;
  --tp-dur: 200ms;
  --tp-dur-slow: 360ms;

  /* Layout */
  --tp-container: 1200px;
  --tp-container-narrow: 760px;
  --tp-header-h: 64px;

  --tp-z-dropdown: 100; --tp-z-sticky: 200; --tp-z-modal: 400; --tp-z-toast: 500;
}

/* =========================================================
   2. SEMANTIC TOKENS — LIGHT (default)
   ========================================================= */
:root,
[data-theme="light"] {
  color-scheme: light;
  --tp-bg: #FFFFFF;
  --tp-bg-subtle: var(--tp-ink-50);
  --tp-surface: #FFFFFF;
  --tp-surface-raised: #FFFFFF;
  --tp-surface-sunken: var(--tp-ink-100);
  --tp-border: var(--tp-ink-200);
  --tp-border-strong: var(--tp-ink-300);

  --tp-text: var(--tp-ink-900);
  --tp-text-muted: var(--tp-ink-600);
  --tp-text-subtle: var(--tp-ink-500);
  --tp-text-inverse: #FFFFFF;

  --tp-brand: var(--tp-orange-600);          /* graphics */
  --tp-accent: var(--tp-orange-700);         /* text, links, accent buttons */
  --tp-accent-hover: var(--tp-orange-800);
  --tp-accent-soft: var(--tp-orange-50);
  --tp-accent-soft-border: var(--tp-orange-200);

  --tp-primary: var(--tp-ink-900);           /* primary button */
  --tp-primary-hover: var(--tp-ink-700);
  --tp-on-primary: #FFFFFF;

  --tp-success: var(--tp-green-700);   --tp-success-soft: var(--tp-green-50);
  --tp-danger: var(--tp-red-700);      --tp-danger-soft: var(--tp-red-50);
  --tp-warning: var(--tp-amber-700);   --tp-warning-soft: var(--tp-amber-50);
  --tp-review: var(--tp-violet-700);   --tp-review-soft: var(--tp-violet-50);
  --tp-info: var(--tp-blue-700);       --tp-info-soft: var(--tp-blue-50);

  --tp-focus: 0 0 0 3px var(--tp-bg), 0 0 0 5px var(--tp-orange-600);
  --tp-shadow-sm: 0 1px 2px rgb(17 24 39 / 0.06);
  --tp-shadow-md: 0 4px 12px -2px rgb(17 24 39 / 0.08), 0 2px 4px rgb(17 24 39 / 0.04);
  --tp-shadow-lg: 0 16px 40px -8px rgb(17 24 39 / 0.16);
}

/* =========================================================
   3. SEMANTIC TOKENS — DARK
   ========================================================= */
[data-theme="dark"] {
  color-scheme: dark;
  --tp-bg: var(--tp-ink-950);
  --tp-bg-subtle: #0F1626;
  --tp-surface: var(--tp-ink-900);
  --tp-surface-raised: var(--tp-ink-800);
  --tp-surface-sunken: #0A0F1C;
  --tp-border: #263042;
  --tp-border-strong: #364156;
  --tp-text: var(--tp-ink-100);
  --tp-text-muted: var(--tp-ink-400);
  --tp-text-subtle: #8B93A3;
  --tp-text-inverse: var(--tp-ink-900);
  --tp-brand: var(--tp-orange-500);
  --tp-accent: var(--tp-orange-400);
  --tp-accent-hover: var(--tp-orange-200);
  --tp-accent-soft: rgb(234 88 12 / 0.14);
  --tp-accent-soft-border: rgb(251 146 60 / 0.35);
  --tp-primary: #FFFFFF;
  --tp-primary-hover: var(--tp-ink-200);
  --tp-on-primary: var(--tp-ink-900);
  --tp-success: #4ADE80;  --tp-success-soft: rgb(34 197 94 / 0.14);
  --tp-danger: #F87171;   --tp-danger-soft: rgb(239 68 68 / 0.14);
  --tp-warning: #FBBF24;  --tp-warning-soft: rgb(245 158 11 / 0.14);
  --tp-review: #A78BFA;   --tp-review-soft: rgb(139 92 246 / 0.16);
  --tp-info: #60A5FA;     --tp-info-soft: rgb(59 130 246 / 0.14);
  --tp-focus: 0 0 0 3px var(--tp-bg), 0 0 0 5px var(--tp-orange-400);
  --tp-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --tp-shadow-md: 0 4px 14px -2px rgb(0 0 0 / 0.5);
  --tp-shadow-lg: 0 18px 44px -8px rgb(0 0 0 / 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --tp-bg: var(--tp-ink-950); --tp-bg-subtle: #0F1626;
    --tp-surface: var(--tp-ink-900); --tp-surface-raised: var(--tp-ink-800); --tp-surface-sunken: #0A0F1C;
    --tp-border: #263042; --tp-border-strong: #364156;
    --tp-text: var(--tp-ink-100); --tp-text-muted: var(--tp-ink-400); --tp-text-subtle: #8B93A3; --tp-text-inverse: var(--tp-ink-900);
    --tp-brand: var(--tp-orange-500); --tp-accent: var(--tp-orange-400); --tp-accent-hover: var(--tp-orange-200);
    --tp-accent-soft: rgb(234 88 12 / 0.14); --tp-accent-soft-border: rgb(251 146 60 / 0.35);
    --tp-primary: #FFFFFF; --tp-primary-hover: var(--tp-ink-200); --tp-on-primary: var(--tp-ink-900);
    --tp-success: #4ADE80; --tp-success-soft: rgb(34 197 94 / 0.14);
    --tp-danger: #F87171; --tp-danger-soft: rgb(239 68 68 / 0.14);
    --tp-warning: #FBBF24; --tp-warning-soft: rgb(245 158 11 / 0.14);
    --tp-review: #A78BFA; --tp-review-soft: rgb(139 92 246 / 0.16);
    --tp-info: #60A5FA; --tp-info-soft: rgb(59 130 246 / 0.14);
    --tp-focus: 0 0 0 3px var(--tp-bg), 0 0 0 5px var(--tp-orange-400);
    --tp-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4); --tp-shadow-md: 0 4px 14px -2px rgb(0 0 0 / 0.5); --tp-shadow-lg: 0 18px 44px -8px rgb(0 0 0 / 0.6);
  }
}

/* =========================================================
   4. BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--tp-bg);
  color: var(--tp-text);
  font-family: var(--tp-font-body);
  font-size: var(--tp-text-md);
  line-height: var(--tp-leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4, .tp-display {
  font-family: var(--tp-font-display);
  font-weight: 700;
  letter-spacing: var(--tp-tracking-display);
  line-height: var(--tp-leading-tight);
  margin: 0 0 var(--tp-space-4);
  text-wrap: balance;
}
h1 { font-size: clamp(var(--tp-text-4xl), 5vw + 1rem, var(--tp-text-6xl)); }
h2 { font-size: clamp(var(--tp-text-3xl), 3vw + 1rem, var(--tp-text-5xl)); }
h3 { font-size: var(--tp-text-2xl); font-weight: 600; letter-spacing: -0.02em; line-height: var(--tp-leading-snug); }
h4 { font-size: var(--tp-text-xl); font-weight: 600; letter-spacing: -0.015em; line-height: var(--tp-leading-snug); }
p { margin: 0 0 var(--tp-space-4); text-wrap: pretty; }
small, .tp-small { font-size: var(--tp-text-sm); }
code, kbd, pre, .tp-mono { font-family: var(--tp-font-mono); font-size: 0.92em; }
code { background: var(--tp-surface-sunken); padding: 0.1em 0.35em; border-radius: var(--tp-radius-xs); }

a { color: var(--tp-accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--tp-accent-hover); }
:focus-visible { outline: none; box-shadow: var(--tp-focus); border-radius: var(--tp-radius-sm); }
::selection { background: var(--tp-orange-200); color: var(--tp-ink-900); }
hr { border: 0; border-top: 1px solid var(--tp-border); margin: var(--tp-space-8) 0; }

.tp-eyebrow {
  font-family: var(--tp-font-body); font-size: var(--tp-text-xs); font-weight: 600;
  letter-spacing: var(--tp-tracking-caps); text-transform: uppercase; color: var(--tp-accent);
}
.tp-lead { font-size: var(--tp-text-lg); color: var(--tp-text-muted); }
.tp-muted { color: var(--tp-text-muted); }
.tp-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* =========================================================
   5. LAYOUT
   ========================================================= */
.tp-container { width: 100%; max-width: var(--tp-container); margin-inline: auto; padding-inline: var(--tp-space-5); }
.tp-container--narrow { max-width: var(--tp-container-narrow); }
.tp-section { padding-block: var(--tp-space-16); }
.tp-stack { display: flex; flex-direction: column; gap: var(--tp-space-4); }
.tp-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tp-space-3); }
.tp-grid { display: grid; gap: var(--tp-space-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

/* =========================================================
   6. SIGNATURE: THE ANSWER BUBBLE
   The brand dot. Use as a bullet, loader, status or accent.
   ========================================================= */
.tp-bubble {
  display: inline-block; flex: none;
  width: 0.6em; height: 0.6em; border-radius: 50%;
  background: var(--tp-brand);
  vertical-align: 0.1em;
}
.tp-bubble--outline { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }
.tp-bubble--pulse { animation: tp-pulse 1.4s var(--tp-ease-out) infinite; }
@keyframes tp-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(0.72); opacity: .7; } }

/* Bubble bullet list */
.tp-list-bubble { list-style: none; padding: 0; margin: 0 0 var(--tp-space-4); }
.tp-list-bubble li { position: relative; padding-left: 1.6em; margin-bottom: var(--tp-space-2); }
.tp-list-bubble li::before {
  content: ""; position: absolute; left: 0.2em; top: 0.5em;
  width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--tp-brand);
}

/* Logo sizing helper:  <img class="tp-logo" src="testipy-wordmark.svg" alt="Testipy"> */
.tp-logo { height: 32px; width: auto; }
.tp-logo--sm { height: 24px; } .tp-logo--lg { height: 48px; }

/* =========================================================
   7. BUTTONS
   ========================================================= */
.tp-btn {
  --_bg: var(--tp-primary); --_fg: var(--tp-on-primary); --_bd: transparent; --_bg-h: var(--tp-primary-hover);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--tp-space-2);
  min-height: 44px; padding: 0 var(--tp-space-5);
  border: 1.5px solid var(--_bd); border-radius: var(--tp-radius-full);
  background: var(--_bg); color: var(--_fg);
  font-family: var(--tp-font-body); font-size: var(--tp-text-md); font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--tp-dur) var(--tp-ease-out), transform var(--tp-dur-fast) var(--tp-ease-out), border-color var(--tp-dur);
}
.tp-btn:hover { background: var(--_bg-h); color: var(--_fg); }
.tp-btn:active { transform: translateY(1px) scale(0.99); }
.tp-btn:disabled, .tp-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.tp-btn--accent { --_bg: var(--tp-orange-700); --_fg: #FFFFFF; --_bg-h: var(--tp-orange-800); }
.tp-btn--secondary { --_bg: transparent; --_fg: var(--tp-text); --_bd: var(--tp-border-strong); --_bg-h: var(--tp-surface-sunken); }
.tp-btn--ghost { --_bg: transparent; --_fg: var(--tp-text); --_bg-h: var(--tp-surface-sunken); }
.tp-btn--danger { --_bg: var(--tp-red-700); --_fg: #FFFFFF; --_bg-h: #991B1B; }
.tp-btn--sm { min-height: 36px; padding: 0 var(--tp-space-4); font-size: var(--tp-text-sm); }
.tp-btn--lg { min-height: 52px; padding: 0 var(--tp-space-8); font-size: var(--tp-text-lg); }
.tp-btn--block { width: 100%; }
.tp-btn--icon { width: 44px; padding: 0; }
.tp-btn .tp-bubble { width: 0.5em; height: 0.5em; }

/* =========================================================
   8. FORMS
   ========================================================= */
.tp-field { display: flex; flex-direction: column; gap: var(--tp-space-2); }
.tp-label { font-size: var(--tp-text-sm); font-weight: 600; color: var(--tp-text); }
.tp-hint { font-size: var(--tp-text-sm); color: var(--tp-text-muted); }
.tp-error { font-size: var(--tp-text-sm); color: var(--tp-danger); font-weight: 500; }
.tp-input, .tp-select, .tp-textarea {
  width: 100%; min-height: 44px; padding: var(--tp-space-2) var(--tp-space-4);
  background: var(--tp-surface); color: var(--tp-text);
  border: 1.5px solid var(--tp-border-strong); border-radius: var(--tp-radius-md);
  transition: border-color var(--tp-dur), box-shadow var(--tp-dur);
}
.tp-textarea { min-height: 120px; padding-block: var(--tp-space-3); resize: vertical; }
.tp-input::placeholder, .tp-textarea::placeholder { color: var(--tp-text-subtle); }
.tp-input:hover, .tp-select:hover, .tp-textarea:hover { border-color: var(--tp-ink-400); }
.tp-input:focus, .tp-select:focus, .tp-textarea:focus { outline: none; border-color: var(--tp-brand); box-shadow: 0 0 0 4px var(--tp-accent-soft); }
.tp-input[aria-invalid="true"] { border-color: var(--tp-danger); }
.tp-select { appearance: none; padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center; }

/* Checkbox & switch */
.tp-check { display: inline-flex; align-items: center; gap: var(--tp-space-2); cursor: pointer; min-height: 44px; }
.tp-check input { width: 20px; height: 20px; accent-color: var(--tp-orange-600); }
.tp-switch { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--tp-border-strong); position: relative; cursor: pointer; transition: background var(--tp-dur); }
.tp-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--tp-shadow-sm); transition: transform var(--tp-dur) var(--tp-ease-pop); }
.tp-switch:checked { background: var(--tp-orange-600); }
.tp-switch:checked::after { transform: translateX(18px); }

/* =========================================================
   9. ANSWER OPTIONS (MCQ) — the bubble in the product
   <label class="tp-option"><input type="radio" name="q1"><span class="tp-option__key">A</span><span class="tp-option__text">…</span></label>
   States via class on .tp-option: is-correct | is-incorrect | is-missed
   ========================================================= */
.tp-options { display: flex; flex-direction: column; gap: var(--tp-space-3); }
.tp-option {
  position: relative; display: flex; align-items: flex-start; gap: var(--tp-space-4);
  padding: var(--tp-space-4); min-height: 56px;
  background: var(--tp-surface); border: 1.5px solid var(--tp-border); border-radius: var(--tp-radius-lg);
  cursor: pointer; transition: border-color var(--tp-dur), background var(--tp-dur);
}
.tp-option:hover { border-color: var(--tp-border-strong); background: var(--tp-bg-subtle); }
.tp-option input { position: absolute; opacity: 0; pointer-events: none; }
.tp-option__key {
  flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--tp-border-strong); color: var(--tp-text-muted);
  font-family: var(--tp-font-display); font-weight: 600; font-size: var(--tp-text-sm);
  transition: all var(--tp-dur) var(--tp-ease-pop);
}
.tp-option__text { padding-top: 4px; }
.tp-option:has(input:focus-visible) { box-shadow: var(--tp-focus); }
.tp-option:has(input:checked) { border-color: var(--tp-brand); background: var(--tp-accent-soft); }
.tp-option:has(input:checked) .tp-option__key { background: var(--tp-brand); border-color: var(--tp-brand); color: #FFFFFF; transform: scale(1.06); }
.tp-option.is-correct { border-color: var(--tp-success); background: var(--tp-success-soft); }
.tp-option.is-correct .tp-option__key { background: var(--tp-green-700); border-color: var(--tp-green-700); color: #fff; }
.tp-option.is-incorrect { border-color: var(--tp-danger); background: var(--tp-danger-soft); }
.tp-option.is-incorrect .tp-option__key { background: var(--tp-red-700); border-color: var(--tp-red-700); color: #fff; }
.tp-option.is-missed { border-style: dashed; border-color: var(--tp-success); }

/* =========================================================
   10. QUESTION PALETTE (NTA-style navigator)
   <button class="tp-qnav" data-state="answered|not-answered|review|answered-review|not-visited" aria-current="true">12</button>
   ========================================================= */
.tp-qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: var(--tp-space-2); }
.tp-qnav {
  --_bg: var(--tp-surface-sunken); --_fg: var(--tp-text);
  position: relative; width: 100%; aspect-ratio: 1; min-width: 40px;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--_bg); color: var(--_fg);
  font-family: var(--tp-font-display); font-weight: 600; font-size: var(--tp-text-sm); cursor: pointer;
}
.tp-qnav[data-state="answered"]        { --_bg: var(--tp-green-700);  --_fg: #fff; }
.tp-qnav[data-state="not-answered"]    { --_bg: var(--tp-red-700);    --_fg: #fff; }
.tp-qnav[data-state="review"]          { --_bg: var(--tp-violet-700); --_fg: #fff; }
.tp-qnav[data-state="answered-review"] { --_bg: var(--tp-violet-700); --_fg: #fff; }
.tp-qnav[data-state="answered-review"]::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: 30%; height: 30%;
  border-radius: 50%; background: var(--tp-green-500); box-shadow: 0 0 0 2px var(--tp-surface);
}
.tp-qnav[aria-current="true"] { box-shadow: 0 0 0 2px var(--tp-surface), 0 0 0 4px var(--tp-brand); }

/* =========================================================
   11. CARDS, QUESTION CARD, STATS
   ========================================================= */
.tp-card {
  background: var(--tp-surface); border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-xl); padding: var(--tp-space-6);
  box-shadow: var(--tp-shadow-sm);
}
.tp-card--raised { box-shadow: var(--tp-shadow-md); border-color: transparent; }
.tp-card--interactive { transition: box-shadow var(--tp-dur), transform var(--tp-dur) var(--tp-ease-out); text-decoration: none; color: inherit; display: block; }
.tp-card--interactive:hover { box-shadow: var(--tp-shadow-lg); transform: translateY(-2px); color: inherit; }
.tp-card__title { font-family: var(--tp-font-display); font-size: var(--tp-text-xl); font-weight: 600; letter-spacing: -0.015em; margin: 0 0 var(--tp-space-2); }

.tp-question { display: flex; flex-direction: column; gap: var(--tp-space-5); }
.tp-question__meta { display: flex; flex-wrap: wrap; gap: var(--tp-space-2); align-items: center; font-size: var(--tp-text-sm); color: var(--tp-text-muted); }
.tp-question__no { font-family: var(--tp-font-display); font-weight: 700; color: var(--tp-text); }
.tp-question__stem { font-size: var(--tp-text-lg); line-height: 1.6; }

.tp-stat { display: flex; flex-direction: column; gap: var(--tp-space-1); }
.tp-stat__value { font-family: var(--tp-font-display); font-size: var(--tp-text-4xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.tp-stat__label { font-size: var(--tp-text-sm); color: var(--tp-text-muted); }
.tp-stat__delta--up { color: var(--tp-success); font-weight: 600; font-size: var(--tp-text-sm); }
.tp-stat__delta--down { color: var(--tp-danger); font-weight: 600; font-size: var(--tp-text-sm); }

/* =========================================================
   12. BADGES, TAGS, CHIPS
   ========================================================= */
.tp-badge {
  --_bg: var(--tp-surface-sunken); --_fg: var(--tp-text-muted);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--tp-radius-full);
  background: var(--_bg); color: var(--_fg);
  font-size: var(--tp-text-xs); font-weight: 600; line-height: 1.5;
}
.tp-badge--accent  { --_bg: var(--tp-accent-soft);  --_fg: var(--tp-accent); }
.tp-badge--success { --_bg: var(--tp-success-soft); --_fg: var(--tp-success); }
.tp-badge--danger  { --_bg: var(--tp-danger-soft);  --_fg: var(--tp-danger); }
.tp-badge--warning { --_bg: var(--tp-warning-soft); --_fg: var(--tp-warning); }
.tp-badge--review  { --_bg: var(--tp-review-soft);  --_fg: var(--tp-review); }
.tp-badge--info    { --_bg: var(--tp-info-soft);    --_fg: var(--tp-info); }
.tp-badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tp-chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--tp-space-4);
  border: 1.5px solid var(--tp-border-strong); border-radius: var(--tp-radius-full);
  background: var(--tp-surface); color: var(--tp-text); font-size: var(--tp-text-sm); font-weight: 500; cursor: pointer;
}
.tp-chip[aria-pressed="true"] { background: var(--tp-primary); border-color: var(--tp-primary); color: var(--tp-on-primary); }

/* =========================================================
   13. PROGRESS, TIMER, SCORE RING
   ========================================================= */
.tp-progress { height: 8px; background: var(--tp-surface-sunken); border-radius: 999px; overflow: hidden; }
.tp-progress__bar { height: 100%; width: var(--value, 0%); background: var(--tp-brand); border-radius: inherit; transition: width var(--tp-dur-slow) var(--tp-ease-out); }
.tp-progress--success .tp-progress__bar { background: var(--tp-green-700); }

.tp-timer {
  display: inline-flex; align-items: center; gap: var(--tp-space-2);
  padding: 6px 14px 6px 10px; border-radius: var(--tp-radius-full);
  background: var(--tp-primary); color: var(--tp-on-primary);
  font-family: var(--tp-font-mono); font-size: var(--tp-text-md); font-weight: 500; font-variant-numeric: tabular-nums;
}
.tp-timer::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--tp-orange-500); animation: tp-pulse 1s infinite; }
.tp-timer--warning { background: var(--tp-red-700); color: #fff; }
.tp-timer--warning::before { background: #fff; }

/* <div class="tp-ring" style="--value:72" role="img" aria-label="Score 72%"><span>72%</span></div> */
.tp-ring {
  --size: 120px; --thick: 12px;
  width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
  background:
    radial-gradient(closest-side, var(--tp-surface) calc(100% - var(--thick)), transparent calc(100% - var(--thick) + 1px)),
    conic-gradient(var(--tp-brand) calc(var(--value, 0) * 1%), var(--tp-surface-sunken) 0);
  font-family: var(--tp-font-display); font-weight: 700; font-size: calc(var(--size) * 0.22); letter-spacing: -0.03em;
}

/* =========================================================
   14. NAVIGATION, TABS, BREADCRUMB
   ========================================================= */
.tp-header {
  position: sticky; top: 0; z-index: var(--tp-z-sticky);
  min-height: var(--tp-header-h); display: flex; align-items: center;
  background: color-mix(in srgb, var(--tp-bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--tp-border);
}
.tp-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tp-space-4); width: 100%; }
.tp-nav { display: flex; flex-wrap: wrap; gap: var(--tp-space-1); list-style: none; margin: 0; padding: 0; }
.tp-nav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--tp-space-3);
  border-radius: var(--tp-radius-full); color: var(--tp-text-muted); font-weight: 500; text-decoration: none;
}
.tp-nav a:hover { color: var(--tp-text); background: var(--tp-surface-sunken); }
.tp-nav a[aria-current="page"] { color: var(--tp-text); }
.tp-nav a[aria-current="page"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tp-brand); margin-right: 8px; }

.tp-tabs { display: flex; gap: var(--tp-space-6); border-bottom: 1px solid var(--tp-border); overflow-x: auto; }
.tp-tab {
  position: relative; padding: var(--tp-space-3) 0; background: none; border: 0; cursor: pointer;
  color: var(--tp-text-muted); font-weight: 600; white-space: nowrap; min-height: 44px;
}
.tp-tab[aria-selected="true"] { color: var(--tp-text); }
.tp-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--tp-brand); }

.tp-breadcrumb { display: flex; flex-wrap: wrap; gap: var(--tp-space-2); font-size: var(--tp-text-sm); color: var(--tp-text-muted); list-style: none; padding: 0; margin: 0; }
.tp-breadcrumb li + li::before { content: "/"; margin-right: var(--tp-space-2); color: var(--tp-text-subtle); }
.tp-breadcrumb a { color: inherit; text-decoration: none; }
.tp-breadcrumb a:hover { color: var(--tp-text); }

/* =========================================================
   15. ALERTS, TOAST, TOOLTIP, MODAL
   ========================================================= */
.tp-alert {
  --_c: var(--tp-info); --_bg: var(--tp-info-soft);
  display: flex; gap: var(--tp-space-3); padding: var(--tp-space-4);
  border-radius: var(--tp-radius-md); background: var(--_bg); color: var(--tp-text);
  border: 1px solid color-mix(in srgb, var(--_c) 30%, transparent);
}
.tp-alert::before { content: ""; flex: none; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--_c); }
.tp-alert--success { --_c: var(--tp-success); --_bg: var(--tp-success-soft); }
.tp-alert--warning { --_c: var(--tp-warning); --_bg: var(--tp-warning-soft); }
.tp-alert--danger  { --_c: var(--tp-danger);  --_bg: var(--tp-danger-soft); }
.tp-alert__title { font-weight: 600; margin-bottom: 2px; }

.tp-toast {
  position: fixed; bottom: var(--tp-space-6); left: 50%; transform: translateX(-50%); z-index: var(--tp-z-toast);
  display: flex; align-items: center; gap: var(--tp-space-3);
  padding: var(--tp-space-3) var(--tp-space-5); border-radius: var(--tp-radius-full);
  background: var(--tp-primary); color: var(--tp-on-primary); box-shadow: var(--tp-shadow-lg); font-weight: 500;
}

.tp-tooltip { position: relative; }
.tp-tooltip[data-tip]:hover::after, .tp-tooltip[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  padding: 6px 10px; border-radius: var(--tp-radius-sm); background: var(--tp-ink-900); color: #fff;
  font-size: var(--tp-text-xs); font-weight: 500; white-space: nowrap; z-index: var(--tp-z-dropdown);
}

.tp-modal { border: 0; padding: 0; border-radius: var(--tp-radius-xl); background: var(--tp-surface); color: var(--tp-text); box-shadow: var(--tp-shadow-lg); width: min(560px, calc(100vw - 32px)); }
.tp-modal::backdrop { background: rgb(11 17 32 / 0.55); backdrop-filter: blur(2px); }
.tp-modal__body { padding: var(--tp-space-8); }
.tp-modal__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--tp-space-3); padding: 0 var(--tp-space-8) var(--tp-space-8); }

/* =========================================================
   16. TABLE (leaderboards, results)
   ========================================================= */
.tp-table-wrap { overflow-x: auto; border: 1px solid var(--tp-border); border-radius: var(--tp-radius-lg); }
.tp-table { width: 100%; border-collapse: collapse; font-size: var(--tp-text-sm); }
.tp-table th { text-align: left; font-weight: 600; color: var(--tp-text-muted); background: var(--tp-bg-subtle); padding: var(--tp-space-3) var(--tp-space-4); border-bottom: 1px solid var(--tp-border); white-space: nowrap; }
.tp-table td { padding: var(--tp-space-3) var(--tp-space-4); border-bottom: 1px solid var(--tp-border); }
.tp-table tr:last-child td { border-bottom: 0; }
.tp-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.tp-table tr.is-me td { background: var(--tp-accent-soft); }

/* =========================================================
   17. SKELETON & LOADER
   ========================================================= */
.tp-skeleton { background: linear-gradient(90deg, var(--tp-surface-sunken) 25%, var(--tp-border) 37%, var(--tp-surface-sunken) 63%); background-size: 400% 100%; animation: tp-shimmer 1.4s ease infinite; border-radius: var(--tp-radius-sm); }
@keyframes tp-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
/* Three answer bubbles filling in turn */
.tp-loader { display: inline-flex; gap: 6px; }
.tp-loader span { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--tp-brand); animation: tp-fill 1.2s infinite; }
.tp-loader span:nth-child(2) { animation-delay: .2s; } .tp-loader span:nth-child(3) { animation-delay: .4s; }
@keyframes tp-fill { 0%,60%,100% { background: transparent; } 30% { background: var(--tp-brand); } }

/* =========================================================
   18. FOOTER
   ========================================================= */
.tp-footer { border-top: 1px solid var(--tp-border); padding-block: var(--tp-space-12); color: var(--tp-text-muted); font-size: var(--tp-text-sm); }
.tp-footer a { color: inherit; text-decoration: none; }
.tp-footer a:hover { color: var(--tp-text); }

/* =========================================================
   19. ACCESSIBILITY & PRINT
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media print {
  .tp-header, .tp-footer, .tp-btn, .tp-qgrid { display: none !important; }
  body { background: #fff; color: #000; }
  .tp-card { box-shadow: none; border-color: #ccc; }
}
