/* ============================================================================
   DAILY GAMES LAB — shared design system
   Aesthetic: dark "optical instrument" — precise, calm, tactile. Distinctive
   type (Syne / Hanken Grotesk / JetBrains Mono). Each game sets its own
   --accent via a body class. Built to feel polished, not generic.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=Hanken+Grotesk:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* surfaces */
  --bg: #0b0c10;
  --bg-2: #111319;
  --surface: #161922;
  --surface-2: #1d2230;
  --line: #272c3a;
  --line-soft: #1f2430;

  /* ink */
  --ink: #f3f5f9;
  --ink-dim: #aab2c4;
  --ink-faint: #6c7488;

  /* accents (overridden per game) */
  --accent: #34e5c4;
  --accent-ink: #04130f;
  --accent-soft: color-mix(in oklab, var(--accent) 18%, transparent);
  --accent-glow: color-mix(in oklab, var(--accent) 40%, transparent);

  /* feedback */
  --good: #56d977;
  --warn: #ffce4d;
  --bad: #ff6b6b;

  /* shape */
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* type */
  --font-display: 'Syne', sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 0 1px var(--accent-soft), 0 14px 44px -20px var(--accent-glow);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(900px 520px at 50% -10%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 70%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* subtle dotted texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 22px 22px;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

.wrap {
  position: relative;
  z-index: 1;
  width: min(640px, 100% - 32px);
  margin-inline: auto;
  padding-block: 22px 60px;
}

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.18rem;
}
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.topbar .back {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: var(--r-pill);
  transition: color 0.2s, border-color 0.2s;
}
.topbar .back:hover { color: var(--ink); border-color: var(--ink-faint); }

/* ---- hero / headings ---- */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.05; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
}
.lead { color: var(--ink-dim); font-size: 1.02rem; }

/* ---- card ---- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

/* ---- buttons ---- */
.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  border-radius: var(--r-pill);
  padding: 14px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 0.12s var(--ease-snap), box-shadow 0.2s, background 0.2s, opacity 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 30px -12px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 14px 38px -10px var(--accent-glow); transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }

/* ---- progress / round dots ---- */
.dots { display: flex; gap: 8px; align-items: center; }
.dots .pip {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); transition: background 0.3s, transform 0.3s var(--ease-snap);
}
.dots .pip.active { background: var(--accent); transform: scale(1.25); }
.dots .pip.done { background: var(--accent-soft); }

/* ---- monospace score readout ---- */
.score-num { font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- result sheet (bottom modal) ---- */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(5, 6, 9, 0.66);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.sheet-scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  width: min(560px, 100%);
  margin-inline: auto;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 26px 24px calc(28px + env(safe-area-inset-bottom));
  transform: translateY(110%);
  transition: transform 0.42s var(--ease);
  box-shadow: 0 -24px 70px -20px rgba(0, 0, 0, 0.8);
}
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 42px; height: 5px; border-radius: 99px; background: var(--line); margin: -8px auto 18px; }

/* ---- the share artifact ---- */
.share-grid {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1.55;
  white-space: pre;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  color: var(--ink);
  letter-spacing: 0.05em;
  overflow-x: auto;
}

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 60;
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: 0.9rem;
  padding: 11px 18px; border-radius: var(--r-pill);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- stat row ---- */
.stats { display: flex; gap: 10px; }
.stat {
  flex: 1; text-align: center;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 12px 8px;
}
.stat b { font-family: var(--font-mono); font-size: 1.5rem; display: block; }
.stat span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }

/* ---- helpers ---- */
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }
.stack > * + * { margin-top: var(--gap, 14px); }
.fade-up { animation: fadeUp 0.5s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.pop { animation: pop 0.45s var(--ease-snap) both; }
@keyframes pop { 0% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } }

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