/* ============ AwesomeQuiz design system ============ */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('/fonts/nunito-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('/fonts/nunito-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* answer identities */
  --ans-a: #f2545b;
  --ans-a-dark: #c43b42;
  --ans-b: #7b5cff;
  --ans-b-dark: #5a3fd6;
  --ans-c: #00a08e;
  --ans-c-dark: #007a6c;
  --ans-d: #db7600;
  --ans-d-dark: #b06000;

  --good: #16a34a;
  --good-dark: #11803a;
  --bad: #ef4444;
  --bad-dark: #c62828;
  --gold: #ffc83d;
  --silver: #d6dbe6;
  --bronze: #f0a066;

  /* surfaces (light UI on top of themed backgrounds) */
  --surface: #ffffff;
  --surface-2: #f5f3fb;
  --surface-3: #ebe7f6;
  --ink: #1d1534;
  --ink-2: #4a4263;
  --ink-3: #8a83a3;
  --line: #e3def0;

  --radius-s: 10px;
  --radius: 16px;
  --radius-l: 24px;
  --shadow-s: 0 2px 6px rgba(29, 21, 52, .08);
  --shadow: 0 10px 30px rgba(29, 21, 52, .14);
  --shadow-l: 0 24px 60px rgba(29, 21, 52, .28);
  --ease: cubic-bezier(.2, .9, .3, 1.2);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* ---- themes: background gradient + accent ---- */
:root, [data-theme='aurora'] {
  --bg-1: #4a1fb8;
  --bg-2: #b5179e;
  --bg-3: #f72585;
  --accent: #6d28d9;
  --accent-dark: #4c1d95;
  --accent-soft: #ede4ff;
  --accent-ink: #fff; /* text on accent backgrounds */
  --accent-text: var(--accent); /* accent used as text/icon colour on light surfaces */
}
[data-theme='ocean'] {
  --bg-1: #03256c;
  --bg-2: #1768ac;
  --bg-3: #06bee1;
  --accent: #1768ac;
  --accent-dark: #0d4a80;
  --accent-soft: #dff1fb;
}
[data-theme='sunset'] {
  --bg-1: #9d0208;
  --bg-2: #e85d04;
  --bg-3: #ffba08;
  --accent: #dc2f02;
  --accent-dark: #9d0208;
  --accent-soft: #ffeadc;
}
[data-theme='forest'] {
  --bg-1: #064e3b;
  --bg-2: #047857;
  --bg-3: #65a30d;
  --accent: #047857;
  --accent-dark: #064e3b;
  --accent-soft: #dcf5e8;
}
[data-theme='bee'] {
  /* yellow / black */
  --bg-1: #0b0b0b;
  --bg-2: #1f1f1f;
  --bg-3: #ffcc00;
  --accent: #ffcc00;
  --accent-dark: #c79f00;
  --accent-soft: #fff4c2;
  --accent-ink: #111111; /* black text on yellow */
  --accent-text: #7a5c00; /* dark gold: readable on white */
}
[data-theme='bee'] .stage {
  background:
    radial-gradient(900px 500px at 0% -10%, rgba(255, 204, 0, .30), transparent 60%),
    radial-gradient(800px 600px at 110% 110%, rgba(255, 204, 0, .20), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255, 204, 0, .05) 0 40px, transparent 40px 80px),
    linear-gradient(135deg, #0b0b0b, #1f1f1f);
  background-attachment: fixed;
}
[data-theme='midnight'] {
  --bg-1: #0b0b1e;
  --bg-2: #1e1b4b;
  --bg-3: #3b0764;
  --accent: #7c3aed;
  --accent-dark: #5b21b6;
  --accent-soft: #ece6ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface-2);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 900; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent-text); font-weight: 700; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--accent); border-radius: 6px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- themed full-screen stage ---- */
.stage {
  min-height: 100vh;
  min-height: 100dvh;
  color: #fff;
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--bg-3) 55%, transparent), transparent 60%),
    radial-gradient(900px 700px at 110% 110%, color-mix(in srgb, var(--bg-3) 40%, transparent), transparent 60%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}
.bg-shapes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-shape {
  position: absolute;
  bottom: -120px;
  width: var(--size, 60px);
  height: var(--size, 60px);
  color: rgba(255, 255, 255, .07);
  animation: floatUp linear infinite;
}
.bg-shape svg { width: 100%; height: 100%; }
@keyframes floatUp {
  from { transform: translateY(0) rotate(0); }
  to { transform: translateY(-130vh) rotate(360deg); }
}
:where(.stage > :not(.bg-shapes)) { position: relative; z-index: 1; }

/* ---- icons ---- */
.icon { display: inline-flex; width: 1.2em; height: 1.2em; flex: none; vertical-align: middle; }
.icon svg { width: 100%; height: 100%; }

/* ---- buttons ---- */
.btn {
  --b: var(--accent);
  --b-dark: var(--accent-dark);
  --b-ink: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  border: 0;
  border-radius: var(--radius-s);
  padding: .7em 1.2em;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  color: var(--b-ink);
  background: var(--b);
  box-shadow: 0 4px 0 var(--b-dark);
  transform: translateY(0);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s, background .15s;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--b-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.4); }
.btn-primary { --b: var(--accent); --b-dark: var(--accent-dark); --b-ink: var(--accent-ink); }
.btn-success { --b: var(--good); --b-dark: var(--good-dark); --b-ink: #fff; }
.btn-danger { --b: var(--bad); --b-dark: var(--bad-dark); --b-ink: #fff; }
.btn-ghost { --b: var(--surface-3); --b-dark: #d5cfe6; --b-ink: var(--ink); }
.btn-white { --b: #fff; --b-dark: rgba(0, 0, 0, .25); --b-ink: var(--ink); }
.btn-glass { --b: rgba(0, 0, 0, .22); --b-dark: rgba(0, 0, 0, .18); --b-ink: #fff; backdrop-filter: blur(8px); }
.btn-lg { font-size: 1.2rem; padding: .85em 1.6em; border-radius: var(--radius); }
.btn-xl { font-size: 1.45rem; padding: .9em 1.8em; border-radius: var(--radius); }
.btn-sm { font-size: .875rem; padding: .45em .8em; box-shadow: 0 3px 0 var(--b-dark); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: transparent; color: inherit; cursor: pointer; font-size: 1.1rem;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(127, 110, 170, .14); }

/* ---- form controls ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 800; font-size: .9rem; color: var(--ink-2); }
.hint { font-size: .82rem; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  padding: .7em .9em;
  font-weight: 700;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.textarea { resize: vertical; min-height: 90px; }
.input-xl {
  font-size: 1.6rem; font-weight: 900; text-align: center; padding: .55em .6em;
  border-radius: var(--radius); letter-spacing: .02em;
}
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-s); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--good); }
.switch input:checked::after { transform: translateX(20px); }

/* segmented control */
.segmented { display: inline-flex; background: var(--surface-3); padding: 4px; border-radius: 12px; gap: 4px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; padding: .45em .9em; border-radius: 9px; font-weight: 800; cursor: pointer; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-s); }

/* ---- cards ---- */
.card { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow); color: var(--ink); }
.muted { color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: .25em .7em; border-radius: 99px; background: var(--surface-3); font-weight: 800; font-size: .8rem; color: var(--ink-2); }

/* ---- answer tiles (shared) ---- */
.ans-a { --ans: var(--ans-a); --ans-dark: var(--ans-a-dark); }
.ans-b { --ans: var(--ans-b); --ans-dark: var(--ans-b-dark); }
.ans-c { --ans: var(--ans-c); --ans-dark: var(--ans-c-dark); }
.ans-d { --ans: var(--ans-d); --ans-dark: var(--ans-d-dark); }

/* ---- toast ---- */
#toasts { position: fixed; z-index: 1000; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 800;
  box-shadow: var(--shadow-l); transform: translateY(20px) scale(.96); opacity: 0; transition: all .3s var(--ease-out); max-width: min(92vw, 520px);
}
.toast.show { transform: none; opacity: 1; }
.toast-success .icon { color: var(--good); }
.toast-error .icon { color: #ff8a8a; }
.toast-info .icon { color: var(--gold); }

/* ---- modal ---- */
.overlay {
  position: fixed; inset: 0; z-index: 900; background: rgba(20, 12, 40, .55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .2s;
}
.overlay.show { opacity: 1; }
.modal { background: var(--surface); color: var(--ink); border-radius: var(--radius-l); width: min(480px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow-l); transform: translateY(16px) scale(.97); transition: transform .25s var(--ease-out); }
.modal-wide { width: min(720px, 100%); }
.overlay.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 0 24px; }
.modal-head h2 { font-size: 1.3rem; }
.modal-body { padding: 16px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 8px 24px 24px; flex-wrap: wrap; }

/* ---- spinner ---- */
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner-dark { border-color: var(--surface-3); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- shared animations ---- */
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.anim-pop { animation: popIn .45s var(--ease) both; }
.anim-up { animation: slideUp .5s var(--ease-out) both; }
.anim-fade { animation: fadeIn .4s ease both; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: confettiFall linear forwards; }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); } }

/* brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 1000; letter-spacing: -.02em; }
.brand-mark { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 5px; background: #fff; box-shadow: var(--shadow-s); transform: rotate(-6deg); }
.brand-mark i { border-radius: 4px; }
.brand-mark i:nth-child(1) { background: var(--ans-a); }
.brand-mark i:nth-child(2) { background: var(--ans-b); }
.brand-mark i:nth-child(3) { background: var(--ans-c); }
.brand-mark i:nth-child(4) { background: var(--ans-d); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .bg-shapes { display: none; }
}

/* custom logo: shown on a white tile so any logo stays legible on every theme */
.brand-logo { flex: none; height: 36px; max-width: 180px; display: inline-flex; align-items: center; background: #fff; border-radius: 11px; padding: 4px 8px; box-shadow: var(--shadow-s); }
.brand-logo img { height: 100%; width: auto; max-width: 100%; object-fit: contain; }
