/* Melo — Session 1 (first-run onboarding). Immersive, full-screen, minimal chrome.
   Ported & refined from design/melo-session1-prototype.html. Reuses the Expressive-Pop
   tokens from /engine/melo.css (--cream/--ink/--orange/--cobalt/--purple/--gold/--muted).
   The "follow-the-glow" keyboard (.kb + .lit/.lit2/.lean/.pulse/.press) is the reusable
   guided-interaction piece. All motion is disabled under prefers-reduced-motion. */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui, 'Inter', sans-serif);
  background: var(--cream, #FBF2E4); color: var(--ink, #2A1A0E);
  overflow: hidden; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  touch-action: manipulation;   /* mobile: kill double-tap-to-zoom across the lesson (pinch-zoom stays) */
}
/* the lesson container + its tap targets — no double-tap zoom mid-lesson (no user-scalable=no, so
   pinch-zoom still works). #kb .wk/.bk are scoped to session1's keyboard, not the shared glowkb. */
.wrap, .overlay, .btn, .choice button, .pad, .toggle button, .deg, #kb, #kb .wk, #kb .bk {
  touch-action: manipulation;
}

/* warm "exhale" wash used on resolution (Screen 3) */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(1200px 700px at 50% 42%, rgba(255,200,150,.0), rgba(255,200,150,0) 70%);
  opacity: 0; transition: opacity .9s ease;
}
body.exhale::after { opacity: 1; }

/* background shapes (same palette as the shared bg system, inlined so Session 1 has no nav) */
.bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bg .s { position: absolute; border-radius: 50%; }
.bg .o1 { width: min(60vw, 540px); aspect-ratio: 1; background: radial-gradient(circle, rgba(255,90,31,.13), transparent 70%); top: -16vw; right: -12vw; animation: float 13s ease-in-out infinite; }
.bg .o2 { width: min(52vw, 440px); aspect-ratio: 1; background: radial-gradient(circle, rgba(31,61,255,.10), transparent 70%); bottom: -16vw; left: -12vw; animation: float 17s ease-in-out infinite reverse; }
.bg .o3 { width: 240px; height: 240px; border: 2px solid rgba(255,90,31,.12); top: 50%; left: -120px; }
.bg .o4 { width: 170px; height: 170px; background: radial-gradient(circle, rgba(122,63,242,.11), transparent 70%); top: 16%; right: 9%; animation: float 11s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-18px) } }

/* tiny chrome: wordmark + low-key skip (keeps the rest of the app reachable / testable) */
.s1-top { position: fixed; top: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; pointer-events: none; }
.s1-brand { font-family: var(--font-serif, serif); font-weight: 900; font-size: 19px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; opacity: .55; }
.s1-brand .d { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); margin-top: 8px; }
.s1-skip { pointer-events: auto; font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-decoration: none; opacity: .6; transition: opacity .2s; }
.s1-skip:hover { opacity: 1; }
.overlay .s1-top .s1-brand { color: var(--cream); }
.overlay .s1-top .s1-skip { color: #a8957d; }

/* ---- main stage ---- */
.wrap { position: relative; z-index: 1; width: 100%; max-width: 900px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.kicker { font-family: var(--font-mono, monospace); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--orange); min-height: 16px; }
.say { font-family: var(--font-serif, serif); font-weight: 700; font-size: clamp(24px, 5vw, 33px); text-align: center; line-height: 1.14; min-height: 40px; transition: opacity .3s, transform .3s; max-width: 18ch; }
.sub { font-size: 14.5px; color: var(--muted); text-align: center; margin-top: -6px; min-height: 20px; transition: opacity .3s; }
.controls { display: flex; align-items: center; gap: 14px; min-height: 52px; justify-content: center; flex-wrap: wrap; }

/* keyboard styles now live in the shared glowkb.css (linked before this file) */
@media (max-width: 560px) { .wrap { gap: 14px; } }

/* ---- controls: toggle, buttons, choice pads, moment pads, dots ---- */
.toggle { display: inline-flex; background: #fff; border: 1px solid var(--line, #EFE3CF); border-radius: 30px; padding: 5px; box-shadow: 0 4px 14px rgba(120,60,10,.1); }
.toggle button { border: none; background: transparent; font-family: var(--font-ui, sans-serif); font-weight: 700; font-size: 14px; padding: 9px 22px; border-radius: 24px; cursor: pointer; color: var(--muted); transition: .2s; }
.toggle button.on { background: var(--orange); color: #fff; }
.toggle button.on.dark { background: var(--cobalt); }

.btn { background: var(--orange); color: #fff; font-weight: 700; font-size: 15px; padding: 13px 28px; border-radius: 30px; border: none; cursor: pointer; box-shadow: 0 5px 0 var(--orange2, #F0531A); transition: transform .1s, box-shadow .1s; font-family: var(--font-ui, sans-serif); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--orange2, #F0531A); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line, #EFE3CF); box-shadow: 0 4px 14px rgba(120,60,10,.1); }
.btn.ghost:active { transform: translateY(2px); box-shadow: 0 2px 8px rgba(120,60,10,.1); }

/* Bright / Dark choice (Screen 2.5) — big, equal, no "correct" styling */
.choice { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.choice button { font-family: var(--font-serif, serif); font-weight: 700; font-size: 20px; padding: 18px 34px; border-radius: 18px; border: 2px solid var(--line, #EFE3CF); background: #fff; color: var(--ink); cursor: pointer; min-width: 150px; transition: transform .12s, border-color .2s, box-shadow .2s; box-shadow: 0 6px 18px rgba(120,60,10,.08); }
.choice button .em { display: block; font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; font-weight: 400; }
.choice button:hover { transform: translateY(-3px); }
.choice button.pick-bright { border-color: var(--orange); background: #FFF6F0; }
.choice button.pick-dark { border-color: var(--cobalt); background: #F1F4FF; }
.choice button.faded { opacity: .35; transform: none; }

/* the leave / come-home round-trip pads (Screen 3) — the user DOES the pull and the relief */
.pads { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.pad { background: #fff; border: 2px solid var(--line, #EFE3CF); border-radius: 16px; padding: 14px 24px; cursor: pointer; text-align: center; transition: transform .1s, border-color .2s, box-shadow .2s; min-width: 132px; }
.pad:active { transform: scale(.97); }
.pad b { display: block; font-family: var(--font-serif, serif); font-size: 17px; }
.pad span { font-family: var(--font-mono, monospace); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pad.lean-pad { border-color: var(--cobalt); background: #F3F5FF; }
.pad.home-pad { border-color: var(--orange); background: #FFF6F0; }

/* ③ scale degrees — numbers-first chips (built by session1.js: big number 1–7 + spelled note) */
.degrow { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.deg { background: #fff; border: 1.5px solid var(--line, #EFE3CF); border-radius: 12px; padding: 7px 0; width: 42px; text-align: center; transition: border-color .2s, background .2s, transform .15s; }
.deg b { display: block; font-family: var(--font-mono, monospace); font-weight: 700; font-size: 15px; color: var(--muted); }
.deg span { font-family: var(--font-serif, serif); font-weight: 700; font-size: 16px; color: var(--ink); }
.deg.on { border-color: var(--orange); background: #FFF6F0; transform: translateY(-2px); }
.deg.on b { color: var(--orange); }

.dots { display: flex; gap: 9px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #E2D6C2; transition: .3s; }
.dots i.on { background: var(--orange); transform: scale(1.25); }
.dots i.done { background: var(--orange-soft, #FF8A4D); }

/* ---- overlays (cold open + payoff) ---- */
.overlay { position: fixed; inset: 0; z-index: 10; background: #241608; color: var(--cream, #FBF2E4); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; transition: opacity .6s; }
.overlay.hide { opacity: 0; pointer-events: none; }
.overlay .brand { font-family: var(--font-serif, serif); font-weight: 900; font-size: 26px; display: flex; align-items: center; gap: 7px; margin-bottom: 28px; opacity: .85; }
.overlay .brand .d { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-top: 9px; }
.overlay h1 { font-family: var(--font-serif, serif); font-weight: 700; font-size: clamp(30px, 6vw, 42px); line-height: 1.08; margin-bottom: 14px; max-width: 16ch; }
.overlay p { font-size: 15px; color: #cdbca6; max-width: 42ch; margin-bottom: 28px; }
.glowdot { width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle, rgba(255,140,80,.95), transparent 70%); margin-bottom: 24px; animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: .7 } 50% { transform: scale(1.12); opacity: 1 } }
.tap-hint { font-family: var(--font-mono, monospace); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: #a8957d; margin-top: 8px; animation: hintfade 2.4s ease-in-out infinite; }
@keyframes hintfade { 0%,100% { opacity: .5 } 50% { opacity: 1 } }
.loading { font-family: var(--font-mono, monospace); font-size: 12px; color: #a8957d; letter-spacing: .08em; margin-top: 14px; opacity: 0; transition: opacity .3s; }
.loading.show { opacity: 1; }

/* payoff (light overlay) */
.win { background: var(--cream, #FBF2E4); color: var(--ink); }
.win h1 { color: var(--ink); }
.win p { color: var(--muted); }
.win .firstwin { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono, monospace); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--orange); background: #FFF1E8; border: 1px solid #FFE0CD; padding: 8px 16px; border-radius: 30px; margin-bottom: 22px; }
.win .firstwin .star { color: var(--gold, #F2B30A); font-size: 15px; }
.winbtns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 11; overflow: hidden; }
.confetti i { position: absolute; width: 11px; height: 11px; border-radius: 2px; top: -20px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(112vh) rotate(720deg); opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .12s !important; }
  .bg .o1, .bg .o2, .bg .o4 { animation: none; }
  .confetti { display: none; }
}
