/* ============================================================
   INAWE · Script Your Luck AI
   Same brand tokens as the Lucky Switch funnel (assets/lucky.css):
   Poppins, black → deep violet gradients, lavender & lilac accents,
   gold highlights, white buttons, dark violet cards with thin lilac borders.
   ============================================================ */

:root {
  --black: #000000;
  --violet-950: #14041f;
  --violet-900: #1c0533;
  --violet-800: #2e0b47;
  --violet-600: #611396;
  --lavender: #b68fff;
  --lilac: #e4cafc;
  --lilac-soft: #f1e6fd;
  --ink: #f4f1f7;
  --ink-soft: #dcd4e6;
  --muted: #b9adc9;
  --line: rgba(228, 202, 252, 0.28);
  --line-strong: rgba(228, 202, 252, 0.5);
  --card: linear-gradient(180deg, rgba(46, 11, 71, 0.82) 0%, rgba(28, 5, 51, 0.92) 100%);
  --gold: #dcae55;
  --gold-grad: linear-gradient(135deg, #f7e6bb 0%, #dcae55 50%, #b5852f 100%);
  --success: #a9e5c2;
  --error: #ff9c92;
  --sans: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: radial-gradient(120% 60% at 50% 0%, var(--violet-800) 0%, var(--violet-950) 45%, var(--black) 100%) fixed, var(--black);
  font-family: var(--sans); font-size: 16px; line-height: 1.7; font-weight: 300;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--lilac); }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
strong, b { font-weight: 600; }
h1, h2, h3 { margin: 0; font-weight: 300; letter-spacing: -0.02em; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(32px, 7vw, 44px); }
h2 { font-size: clamp(24px, 5vw, 30px); }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
h1 em, h2 em { font-style: italic; font-weight: 600; }
.gold-text { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kicker { font-size: 11.5px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--lilac); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.page { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0; }
.logo img { height: 22px; width: auto; }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--ink); border-radius: 12px; cursor: pointer;
}
.icon-btn:hover { background: rgba(228, 202, 252, 0.08); }
.icon-btn:focus-visible { outline: 2px solid var(--lavender); outline-offset: 2px; }
.text-btn { background: none; border: 0; padding: 8px 4px; font: inherit; font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.text-btn:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 14px 28px; border-radius: 10px; border: 0;
  background: #fff; color: #000; font-family: var(--sans); font-size: 16px; font-weight: 500;
  text-decoration: none; cursor: pointer; text-align: center; line-height: 1.3;
  box-shadow: 0 14px 40px -14px rgba(182, 143, 255, 0.75);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .25s var(--ease);
}
.btn:hover { transform: translateY(-2px); background: var(--lilac-soft); }
.btn:focus-visible { outline: 3px solid var(--lavender); outline-offset: 3px; }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); box-shadow: none; }
.btn--ghost:hover { background: rgba(228, 202, 252, 0.08); }
.btn--sm { min-height: 40px; padding: 8px 16px; font-size: 14px; border-radius: 8px; }

/* ---------- forms ---------- */
.label { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.input {
  width: 100%; min-height: 54px; padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: rgba(20, 4, 31, 0.6); color: var(--ink);
  font-family: var(--sans); font-size: 16px; font-weight: 400;
}
.input::placeholder { color: #8f81a3; }
.input:focus { outline: none; border-color: var(--lavender); box-shadow: 0 0 0 3px rgba(182, 143, 255, 0.25); }
.notice { padding: 14px 16px; border-radius: 12px; font-size: 14.5px; line-height: 1.6; border: 1px solid var(--line); background: var(--card); }
.notice.success { border-color: rgba(169, 229, 194, 0.45); }
.notice.error { border-color: rgba(255, 156, 146, 0.55); color: #ffd9d4; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.card--glow { border-color: var(--line-strong); box-shadow: 0 30px 70px -40px rgba(97, 19, 150, 0.9); }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(220, 174, 85, 0.55); background: rgba(220, 174, 85, 0.1);
  font-size: 13px; font-weight: 500; color: #f7e6bb; white-space: nowrap;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-grad); }

/* ---------- home ---------- */
.home { display: flex; flex-direction: column; gap: 28px; padding: 8px 0 48px; }
.hero { display: flex; flex-direction: column; gap: 14px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(28, 5, 51, 0.6);
  text-decoration: none; color: var(--ink); transition: border-color .2s var(--ease), background .2s var(--ease);
}
.row:hover { border-color: var(--line-strong); background: rgba(46, 11, 71, 0.7); }
.row .t { display: block; font-weight: 500; font-size: 15px; line-height: 1.4; }
.row .m { display: block; font-size: 13px; color: var(--muted); }
.tag-ready { color: #f7e6bb; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.chat .topbar { padding: 12px 0; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.chat-title { flex: 1; min-width: 0; text-align: center; font-size: 14px; font-weight: 500; }
.chat-title small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.thread { flex: 1; overflow-y: auto; padding: 22px 0 12px; display: flex; flex-direction: column; gap: 18px; overscroll-behavior: contain; }
.msg-user {
  align-self: flex-end; max-width: 85%; padding: 12px 16px; border-radius: 18px 18px 4px 18px;
  background: var(--lilac); color: #14041f; font-weight: 400; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-ai { align-self: flex-start; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.msg-ai .who { font-size: 11.5px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--lavender); }
.msg-ai .bubble { color: var(--ink); overflow-wrap: anywhere; }
.msg-ai .bubble p { margin: 0 0 0.8em; }
.msg-ai .bubble p:last-child { margin: 0; }
.msg-ai .bubble ul { margin: 0 0 0.8em; padding-left: 1.2em; }
.typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--lavender); opacity: .35; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i, .script.writing .script-status { animation: none; opacity: .7; } .script-toggle { transition: none; } .btn:hover { transform: none; } }

/* ---------- script cards ---------- */
.script {
  border-radius: var(--r); padding: 1px; background: linear-gradient(135deg, rgba(247, 230, 187, 0.7), rgba(182, 143, 255, 0.35) 45%, rgba(220, 174, 85, 0.6));
}
.script > summary, .script > .script-content { background: linear-gradient(180deg, #24073b 0%, #14041f 100%); }
.script > summary { border-radius: calc(var(--r) - 1px); }
.script[open] > summary { border-radius: calc(var(--r) - 1px) calc(var(--r) - 1px) 0 0; background: #24073b; }
.script > .script-content { border-radius: 0 0 calc(var(--r) - 1px) calc(var(--r) - 1px); padding: 4px 20px 22px; background: linear-gradient(180deg, #1f0633 0%, #14041f 100%); }
.script-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px;
  cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent;
}
.script-head::-webkit-details-marker { display: none; }
.script-head:focus-visible { outline: 2px solid var(--lavender); outline-offset: 2px; }
.script-head-text { display: flex; flex-direction: column; min-width: 0; }
.script-head .kicker { color: var(--gold); text-transform: none; letter-spacing: 0.02em; font-size: 13px; font-weight: 600; }
.script-head h3 { margin-top: 4px; }
.script-head .sub { font-size: 13px; color: var(--muted); }
.script-status { margin-top: 8px; font-size: 12.5px; color: #f7e6bb; }
.script.writing .script-status { animation: blink 1.6s infinite; }
.script-toggle {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); color: var(--gold); transition: transform .2s ease;
}
.script[open] .script-toggle { transform: rotate(180deg); }
.script + .script { margin-top: 12px; }
.make-short { align-self: flex-start; margin-top: 2px; }
.script-body { font-size: 16.5px; line-height: 1.85; color: var(--ink); }
.script-body p { margin: 0 0 1em; }
.script-body p:last-child { margin: 0; }
.script-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.script.writing .script-actions { display: none; }

.coach-cta { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(97, 19, 150, 0.22); }

/* ---------- composer ---------- */
.composer { flex-shrink: 0; padding: 12px 0 max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.composer form { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea {
  flex: 1; min-height: 52px; max-height: 160px; resize: none; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: rgba(20, 4, 31, 0.75); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
}
.composer textarea:focus { outline: none; border-color: var(--lavender); }
.send { width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; border: 0; background: #fff; color: #000; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.send:disabled { opacity: .5; cursor: progress; }
.composer .note { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  padding: 10px 18px; border-radius: 999px; background: #fff; color: #000; font-size: 14px; font-weight: 500;
  box-shadow: 0 14px 40px -14px rgba(182, 143, 255, 0.9);
}

/* Section labels inside a script */
.script-body .script-section {
  margin: 1.6em 0 0.4em; font-size: 15px; font-weight: 600; letter-spacing: 0.01em; text-transform: none; color: var(--gold);
}
.script-body .script-section:first-child { margin-top: 0; }
.msg-ai .bubble ul { margin: 0 0 0.8em; padding-left: 1.2em; }
.msg-ai .bubble li { margin: 0.2em 0; }
.msg-ai .bubble strong { color: #fff; font-weight: 600; }
.msg-ai .bubble em { color: var(--ink-soft); }

/* ---------- Read it out loud ---------- */
body.reader-open { overflow: hidden; }
.reader {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  background: radial-gradient(120% 70% at 50% 0%, #2e0b47 0%, #14041f 55%, #000 100%);
}
.reader-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.reader-title { flex: 1; text-align: center; font-size: 13px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.reader-size { display: flex; }
.reader-size .icon-btn { font-family: var(--sans); font-size: 14px; font-weight: 500; }
.reader-scroll { flex: 1; overflow-y: auto; padding: 32px 20px 45vh; outline: none; scroll-behavior: auto; }
.reader-text { max-width: 640px; margin: 0 auto; font-size: 24px; line-height: 1.75; font-weight: 300; color: #fff; }
.reader-text p { margin: 0 0 1.1em; }
.reader-text .script-section { margin: 2em 0 0.6em; font-size: 16px; font-weight: 600; letter-spacing: 0.01em; text-transform: none; color: var(--gold); opacity: 0.9; }
.reader-text .reader-intro { font-size: 0.68em; color: var(--muted); font-style: italic; }
.reader-text .reader-end { text-align: center; }
.reader-controls { padding: 12px 16px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(10, 2, 18, 0.88); display: flex; flex-direction: column; gap: 10px; }
.reader-tracks { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.reader-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  flex-shrink: 0; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent;
  color: var(--ink); font-family: var(--sans); font-size: 13px; cursor: pointer;
}
.chip[aria-checked="true"] { border-color: var(--gold); background: rgba(220, 174, 85, 0.14); color: #f7e6bb; }
