/* LyricBridge player — friendly bilingual UI, soft PASTEL light theme.
   Sarabun (matches the burned-in ASS subtitle font) with a system Thai fallback
   so it renders cleanly offline / self-hosted. */
@import url("https://fonts.googleapis.com/css2?family=Sarabun:wght@400;600;700&display=swap");

:root {
  --bg:     #fbf6fe;   /* soft lavender-cream */
  --bg2:    #f4ecfb;   /* slightly deeper pastel */
  --panel:  #ffffff;
  --panel2: #faf4fe;
  --line:   #ece0f4;   /* soft lavender border */
  --text:   #4b4364;   /* deep muted purple-slate, readable on light */
  --dim:    #6f6788;   /* muted lavender-grey — darkened to meet WCAG AA 4.5:1 on
                          white/near-white (was #9d92b3 ≈ 2.91:1; .en text is real
                          bilingual content, so it must pass contrast) */
  --active: #ff5fa2;   /* vivid pastel pink — current word, pops on light */
  --accent: #9b7be3;   /* soft purple */
  --accent2:#ff9bb8;   /* pastel coral-pink */
  --good:   #3fc3a0;   /* mint */
  --radius: 16px;
  --shadow: 0 10px 26px rgba(155, 123, 227, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(900px 480px at 12% -6%, rgba(255, 155, 184, .28), transparent 60%),
    radial-gradient(900px 520px at 92% -4%, rgba(155, 123, 227, .22), transparent 58%),
    radial-gradient(820px 520px at 50% 108%, rgba(120, 214, 197, .22), transparent 60%),
    var(--bg);
  min-height: 100vh;
}

.en { color: var(--dim); font-weight: 400; }
small { color: var(--dim); font-weight: 400; }

/* ── Header ──────────────────────────────────────────────────── */
.app-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), transparent);
}
.brand { display: flex; align-items: center; gap: 1rem; max-width: 920px; margin: 0 auto; }
.logo {
  font-size: 2.4rem; line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(255, 95, 162, .35));
}
.brand h1 { margin: 0; font-size: 1.55rem; font-weight: 700; letter-spacing: .2px; }
.brand h1 .sub { color: var(--dim); font-weight: 400; font-size: .95rem; margin-left: .35rem; }
.tagline { margin: .2rem 0 0; font-size: .92rem; }
.tagline .en { display: block; font-size: .82rem; }

/* ── Layout ──────────────────────────────────────────────────── */
main { max-width: 920px; margin: 0 auto; padding: 1.5rem 1.25rem 5rem; }

/* ── Setup steps ─────────────────────────────────────────────── */
.setup { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 680px) { .setup { grid-template-columns: 1fr; } }

.step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
/* Step 0 hero (one-upload, the recommended path) */
.oneup { margin-bottom: 1rem; }
.step.hero {
  border-color: #e3c9f1;
  background: linear-gradient(135deg, #ffffff, #fdf1fb);
  box-shadow: 0 12px 30px rgba(255, 95, 162, .14);
}
.step.hero .num {
  background: linear-gradient(135deg, var(--active), var(--accent2));
  box-shadow: 0 3px 12px rgba(255, 95, 162, .4);
}
.step.hero h2 { font-size: 1.15rem; }

/* Manual mode (advanced, collapsed by default) */
.manual { margin-bottom: 1rem; }
.manual > summary {
  cursor: pointer; list-style: none; color: var(--accent); font-size: .9rem;
  padding: .55rem .9rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
}
.manual > summary::-webkit-details-marker { display: none; }
.manual > summary::before { content: "▸ "; }
.manual[open] > summary::before { content: "▾ "; }
.manual > summary .en { display: inline; font-size: .78rem; margin-left: .3rem; }
.manual .setup { margin-top: 1rem; }

.step-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .85rem; }
.step-head h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.step-head .en { margin: 0; font-size: .8rem; }
.num {
  flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: .95rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), #c0a3ff);
  box-shadow: 0 3px 10px rgba(155, 123, 227, .35);
}
.step.done .num { background: linear-gradient(135deg, var(--good), #88e6cd); box-shadow: 0 3px 10px rgba(63, 195, 160, .35); }
.step.done .num { font-size: 0; }
.step.done .num::after { content: "✓"; font-size: 1rem; }

/* ── Dropzones (styled file inputs) ──────────────────────────── */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  text-align: center; cursor: pointer;
  padding: 1.4rem 1rem;
  border: 1.5px dashed #d7c8e6;
  border-radius: 12px;
  background: var(--bg2);
  transition: border-color .15s, background .15s, transform .1s;
}
.dropzone:hover { border-color: var(--accent); background: #f1e8fb; }
.dropzone.dragover { border-color: var(--accent); background: rgba(155, 123, 227, .12); transform: translateY(-1px); }
.dropzone.filled { border-style: solid; border-color: var(--good); background: rgba(63, 195, 160, .10); }
.dz-icon { font-size: 1.7rem; }
.dz-text { font-size: .95rem; }
.dz-text small { display: block; font-size: .76rem; margin-top: .1rem; }
.dz-file {
  font-size: .82rem; color: #2ba488; font-weight: 600;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dz-file:empty { display: none; }
.dropzone.small { padding: 1rem; }
.dropzone.small .dz-icon { font-size: 1.3rem; }

/* ── Advanced (server transcribe) ────────────────────────────── */
.advanced { margin-top: .8rem; }
.advanced > summary {
  cursor: pointer; font-size: .85rem; color: var(--accent);
  list-style: none; padding: .4rem 0;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "▸ "; }
.advanced[open] > summary::before { content: "▾ "; }
.advanced > summary .en { display: block; font-size: .76rem; }
.adv-body { margin-top: .6rem; display: grid; gap: .7rem; }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; color: var(--dim); }
.field input {
  background: #fff; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; font: inherit; font-size: .85rem;
}
.field input:focus { outline: none; border-color: var(--accent); }

/* ── Player ──────────────────────────────────────────────────── */
.player {
  margin-top: 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
audio { width: 100%; }
.offset { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; font-size: .82rem; color: var(--dim); }
.offset label { font-weight: 600; color: var(--text); }
.offset input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--accent); }
.offset-val { min-width: 56px; text-align: right; color: var(--accent); font-weight: 600; }
.offset-hint { flex-basis: 100%; font-size: .76rem; }
.vocal-guide-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.75rem;
  background: var(--surface-alt, #f3f4f6);
  border-radius: 8px;
  margin-top: 0.5rem;
}
.vg-toggle { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.9rem; }
.vg-slider-row { display: flex; align-items: center; gap: 0.5rem; }
.vg-label { font-size: 0.85rem; color: var(--text-muted, #666); }
#vocalVolume { width: 120px; }
#vocalVolumeVal { font-size: 0.85rem; min-width: 3ch; }
.nudge { display: flex; align-items: center; gap: .5rem; }
.nudge button {
  background: #fff; color: var(--accent); border: 1px solid #e0d2ef;
  border-radius: 8px; padding: .35rem .7rem; cursor: pointer; font: inherit; font-size: .82rem; font-weight: 600;
}
.nudge button:hover { border-color: var(--accent); background: #f3ebfc; }
kbd {
  background: #efe6f8; border: 1px solid #d9c7ec; border-radius: 4px;
  padding: 0 .35rem; font-size: .82em; font-family: inherit; color: var(--text);
}

.status { margin: .6rem 0 0; color: var(--dim); font-size: .85rem; min-height: 1.2em; }
.status.busy { color: var(--accent); }
.status.error { color: #e7568a; }
.status.ok { color: #2ba488; }

/* ── Lyrics stage ────────────────────────────────────────────── */
.stage { margin-top: 1.1rem; }
.lyrics {
  font-size: 1.95rem; text-align: center;
  min-height: 220px;
  padding: 1.5rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fbf4ff);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.line { margin: .85rem 0; transition: opacity .3s; color: #b6abc9; }
.word { color: var(--text); transition: color .12s ease, text-shadow .12s ease; }

/* current word pops in pastel pink with a soft glow */
.word.active { color: var(--active); text-shadow: 0 0 16px rgba(255, 95, 162, .35); }

/* empty state */
.empty { color: var(--dim); display: grid; place-items: center; gap: .5rem; padding: 2.2rem 1rem; }
.empty-icon { font-size: 2.6rem; opacity: .85; }
.empty-icon.spin { display: inline-block; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .6; } 50% { transform: scale(1.18); opacity: 1; } }
.processing p { color: var(--accent); font-weight: 600; }

/* 4-step progress bar shown during the one-upload pipeline */
.stepbar { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; margin-top: 1.1rem; }
.stepdot {
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--dim);
  font-size: .82rem; transition: all .2s;
}
.stepdot .stepnum {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: #ece3f6; color: var(--dim); font-size: .72rem; font-weight: 700; flex: none;
}
.stepdot.active {
  border-color: var(--accent); color: var(--accent); font-weight: 600;
  box-shadow: 0 2px 10px rgba(155, 123, 227, .25);
}
.stepdot.active .stepnum { background: var(--accent); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.stepdot.done { border-color: var(--good); color: #2ba488; }
.stepdot.done .stepnum { background: var(--good); color: #fff; }
@media (max-width: 600px) { .steptxt { display: none; } }
.empty p { margin: 0; font-size: 1rem; }
.empty small { display: block; font-size: .82rem; margin-top: .15rem; }

/* ── Edit tools ──────────────────────────────────────────────── */
.tools { margin-top: 1rem; }
.edit-tools > summary {
  cursor: pointer; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: .6rem .9rem; font-size: .9rem; box-shadow: var(--shadow);
}
.edit-tools > summary::-webkit-details-marker { display: none; }
.edit-tools > summary .en { font-size: .78rem; margin-left: .3rem; }
.edit-tools[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.editbar {
  background: var(--panel2); border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 10px 10px;
  padding: .9rem; display: grid; gap: .7rem;
}
.switch { display: flex; align-items: center; gap: .45rem; font-size: .9rem; cursor: pointer; }
.edithint { margin: 0; font-size: .8rem; color: var(--dim); }
.edithint small { display: block; }
.export { display: flex; gap: .6rem; flex-wrap: wrap; }
.export button {
  background: #fff; color: var(--accent);
  border: 1px solid #e0d2ef; border-radius: 8px;
  padding: .5rem .9rem; cursor: pointer; font: inherit; font-size: .86rem; font-weight: 600;
  transition: border-color .15s, background .15s, color .15s;
}
.export button:hover { border-color: var(--accent); background: #f3ebfc; }

/* in edit mode words become clickable targets */
.lyrics.editing .word { cursor: pointer; border-bottom: 1px dashed transparent; }
.lyrics.editing .word:hover { border-bottom-color: var(--accent); }
.word.edited { color: var(--accent); }
/* E1: the word currently being retyped inline (contentEditable) */
.word.editing-word {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
  background: var(--panel);
  cursor: text;
  caret-color: var(--active);
}
/* F8: video style controls (apply to the 🎬 render button). */
.render-style {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--accent, #b78ae0);
  border-radius: 10px;
  font-size: .85rem;
  align-items: center;
}
.render-style label { display: inline-flex; align-items: center; gap: 6px; }
.render-style input[type="number"] { width: 4.5em; }

/* F5: sync-quality badge — sets the timing expectation before singing. */
.sync-badge {
  margin: 6px auto 0;
  padding: 4px 14px;
  border-radius: 999px;
  width: fit-content;
  font-size: .9rem;
  border: 1px solid transparent;
}
.sync-badge.good    { background: #e7f7ec; border-color: #74c69d; color: #1b6b3a; }
.sync-badge.partial { background: #fff6e0; border-color: #f3c969; color: #8a5a00; }
.sync-badge.rough   { background: #fdeaea; border-color: #ef9a9a; color: #9b1c1c; }

/* F3: ASR isn't sure about this word — orange wavy underline ("uncertain",
   not "wrong"; red would overclaim). Cleared once the user edits the word. */
.word.low-conf {
  text-decoration: underline wavy #ff9f43;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
/* F6: timing for this word is interpolated (guessed) — fade it. Distinct
   visual axis from F3's underline; both can apply to one word. Cleared when
   the user sets the time themselves. */
.word.interp { opacity: .55; }
/* F7: romanized reading under each word; toggled via body.show-roman so the
   lyrics never need a re-render. */
.word .roman { display: none; }
body.show-roman .word { display: inline-block; text-align: center; }
body.show-roman .word .roman {
  display: block;
  font-size: .5em;
  line-height: 1.1;
  opacity: .7;
  font-weight: 400;
}

/* ── Progressive disclosure ──────────────────────────────────── */
.player, .tools { display: none; }
body.has-audio .player { display: block; }
body.has-lyrics .tools { display: block; }

@media (max-width: 600px) {
  .lyrics { font-size: 1.55rem; }
  .brand h1 { font-size: 1.3rem; }
}

/* ════════════════════════════════════════════════════════════════
   Phase S — sing mode (S1 stage, S2 tempo/loop, S3 theme, S4 record)
   ════════════════════════════════════════════════════════════════ */

/* Collapsible sing-tools panel (matches the edit-tools look) */
.sing-tools { margin-top: 1rem; }
.sing-tools > summary {
  cursor: pointer; list-style: none; color: var(--accent); font-weight: 600;
  padding: .55rem .9rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
}
.sing-tools > summary::-webkit-details-marker { display: none; }
.sing-body {
  margin-top: .7rem; padding: .9rem; background: var(--panel2);
  border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; gap: .8rem;
}
.sing-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.sing-row label, .sing-label { font-size: .9rem; }
.sing-val { font-size: .85rem; color: var(--dim); min-width: 3.5rem; }
.sing-row button, .sing-tools .sing-row select {
  font: inherit; padding: .4rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text); cursor: pointer;
}
.sing-row button:hover { border-color: var(--accent); }
#stageBtn, #recordBtn { font-weight: 600; }
.sing-privacy { margin: 0; font-size: .8rem; color: var(--dim); }
.sing-privacy .en { display: inline; }

/* S3 — on-screen lyric size + theme (CSS vars set inline by player.js) */
.stage { background: var(--player-bg, transparent); border-radius: var(--radius); }
.lyrics .word { color: var(--player-text, inherit); }
body.psize-sm .lyrics { font-size: 1.3rem; }
body.psize-md .lyrics { font-size: 1.8rem; }
body.psize-lg .lyrics { font-size: 2.4rem; }
body.psize-xl .lyrics { font-size: 3rem; }

/* S1 — stage mode: big type, minimal chrome. Works WITHOUT the Fullscreen API
   (iOS Safari), since it's purely the body.stage-mode class. */
body.stage-mode { background: var(--player-bg, var(--bg)); }
body.stage-mode .app-header,
body.stage-mode .oneup,
body.stage-mode .manual,
body.stage-mode .tools,
body.stage-mode .sync-badge,
body.stage-mode .privacy-note { display: none; }
body.stage-mode main { max-width: 100%; padding: 1rem; }
body.stage-mode .lyrics {
  font-size: clamp(2rem, 7vw, 4rem); text-align: center; line-height: 1.4;
}

/* S1 — word-fill sweep: a translucent highlight grows left→right across the
   active word as it's sung, driven by the --wprog var player.js sets per frame. */
body.stage-mode .word.active {
  background: linear-gradient(90deg,
    rgba(255, 95, 162, .35) calc(var(--wprog, 0) * 100%), transparent 0);
  border-radius: 6px;
}

/* S1 — 3-2-1 countdown overlay before a verse entrance */
#countdownOverlay {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 26vw; font-weight: 800; color: var(--active);
  background: rgba(75, 67, 100, .25); text-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
#countdownOverlay[hidden] { display: none; }
#countdownOverlay.pulse { animation: cd-pop .9s ease-out; }
@keyframes cd-pop {
  from { transform: scale(.5); opacity: .15; }
  60%  { opacity: 1; }
  to   { transform: scale(1.15); opacity: .9; }
}
@media (prefers-reduced-motion: reduce) {
  #countdownOverlay.pulse { animation: none; }
}

/* ════════════════════════════════════════════════════════════════
   Phase L — Landing page (index.html). Reuses the pastel theme vars.
   Mobile-first; WCAG AA contrast; keyboard-visible focus.
   ════════════════════════════════════════════════════════════════ */

/* Accessible skip link — hidden until focused */
.skip-link {
  position: absolute; left: .5rem; top: -3rem;
  background: var(--panel); color: var(--text);
  padding: .5rem .8rem; border-radius: 10px; border: 1px solid var(--line);
  z-index: 100; transition: top .15s ease;
}
.skip-link:focus { top: .5rem; }

/* Visible focus ring for keyboard users across the landing */
.landing a:focus-visible,
.landing .lp-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Back-to-home link on the player header */
.home-link {
  font-size: .85rem; color: var(--accent); text-decoration: none;
  align-self: flex-start; margin-right: .25rem;
}
.home-link:hover { text-decoration: underline; }

.landing main { padding-bottom: 3rem; }

/* Hero */
.lp-hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.lp-hero-title {
  margin: 0 auto; max-width: 18ch; font-size: 2rem; font-weight: 700;
  line-height: 1.25; letter-spacing: .2px;
}
.lp-hero-title .en { display: block; font-size: 1rem; margin-top: .5rem; }
.lp-hero-sub { max-width: 56ch; margin: 1rem auto 0; font-size: 1.02rem; }
.lp-hero-sub .en { display: block; font-size: .88rem; margin-top: .35rem; }
.lp-note { margin-top: .9rem; font-size: .85rem; color: var(--dim); }
.lp-note .en { display: inline; }

/* CTA buttons — large bold text (AA large-text 3:1+ on these fills) */
.lp-cta-row {
  display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center;
  margin-top: 1.4rem;
}
.lp-btn {
  display: inline-block; padding: .8rem 1.4rem; border-radius: 999px;
  font-size: 1.05rem; font-weight: 700; text-decoration: none;
  border: 2px solid transparent; cursor: pointer;
}
.lp-btn .en { font-weight: 400; font-size: .85rem; }
.lp-btn.primary {
  /* deep purple → enough contrast for white bold text */
  background: #6f49c0; color: #fff;
  box-shadow: 0 8px 22px rgba(111, 73, 192, .35);
}
.lp-btn.primary .en { color: #efe7ff; }
.lp-btn.primary:hover { background: #5e3bab; }
.lp-btn.ghost {
  background: var(--panel); color: #5e3bab; border-color: #d9c8f2;
  box-shadow: var(--shadow);
}
.lp-btn.ghost .en { color: var(--dim); }
.lp-btn.ghost:hover { border-color: var(--accent); }

/* Generic landing section */
.lp-section { max-width: 920px; margin: 2.2rem auto 0; }
.lp-section > h2 {
  font-size: 1.4rem; font-weight: 700; margin: 0 0 1rem;
  text-align: center;
}
.lp-section > h2 .en { display: block; font-size: .85rem; }
.lp-lead { max-width: 64ch; margin: 0 auto; font-size: 1rem; }
.lp-lead .en { display: block; font-size: .85rem; margin-top: .4rem; }

/* How-it-works steps + feature cards share a responsive grid */
.lp-steps, .lp-features {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 760px) { .lp-steps { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 760px) { .lp-features { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 460px) { .lp-steps, .lp-features { grid-template-columns: 1fr; } }

.lp-step, .lp-feature {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow);
}
.lp-step h3, .lp-feature h3 { margin: .5rem 0 .3rem; font-size: 1.02rem; }
.lp-step h3 .en, .lp-feature h3 .en { display: block; font-size: .78rem; }
.lp-step p, .lp-feature p { margin: 0; font-size: .9rem; }
.lp-step p .en, .lp-feature p .en { display: block; font-size: .78rem; }
.lp-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--active), var(--accent2));
  box-shadow: 0 3px 12px rgba(255, 95, 162, .4);
}
.lp-feat-icon { font-size: 1.8rem; line-height: 1; }

/* Sample-song picker (Phase D+): 1–2 cards linking to ?demo=N */
.lp-demos {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 460px) { .lp-demos { grid-template-columns: 1fr; } }
.lp-demo {
  display: flex; align-items: center; gap: .9rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow);
  text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
.lp-demo:hover { border-color: var(--accent); transform: translateY(-2px); }
.lp-demo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lp-demo-play {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border-radius: 50%; color: #fff; font-size: 1rem;
  background: linear-gradient(135deg, var(--active), var(--accent2));
  box-shadow: 0 3px 12px rgba(255, 95, 162, .4);
}
.lp-demo-txt { display: flex; flex-direction: column; }
.lp-demo-txt strong { font-size: 1rem; }
.lp-demo-txt .en { font-size: .78rem; color: var(--dim); }

/* Trust / OSS / closing blocks */
.lp-trust p, .lp-oss p { max-width: 64ch; margin: 0 auto .8rem; font-size: .96rem; }
.lp-trust p .en, .lp-oss p .en { display: block; font-size: .82rem; margin-top: .35rem; }
.lp-oss { text-align: center; }
.lp-oss code, .lp-lead code {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: .05rem .35rem; font-size: .9em;
}
.lp-cta-end { text-align: center; padding-bottom: 1rem; }

/* Footer */
.lp-footer {
  border-top: 1px solid var(--line); margin-top: 2.5rem;
  padding: 1.5rem 1.25rem; text-align: center;
  background: linear-gradient(0deg, rgba(255, 255, 255, .5), transparent);
}
.lp-footer p { margin: .25rem 0; font-size: .85rem; }
.lp-footer a { color: var(--accent); }

@media (max-width: 600px) {
  .lp-hero-title { font-size: 1.6rem; }
  .lp-hero { padding-top: 1.5rem; }
}

/* ════════════════════════════════════════════════════════════════
   Phase A — Google Sign-In bar (shown only when the backend requires login)
   ════════════════════════════════════════════════════════════════ */
.authbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: .8rem;
  margin-bottom: 1rem; padding: .8rem 1rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.authbar .auth-state { font-size: .92rem; }
.authbar .auth-state .en { display: block; font-size: .78rem; }
.authbar #signOutBtn {
  font: inherit; padding: .4rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2);
  color: var(--text); cursor: pointer;
}
.authbar #signOutBtn:hover { border-color: var(--accent); }

/* ════════════════════════════════════════════════════════════════
   Phase A (owner) — full-page sign-in gate on app.html. Opaque overlay
   covers the player until the user signs in with Google. Landing is
   never gated. Frontend-only UX wall (demo assets are public statics).
   ════════════════════════════════════════════════════════════════ */
#authGate {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 1.25rem;
  background:
    radial-gradient(900px 480px at 12% -6%, rgba(255, 155, 184, .28), transparent 60%),
    radial-gradient(900px 520px at 92% -4%, rgba(155, 123, 227, .22), transparent 58%),
    var(--bg);
}
#authGate[hidden] { display: none; }
.auth-gate-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2rem 1.8rem; max-width: 26rem; width: 100%; text-align: center;
}
.auth-gate-card h2 { margin: 0 0 .3rem; font-size: 1.3rem; }
.auth-gate-card .en { display: block; margin: 0 0 1.2rem; font-size: .85rem; color: var(--dim); }
.auth-gate-card #authGateBtn { display: flex; justify-content: center; min-height: 44px; }
.auth-gate-back {
  display: inline-block; margin-top: 1.1rem; font-size: .85rem; color: var(--accent);
}
/* Belt-and-braces: while gated, don't let the page scroll behind the overlay. */
body.auth-gated { overflow: hidden; }
