/* Emre's Quest — design tokens, reset, typography. Dark (default) + light theme via [data-theme]. */
:root {
  color-scheme: dark;
  /* palette — dark "mission control" */
  --bg: #0a0f24;
  --bg-2: #0e1530;
  --bg-glow: radial-gradient(1200px 600px at 85% -10%, rgba(99, 102, 241, .22), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, .12), transparent 60%);
  --surface: #131b3b;
  --surface-2: #1a2450;
  --surface-3: #233063;
  --border: #2b3870;
  --border-strong: #3d4c8f;
  --text: #eef2ff;
  --text-muted: #aab4dc;
  --text-faint: #7d88b5;
  --primary: #7c6cff;
  --primary-2: #a78bfa;
  --primary-ink: #ffffff;
  --link: #a78bfa;
  --cyan: #22d3ee;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, .16);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, .16);
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, .16);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, .14);
  --xp: #fbbf24;
  --coin: #facc15;
  --accent: var(--primary);           /* override per element: style="--accent:#4f7cff" */
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-ink: #ffffff;

  /* shape & depth */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;
  --shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 8px 24px rgba(3, 6, 20, .35);
  --shadow-lg: 0 4px 0 rgba(0, 0, 0, .25), 0 20px 50px rgba(3, 6, 20, .5);
  --shadow-btn: 0 4px 0 rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent), 0 0 24px color-mix(in srgb, var(--accent) 35%, transparent);
  --focus: 0 0 0 3px var(--bg), 0 0 0 6px #ffd84d;

  /* type */
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: .78rem;
  --fs-sm: .9rem;
  --fs-md: 1rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.5rem;
  --fs-2xl: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
  --fs-3xl: clamp(2rem, 1.4rem + 2.6vw, 3rem);

  /* spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;

  /* layout */
  --topbar-h: 64px;
  --sidebar-w: 244px;
  --content-max: 1180px;
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --dur: .18s;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fc;
  --bg-2: #ffffff;
  --bg-glow: radial-gradient(1200px 600px at 85% -10%, rgba(124, 108, 255, .14), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, .12), transparent 60%);
  --surface: #ffffff;
  --surface-2: #eef1fb;
  --surface-3: #e2e7f7;
  --border: #d6dcf0;
  --border-strong: #b7c0e0;
  --text: #121735;
  --text-muted: #4a5478;
  --text-faint: #6b7499;
  --primary: #5b4ae6;
  --primary-2: #7c6cff;
  --link: #5b4ae6;
  --cyan: #0891b2;
  --success: #15803d;
  --success-soft: rgba(22, 163, 74, .12);
  --warning: #b45309;
  --warning-soft: rgba(217, 119, 6, .12);
  --danger: #be123c;
  --danger-soft: rgba(225, 29, 72, .1);
  --info: #0369a1;
  --info-soft: rgba(2, 132, 199, .1);
  --xp: #b45309;
  --coin: #a16207;
  --shadow: 0 1px 0 rgba(18, 23, 53, .06), 0 6px 18px rgba(18, 23, 53, .08);
  --shadow-lg: 0 2px 0 rgba(18, 23, 53, .06), 0 18px 40px rgba(18, 23, 53, .14);
  --shadow-btn: 0 4px 0 rgba(18, 23, 53, .22);
  --focus: 0 0 0 3px var(--bg), 0 0 0 6px #5b4ae6;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--s3); font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--s3); }
a { color: var(--link); text-underline-offset: 3px; }
code, kbd { font-family: var(--font-mono); font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s5) 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--primary) 45%, transparent); }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-xs); }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s3); top: -60px; z-index: 1000; background: var(--primary); color: #fff; padding: var(--s2) var(--s4); border-radius: var(--radius-sm); }
.skip-link:focus { top: var(--s3); }

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

/* --accent-soft must follow a per-element --accent (e.g. subject colours set inline), so recompute it wherever --accent is set inline or by a helper class. */
[style*="--accent"] { --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent); }
.chip-success, .chip-warning, .chip-danger, .chip-info, .chip-muted { --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent); }
