/* The Catalyst Live — design tokens and base components.
   Type: Inter (text), Space Grotesk (headlines; falls back to Inter Display, which ships with the app),
   JetBrains Mono (identifiers). Fonts are self-hosted: the app works offline and sends nothing to font CDNs.
   Space Grotesk is used when installed on the device; to ship it with the app, add its woff2 to /public/fonts/
   and a url() to the @font-face below (it could not be downloaded in the build environment). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: local("Inter Regular"), local("Inter-Regular"), url("/fonts/Inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 400; font-display: swap; src: local("Inter Italic"), local("Inter-Italic"), url("/fonts/Inter-Italic.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: local("Inter Medium"), local("Inter-Medium"), url("/fonts/Inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: local("Inter SemiBold"), local("Inter-SemiBold"), url("/fonts/Inter-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700 900; font-display: swap; src: local("Inter Bold"), local("Inter-Bold"), url("/fonts/Inter-Bold.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-style: normal; font-weight: 500 600; font-display: swap; src: local("Inter Display SemiBold"), local("InterDisplay-SemiBold"), url("/fonts/InterDisplay-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-style: normal; font-weight: 700 900; font-display: swap; src: local("Inter Display Bold"), local("InterDisplay-Bold"), url("/fonts/InterDisplay-Bold.woff") format("woff"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700; font-display: swap; src: local("Space Grotesk"), local("SpaceGrotesk-Regular"), local("Space Grotesk Regular"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: local("JetBrains Mono"), local("JetBrainsMono-Regular"), url("/fonts/JetBrainsMono-Regular.woff") format("woff"); }

:root {
  /* brand */
  --purple: #3B1F73; --night: #15102A; --violet: #6D28D9; --lilac: #D9CCFF; --paper: #FAF9F7;
  /* roles (names kept for older pages) */
  --purple-2: #5B2DB8; --deep: #15102A; --accent: #6D28D9;
  --tint: #F4F1FA; --tint-2: #ECE6F7; --surface: #FAF9F7; --raised: #fff;
  --ink: #15102A; --muted: #5B5470; --line: #E4DFEC; --line-strong: #8A82A0; --white: #fff;
  --ok: #1C7547; --ok-bg: #E5F3EA; --bad: #B42318; --bad-bg: #FCE9E7; --warn: #A34A06; --warn-bg: #FCEFDF;
  --radius: 16px; --radius-s: 10px; --radius-l: 22px; --pill: 999px;
  --shadow: 0 1px 2px rgba(21,16,42,.05), 0 8px 28px rgba(21,16,42,.07);
  --shadow-lift: 0 2px 4px rgba(21,16,42,.06), 0 16px 40px rgba(21,16,42,.12);
  --shadow-dialog: 0 24px 64px rgba(21,16,42,.22);
  --ease: cubic-bezier(.2,.7,.2,1);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Space Grotesk", "Inter Display", "Inter", system-ui, sans-serif;
  --serif: var(--display); /* older pages use --serif for headlines */
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--surface); line-height: 1.55; font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); line-height: 1.18; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: 1.85rem; } h2 { font-size: 1.4rem; letter-spacing: -.01em; } h3 { font-size: 1.12rem; font-weight: 600; letter-spacing: -.005em; } h4 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .8em; }
a { color: var(--accent); text-underline-offset: 3px; }
code, kbd, .mono { font-family: var(--mono); font-size: .9em; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
::selection { background: var(--lilac); color: var(--night); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.kicker { font-family: var(--sans); font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); line-height: 1.35; }
.wordmark { font-family: var(--sans); font-weight: 700; letter-spacing: .2em; font-size: .74rem; color: var(--purple); text-transform: uppercase; display: inline-flex; align-items: center; gap: .55rem; white-space: nowrap; }
.wordmark svg { width: 22px; height: 22px; flex: none; }
.wordmark .live, .wm-live { font-family: var(--display); font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 1.12em; color: var(--lilac); margin-left: .05em; }

/* product lockup: mark + THE CATALYST + Live (one name for every part of the platform) */
.lockup { display: inline-flex; align-items: center; gap: .6rem; color: var(--purple); text-decoration: none; white-space: nowrap; }
.lockup .cl-mark { width: 24px; height: 24px; flex: none; }
.lockup .lk { display: inline-flex; align-items: baseline; gap: .4rem; line-height: 1; }
.lockup .lk b { font-family: var(--sans); font-weight: 700; font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; }
.lockup .lk i { font-style: normal; font-family: var(--display); font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em; color: var(--accent); }
.on-dark .lockup, .lockup.on-dark { color: #fff; } .on-dark .lockup .cl-mark, .lockup.on-dark .cl-mark { color: var(--lilac); } .on-dark .lockup .lk i, .lockup.on-dark .lk i { color: var(--lilac); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .55rem 1.25rem; border-radius: var(--pill); border: 1.5px solid var(--purple); background: var(--purple); color: #fff; font-weight: 600; font-size: .94rem; line-height: 1.2; letter-spacing: .005em; cursor: pointer; text-decoration: none; transition: background-color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease), transform .06s; white-space: nowrap; }
.btn:hover { background: var(--night); border-color: var(--night); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); background: #fff; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--purple); }
.btn.quiet:hover { background: var(--tint-2); }
.btn.danger { background: #fff; color: var(--bad); border-color: #EDBDB7; }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { min-height: 36px; padding: .35rem .9rem; font-size: .86rem; }
.btn.block { width: 100%; white-space: normal; }
.btn svg { width: 18px; height: 18px; flex: none; }
.icon-btn { width: 44px; height: 44px; padding: 0; }

.field { display: block; margin-bottom: 1.05rem; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; color: var(--ink); }
.input, textarea.input, select.input { width: 100%; min-height: 46px; padding: .65rem .9rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.input:hover { border-color: #CFC7DE; }
.input::placeholder { color: #8F88A3; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(109,40,217,.14); }
.btn:focus-visible, .opt:focus-visible, .tab:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea.input { min-height: 88px; resize: vertical; line-height: 1.5; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.5rem; }
.card + .card { margin-top: 1rem; }
@media (max-width: 520px) { .card { padding: 1.15rem 1.1rem; } }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem; border-radius: var(--pill); font-size: .76rem; font-weight: 600; background: var(--tint-2); color: var(--purple); line-height: 1.4; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #E0244E; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--night); color: #fff; padding: .8rem 1.2rem; border-radius: 14px; box-shadow: var(--shadow-dialog); z-index: 100; max-width: calc(100% - 32px); font-size: .94rem; animation: toastin .25s var(--ease); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* options (poll/quiz) */
.opts { display: grid; gap: .6rem; }
.opt { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; min-height: 54px; padding: .75rem 1rem; border: 1.5px solid var(--line); border-radius: 14px; transition: border-color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease); line-height: 1.4; background: #fff; cursor: pointer; font-weight: 500; position: relative; overflow: hidden; }
.opt:hover:not(:disabled) { border-color: var(--purple-2); box-shadow: 0 2px 10px rgba(59,31,115,.08); }
.opt:disabled { cursor: default; }
.opt .letter { flex: none; width: 30px; height: 30px; border-radius: 50%; font-family: var(--display); display: grid; place-items: center; background: var(--tint-2); color: var(--purple); font-weight: 700; font-size: .85rem; }
.opt.chosen { border-color: var(--purple); background: var(--tint); }
.opt.chosen .letter { background: var(--purple); color: #fff; }
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct .letter { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt .bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(75,42,153,.10); z-index: 0; transition: width .4s; }
.opt > *:not(.bar) { position: relative; z-index: 1; }
.opt .pct { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--purple); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.scale .opt { justify-content: center; font-size: 1.25rem; font-weight: 700; min-height: 60px; }
.scale-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: .35rem; gap: 1rem; }

/* bars (results) */
.bars { display: grid; gap: .55rem; }
.barrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .75rem; align-items: center; }
.barrow .lbl { font-weight: 500; }
.barrow .num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--purple); }
.barrow .track { grid-column: 1 / -1; height: 12px; background: var(--tint-2); border-radius: 6px; overflow: hidden; }
.barrow .fill { height: 100%; background: var(--purple-2); border-radius: 6px; transition: width .5s; }
.barrow.correct .fill { background: var(--ok); } .barrow.correct .lbl { color: var(--ok); font-weight: 700; }

.cloud { display: flex; flex-wrap: wrap; gap: .3rem .9rem; justify-content: center; align-items: center; padding: 1rem; }
.cloud span { color: var(--purple); font-weight: 700; line-height: 1.1; }
.cloud span:nth-child(3n) { color: var(--purple-2); } .cloud span:nth-child(4n) { color: #6C4BC0; } .cloud span:nth-child(5n) { color: var(--deep); }

/* checkbox with its label: box aligned with the first line of text, text wraps beside it */
.check { display: flex; align-items: flex-start; gap: .6rem; flex-wrap: nowrap; cursor: pointer; line-height: 1.45; }
.check input[type="checkbox"] { flex: none; width: 18px; height: 18px; margin: calc((1.45em - 18px) / 2) 0 0; accent-color: var(--purple); cursor: pointer; }
.check > span { flex: 1; min-width: 0; }
