@font-face { font-family: "Instrument Serif"; src: url("/fonts/InstrumentSerif-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --accent: #2B45E0; --accent-ink: #ffffff; --accent-soft: #e8ebfc;
  --bg: #f6f7fb; --surface: #ffffff; --ink: #14161c; --muted: #5b6070; --rule: #dde1ea;
  --mine: #2B45E0; --mine-ink: #ffffff; --theirs: #ffffff; --theirs-ink: #14161c; --notice: #eef0f5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #6f84ff; --accent-ink: #0b0d14; --accent-soft: #1d2340;
    --bg: #0d0f15; --surface: #161922; --ink: #eceef4; --muted: #9aa0b2; --rule: #262a36;
    --mine: #3d55e8; --mine-ink: #ffffff; --theirs: #1b1f2a; --theirs-ink: #eceef4; --notice: #151822;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.45 "Geist", -apple-system, system-ui, sans-serif; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
/* The page itself never scrolls (iPhone would drag the whole app around under the keyboard); the thread does. */
body:has(#app:not([hidden])) { position: fixed; inset: 0; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

/* Sized to the visible screen (app.js sets --app-h from the iPhone's visual viewport) so the keyboard never covers the box. */
.app { position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100dvh); transform: translateY(var(--app-top, 0px));
  display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; background: var(--bg); }

.top { position: relative; display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 8px 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--rule); flex: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); }
.who { flex: 1; min-width: 0; }
.name { font-family: "Instrument Serif", Georgia, serif; font-size: 23px; line-height: 1; }
.state { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.state span { overflow: hidden; text-overflow: ellipsis; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22a06b; flex: none; }
.state.busy { color: var(--accent); } .state.busy .live-dot { background: var(--accent); animation: blink 1.2s infinite; }
.state.warn { color: #a15c00; } .state.warn .live-dot { background: #e8a33d; }
.state.bad { color: #b42318; } .state.bad .live-dot { background: #e0353b; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); fill: currentColor; flex: none; }
.icon-btn:active { background: var(--notice); }
.menu { position: absolute; right: 10px; top: calc(56px + env(safe-area-inset-top)); background: var(--surface); border: 1px solid var(--rule);
  border-radius: 14px; box-shadow: 0 10px 34px rgba(0,0,0,.14); padding: 6px; z-index: 20; min-width: 240px; }
.menu button { display: block; width: 100%; text-align: left; padding: 14px 14px; border-radius: 10px; font-size: 16px; }
.menu button:active, .menu button:hover { background: var(--notice); }

/* ───── thread ───── */
.thread { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.thread-inner { min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 8px 10px 10px; }
.older { display: block; margin: 6px auto 4px; font-size: 14px; color: var(--accent); padding: 10px 16px; min-height: 44px; }
.day { text-align: center; margin: 16px 0 4px; }
.day span { display: inline-block; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--rule);
  padding: 3px 11px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.msg { margin-top: 10px; }
.msg.cont { margin-top: 3px; }
.msg:has(+ .msg.cont) > .meta { display: none; }
.row { display: flex; }
.msg.me .row { justify-content: flex-end; }
.bubble { max-width: min(86%, 600px); padding: 9px 14px; border-radius: 20px; overflow-wrap: anywhere; min-width: 0;
  background: var(--theirs); color: var(--theirs-ink); border: 1px solid var(--rule); }
.msg.me .bubble { background: var(--mine); color: var(--mine-ink); border-color: transparent; border-bottom-right-radius: 6px; }
.msg.me.cont .bubble { border-top-right-radius: 8px; }
.msg.agent .bubble { border-bottom-left-radius: 6px; }
.msg.agent.cont .bubble { border-top-left-radius: 8px; }
.msg.local.waiting .bubble, .msg.local.failed .bubble { opacity: .72; }
.msg.local.failed .bubble { box-shadow: 0 0 0 2px #e0353b; }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg.agent .bubble a, .notice-card a { color: var(--accent); }
.bubble code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; background: rgba(127,127,127,.14); padding: 1px 4px; border-radius: 5px; }
.md p { margin: 0 0 .55em; } .md > :last-child { margin-bottom: 0; }
.md ul, .md ol { margin: .15em 0 .6em; padding-left: 1.25em; } .md li { margin: .22em 0; } .md li::marker { color: var(--muted); }
.msg.me .md li::marker { color: inherit; }
.md h4 { font-size: 1em; margin: .7em 0 .3em; } .md h4:first-child { margin-top: 0; }
.md strong { font-weight: 600; }
.clip { position: relative; }
.clip.closed { max-height: 15em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.more { display: block; width: 100%; margin: 8px 0 2px; padding: 10px; min-height: 44px; border-radius: 12px; background: var(--accent-soft);
  color: var(--accent); font-weight: 600; font-size: 15px; }
.meta { font-size: 12px; color: var(--muted); padding: 3px 8px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg.me .meta { justify-content: flex-end; }
.via::before { content: "· "; }
.rcpt { display: none; } .msg.me.last .rcpt { display: inline; }
.rcpt::before { content: "· "; }
.rcpt .warn { color: #a15c00; } .rcpt .bad { color: #b42318; font-weight: 500; }
.acts { width: 100%; display: flex; justify-content: flex-end; gap: 8px; }
.msg .bubble.media { padding: 0; background: none; border: 0; }
.bubble.media .files { margin: 0; }
.act { padding: 8px 14px; min-height: 38px; border-radius: 19px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; }
.msg.notice { display: flex; flex-direction: column; align-items: center; }
.notice-card { width: 100%; max-width: 600px; }
.bubble.n { max-width: 100%; background: var(--notice); border-radius: 14px; font-size: 15px; }
.bubble.n::before { content: "Update"; display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.msg.notice .meta { justify-content: center; }
.vn-label { font-size: 13px; opacity: .85; margin-bottom: 4px; }
.transcript { margin-top: 8px; font-size: 14px; line-height: 1.4; border-left: 3px solid currentColor; padding-left: 9px; opacity: .92; }
.transcript span { display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; opacity: .75; margin-bottom: 2px; }

/* photos and videos in fixed frames: nothing jumps while they load */
.files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.md + .files, .vn-label + .files { margin-top: 8px; }
.bubble > .files:first-child { margin-top: 0; }
.ph { display: block; width: 240px; height: 240px; max-width: 100%; border-radius: 14px; overflow: hidden; background: rgba(127,127,127,.15); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.files.grid { display: grid; grid-template-columns: 1fr 1fr; width: 240px; max-width: 100%; }
.files.grid .ph { width: 100%; height: 118px; }
.files.grid audio, .files.grid video, .files.grid .file-chip, .files.grid .vid { grid-column: 1 / -1; }
.files audio { width: 250px; max-width: 100%; height: 44px; display: block; }
.vid { display: block; }
.vid video { width: 200px; height: 280px; object-fit: cover; border-radius: 14px; display: block; background: #000; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  background: rgba(127,127,127,.15); color: inherit; text-decoration: none; font-size: 14px; max-width: 100%; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.agent .bubble a.file-chip, .msg.agent .bubble a.ph { color: inherit; text-decoration: none; }
.viewer-body video { width: 100%; max-height: 80vh; display: block; margin: 0 auto; border-radius: 10px; background: #000; }

/* Stirling typing */
.typing { margin-top: 10px; }
.typing .bubble { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.typing em { font-style: normal; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .3; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.jump-wrap { position: sticky; bottom: 8px; height: 0; display: flex; justify-content: flex-end; z-index: 4; }
.jump { transform: translateY(-100%); display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 20px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); box-shadow: 0 4px 16px rgba(0,0,0,.14); font-size: 14px; font-weight: 500; }
.jump.new { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ───── composer ───── */
.attachments { display: flex; gap: 10px; padding: 10px 12px 2px; overflow-x: auto; background: var(--surface); border-top: 1px solid var(--rule); flex: none; }
.att { position: relative; flex: none; }
.att img, .att video { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; display: block; background: #000; }
.att .file-chip { height: 72px; max-width: 170px; }
.att button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 15px; line-height: 26px; }
.attachments:not([hidden]) + .composer { border-top: 0; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--rule); flex: none; }
.composer textarea { flex: 1; min-width: 0; resize: none; max-height: 150px; min-height: 46px; padding: 11px 16px; border-radius: 23px;
  border: 1px solid var(--rule); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4; outline: none; }
.composer textarea:focus { border-color: var(--accent); }
.attach { width: 46px; height: 46px; background: var(--notice); color: var(--ink); }
.big-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none;
  box-shadow: 0 2px 8px rgba(43,69,224,.3); }
.big-btn:active { transform: scale(.94); }

/* ───── voice note: big buttons, one thumb ───── */
.recording { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 14px; background: var(--surface); border-top: 1px solid var(--rule); flex: none; }
.rec-row { display: flex; align-items: center; gap: 12px; }
.rec-cancel { width: 54px; height: 54px; border-radius: 50%; background: #fdecea; color: #c62828; display: grid; place-items: center; flex: none; }
.rec-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.rec-top { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #e0353b; animation: blink 1s infinite; flex: none; }
.rec-listen { margin-left: auto; padding: 0 14px; min-height: 40px; border-radius: 20px; background: var(--notice); font-size: 14px; font-weight: 500; white-space: nowrap; }
.rec-send { width: 66px; height: 66px; }
.rec-level { height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; display: block; }
.rec-level i { display: block; height: 100%; width: 0; background: #1f9d55; transition: width .1s linear; }
.rec-warn { background: #fff4e5; color: #8a4b00; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.35; }
.review audio { width: 100%; height: 44px; }
.rec-actions { justify-content: space-between; }
.rec-actions .rec-label { flex: 1; text-align: center; color: var(--muted); font-size: 15px; }
.rec-btn { min-height: 50px; padding: 0 24px; border-radius: 25px; background: var(--notice); font-weight: 600; font-size: 16px; }
.rec-btn.primary { background: var(--accent); color: var(--accent-ink); }

.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-size: 15px; line-height: 1.35; max-width: min(92vw, 460px);
  box-shadow: 0 8px 28px rgba(0,0,0,.22); transition: opacity .2s, transform .2s; z-index: 70; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ───── in-app file viewer (transcripts, recordings, photos): never leaves the app ───── */
.viewer { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; }
.viewer-top { display: flex; align-items: center; gap: 8px; padding: calc(6px + env(safe-area-inset-top)) 6px 6px; background: var(--surface); border-bottom: 1px solid var(--rule); }
.viewer-top .back { font-size: 17px; color: var(--accent); padding: 0 12px; min-height: 44px; font-weight: 600; white-space: nowrap; }
.viewer-top .title { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.viewer-top .share { font-size: 16px; color: var(--accent); padding: 0 12px; min-height: 44px; }
.viewer-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.viewer-body pre { white-space: pre-wrap; word-wrap: break-word; font: 14px/1.5 ui-monospace, Menlo, monospace; margin: 0; color: var(--ink); }
.viewer-body img { max-width: 100%; display: block; margin: 0 auto; border-radius: 10px; }
.viewer-body audio { width: 100%; margin-top: 20px; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-body.frame { padding: 0; }
.viewer-body .muted { text-align: center; margin-top: 30px; }

.signed-out { height: 100dvh; display: grid; place-content: center; text-align: center; padding: 24px; }
.signed-out img { border-radius: 50%; margin: 0 auto 12px; }
.signed-out h1 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 40px; margin: 0 0 6px; }
.muted { color: var(--muted); }

@media (max-width: 420px) { .bubble { max-width: 88%; } .ph { width: 220px; height: 220px; } .files.grid { width: 220px; } .files.grid .ph { height: 108px; } }

/* ───── views + tab bar ───── */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view[hidden] { display: none !important; }
.tabs { display: flex; background: var(--surface); border-top: 1px solid var(--rule); padding: 2px 4px calc(2px + env(safe-area-inset-bottom)); flex: none; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; color: var(--muted); font-size: 11px; position: relative; }
.tabs button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent); }
.tabs .badge { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 16px; height: 16px; border-radius: 8px; background: #e0353b; color: #fff;
  font-size: 10px; font-style: normal; line-height: 16px; padding: 0 4px; }
/* keyboard up or recording: the tab bar steps aside so the thread keeps the room */
body.kb .tabs, body.recording-on .tabs { display: none; }
body:not(.kb) .composer, body:not(.kb) .recording { padding-bottom: 8px; }
body.recording-on .recording { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

/* ───── dashboards ───── */
.dash { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.dash-inner { padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 14px 14px 12px; }
.card.inner { border: 0; padding: 4px 0 0; background: none; }
.card h3 { margin: 0 0 10px; font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 21px; line-height: 1.15;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card.inner h3 { font-family: "Geist", system-ui, sans-serif; font-size: 13px; font-weight: 600; color: var(--muted); }
.card h3 small { font-family: "Geist", system-ui, sans-serif; font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; }
.kpi { background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px; }
.kpi .kv { font-family: "Instrument Serif", Georgia, serif; font-size: 30px; line-height: 1.05; }
.kpi .kl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .ks { font-size: 11.5px; margin-top: 3px; color: var(--muted); }
.kpi.warn .kv { color: #c2410c; }
.up { color: #1d7a4e; } .down { color: #c2410c; }
.chart { width: 100%; height: 90px; display: block; }
.chart rect { fill: var(--accent); }
.chart text { font-size: 4px; fill: var(--muted); font-family: "Geist", system-ui, sans-serif; }
.note, .empty { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; font-size: 14px; border-radius: 8px; overflow: hidden; }
.rank li i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; border-radius: 8px; }
.rank li span { position: relative; z-index: 1; } .rank .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .rank .v { font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 6px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--rule); }
.tbl td { padding: 8px 4px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chips span { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 6px; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 9px; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bg); }
.stack i, .legend i { display: inline-block; } .stack .a, .legend .a { background: var(--accent); } .stack .b, .legend .b { background: #9aa8f5; } .stack .c, .legend .c { background: #c9d0f8; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; } .hours i { height: 26px; border-radius: 3px; background: var(--accent); }
.hlab { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.banner { border-radius: 16px; padding: 14px 16px; border: 1px solid; }
.banner.ok { background: #e3f2ea; border-color: #bfe0cc; color: #14532d; }
.banner.bad { background: #fdecea; border-color: #f5c2bd; color: #7f1d1d; }
.banner ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; } .banner small { display: block; margin-top: 6px; opacity: .75; font-size: 12px; }
.checks { list-style: none; margin: 0 0 6px; padding: 0; }
.checks li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.checks li:last-child { border-bottom: 0; } .checks li span { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dot.ok { background: #22a06b; } .dot.bad { background: #e0353b; } .dot.warn { background: #e8a33d; }
.stamp { text-align: center; font-size: 12px; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 10px; }
.stamp button { color: var(--accent); font-size: 12px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .banner.ok { background: #0f2a1d; border-color: #1d4a33; color: #b7e4c7; }
  :root:not([data-theme="light"]) .banner.bad { background: #2c1214; border-color: #5c2226; color: #fecaca; }
  :root:not([data-theme="light"]) .stack .b, :root:not([data-theme="light"]) .legend .b { background: #4b5bb0; }
  :root:not([data-theme="light"]) .stack .c, :root:not([data-theme="light"]) .legend .c { background: #2c3570; }
}

.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ───── add-to-home-screen guide (iPhone) ───── */
.guide { position: fixed; inset: 0; z-index: 50; background: rgba(10,12,20,.55); display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
.guide-card { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 22px 20px 18px; max-width: 420px; width: 100%; text-align: center; }
.guide-card img { border-radius: 16px; border: 1px solid var(--rule); }
.guide-card h2 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 26px; margin: 10px 0 12px; }
.guide-card ol { list-style: none; padding: 0; margin: 0 0 12px; text-align: left; }
.guide-card li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.4; }
.guide-card li:last-child { border-bottom: 0; }
.guide-card li svg { vertical-align: -4px; color: var(--accent); }
.guide-card .step { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 13px; display: grid; place-items: center; font-weight: 600; }
.guide-card .warn { background: #fff4e5; color: #8a4b00; border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.guide-card .small { font-size: 12.5px; margin: 0 0 14px; }
.guide-card button.primary { width: 100%; padding: 12px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-size: 16px; }
.guide-arrow { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: #fff; font-size: 34px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }
