:root {
  /* palette (CONCEPT_PLAN §5) */
  --c-forest: #3c5e46;
  --c-stone: #5e6b73;
  --c-water: #2e5e78;
  --c-mist: #a3c6d6;
  --c-gold: #c9a86a;

  --c-bg-0: #0b1410;
  --c-bg-1: #0f1c16;
  --c-text: rgba(255, 255, 255, 0.92);
  --c-text-muted: rgba(255, 255, 255, 0.68);
  --c-line: rgba(255, 255, 255, 0.12);

  --radius-lg: 18px;
  --radius-md: 14px;

  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 28px;
  --space-6: 40px;

  --max-content: 520px;

  /* motion (SPEC-03 duration bounds) */
  --t-fade: 420ms;
  --t-reveal: 900ms;
  --t-step: 320ms;
  --t-flash: 200ms;
  --ease: cubic-bezier(0.2, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --t-fade: 220ms;
    --t-reveal: 260ms;
    --t-step: 220ms;
    --t-flash: 0ms;
  }
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 50% 0%, rgba(46, 94, 120, 0.22), transparent 60%),
    linear-gradient(180deg, var(--c-bg-0), var(--c-bg-1));
  color: var(--c-text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-weight: 300;
  text-transform: lowercase;
  letter-spacing: 0.06em;
}

button,
input {
  font: inherit;
}

#app {
  min-height: 100%;
}

.stage {
  min-height: 100%;
  padding: max(env(safe-area-inset-top), var(--space-4)) var(--space-4)
    max(env(safe-area-inset-bottom), var(--space-6));
  display: flex;
  justify-content: center;
  position: relative;
}

.stage__inner {
  width: 100%;
  max-width: var(--max-content);
  position: relative;
  z-index: 1;
}

.stage__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.meaning-overlay {
  position: absolute;
  left: 50%;
  top: clamp(180px, 52vh, 340px);
  max-width: min(78vw, 520px);
  color: var(--c-text);
  font-size: clamp(18px, 2.8vw, 24px);
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 6px);
  filter: blur(0px);
  transition: opacity 220ms var(--ease), transform 220ms var(--ease), filter 220ms var(--ease);
}

.meaning-overlay .meaning-label {
  font-size: 13px;
  opacity: 0.6;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  margin-bottom: 6px;
}

.meaning-overlay .meaning-text {
  /* keep existing meaning-overlay sizing */
}

.meaning-overlay.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.path-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 62vh;
  height: 10vh;
  min-height: 80px;
}

.screen-xfade-in {
  opacity: 0;
  transform: translateY(-8px);
  filter: blur(2px);
  transition: opacity 450ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 450ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.screen-xfade-in.is-active {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0px);
}

.screen-xfade-out {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0px);
  transition: opacity 450ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 450ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.screen-xfade-out.is-active {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(2px);
}

/* Completion cadence: fade current card out before meaning interlude */
.choreo-fade-out {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(2px);
  transition: opacity 320ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.veil {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(900px 600px at 50% 10%, rgba(60, 94, 70, 0.22), transparent 60%),
    linear-gradient(180deg, var(--c-bg-0), var(--c-bg-1));
  opacity: 0;
  transition: opacity var(--t-fade) var(--ease);
  pointer-events: none;
  z-index: 999;
}

.veil--visible {
  opacity: 1;
  pointer-events: auto;
}

.veil__text {
  color: var(--c-text-muted);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.fade-in {
  opacity: 0;
  animation: fadeIn var(--t-fade) var(--ease) forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--c-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--c-text);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-step) var(--ease), border-color var(--t-step) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: 2px solid rgba(201, 168, 106, 0.55);
  outline-offset: 2px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  border-color: rgba(201, 168, 106, 0.28);
}

.btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  text-transform: lowercase;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-text:focus-visible {
  outline: 2px solid rgba(201, 168, 106, 0.55);
  outline-offset: 2px;
  border-radius: 10px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.muted {
  color: var(--c-text-muted);
}

.footer-micro {
  margin-top: var(--space-6);
  color: var(--c-text-muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

/* Landing (front screen) */
.landing-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0) 45%);
}

.landing {
  position: relative;
  z-index: 1;
  margin-top: 14vh;
}

.landing__title {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 28px);
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.landing__sub {
  font-size: clamp(14px, 2.1vw, 16px);
  line-height: 1.55;
  opacity: 0.78;
  max-width: 34ch;
}

.landing__reward {
  font-size: clamp(14px, 2.1vw, 16px);
  line-height: 1.55;
  opacity: 0.78;
  max-width: 38ch;
}

.landing .btn {
  min-height: 52px;
  font-size: 16px;
  font-weight: 450;
}

@media (min-width: 720px) {
  .landing .btn {
    min-height: 56px;
  }
}

.landing .btn--primary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(201, 168, 106, 0.35);
}

.landing .btn--primary:active {
  transform: scale(0.99);
}

.landing__trust {
  margin-top: var(--space-6);
  font-size: 12px;
  opacity: 0.55;
  letter-spacing: 0.2px;
  text-transform: lowercase;
}

/* Sequence complete modal (SCR-009 completion / unlock) */
.sc-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(env(safe-area-inset-top), 18px) 16px max(env(safe-area-inset-bottom), 18px);
  opacity: 0;
  transition: opacity 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 50;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(10px);
}

.sc-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px 700px at 50% 15%, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.sc-backdrop.is-visible {
  opacity: 1;
}

.sc-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(22px);
  padding: 18px 16px;
  transform: translateY(10px);
  opacity: 0;
  transition: opacity 220ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sc-modal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.sc-title {
  margin: 0;
  font-size: 21px;
  font-weight: 450;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.sc-subtitle {
  font-size: 14.5px;
  opacity: 0.7;
}

.sc-label {
  font-size: 12.5px;
  opacity: 0.6;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.sc-micro {
  font-size: 13px;
  opacity: 0.7;
}

.sc-preview {
  margin-top: 10px;
}

.sc-thumb {
  /* Keep the preview tangible but not dominant (9:16 thumbnail). */
  width: clamp(180px, 58vw, 260px);
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  align-self: center;
}

.sc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.sc-btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.10);
}

.sc-fallback {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sc-fallback.is-visible {
  display: grid;
}

.sc-extras {
  margin-top: 6px;
}

.sc-extras__toggle {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--c-text);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-transform: lowercase;
}

.sc-chevron {
  display: inline-block;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0.75;
}

.sc-extras__panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 180ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.sc-extras.is-open .sc-extras__panel {
  max-height: 220px;
  opacity: 1;
  transform: translateY(0);
}

.sc-extras.is-open .sc-chevron {
  transform: rotate(180deg);
}

.sc-trust {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.7;
}

.sc-links {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.sc-toast {
  position: fixed;
  left: 50%;
  bottom: max(env(safe-area-inset-bottom), 18px);
  transform: translate(-50%, 10px);
  opacity: 0;
  padding: 12px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(18px);
  color: var(--c-text);
  font-size: 13px;
  transition: opacity 220ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 60;
  pointer-events: none;
}

.sc-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
