/* sing v2 — base: reset-lite, page, column, top bar, a11y, reduced motion.
   docs/DESIGN-V2.md §2 (page), §3 (type), §4 (layout), §11 (a11y). */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  /* §2/§4 page base; the two static radial washes are desktop-only (below) */
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* §4 desktop (>768px, strictly): static ambient backdrop — two soft radial
   washes (gold 4% / lavender 3%), no motion. Phones stay on plain --bg. */
@media (min-width: 768.02px) {
  body {
    background-image:
      radial-gradient(120% 70% at 50% -10%, var(--wash-gold), transparent 60%),
      radial-gradient(120% 70% at 50% 110%, var(--wash-lavender), transparent 60%);
    background-attachment: fixed;
    background-repeat: no-repeat;
  }
}

h1,
h2 {
  font-weight: 800;
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-heading);
}

h3 {
  font-weight: 600;
  line-height: var(--lh-heading);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

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

svg {
  display: block;
  flex: none;
}

/* §3 every measured number is tabular */
.num {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* §11 focus: 2px gold ring, offset 2 — the one global focus style */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

::selection {
  background: var(--glow-gold);
}

/* subtle scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--r-pill);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* ---- §4 layout column ---- */

.app-column {
  max-width: 520px;
  margin: 0 auto;
  padding-inline: var(--sp-5);
}

@media (max-width: 400px) {
  .app-column {
    padding-inline: var(--sp-4);
  }
}

/* §4 bottom controls sit above the safe area + 16 */
.safe-bottom {
  padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
}

/* ---- §4 shared top bar: 56px, 48×48 chevron slot, centered title ---- */

.top-bar {
  display: grid;
  grid-template-columns: minmax(var(--sp-7), auto) 1fr minmax(var(--sp-7), auto);
  align-items: center;
  height: 56px;
  flex: none;
}

.top-bar-title {
  text-align: center;
  font-size: var(--fs-secondary);
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
  min-width: 0;
}

/* ---- §7 settings: chosen-option marker (demo voice) ----
   Deliberately not `.variant-chip`: lavender stays on the "smaller version"
   chips of adapted results; a selection reads as a gold dot on the chip. */

.selected-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--gold);
}

/* ---- §11 reduced motion: the single override block ----
   Transitions become ≤150ms opacity-only; decorative animation stops;
   entrances and stars degrade to opacity (stars keep ≤200ms, §10).
   Keyframes referenced here are defined next to their components. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-property: opacity !important;
    transition-duration: 150ms !important;
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
  }

  /* decorative loops and flourishes stop outright */
  .level-node.current,
  .chip-streak.pulse {
    animation: none !important;
  }

  /* stars still land, as a ≤200ms opacity settle (§10) */
  .star-pip.earned {
    animation: star-settle 200ms var(--ease) both !important;
  }

  /* entrances cross-fade; the 12px rise and count-in scale go away */
  .fade-in,
  .rise-in,
  .count-in-num {
    animation: fade-only 150ms var(--ease) both !important;
  }
}
