:root {
  --bg: #04050b;
  --ink: #eef0ff;
  --muted: #9aa0c3;
  --dim: #6b7099;
  --line: rgba(255, 255, 255, 0.09);
  --glass: rgba(13, 15, 32, 0.52);
  --glass-2: rgba(20, 22, 46, 0.72);
  --violet: #a78bfa;
  --cyan: #22d3ee;
  --amber: #fbbf24;
  --green: #34d399;
  --pink: #f472b6;
  --red: #fb7185;
  --grad: linear-gradient(120deg, #a78bfa, #22d3ee);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabs-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; display: block; touch-action: none; }
#veil { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(120% 80% at 50% 110%, rgba(4,5,11,0.92) 30%, rgba(4,5,11,0) 70%); opacity: 0.9; transition: opacity .8s; }
body.v-notes #veil, body.v-settings #veil, body.v-lab #veil { opacity: 1; background: linear-gradient(to bottom, rgba(4,5,11,0) 0, rgba(4,5,11,0.55) 26%, rgba(4,5,11,0.86) 60%); }

.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); border: 1px solid var(--line); }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }

/* ---------- boot */
#boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: radial-gradient(circle at 50% 45%, #0b0d22 0, #04050b 70%); transition: opacity 1s ease, visibility 1s; }
#boot.gone { opacity: 0; visibility: hidden; }
.boot-inner { width: min(320px, 82vw); text-align: center; }
.boot-logo { position: relative; width: 92px; height: 92px; margin: 0 auto 22px; }
.boot-logo.small { width: 64px; height: 64px; margin-bottom: 10px; }
.boot-logo i { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid transparent; border-top-color: var(--violet); border-right-color: rgba(34,211,238,.6); animation: spin 2.4s linear infinite; }
.boot-logo i:nth-child(2) { inset: 12%; animation-duration: 1.7s; animation-direction: reverse; border-top-color: var(--cyan); border-right-color: transparent; border-left-color: rgba(167,139,250,.6); }
.boot-logo i:nth-child(3) { inset: 26%; animation-duration: 3.1s; border-top-color: var(--pink); }
.boot-logo b { position: absolute; inset: 38%; border-radius: 50%; background: radial-gradient(circle, #fff 0, #c4b5fd 30%, rgba(124,58,237,0) 72%); box-shadow: 0 0 30px 8px rgba(139,92,246,.55); animation: breathe 2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.25); opacity: .8; } }
.boot-title { margin: 0; font-size: 34px; font-weight: 300; letter-spacing: .55em; text-indent: .55em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(139,92,246,.45)); }
.boot-sub { margin: 4px 0 26px; color: var(--dim); letter-spacing: .3em; text-transform: uppercase; font-size: 11px; }
.boot-bar { height: 2px; background: rgba(255,255,255,.07); border-radius: 2px; overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--grad); box-shadow: 0 0 12px var(--cyan); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.boot-pct { margin-top: 10px; font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted); letter-spacing: .1em; }
.boot-steps { list-style: none; padding: 0; margin: 18px 0 0; text-align: left; font: 12px/1.9 ui-monospace, "SF Mono", Menlo, monospace; color: var(--dim); min-height: 120px; }
.boot-steps li { opacity: 0; transform: translateY(6px); animation: rise .35s forwards; display: flex; gap: 8px; }
.boot-steps li::before { content: '◌'; color: var(--cyan); }
.boot-steps li.ok { color: var(--muted); }
.boot-steps li.ok::before { content: '✓'; color: var(--green); }
.boot-steps li.bad::before { content: '!'; color: var(--red); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- login */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 40; }
.login-card { width: min(360px, 100%); padding: 30px 24px 22px; border-radius: 26px; text-align: center; animation: pop .7s cubic-bezier(.2,.9,.2,1); }
.login-card h1 { margin: 4px 0 2px; font-weight: 300; letter-spacing: .5em; text-indent: .5em; font-size: 24px; }
.login-card input { width: 100%; margin: 18px 0 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.05); font-size: 17px; outline: none; }
.login-card input:focus { border-color: rgba(167,139,250,.6); box-shadow: 0 0 0 4px rgba(167,139,250,.15); }
@keyframes pop { from { opacity: 0; transform: translateY(30px) scale(.96); filter: blur(8px); } }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 14px; font-weight: 600; font-size: 15px; transition: transform .15s, background .2s, opacity .2s; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--grad); color: #0a0a18; box-shadow: 0 8px 30px -8px rgba(124,58,237,.7), inset 0 1px 0 rgba(255,255,255,.4); }
.btn.big { width: 100%; padding: 14px 18px; font-size: 16px; border-radius: 16px; }
.btn.ghost { background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.btn.danger { background: rgba(251,113,133,.12); color: #fda4af; border: 1px solid rgba(251,113,133,.25); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); }
.icon-btn:active { background: rgba(255,255,255,.08); }

/* ---------- app frame */
#app { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#app > .tabs { pointer-events: auto; }
.top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 10px) 16px 8px; z-index: 3; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: .5em; font-weight: 500; color: #d9dcff; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 12px var(--violet); }
.pill { display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: #cfd3ff; background: rgba(13,15,32,.55); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); position: relative; }
.pill.ok .pulse-dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.pill.busy .pulse-dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.pill.busy .pulse-dot::after, .pill.warn .pulse-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid currentColor; animation: ping 1.4s infinite; color: var(--amber); }
.pill.warn { color: #fde68a; }
.pill.warn .pulse-dot { background: var(--pink); box-shadow: 0 0 10px var(--pink); }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }

.view { position: absolute; inset: 0; padding: calc(var(--safe-t) + 58px) 16px calc(var(--tabs-h) + var(--safe-b) + 20px); display: flex; flex-direction: column; opacity: 0; transform: translateY(24px) scale(.985); filter: blur(6px); transition: opacity .45s ease, transform .55s cubic-bezier(.2,.9,.2,1), filter .45s; pointer-events: none; overflow: hidden; }
.view.active { opacity: 1; transform: none; filter: none; pointer-events: auto; }
#v-talk.active { pointer-events: none; }
#v-talk.active > * { pointer-events: auto; }
#v-talk.active > .talk-hero { pointer-events: none; }
#v-notes, #v-lab, #v-settings { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.view-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.view-head h2 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.count { color: var(--dim); font-weight: 500; font-size: 16px; margin-left: 6px; }
h3.sub { margin: 26px 2px 10px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 600; }

/* ---------- tabs */
.tabs { position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 10px); height: var(--tabs-h); border-radius: 22px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px; z-index: 5; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8); }
.tabs button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 16px; color: var(--dim); font-size: 11px; font-weight: 600; transition: color .25s, background .25s; }
.tabs button.on { color: #fff; background: rgba(255,255,255,.07); }
.tabs button.on svg { filter: drop-shadow(0 0 8px rgba(167,139,250,.9)); stroke: url(#none); color: #c4b5fd; }
.badge { position: absolute; top: 6px; right: calc(50% - 20px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--amber); color: #1a1200; font: 700 10.5px/17px system-ui; font-style: normal; box-shadow: 0 0 12px rgba(251,191,36,.7); }

/* ---------- talk */
.talk-hero { flex: 0 0 auto; min-height: 29vh; display: flex; align-items: flex-end; justify-content: center; }
.hero-line { flex: none; margin: 0 auto 6px; text-align: center; color: #d5d8f5; font-size: 16px; max-width: 320px; text-shadow: 0 2px 20px #000; animation: msgIn .8s .3s backwards; }
.hero-line span { display: block; margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.log { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px 2px 8px; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 40px); mask-image: linear-gradient(to bottom, transparent 0, #000 40px); overscroll-behavior: contain; scroll-behavior: smooth; }
.log::before { content: ''; flex: 1 1 auto; }
.msg { flex: none; max-width: 86%; padding: 11px 14px; border-radius: 20px; font-size: 15.5px; line-height: 1.45; animation: msgIn .45s cubic-bezier(.2,.9,.2,1); white-space: pre-wrap; word-wrap: break-word; }
@keyframes msgIn { from { opacity: 0; transform: translateY(14px) scale(.97); filter: blur(4px); } }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, rgba(139,92,246,.5), rgba(34,211,238,.28)); border: 1px solid rgba(196,181,253,.25); border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--glass-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.msg.ai.auto { border-color: rgba(251,191,36,.25); background: linear-gradient(135deg, rgba(251,191,36,.12), rgba(20,22,46,.75)); }
.msg.err { border-color: rgba(251,113,133,.35); }
.msg .via { display: block; font-size: 11px; color: rgba(255,255,255,.55); margin-top: 3px; text-align: right; }
.caret { display: inline-block; width: 7px; height: 1.05em; vertical-align: -2px; margin-left: 2px; background: var(--cyan); border-radius: 2px; animation: blink .9s steps(2) infinite; box-shadow: 0 0 8px var(--cyan); }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; gap: 5px; padding: 4px 2px; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); animation: dots 1.2s infinite ease-in-out; box-shadow: 0 0 8px var(--cyan); }
.thinking i:nth-child(2) { animation-delay: .15s; background: var(--violet); } .thinking i:nth-child(3) { animation-delay: .3s; background: var(--pink); }
@keyframes dots { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.msg-notes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; white-space: normal; }
.note-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: rgba(255,255,255,.07); border: 1px solid var(--line); max-width: 100%; white-space: nowrap; }
.note-chip .t { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.note-chip .k { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.note-chip.live { border-color: rgba(251,191,36,.4); }
.note-chip.live::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); animation: blink 1s infinite; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 8px 13px; border-radius: 999px; font-size: 13px; color: #d4d7ff; background: rgba(13,15,32,.6); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.composer { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 7px 7px 7px 14px; border-radius: 26px; box-shadow: 0 18px 50px -22px rgba(0,0,0,.9); }
.composer textarea { flex: 1; min-height: 44px; max-height: 140px; padding: 11px 0; border: 0; outline: none; background: none; resize: none; font-size: 16px; line-height: 1.4; }
.composer textarea::placeholder { color: var(--dim); }
.icon-btn.send { width: 44px; height: 44px; color: #c4b5fd; transition: opacity .2s, transform .2s; }
.icon-btn.send svg { fill: currentColor; stroke: none; }
.composer:not(.has-text) .send { display: none; }
.mic { position: relative; flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #0b0b1a; background: var(--grad); box-shadow: 0 0 0 0 rgba(167,139,250,.6), 0 10px 30px -6px rgba(124,58,237,.8); animation: micGlow 3s ease-in-out infinite; }
.mic svg { width: 24px; height: 24px; stroke-width: 2; }
.mic-ring { position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid rgba(196,181,253,.5); animation: ping 2.6s infinite; }
@keyframes micGlow { 50% { box-shadow: 0 0 0 6px rgba(167,139,250,.08), 0 10px 40px -4px rgba(34,211,238,.8); } }
.composer.has-text .mic { width: 44px; height: 44px; }

/* ---------- listening */
.listen { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 20px 20px calc(var(--safe-b) + 30px); background: linear-gradient(to bottom, rgba(4,5,11,0) 0, rgba(4,5,11,.25) 22%, rgba(4,5,11,.9) 46%, rgba(4,5,11,.97) 100%); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fadeIn .35s; }
@keyframes fadeIn { from { opacity: 0; } }
.listen-state { margin: 0; font-size: 13px; letter-spacing: .25em; text-transform: uppercase; color: #f9a8d4; text-shadow: 0 0 20px rgba(244,114,182,.8); }
.listen-text { margin: 12px 0 8px; min-height: 3em; max-height: 34vh; overflow-y: auto; font-size: 22px; line-height: 1.35; text-align: center; font-weight: 500; max-width: 560px; }
.listen-text .interim { color: var(--muted); }
#wave { width: min(560px, 100%); height: 60px; }
.listen-time { margin: 4px 0 18px; font: 600 13px ui-monospace, Menlo, monospace; color: var(--muted); }
.listen-actions { display: flex; gap: 10px; width: min(420px, 100%); }
.listen-actions .btn.ghost { flex: 0 0 34%; }

/* ---------- notes list */
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 16px; margin-bottom: 10px; flex: none; }
.search svg { color: var(--dim); width: 19px; }
.search input { flex: 1; padding: 12px 0; border: 0; outline: none; background: none; font-size: 16px; }
.filters { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; flex: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.filters button.on { color: #0b0b1a; background: #e9e5ff; border-color: transparent; }
.note-list { display: flex; flex-direction: column; gap: 10px; }
.card { position: relative; display: block; width: 100%; text-align: left; padding: 14px 15px 13px 18px; border-radius: 20px; background: var(--glass-2); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); overflow: hidden; animation: cardIn .5s cubic-bezier(.2,.9,.2,1) backwards; transition: transform .15s; }
.card:active { transform: scale(.985); }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px); } }
.card::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--k, var(--violet)); box-shadow: 0 0 14px var(--k, var(--violet)); }
.card.done { opacity: .55; }
.card h4 { margin: 0 0 4px; font-size: 16px; font-weight: 650; line-height: 1.3; display: flex; gap: 8px; align-items: flex-start; }
.card h4 .pin { color: var(--amber); font-size: 12px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 9px; font-size: 12px; color: var(--dim); }
.tag { padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--muted); font-size: 11.5px; }
.st { font-weight: 650; display: inline-flex; align-items: center; gap: 5px; }
.st.ready { color: var(--green); } .st.live { color: var(--amber); } .st.fail { color: var(--red); } .st.rem { color: #fde68a; }
.livebar { position: relative; height: 3px; margin-top: 10px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.livebar span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--amber), var(--cyan), var(--violet)); background-size: 200% 100%; animation: flow 2s linear infinite; border-radius: 3px; transition: width 1s; box-shadow: 0 0 10px var(--amber); }
@keyframes flow { to { background-position: -200% 0; } }
.liveline { margin-top: 7px; font: 12px/1.4 ui-monospace, Menlo, monospace; color: #fcd34d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty b { display: block; font-size: 18px; color: var(--ink); margin-bottom: 6px; font-weight: 600; }
.note-list.compact .card { padding: 11px 13px 11px 16px; }
.note-list.compact .card p { -webkit-line-clamp: 2; }

/* ---------- lab */
.lab-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { padding: 12px 8px; border-radius: 16px; text-align: center; background: var(--glass-2); border: 1px solid var(--line); }
.stat b { display: block; font: 700 22px/1.1 ui-monospace, "SF Mono", Menlo, monospace; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.lab-list { display: flex; flex-direction: column; gap: 12px; }
.lab-card { display: block; width: 100%; text-align: left; padding: 16px; border-radius: 22px; background: linear-gradient(160deg, rgba(251,191,36,.08), rgba(20,22,46,.8) 40%); border: 1px solid rgba(251,191,36,.2); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); animation: cardIn .5s backwards; }
.lab-card h4 { margin: 0; font-size: 16.5px; }
.phase { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; font-weight: 650; font-size: 14px; color: #fde68a; }
.orbiter { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(251,191,36,.25); border-top-color: var(--amber); animation: spin .9s linear infinite; flex: none; }
.timer { margin-left: auto; font: 600 12.5px ui-monospace, Menlo, monospace; color: var(--muted); }
.mini-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 6px 0 8px; }
.mini-stats b { color: var(--ink); font-family: ui-monospace, Menlo, monospace; }
.feed { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font: 12.5px/1.45 ui-monospace, "SF Mono", Menlo, monospace; }
.feed li { display: flex; gap: 8px; align-items: baseline; color: #c7cbee; animation: stepIn .45s cubic-bezier(.2,.9,.2,1); }
.feed li .ic { flex: none; width: 18px; text-align: center; }
.feed li .tx { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.feed li.helper { padding-left: 14px; color: #a9add6; }
.feed li.k-search .tx b { color: #5eead4; } .feed li.k-read .tx b { color: #fcd34d; } .feed li.k-agent .tx b { color: #c4b5fd; } .feed li.k-thought .tx { color: #f5d0fe; font-style: italic; } .feed li.k-error .tx { color: #fda4af; }
@keyframes stepIn { from { opacity: 0; transform: translateX(-12px); filter: blur(3px); background: rgba(251,191,36,.15); } }

/* ---------- sheet */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: 13vh; z-index: 20; display: flex; flex-direction: column; border-radius: 28px 28px 0 0; background: rgba(9,10,24,.86); backdrop-filter: blur(26px) saturate(150%); -webkit-backdrop-filter: blur(26px) saturate(150%); border-top: 1px solid rgba(255,255,255,.12); box-shadow: 0 -30px 80px -20px rgba(124,58,237,.35); transform: translateY(105%); transition: transform .6s cubic-bezier(.2,.9,.15,1); }
.sheet.open { transform: none; }
.sheet::before { content: ''; position: absolute; top: -1px; left: 12%; right: 12%; height: 1px; background: linear-gradient(90deg, transparent, var(--k, var(--violet)), transparent); box-shadow: 0 0 20px var(--k, var(--violet)); }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.18); margin: 9px auto 0; flex: none; }
.sheet-top { display: flex; align-items: center; gap: 4px; padding: 4px 8px 0; flex: none; }
.grow { flex: 1; }
.kind-chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--k); background: color-mix(in srgb, var(--k) 14%, transparent); border: 1px solid color-mix(in srgb, var(--k) 35%, transparent); text-transform: uppercase; }
.sheet-body { flex: 1; overflow-y: auto; padding: 6px 20px calc(var(--safe-b) + 40px); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-body h1.nt { margin: 6px 0 8px; font-size: 25px; line-height: 1.2; font-weight: 750; letter-spacing: -.02em; }
.said { margin: 0 0 14px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: #d5d8f5; white-space: pre-wrap; font-size: 15px; }
.said small { display: block; color: var(--dim); font-size: 11.5px; margin-bottom: 4px; letter-spacing: .1em; text-transform: uppercase; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.sec-title { margin: 24px 0 10px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.sec-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.research-cta { padding: 18px; border-radius: 20px; background: linear-gradient(140deg, rgba(139,92,246,.2), rgba(34,211,238,.08)); border: 1px solid rgba(167,139,250,.25); }
.research-cta p { margin: 0 0 12px; color: #d5d8f5; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); margin-bottom: 12px; }
.seg button { padding: 8px 6px; border-radius: 10px; font-size: 13px; font-weight: 650; color: var(--muted); line-height: 1.2; }
.seg button small { display: block; font-weight: 500; font-size: 11px; color: var(--dim); }
.seg button.on { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.livebox { padding: 16px; border-radius: 22px; background: linear-gradient(160deg, rgba(251,191,36,.09), rgba(14,16,34,.9) 45%); border: 1px solid rgba(251,191,36,.22); }
.ring-prog { --p: 0; width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--amber) calc(var(--p) * 1%), rgba(255,255,255,.07) 0); position: relative; transition: --p 1s; }
.ring-prog::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #0c0d1f; }
.ring-prog b { position: relative; font: 700 14px ui-monospace, Menlo, monospace; }
.live-head { display: flex; gap: 14px; align-items: center; }
.live-head .ph { font-weight: 700; font-size: 16px; color: #fde68a; }
.live-head .sub2 { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 6px; }
.counters div { text-align: center; padding: 8px 2px; border-radius: 12px; background: rgba(255,255,255,.04); }
.counters b { display: block; font: 700 19px/1.15 ui-monospace, Menlo, monospace; color: #fff; }
.counters span { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.preview { margin-top: 14px; padding: 14px; border-radius: 16px; background: rgba(0,0,0,.25); border: 1px dashed rgba(255,255,255,.12); max-height: 46vh; overflow-y: auto; }
.preview .label { font-size: 11px; letter-spacing: .14em; color: var(--cyan); text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }

/* report typography */
.report { font-size: 15.5px; line-height: 1.62; color: #e3e5fb; }
.report h1 { font-size: 22px; line-height: 1.25; margin: 4px 0 10px; letter-spacing: -.01em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.report h2 { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #c4b5fd; margin: 26px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.report h2[data-sec="in-short"] { border: 0; padding: 0; margin-top: 12px; color: var(--cyan); }
.report h3 { font-size: 16.5px; margin: 18px 0 6px; }
.report h4 { font-size: 15px; margin: 14px 0 4px; }
.report p { margin: 0 0 11px; }
.report h2[data-sec="in-short"] + p, .report h2[data-sec="in-short"] + p + p { font-size: 16.5px; color: #fff; padding: 12px 14px; margin: 0 0 6px; border-radius: 14px; background: linear-gradient(135deg, rgba(34,211,238,.1), rgba(139,92,246,.1)); border: 1px solid rgba(34,211,238,.18); }
.report ul, .report ol { margin: 0 0 12px; padding-left: 22px; }
.report li { margin: 4px 0; }
.report a { color: #7dd3fc; text-decoration: none; border-bottom: 1px solid rgba(125,211,252,.3); }
.report a.cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px; border-radius: 6px; font: 700 10.5px/1 ui-monospace, Menlo, monospace; vertical-align: 2px; background: rgba(125,211,252,.14); border: 0; }
.report code { font: 13px ui-monospace, Menlo, monospace; padding: 1px 5px; border-radius: 5px; background: rgba(255,255,255,.08); }
.report pre { padding: 12px; border-radius: 12px; background: rgba(0,0,0,.3); overflow-x: auto; }
.report blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--violet); color: #cfd2f2; background: rgba(167,139,250,.06); border-radius: 0 10px 10px 0; }
.report .table { overflow-x: auto; margin: 0 -4px 14px; border-radius: 14px; border: 1px solid var(--line); }
.report table { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 420px; }
.report th, .report td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.report th { background: rgba(255,255,255,.05); font-size: 12px; letter-spacing: .04em; color: #c7cbee; }
.report ol.sources, .report ul.sources { list-style: none; padding: 0; font-size: 13px; }
.report ol.sources li { padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.03); margin: 5px 0; word-break: break-word; }
.report ol.sources li:target { outline: 1px solid var(--cyan); background: rgba(34,211,238,.08); }
.report ol.sources .n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 4px; border-radius: 6px; background: rgba(125,211,252,.15); color: #7dd3fc; font: 700 11px ui-monospace, Menlo, monospace; }
.report-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.report-meta span { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid var(--line); }
.followup-head { margin: 34px 0 6px; padding: 10px 14px; border-radius: 14px; background: rgba(167,139,250,.1); border: 1px solid rgba(167,139,250,.25); font-weight: 650; color: #ddd6fe; }
.trail summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 10px 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.actions .btn { width: 100%; }
.ask { display: flex; gap: 8px; margin-top: 10px; }
.ask input { flex: 1; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.05); outline: none; font-size: 16px; min-width: 0; }
.edit-area { width: 100%; min-height: 140px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.05); outline: none; font-size: 16px; resize: vertical; }
.edit-title { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.05); outline: none; font-size: 20px; font-weight: 700; margin: 6px 0 8px; }
input[type="datetime-local"] { padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color-scheme: dark; font-size: 16px; }

/* ---------- settings */
.set-card { padding: 16px; border-radius: 20px; background: var(--glass-2); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); margin-bottom: 12px; animation: cardIn .5s backwards; }
.set-card h3 { margin: 0 0 4px; font-size: 16px; }
.set-card p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row .l { font-size: 14.5px; }
.set-row .l small { display: block; color: var(--dim); font-size: 12px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; border-radius: 999px; background: rgba(255,255,255,.12); transition: background .25s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .25s cubic-bezier(.2,.9,.2,1); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.switch.on { background: linear-gradient(120deg, #8b5cf6, #22d3ee); }
.switch.on::after { transform: translateX(20px); }
.conn { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.conn .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px var(--red); flex: none; }
.conn.ok .dot { background: var(--green); box-shadow: 0 0 12px var(--green); }
.steps-ol { margin: 0 0 12px; padding-left: 20px; color: #d5d8f5; font-size: 14px; }
.steps-ol li { margin: 6px 0; }
.code-in { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.05); outline: none; font: 15px ui-monospace, Menlo, monospace; margin-bottom: 10px; }
.foot { text-align: center; color: var(--dim); font-size: 11.5px; padding: 10px 0 20px; }

/* ---------- menu, toast */
.menu { position: fixed; z-index: 40; min-width: 200px; padding: 6px; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.6); background: rgba(16,18,38,.95); animation: pop .3s cubic-bezier(.2,.9,.2,1); }
.menu button { display: block; width: 100%; text-align: left; padding: 11px 14px; border-radius: 11px; font-size: 15px; }
.menu button:active { background: rgba(255,255,255,.08); }
.menu button.red { color: #fda4af; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 28px); transform: translate(-50%, 20px); z-index: 60; padding: 11px 16px; border-radius: 14px; background: rgba(20,22,46,.95); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.5); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .3s, transform .4s cubic-bezier(.2,.9,.2,1); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  .view { padding-left: calc(50vw - 340px); padding-right: calc(50vw - 340px); }
  .tabs { left: calc(50vw - 230px); right: calc(50vw - 230px); }
  .sheet { left: calc(50vw - 380px); right: calc(50vw - 380px); top: 6vh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
