/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  --ink-950: #0a0716;
  --ink-900: #0f0b1f;
  --ink-800: #171030;
  --ink-700: #221946;
  --ink-600: #30245f;
  --ink-500: #45387d;
  --line: rgb(255 255 255 / 0.09);
  --line-strong: rgb(255 255 255 / 0.18);
  --text: #f6f1ff;
  --muted: #a99fd0;
  --faint: #6f6599;

  --truth: #3de0d0;
  --truth-deep: #0b5f5b;
  --truth-glow: rgb(61 224 208 / 0.35);
  --dare: #ff4f7b;
  --dare-deep: #7d1131;
  --dare-glow: rgb(255 79 123 / 0.38);
  --fate: #ffc94a;
  --fate-deep: #6e4c00;
  --good: #63e690;
  --bad: #ff6a57;

  --font-display: 'Bricolage Grotesque', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --text-xs: 0.78rem;
  --text-sm: 0.9rem;
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  --text-lg: clamp(1.15rem, 1rem + 0.6vw, 1.4rem);
  --text-xl: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem);
  --text-hero: clamp(2.8rem, 1.2rem + 6.4vw, 6.4rem);

  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow-hard: 0 5px 0 0 var(--ink-950);
  --shadow-float: 0 30px 60px -20px rgb(0 0 0 / 0.65);

  --duration-fast: 140ms;
  --duration: 280ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --gutter: clamp(16px, 3vw, 32px);
  color-scheme: dark;
}

/* ─── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink-900);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.02; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--truth); }
:focus-visible { outline: 3px solid var(--fate); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--fate); color: var(--ink-900); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* Ambient glow + film grain behind everything */
.atmosphere {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 50vmax at -10% -10%, rgb(61 224 208 / 0.16), transparent 60%),
    radial-gradient(55vmax 50vmax at 110% 110%, rgb(255 79 123 / 0.18), transparent 60%),
    radial-gradient(40vmax 30vmax at 70% -20%, rgb(255 201 74 / 0.07), transparent 70%),
    var(--ink-900);
}
.atmosphere::after {
  content: ''; position: absolute; inset: 0; opacity: 0.22; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.boot { padding: 30vh var(--gutter); text-align: center; color: var(--muted); font-family: var(--font-display); font-size: var(--text-lg); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--ink-600);
  --btn-fg: var(--text);
  --btn-edge: var(--ink-950);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 48px; padding: 0.7em 1.3em;
  border: 2px solid var(--btn-edge); border-radius: 14px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 700; font-family: var(--font-body); letter-spacing: 0.01em;
  box-shadow: 0 5px 0 0 var(--btn-edge);
  cursor: pointer; text-decoration: none; user-select: none;
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), filter var(--duration-fast);
}
.btn:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 7px 0 0 var(--btn-edge); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 0 var(--btn-edge); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: 0 5px 0 0 var(--btn-edge); filter: none; }
.btn--primary { --btn-bg: var(--fate); --btn-fg: var(--ink-900); }
.btn--truth { --btn-bg: var(--truth); --btn-fg: var(--ink-900); }
.btn--dare { --btn-bg: var(--dare); --btn-fg: #fff; }
.btn--good { --btn-bg: var(--good); --btn-fg: var(--ink-900); }
.btn--bad { --btn-bg: var(--bad); --btn-fg: #fff; }
.btn--ghost { --btn-bg: transparent; --btn-edge: var(--line-strong); box-shadow: none; }
.btn--ghost:hover { box-shadow: none; background: rgb(255 255 255 / 0.06); }
.btn--sm { min-height: 38px; padding: 0.45em 0.9em; font-size: var(--text-sm); border-radius: 11px; }
.btn--block { width: 100%; }

.link-btn { background: none; border: 0; padding: 6px 2px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: var(--text-sm); }
.link-btn:hover { color: var(--text); }

/* ─── Form fields ────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field__label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
.input {
  width: 100%; min-height: 50px; padding: 0.7em 1em;
  background: var(--ink-950); border: 2px solid var(--line-strong); border-radius: 14px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--truth); box-shadow: 0 0 0 4px var(--truth-glow); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.4; }

/* ─── Chips / pills ──────────────────────────────────────── */
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line-strong);
  background: transparent; font-weight: 600; font-size: var(--text-sm); cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}
.pill:hover { border-color: var(--muted); }
.pill[aria-pressed='true'] { background: var(--text); color: var(--ink-900); border-color: var(--text); }
.pill:disabled { cursor: default; opacity: 0.8; }

/* Avatar picker */
.avatar-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.avatar-opt {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 1.35rem;
  border-radius: 12px; border: 2px solid transparent; background: var(--ink-950); cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring), border-color var(--duration-fast);
}
.avatar-opt:hover { transform: scale(1.12) rotate(-6deg); }
.avatar-opt[aria-checked='true'] { border-color: var(--fate); background: var(--ink-600); transform: scale(1.08); }
@media (max-width: 420px) { .avatar-grid { grid-template-columns: repeat(5, 1fr); } }

/* ─── Toasts ─────────────────────────────────────────────── */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: min(92vw, 420px); pointer-events: none; }
.toast {
  background: var(--text); color: var(--ink-900); font-weight: 600;
  padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-float);
  animation: toast-in var(--duration) var(--ease-spring);
}
.toast--error { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }

/* ─── FX layer (reactions, confetti) ─────────────────────── */
.fx-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.float-emoji {
  position: absolute; bottom: -60px; font-size: 2.4rem;
  animation: float-up 2.6s var(--ease-out) forwards;
}
@keyframes float-up {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  12% { opacity: 1; transform: translate(0, -12vh) scale(1.15); }
  100% { transform: translate(var(--drift, 0px), -78vh) scale(0.9) rotate(var(--spin, 0deg)); opacity: 0; }
}
.float-emoji__who { display: block; font-size: 0.7rem; text-align: center; font-family: var(--font-body); font-weight: 700; color: var(--muted); }
.confetti {
  position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px;
  animation: confetti-fall var(--dur, 2.4s) linear forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--drift, 0px), 110vh) rotate(var(--spin, 720deg)); opacity: 0.8; }
}

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

/* ─── Modal dialog ───────────────────────────────────────── */
.modal { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 0; background: var(--ink-800); color: var(--text); width: min(92vw, 460px); box-shadow: var(--shadow-float); }
.modal::backdrop { background: rgb(10 7 22 / 0.75); backdrop-filter: blur(4px); }
.modal[open] { animation: toast-in var(--duration) var(--ease-spring); }
.modal__body { display: grid; gap: 12px; padding: 24px; }
.modal__body h2 { font-size: var(--text-lg); }
.modal__body p, .modal__body li { color: var(--muted); font-size: var(--text-sm); }
.modal__body ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
