/* insta by rvrs · phone-first · tokens match the approved prototype */
:root {
  --bg: #0f0e12; --panel: #1a1820; --panel-2: #242129; --rule: #2e2a36; --fg: #f2eee6; --muted: #a39db0;
  --accent: #b9acff; --accent-ink: #1a1430; --good: #9bd3a8; --warn: #f0c27a; --bad: #f2a79c;
  --display: "Bricolage Grotesque", system-ui, sans-serif; --body: "Manrope", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { min-height: 100%; }
.shell { min-height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1 1 auto; max-width: 720px; width: 100%; margin: 0 auto; padding-inline: 16px; padding-block: calc(var(--sat) + 18px) 24px; display: flex; flex-direction: column; gap: 18px; }
.screen.center { justify-content: center; align-items: center; min-height: 100vh; gap: 24px; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
h1 { font: 700 26px/1.1 var(--display); margin: 0; }
.eyebrow { font: 600 12px var(--body); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.link { color: var(--accent); font-weight: 700; font-size: 13px; min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; }

.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); align-self: center; }
.brand-name { font: 700 28px var(--display); } .brand-by { color: var(--muted); font-size: 13px; }

.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack.tight { gap: 4px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 18px; padding: 14px 16px; min-width: 0; }
.card.list { padding: 0; overflow: hidden; }
.list > .item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; min-height: 52px; border-bottom: 1px solid var(--rule); }
.list > .item:last-child { border-bottom: 0; }
.list .empty { padding: 14px; color: var(--muted); font-size: 13px; }

.input { width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--rule); background: var(--panel-2); color: var(--fg); }
.btn { min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--rule); background: var(--panel-2); color: var(--fg); font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.good { background: var(--good); color: var(--accent-ink); border-color: transparent; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--rule); color: var(--fg); font-size: 12px; font-weight: 700; cursor: pointer; }
.chip.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tag { font-size: 11px; font-weight: 700; white-space: nowrap; }
.tag.good { color: var(--good); } .tag.warn { color: var(--warn); } .tag.bad { color: var(--bad); } .tag.accent { color: var(--accent); }

.step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; }
.step-n { width: 28px; height: 28px; border-radius: 999px; background: var(--panel-2); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-top: 2px; }
.step-n.done { background: var(--good); color: var(--accent-ink); } .step-n.accent { background: var(--accent); color: var(--accent-ink); }

.recorder { align-items: center; text-align: center; }
.meter { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.meter span { width: 4px; border-radius: 2px; background: #3a3545; height: 8px; transition: height .08s linear, background .2s; }
.meter.live span { background: var(--accent); }
.timer { font: 500 22px var(--mono); font-variant-numeric: tabular-nums; }
.rec { width: 72px; height: 72px; border-radius: 999px; background: var(--accent); border: 4px solid var(--rule); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rec .rec-dot { width: 28px; height: 28px; border-radius: 999px; background: var(--accent-ink); transition: all .15s; }
.rec.on { background: var(--bad); } .rec.on .rec-dot { width: 24px; height: 24px; border-radius: 6px; }
.rec:disabled { opacity: .5; }

audio { width: 100%; height: 36px; }
.voice-card { display: flex; flex-direction: column; gap: 10px; }
.engine { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--rule); background: var(--panel-2); }
.engine.on { border-color: var(--good); }
.progress { display: flex; align-items: center; gap: 10px; }
.spinner { width: 16px; height: 16px; border-radius: 999px; border: 2px solid var(--rule); border-top-color: var(--accent); animation: spin 1s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .meter span { transition: none; } }

/* Brief chat */
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; }
.msg.ai { align-self: flex-start; background: var(--panel); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; font-weight: 600; }
.msg.wait { color: var(--muted); }
.composer { position: sticky; bottom: calc(var(--sab) + 70px); display: flex; gap: 8px; padding: 8px 0 0; background: var(--bg); }
.composer .input { flex: 1 1 auto; min-width: 0; border-radius: 999px; }
.composer .btn { border-radius: 999px; }
.bible summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; min-height: 32px; }
.bible summary::-webkit-details-marker { display: none; }
.bible-grid { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; margin-top: 12px; font-size: 13.5px; }
.bible-grid .k { color: var(--muted); font-weight: 600; text-transform: capitalize; padding-top: 6px; }
.bible-grid textarea { width: 100%; min-height: 40px; resize: vertical; font: inherit; font-size: 13.5px; line-height: 1.4; color: var(--fg); background: var(--panel-2); border: 1px solid var(--rule); border-radius: 10px; padding: 6px 10px; }
@media (min-width: 900px) { .composer { bottom: 0; } }

/* Samples */
.sample { display: flex; flex-direction: column; gap: 10px; }
.media img { width: 100%; border-radius: 12px; display: block; aspect-ratio: 4 / 5; object-fit: cover; }
.media.strip { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.media.strip img { width: 78%; flex: 0 0 auto; scroll-snap-align: start; }
.caption { color: #d9d4cc; line-height: 1.45; white-space: pre-wrap; }
.reactions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* Strategy */
.thesis { font: 600 19px/1.35 var(--display); text-wrap: balance; max-width: 40ch; }
.pillars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Reading view: script text scrolls, recorder bar stays pinned */
.reader { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; }
.reader-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: calc(var(--sat) + 10px) 16px 10px; border-bottom: 1px solid var(--rule); }
.reader-text { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 20px 24px; max-width: 760px; width: 100%; margin: 0 auto; font: 400 21px/1.6 var(--display); }
.reader-text h2 { font: 600 15px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin: 28px 0 10px; }
.reader-text h2 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.reader-text p { margin: 0 0 16px; max-width: 60ch; }
.reader-text p.hint { font: 500 14px/1.5 var(--body); color: var(--muted); }
.reader-text p.q { font-weight: 600; }
.reader-text em { font-style: normal; font: 500 13px var(--mono); color: var(--muted); }
.reader-bar { border-top: 1px solid var(--rule); background: #121116; padding: 10px 16px calc(var(--sab) + 12px); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.reader-bar .meter { height: 28px; }
.reader-controls { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 760px; }
.reader-controls .rec { width: 64px; height: 64px; flex: 0 0 auto; }
.reader-controls .timer { font-size: 18px; min-width: 86px; }

.tabs { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--rule); background: #121116; padding: 8px 8px calc(var(--sab) + 10px); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; min-height: 44px; color: var(--muted); font-size: 11px; font-weight: 700; }
.tabs a.on { color: var(--accent); }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .tabs { position: static; flex: 0 0 220px; grid-template-columns: 1fr; align-content: start; gap: 4px; border-top: 0; border-right: 1px solid var(--rule); padding: 28px 12px; min-height: 100vh; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px; }
  .tabs a.on { background: var(--panel); }
  .screen { padding-block: 32px; }
}
