/* Luisa's page ("Il mondo di Luisa"). Three parts, each between markers so the design preview
   (docs/design/anteprima/luna-v2.html) can carry an identical copy: LUNA FIGURE CSS, APP CSS, boot + pairing. */

/* Fonts served by our server (never Google Fonts): OFL 1.1, see fonts/LICENSES.txt. Kept by sw.js. */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/fraunces.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/atkinson-hyperlegible-next.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ==== LUNA FIGURE CSS: begin (same in web/luisa/style.css and the preview) ==== */
.lu { display: block; width: 100%; height: 100%; overflow: visible; --A-u: var(--idle-Au); --A-f: var(--idle-Af); --B-u: var(--idle-Bu); --B-f: var(--idle-Bf); }
.lu * { transform-box: view-box; }
.lu-upper { transform-origin: var(--hip); transition: transform 0.6s cubic-bezier(0.34, 1.3, 0.5, 1); }
.lu-breath { animation: lu-breath 4.4s ease-in-out infinite; }
.lu-torso { transform-origin: var(--waist); animation: lu-chest 4.4s ease-in-out infinite; }
.lu-headrot { transform-origin: var(--neck); transition: transform 0.5s cubic-bezier(0.34, 1.35, 0.5, 1); }
.lu-headanim { transform-origin: var(--neck); }
.lu-hairback .lu-headanim, .lu-hairback { transform-origin: var(--neck); }
.lu-arm .lu-up, .lu-arm .lu-fore { transition: transform 0.5s cubic-bezier(0.34, 1.25, 0.5, 1); }
.lu-armA .lu-up { transform-origin: var(--A-s); transform: rotate(var(--A-u, 0deg)); }
.lu-armA .lu-fore { transform-origin: var(--A-e); transform: rotate(var(--A-f, 0deg)); }
.lu-armB .lu-up { transform-origin: var(--B-s); transform: rotate(var(--B-u, 0deg)); }
.lu-armB .lu-fore { transform-origin: var(--B-e); transform: rotate(var(--B-f, 0deg)); }
.lu-eye { transform-box: fill-box; transform-origin: 50% 50%; transition: transform 0.09s ease-out; }
.lu-iris { transition: transform 0.35s ease-out; }
.lu-brow { transition: transform 0.35s ease-out; transform-box: fill-box; transform-origin: 50% 50%; }
.lu-h-point, .lu-think, .lu-waves { opacity: 0; }
/* rim light on the hair: only on dark backgrounds (evening theme) */
.lu-rim { opacity: 0; transition: opacity 0.4s; }
.lu .lu-rim path, .lu .lu-rim circle { fill: none; stroke: #a7a2f0; stroke-width: 9px; }

/* Garment colours (IDEA-009, dress-up): each look sets these variables on the <svg>; the values
   after the comma are the defaults. f- = fill, s- = stroke. */
.lu .f-o-main { fill: var(--luna-outfit-main, #ef7d63); }
.lu .f-o-shade { fill: var(--luna-outfit-shade, #d3624c); }
.lu .s-o-shade { stroke: var(--luna-outfit-shade, #d3624c); }
.lu .f-o-pattern { fill: var(--luna-outfit-pattern, #fff3e2); }
.lu .f-o-trim { fill: var(--luna-outfit-trim, #fff3e2); }
.lu .f-o-accent { fill: var(--luna-outfit-accent, #f5c86a); }
.lu .f-t-main { fill: var(--luna-top-main, #fff3e2); }
.lu .f-t-shade { fill: var(--luna-top-shade, #efd9bd); }
.lu .s-t-shade { stroke: var(--luna-top-shade, #efd9bd); }
.lu .s-legwear-main { stroke: var(--luna-legwear-main, #fff3e2); }
.lu .s-legwear-band { stroke: var(--luna-legwear-band, #d79b3a); }
.lu .f-shoes-main { fill: var(--luna-shoes-main, #fff3e2); }
.lu .f-shoes-shade { fill: var(--luna-shoes-shade, #e9d3b5); }
.lu .s-shoes-shade { stroke: var(--luna-shoes-shade, #e9d3b5); }
.lu .s-shoes-accent { stroke: var(--luna-shoes-accent, #ef7d63); }
.lu .f-acc-head-main { fill: var(--luna-acc-head-main, #f5c86a); }
.lu .f-acc-neck-main { fill: var(--luna-acc-neck-main, #f5c86a); }
.lu .s-acc-neck-shade { stroke: var(--luna-acc-neck-shade, #d79b3a); }
.lu .f-acc-hand-main { fill: var(--luna-acc-hand-main, #f5c86a); }
[data-theme="evening"] .lu-rim { opacity: 0.55; }
[data-theme="evening"] .lu .lu-waves path { stroke: #f5c86a; }
.lu-h-open, .lu-h-point { transition: opacity 0.12s; }
.lu-mouth > * { opacity: 0; }
.lu[data-mouth="0"] .lu-m0, .lu[data-mouth="1"] .lu-m1, .lu[data-mouth="2"] .lu-m2,
.lu[data-mouth="3"] .lu-m3, .lu[data-mouth="o"] .lu-mo, .lu[data-mouth="h"] .lu-mh { opacity: 1; }
.lu.blink .lu-eye { transform: scaleY(0.1) !important; }

/* preparing: waves hello */
.lu.st-preparing { --B-u: var(--wave1-Bu); --B-f: var(--wave1-Bf); }
.lu.st-preparing.w2 { --B-u: var(--wave2-Bu); --B-f: var(--wave2-Bf); }
.lu.st-preparing .lu-armB .lu-fore { transition-duration: 0.3s; }
.lu.st-preparing .lu-headrot { transform: rotate(-3deg); }

/* listening: leans in, head tilted, eyes open wide; the hand goes to the ear when it is her turn */
.lu.st-listening { --A-u: var(--listen-Au); --A-f: var(--listen-Af); --B-u: var(--listen-Bu); --B-f: var(--listen-Bf); }
.lu.st-listening.cup { --A-u: var(--idle-Au); --A-f: var(--idle-Af); --B-u: var(--cup-Bu); --B-f: var(--cup-Bf); }
.lu.st-listening .lu-upper { transform: rotate(2.2deg) translateY(4px); }
.lu.st-listening .lu-headrot { transform: rotate(7deg); }
.lu.st-listening .lu-eye { transform: scale(1.06); }
.lu.st-listening .lu-brow { transform: translateY(-4px); }
.lu.st-listening .lu-headanim { animation: lu-nod 2.8s ease-in-out infinite; }
.lu.st-listening.cup .lu-waves { opacity: 1; }
.lu.st-listening.cup .lu-w1 { animation: lu-wave 1.2s ease-in-out infinite; }
.lu.st-listening.cup .lu-w2 { animation: lu-wave 1.2s ease-in-out 0.25s infinite; }

/* thinking: eyes up, finger on the chin, three little stars */
.lu.st-thinking { --A-u: var(--think-Au); --A-f: var(--think-Af); --B-u: var(--think-Bu); --B-f: var(--think-Bf); }
.lu.st-thinking .lu-armA .lu-h-open { opacity: 0; }
.lu.st-thinking .lu-armA .lu-h-point { opacity: 1; }
.lu.st-thinking .lu-headrot { transform: rotate(-6deg); }
.lu.st-thinking .lu-iris { transform: translate(4px, -7px); }
.lu.st-thinking .lu-browB { transform: translateY(-5px) rotate(4deg); }
.lu.st-thinking .lu-browA { transform: translateY(1px); }
.lu.st-thinking .lu-think { opacity: 1; }
.lu.st-thinking .lu-ts1 { animation: lu-twinkle 1.5s ease-in-out infinite; }
.lu.st-thinking .lu-ts2 { animation: lu-twinkle 1.5s ease-in-out 0.25s infinite; }
.lu.st-thinking .lu-ts3 { animation: lu-twinkle 1.5s ease-in-out 0.5s infinite; }
.lu-think path { transform-box: fill-box; transform-origin: 50% 50%; }

/* speaking: hands that talk, small nods */
.lu.st-speaking.g1 { --A-u: var(--talk1-Au); --A-f: var(--talk1-Af); --B-u: var(--talk1-Bu); --B-f: var(--talk1-Bf); }
.lu.st-speaking.g2 { --A-u: var(--talk2-Au); --A-f: var(--talk2-Af); --B-u: var(--talk2-Bu); --B-f: var(--talk2-Bf); }
.lu.st-speaking .lu-arm .lu-up, .lu.st-speaking .lu-arm .lu-fore { transition-duration: 1.1s; transition-timing-function: cubic-bezier(0.45, 0, 0.3, 1); }
.lu.st-speaking .lu-headanim { animation: lu-talkhead 2.2s ease-in-out infinite; }
.lu.st-speaking .lu-brow { transform: translateY(-2px); }

@keyframes lu-breath { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.2px); } }
@keyframes lu-chest { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.012); } }
@keyframes lu-nod { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-2deg); } }
@keyframes lu-talkhead { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(1.6deg); } 70% { transform: rotate(-1.4deg); } }
@keyframes lu-twinkle { 0%, 100% { opacity: 0.35; transform: scale(0.7); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes lu-wave { 0%, 100% { opacity: 0.25; transform: translateX(6px); } 50% { opacity: 1; transform: translateX(0); } }

@media (prefers-reduced-motion: reduce) {
  .lu-breath, .lu-torso, .lu-headanim, .lu-ts1, .lu-ts2, .lu-ts3, .lu-w1, .lu-w2 { animation: none !important; }
  .lu *, .lu-upper, .lu-headrot { transition-duration: 0.01s !important; }
}
/* ==== LUNA FIGURE CSS: end ==== */

/* ==== APP CSS: begin ====
   "Il mondo di Luisa": elegant and calm ("Notte di fiaba", refined, D-073). The playful tone lives
   only in Luna. Everything is scoped under .lw so the design preview can show the same screen in a
   frame; layout uses container queries on .lw-shell (the frame is not the viewport).
   Themes: data-theme="day" | "evening" (automatic, evening from 19:00, set by app.js).
   Colours and contrasts: docs/design/stile.md §3 (all text pairs >= 4.5:1). */

.lw {
  --bg: #fbf4ea; --bg2: #f3e7d6; --surface: #ffffff; --surface2: #f6eee2;
  --text: #231e4d; --muted: #554d7d; --accent: #4e3a8e; --on-accent: #ffffff;
  --gold-text: #8a5b00; --line: rgba(35, 30, 77, 0.12); --line-strong: rgba(35, 30, 77, 0.22);
  --warn: #a33a22; --warn-bg: #fff1ea;
  --moon: radial-gradient(circle at 42% 38%, #fffaf0 0%, #f9ebcf 46%, rgba(246, 225, 186, 0) 71%);
  --shadow: 0 1px 2px rgba(35, 30, 77, 0.06), 0 10px 30px rgba(35, 30, 77, 0.08);
  --shadow-lift: 0 2px 4px rgba(35, 30, 77, 0.08), 0 16px 40px rgba(35, 30, 77, 0.12);
  --font-title: "Fraunces", "Noto Serif Display", "Noto Serif", Georgia, "Tinos", serif;
  --font-text: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Noto Sans", Roboto, "Segoe UI", system-ui, sans-serif;
  --vh: 1vh;
  color-scheme: light;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.55;
}
.lw[data-theme="evening"] {
  --bg: #17153a; --bg2: #1f1c4c; --surface: #232052; --surface2: #2e2a66;
  --text: #fff7ec; --muted: #cfc8ee; --accent: #f5c86a; --on-accent: #17153a;
  --gold-text: #f5c86a; --line: rgba(245, 200, 106, 0.16); --line-strong: rgba(245, 200, 106, 0.32);
  --warn: #ff9f8a; --warn-bg: rgba(255, 159, 138, 0.1);
  --moon: radial-gradient(circle at 42% 38%, rgba(255, 244, 214, 0.2) 0%, rgba(245, 200, 106, 0.12) 44%, rgba(245, 200, 106, 0) 71%);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(4, 3, 20, 0.35);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.3), 0 18px 44px rgba(4, 3, 20, 0.45);
  color-scheme: dark;
}
.lw *, .lw *::before, .lw *::after { box-sizing: border-box; }
.lw .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.lw [hidden] { display: none !important; }
:where(.lw) button { font: inherit; color: inherit; }
.lw :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.lw-shell {
  container-type: inline-size;
  position: relative;
  min-height: calc(var(--vh) * 100);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 70% at 50% -10%, var(--bg2) 0%, transparent 60%),
    var(--bg);
  overflow-x: clip;
}
/* a few small, almost still stars in the evening (decorative) */
.lw[data-theme="evening"] .lw-shell::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.8;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 14%, #fff7ec 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 32%, #fff7ec 50%, transparent 51%),
    radial-gradient(2px 2px at 36% 9%, #f5c86a 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 22%, #fff7ec 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 74% 11%, #fff7ec 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 28%, #fff7ec 50%, transparent 51%),
    radial-gradient(2px 2px at 93% 7%, #f5c86a 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 44%, #fff7ec 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 12% 58%, #fff7ec 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 64%, #fff7ec 50%, transparent 51%),
    radial-gradient(1px 1px at 84% 70%, #fff7ec 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 30% 86%, #fff7ec 50%, transparent 51%);
}

/* ---- top bar ---- */
.lw-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px clamp(16px, 4cqw, 48px) 0;
}
.lw-brand { display: flex; align-items: center; gap: 10px; margin: 0; white-space: nowrap; font-family: var(--font-title); font-weight: 600; font-size: 20px; letter-spacing: 0.01em; color: var(--text); }
.lw-brand svg { width: 28px; height: 28px; flex: none; }
.lw-mic {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px; font-size: 16px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text);
}
.lw-mic .dot { width: 10px; height: 10px; border-radius: 50%; background: #2f9e6b; box-shadow: 0 0 0 4px rgba(47, 158, 107, 0.18); }
.lw-mic svg { width: 18px; height: 18px; }
.lw-mic.off .dot { background: var(--muted); box-shadow: none; }

.lw-banner {
  position: relative; z-index: 2;
  margin: 14px clamp(16px, 4cqw, 48px) 0; padding: 12px 18px; border-radius: 16px;
  display: flex; align-items: center; gap: 12px; font-size: 18px;
  background: var(--warn-bg); color: var(--text); border: 1px solid var(--line-strong);
}
.lw-banner svg { width: 24px; height: 24px; flex: none; color: var(--warn); }

/* ---- main: stage (Luna) + panel ---- */
.lw-main { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; padding: 8px clamp(16px, 4cqw, 48px) 24px; }
.lw-hero { display: grid; grid-template-columns: 1fr; align-items: center; gap: 8px 32px; }
.lw-stage {
  position: relative; justify-self: center;
  width: min(100%, 420px); height: clamp(320px, calc(var(--vh) * 48), 480px);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.lw[data-view="talk"] .lw-stage { cursor: default; }
.lw-moon { position: absolute; left: 50%; top: 2%; width: min(100%, calc(var(--vh) * 62)); max-width: 560px; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; background: var(--moon); pointer-events: none; }
.lw-moon::after { content: ""; position: absolute; inset: 9%; border-radius: 50%; border: 1px solid var(--line); }
.lw-figure { position: relative; flex: 1 1 auto; min-height: 0; aspect-ratio: 400 / 640; margin-bottom: -16px; }
.lw-figure .lu { filter: drop-shadow(0 10px 18px rgba(35, 30, 77, 0.14)); }
.lw[data-theme="evening"] .lw-figure .lu { filter: drop-shadow(0 0 22px rgba(245, 200, 106, 0.14)); }
.lw-nameplate {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 10px; margin: 0; white-space: nowrap;
  padding: 6px 8px 6px 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  font-family: var(--font-title); font-weight: 600; font-size: 22px; color: var(--text);
}
.lw-nameplate .who-name { color: var(--name-color, var(--gold-text)); }
.ai-badge {
  text-decoration: none; cursor: default;
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 30px;
  padding: 0 10px; border-radius: 999px; font-family: var(--font-text); font-size: 15px; font-weight: 700; letter-spacing: 0.06em;
  background: var(--accent); color: var(--on-accent);
}

/* another character: a circle of light in its colour, with its emblem (stile.md §6) */
.lw-orb { position: absolute; left: 50%; top: 46%; width: min(68%, 260px); aspect-ratio: 1; transform: translate(-50%, -50%); }
.lw-orb .core {
  position: absolute; inset: 14%; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 38% 34%, color-mix(in srgb, var(--c-light) 70%, #fff) 0%, var(--c-light) 70%);
  box-shadow: 0 0 0 3px var(--c-ring), 0 0 48px color-mix(in srgb, var(--c-light) 55%, transparent);
  color: #231e4d; transition: transform 0.12s linear;
}
.lw-orb .core svg { width: 44%; height: 44%; }
.lw-orb .ring { position: absolute; inset: 14%; border-radius: 50%; border: 3px solid var(--c-light); opacity: 0; }
.lw-orb[data-state="speaking"] .ring { animation: orb-out 1.4s ease-out infinite; }
.lw-orb[data-state="speaking"] .ring.r2 { animation-delay: 0.7s; }
.lw-orb[data-state="listening"] .ring { animation: orb-in 1.6s ease-in infinite; }
.lw-orb[data-state="listening"] .ring.r2 { animation-delay: 0.8s; }
.lw-orb .dots { position: absolute; inset: 0; opacity: 0; }
.lw-orb[data-state="thinking"] .dots, .lw-orb[data-state="preparing"] .dots { opacity: 1; animation: orb-spin 2.4s linear infinite; }
.lw-orb .dots i { position: absolute; inset: 0; }
.lw-orb .dots i::before { content: ""; position: absolute; left: calc(50% - 7px); top: 3%; width: 14px; height: 14px; border-radius: 50%; background: var(--c-light); box-shadow: 0 0 0 2px var(--c-ring); }
.lw-orb .dots i:nth-child(2) { transform: rotate(120deg); }
.lw-orb .dots i:nth-child(3) { transform: rotate(240deg); }
@keyframes orb-out { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(1.38); opacity: 0; } }
@keyframes orb-in { 0% { transform: scale(1.38); opacity: 0; } 60% { opacity: 0.6; } 100% { transform: scale(1); opacity: 0; } }
@keyframes orb-spin { to { transform: rotate(360deg); } }

/* ---- right panel: home ---- */
.lw-panel { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-top: 22px; }
.lw-greet { margin: 0; font-family: var(--font-title); font-weight: 600; font-size: clamp(30px, 5.2cqw, 46px); line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; }
.lw-lead { margin: 0; font-size: 21px; color: var(--muted); }
.lw-rule { width: 120px; height: 14px; margin: 2px 0; color: var(--gold-text); opacity: 0.8; }
.lw .lw-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 64px; padding: 0 34px 0 28px; margin-top: 6px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font-size: 22px; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  touch-action: manipulation;
}
.lw-cta svg { width: 26px; height: 26px; }
.lw-cta:hover { filter: brightness(1.06); box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 42%, transparent); }
.lw-cta:active { transform: scale(0.98); }
.lw-cta[aria-disabled="true"] { filter: saturate(0.4); opacity: 0.6; cursor: not-allowed; }
.lw-hint { margin: 0; font-size: 18px; color: var(--muted); font-style: normal; max-width: 34ch; }
.lw-hint q { quotes: "«" "»"; }

/* notice (service sentences, unpaired, offline): calm card, never alarming */
.lw-notice {
  width: min(100%, 560px); margin: 6px auto 0; padding: 18px 22px; border-radius: 20px; text-align: left;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start;
}
.lw-notice > svg { grid-row: span 3; width: 28px; height: 28px; margin-top: 2px; color: var(--gold-text); }
.lw-notice .n-title { margin: 0; font-family: var(--font-title); font-size: 22px; font-weight: 600; line-height: 1.25; }
.lw-notice .n-text { margin: 0; font-size: 18px; color: var(--text); }
.lw-notice .n-small { margin: 4px 0 0; font-size: 16px; color: var(--muted); }
.lw-notice .n-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.lw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px;
  border-radius: 999px; border: 2px solid var(--accent); background: transparent; color: var(--text);
  font-size: 18px; font-weight: 700; cursor: pointer; touch-action: manipulation; transition: background 0.2s, transform 0.12s;
}
.lw-btn svg { width: 22px; height: 22px; }
.lw-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.lw-btn:active { transform: scale(0.98); }

/* ---- talk panel ---- */
.lw-talk { display: none; width: 100%; flex-direction: column; align-items: center; gap: 16px; }
.lw[data-view="talk"] .lw-home { display: none; }
.lw[data-view="talk"] .lw-talk { display: flex; }
.lw[data-view="talk"] .lw-friends { display: none; }
.lw-status {
  display: inline-flex; align-items: center; gap: 12px; margin: 0; min-height: 48px; padding: 8px 22px 8px 16px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong);
  font-size: 22px; font-weight: 700; color: var(--text);
}
.lw-status .s-icon { width: 28px; height: 28px; flex: none; color: var(--gold-text); }
.lw[data-view="home"] .lw-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.lw-subs {
  width: min(100%, 900px); min-height: 7.5em; max-height: 15em; overflow-y: auto; margin: 0; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 10px; text-align: left; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.lw-subs:empty { display: none; }
.lw-subs .line { margin: 0; font-size: 22px; line-height: 1.5; overflow-wrap: anywhere; }
.lw-subs .line .who { font-weight: 700; margin-right: 8px; }
.lw-subs .line.ai .who { color: var(--name-color, var(--gold-text)); }
.lw-subs .line.luisa { color: var(--muted); }
.lw-subs .line.luisa .who { color: var(--text); }
.lw-end { min-width: 160px; }
.lw-mock { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center; font-size: 15px; color: var(--muted); }
.lw-mock button { font-size: 15px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.lw-mockbar { position: relative; z-index: 3; background: #ffb547; color: #1a1a1a; text-align: center; font-weight: 700; font-size: 15px; padding: 6px 12px; }

/* ---- other characters ---- */
.lw-friends { margin-top: 36px; }
.lw-friends h2 { margin: 0 0 16px; text-align: center; font-family: var(--font-title); font-weight: 600; font-size: 26px; }
.lw-cards { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 210px)); justify-content: center; gap: 16px; max-width: 1040px; }
.lw-card {
  width: 100%; height: 100%; min-height: 200px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 14px 18px; border-radius: 24px; cursor: pointer; text-align: center;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s; touch-action: manipulation;
}
.lw-card:hover { box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.lw-card:active { transform: scale(0.98); }
.lw-card .em {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 38% 34%, color-mix(in srgb, var(--c-light) 60%, #fff) 0%, var(--c-light) 72%);
  box-shadow: 0 0 0 3px var(--c-ring); color: #231e4d;
}
.lw[data-theme="evening"] .lw-card .em { box-shadow: 0 0 22px color-mix(in srgb, var(--c-light) 40%, transparent); }
.lw-card .em svg { width: 40px; height: 40px; }
.lw-card .nm { font-family: var(--font-title); font-weight: 600; font-size: 22px; line-height: 1.2; color: var(--c-text); }
.lw-card .ht { font-size: 16px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.lw-foot { position: relative; z-index: 1; padding: 18px clamp(16px, 4cqw, 48px) 22px; text-align: center; font-size: 16px; color: var(--muted); }
.lw-foot p { margin: 0; }

/* wide screens (Chromebook): Luna on the left, words on the right */
@container (min-width: 760px) {
  .lw-hero { grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.05fr); }
  .lw-stage { height: clamp(380px, calc(var(--vh) * 76), 640px); width: 100%; }
  .lw-panel { align-items: flex-start; text-align: left; padding-top: 0; }
  .lw-hint { max-width: 40ch; }
  .lw-notice { margin-left: 0; }
  .lw-talk { align-items: flex-start; }
  .lw-subs { width: 100%; }
}
@container (max-width: 420px) {
  .lw-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .lw-card { min-height: 180px; padding: 16px 10px; }
  .lw-card .em { width: 64px; height: 64px; }
  .lw .lw-cta { width: 100%; padding: 0 20px; }
  .lw-subs .line { font-size: 20px; }
  .lw-top { gap: 8px; padding-top: 14px; }
  .lw-brand { font-size: 17px; gap: 8px; }
  .lw-brand svg { width: 24px; height: 24px; }
  .lw-mic { font-size: 15px; padding: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .lw *, .lw *::before, .lw *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .lw-orb .dots, .lw-orb .ring { animation: none !important; }
}
@media (forced-colors: active) {
  .lw-cta, .ai-badge, .lw-btn, .lw-card, .lw-notice, .lw-status, .lw-nameplate { border: 2px solid CanvasText; }
}
/* ==== APP CSS: end ==== */

/* ---- Marco's choices from the panel (GET /api/ui, set by app.js as data attributes) ---- */
body.lw[data-subtitles="off"] .lw-subs { display: none !important; }
body.lw:is([data-motion="reduced"], [data-motion="still"]) *,
body.lw:is([data-motion="reduced"], [data-motion="still"]) *::before,
body.lw:is([data-motion="reduced"], [data-motion="still"]) *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }

/* ---- boot: the theme is chosen before the page shows (no flash of the wrong theme) ---- */
body.lw { margin: 0; min-height: 100vh; min-height: 100dvh; }
body.lw.booting .lw-shell { opacity: 0; animation: lw-reveal 0.01s linear 0.9s forwards; }
@keyframes lw-reveal { to { opacity: 1; } }

/* ---- pairing pages (server/src/auth/routes.ts: body.pair-page > main.pair): Marco pairs once ---- */
body.pair-page {
  margin: 0; min-height: 100vh; background: #fbf4ea; color: #231e4d;
  font-family: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Noto Sans", Roboto, "Segoe UI", system-ui, sans-serif;
  font-size: 19px; line-height: 1.55;
}
.pair { max-width: 36rem; margin: 0 auto; padding: 48px 20px; }
.pair h1 { font-family: "Fraunces", "Noto Serif Display", "Noto Serif", Georgia, serif; font-weight: 600; font-size: 32px; line-height: 1.2; margin: 0 0 16px; }
.pair p, .pair li { margin: 0 0 12px; }
.pair ol { padding-left: 1.3em; margin: 0 0 20px; }
.pair-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 30px;
  font: inherit; font-size: 20px; font-weight: 700; border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
  background: #4e3a8e; color: #ffffff; box-shadow: 0 6px 20px rgba(78, 58, 142, 0.3);
}
.pair-button:focus-visible { outline: 3px solid #4e3a8e; outline-offset: 3px; }
