/* ===== galaxy background, custom cursor, scroll river, assistant ===== */
#galaxy { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
main { position: relative; }
main > section { position: relative; z-index: 1; }



/* assistant */
.as-fab { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px 12px 14px; border: 0; border-radius: 999px; background: var(--ink); color: var(--bg); font: 600 .92rem/1 "Inter", system-ui, sans-serif; cursor: pointer; box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); transition: transform .25s; }
.as-fab:hover { transform: translateY(-2px); }
.as-fab .spark { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--accent) 55%, var(--accent-2)); box-shadow: 0 0 14px var(--accent); animation: asPulse 2.4s ease-in-out infinite; }
@keyframes asPulse { 50% { transform: scale(1.18); } }
.as-win { position: fixed; right: 20px; bottom: 84px; z-index: 61; width: min(392px, calc(100vw - 28px)); height: min(560px, calc(100vh - 120px)); display: grid; grid-template-rows: auto 1fr auto auto; padding: 0; border-radius: 22px; overflow: hidden; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .45); transform-origin: bottom right; animation: asIn .35s cubic-bezier(.22, 1, .36, 1); }
.as-win[hidden] { display: none; }
@keyframes asIn { from { opacity: 0; transform: translateY(18px) scale(.94); } }
.as-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.as-head .spark { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, rgba(255, 255, 255, .35) 60%); flex: none; }
.as-head b { display: block; font-size: 1rem; }
.as-head small { opacity: .85; font-size: .78rem; }
.as-x { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .2); color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.as-body { padding: 16px; overflow-y: auto; display: grid; gap: 10px; align-content: start; scroll-behavior: smooth; }
.as-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: .92rem; line-height: 1.5; animation: asMsg .3s ease both; }
@keyframes asMsg { from { opacity: 0; transform: translateY(8px); } }
.as-msg.bot { background: var(--accent-soft); color: var(--ink); border-bottom-left-radius: 5px; justify-self: start; }
.as-msg.me { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; justify-self: end; }
.as-msg a { color: inherit; font-weight: 600; text-decoration: underline; }
.as-msg.bot ul { margin: 6px 0 0; padding-left: 18px; }
.as-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.as-links a { text-decoration: none; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .82rem; }
.as-typing i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: asDot 1s infinite; }
.as-typing i:nth-child(2) { animation-delay: .15s; } .as-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes asDot { 50% { transform: translateY(-4px); opacity: .4; } }
.as-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.as-chips[hidden] { display: none; }
.as-chips button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 13px; border-radius: 999px; font: 500 .82rem "Inter", system-ui, sans-serif; cursor: pointer; transition: background .2s, border-color .2s; }
.as-chips button:hover { background: var(--accent-soft); border-color: var(--accent); }
.as-form { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.as-form input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 11px 16px; font: inherit; font-size: .92rem; }
.as-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.as-form button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; }
.as-form svg { width: 18px; height: 18px; }
.as-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { .as-fab .spark, .river-svg .rv-ring { animation: none; } }

/* ===== full-screen talking assistant ===== */
html.as-lock { overflow: hidden; }
.as-page { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-rows: auto 1fr; color: #1f1740; background: radial-gradient(120% 90% at 20% 0%, #fff 0, #f6edff 45%, #efe4ff 100%); animation: asPageIn .45s cubic-bezier(.22, 1, .36, 1); overflow: hidden; }
.as-page[hidden] { display: none; }
@keyframes asPageIn { from { opacity: 0; transform: scale(1.03); } }
:root[data-theme="dark"] .as-page { color: #f1ebff; background: radial-gradient(120% 90% at 20% 0%, #2a1f55 0, #181033 55%, #0e0a22 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .as-page { color: #f1ebff; background: radial-gradient(120% 90% at 20% 0%, #2a1f55 0, #181033 55%, #0e0a22 100%); } }
.as-tools { display: flex; justify-content: flex-end; gap: 12px; padding: 22px 28px 0; position: relative; z-index: 3; }
.as-ic { width: 52px; height: 52px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85); color: #7c3aed; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 20px -8px rgba(124, 58, 237, .5); transition: transform .2s; }
.as-ic:hover { transform: scale(1.07); }
.as-ic svg { width: 22px; height: 22px; }
.as-close { color: #ef4444; }
.as-stage { display: grid; grid-template-columns: minmax(320px, 760px) 1fr; align-items: center; gap: 24px; padding: 0 clamp(18px, 4vw, 64px) 40px; min-height: 0; }
.as-chat { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 14px; height: min(78vh, 760px); min-height: 0; align-self: end; position: relative; z-index: 2; }
.as-page .as-body { padding: 0 4px; overflow-y: auto; display: grid; gap: 14px; align-content: end; scrollbar-width: none; mask-image: linear-gradient(to bottom, transparent, #000 14%); }
.as-page .as-body::-webkit-scrollbar { display: none; }
.as-page .as-msg { max-width: 92%; padding: 14px 20px; border-radius: 20px; font-size: 1.05rem; line-height: 1.5; }
.as-page .as-msg.bot { background: rgba(255, 255, 255, .78); color: #1f1740; border-bottom-left-radius: 8px; box-shadow: 0 10px 30px -18px rgba(124, 58, 237, .5); backdrop-filter: blur(10px); }
.as-page .as-msg.me { background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: #fff; border-bottom-right-radius: 8px; justify-self: end; }
:root[data-theme="dark"] .as-page .as-msg.bot { background: rgba(255, 255, 255, .1); color: #f1ebff; }
.as-page .as-links a { background: rgba(255, 255, 255, .9); color: #6d28d9; border-color: rgba(124, 58, 237, .25); }
.as-page .as-chips { padding: 0; }
.as-page .as-chips button { background: rgba(255, 255, 255, .8); border-color: rgba(124, 58, 237, .22); color: #4c1d95; }
.as-page .as-chips button:hover { background: #fff; border-color: #8b5cf6; }
.as-page .as-form { position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 0; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px rgba(139, 92, 246, .12), 0 18px 50px -12px rgba(139, 92, 246, .55); }
.as-page .as-form input { border: 0; background: transparent; color: #1f1740; padding: 12px 6px; font-size: 1.05rem; border-radius: 0; }
.as-page .as-form input:focus { outline: none; }
.as-mic, .as-send { width: 46px; height: 46px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .2s, background .2s; }
.as-mic { background: transparent; color: #1f1740; }
.as-mic:hover { background: rgba(139, 92, 246, .12); }
.as-mic[hidden] { display: none; }
.as-mic.on { background: #ef4444; color: #fff; animation: asRec 1.1s ease-in-out infinite; }
@keyframes asRec { 50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, .18); } }
.as-mic svg, .as-send svg { width: 20px; height: 20px; }
.as-send { background: #8b5cf6; color: #fff; }
.as-stop { display: none; width: 46px; height: 46px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; place-items: center; }
.as-stop i { width: 16px; height: 16px; background: #ef4444; border-radius: 3px; display: block; }
.as-page .as-form .as-stop { display: none; background: transparent; }
.as-page.is-speaking .as-form .as-send { display: none; }
.as-page.is-speaking .as-form .as-stop { display: grid; }
.as-page .as-form .as-mic { background: transparent; color: #1f1740; }
.as-page .as-form .as-mic.on { background: #ef4444; color: #fff; }
:root[data-theme="dark"] .as-page .as-form { background: #fff; }

/* orb */
.as-orbwrap { position: relative; display: grid; place-items: center; align-self: center; justify-self: center; width: min(46vw, 78vh); }
.as-orb { --amp: 1; position: relative; width: 100%; aspect-ratio: 1; transform: scale(var(--amp)); transition: transform .14s ease-out; }
.as-orb span { position: absolute; border-radius: 50%; }
.as-orb .halo { inset: -4%; background: conic-gradient(from 0deg, #bfe3ff, #e9d5ff, #f0abfc, #c4b5fd, #a5d8ff, #bfe3ff); filter: blur(26px); opacity: .8; animation: orbSpin 16s linear infinite; }
.as-orb .core { inset: 14%; overflow: hidden; background: radial-gradient(circle at 32% 28%, #fff 0, #fbcfe8 24%, #e879f9 58%, #a78bfa 92%); box-shadow: inset 0 0 70px rgba(255, 255, 255, .9), inset -34px -46px 90px rgba(147, 51, 234, .45); }
.as-orb .core b { position: absolute; border-radius: 50%; filter: blur(22px); opacity: .85; }
.as-orb .b1 { width: 70%; height: 70%; left: -10%; top: 18%; background: #c084fc; animation: orbFloat1 9s ease-in-out infinite; }
.as-orb .b2 { width: 62%; height: 62%; right: -12%; top: -8%; background: #f9a8d4; animation: orbFloat2 11s ease-in-out infinite; }
.as-orb .b3 { width: 55%; height: 55%; left: 22%; bottom: -14%; background: #93c5fd; animation: orbFloat1 13s ease-in-out infinite reverse; }
.as-orb .glass { inset: 10%; border: clamp(8px, 1.6vw, 18px) solid rgba(255, 255, 255, .6); filter: blur(1.2px); box-shadow: 0 0 60px rgba(255, 255, 255, .5); }
@keyframes orbSpin { to { transform: rotate(360deg); } }
@keyframes orbFloat1 { 50% { transform: translate(24%, -18%) scale(1.15); } }
@keyframes orbFloat2 { 50% { transform: translate(-22%, 24%) scale(.9); } }
.as-orb.talking .halo { animation-duration: 6s; opacity: 1; }
.as-orb.talking .core b { animation-duration: 3.6s; }
.as-orb.listening { animation: orbListen 1.4s ease-in-out infinite; }
.as-orb.listening .halo { animation-duration: 5s; opacity: 1; filter: blur(18px); }
.as-orb.thinking .halo { animation-duration: 4s; }
@keyframes orbListen { 50% { transform: scale(1.04); } }
.as-state { position: absolute; bottom: -2%; margin: 0; font-size: .9rem; letter-spacing: .08em; color: #7c3aed; font-weight: 600; min-height: 1.2em; }
@media (max-width: 860px) {
  .as-stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; padding-bottom: 18px; }
  .as-orbwrap { width: min(60vw, 34vh); order: -1; }
  .as-chat { height: auto; max-height: 58vh; }
  .as-tools { padding: 14px 16px 0; }
  .as-ic { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .as-orb .halo, .as-orb .core b, .as-orb.listening { animation: none; } }

/* ===== assistant page: AI face panel, cyan theme ===== */
.as-page, :root[data-theme="dark"] .as-page, :root[data-theme="light"] .as-page { color: #e6faff; background: radial-gradient(120% 90% at 18% 0%, #0d4a73 0, #062640 48%, #030f1f 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .as-page { color: #e6faff; background: radial-gradient(120% 90% at 18% 0%, #0d4a73 0, #062640 48%, #030f1f 100%); } }
.as-ic { background: rgba(255, 255, 255, .1); color: #67e8f9; box-shadow: 0 0 0 1px rgba(103, 232, 249, .35), 0 8px 24px -8px rgba(34, 211, 238, .5); }
.as-close { color: #fca5a5; }
.as-page .as-msg.bot, :root[data-theme="dark"] .as-page .as-msg.bot { background: rgba(9, 40, 66, .72); color: #e6faff; border: 1px solid rgba(103, 232, 249, .22); box-shadow: 0 10px 30px -18px rgba(34, 211, 238, .6); }
.as-page .as-msg.me { background: linear-gradient(135deg, #0891b2, #2563eb); color: #fff; }
.as-page .as-links a { background: rgba(103, 232, 249, .12); color: #a5f3fc; border-color: rgba(103, 232, 249, .4); }
.as-page .as-chips button { background: rgba(9, 40, 66, .7); border-color: rgba(103, 232, 249, .35); color: #cffafe; }
.as-page .as-chips button:hover { background: rgba(34, 211, 238, .2); border-color: #22d3ee; }
.as-page .as-form, :root[data-theme="dark"] .as-page .as-form { background: rgba(7, 33, 56, .9); box-shadow: 0 0 0 1px rgba(103, 232, 249, .3), 0 18px 50px -12px rgba(34, 211, 238, .45); }
.as-page .as-form input { color: #e6faff; }
.as-page .as-form input::placeholder { color: #7fb3c7; }
.as-page .as-form .as-mic { color: #a5f3fc; }
.as-page .as-form .as-send { background: #0891b2; }
.as-page .as-state { color: #67e8f9; }
.as-page .as-body { mask-image: linear-gradient(to bottom, transparent, #000 14%); }

.as-orbwrap { width: min(40vw, 70vh); }
.as-orb { border-radius: 26px; overflow: hidden; aspect-ratio: 338 / 372; background: #031a2e; box-shadow: 0 0 0 1px rgba(103, 232, 249, .35), 0 0 60px -6px rgba(34, 211, 238, .55), 0 30px 80px -20px rgba(0, 0, 0, .7); animation: faceFloat 7s ease-in-out infinite; }
.as-orb .face { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(1.1) brightness(.95); transition: filter .3s; }
.as-orb .scan { position: absolute; left: 0; right: 0; height: 22%; top: -22%; border-radius: 0; background: linear-gradient(to bottom, transparent, rgba(103, 232, 249, .28), transparent); animation: faceScan 4.5s linear infinite; mix-blend-mode: screen; }
.as-orb .wave { position: absolute; left: 0; bottom: 14%; height: 20%; width: 26%; display: flex; align-items: center; gap: 3%; padding-left: 4%; border-radius: 0; }
.as-orb .wave i { flex: 1; max-width: 6px; height: 14%; border-radius: 3px; background: linear-gradient(#a5f3fc, #22d3ee); box-shadow: 0 0 8px #22d3ee; transform-origin: center; transition: height .2s; }
.as-orb.talking .wave i, .as-orb.listening .wave i { animation: faceBar .55s ease-in-out infinite; }
.as-orb .wave i:nth-child(2n) { animation-delay: .12s; } .as-orb .wave i:nth-child(3n) { animation-delay: .24s; } .as-orb .wave i:nth-child(5n) { animation-delay: .06s; }
.as-orb.talking .face { filter: saturate(1.35) brightness(1.15); }
.as-orb.thinking .scan { animation-duration: 1.6s; }
.as-orb.listening { box-shadow: 0 0 0 2px #22d3ee, 0 0 80px 4px rgba(34, 211, 238, .7); }
@keyframes faceFloat { 50% { translate: 0 -10px; } }
@keyframes faceScan { to { top: 110%; } }
@keyframes faceBar { 0%, 100% { height: 14%; } 50% { height: 90%; } }
@media (max-width: 860px) { .as-orbwrap { width: min(46vw, 30vh); } }
@media (prefers-reduced-motion: reduce) { .as-orb, .as-orb .scan, .as-orb .wave i { animation: none !important; } }

/* the face is drawn in code: grid of dots behind it, no picture */
.as-orb { background: radial-gradient(90% 80% at 50% 40%, #07406a 0, #04213a 60%, #021222 100%); }
.as-orb:before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(103, 232, 249, .35) 1px, transparent 1.4px); background-size: 14px 14px; mask-image: radial-gradient(circle at 20% 15%, #000, transparent 60%); opacity: .7; pointer-events: none; }
.as-orb canvas.face { width: 100%; height: 100%; display: block; filter: none; position: relative; }
.as-orb.talking canvas.face { filter: brightness(1.15); }

/* profile-of-dots portrait panel */
.as-orbwrap { width: min(44vw, 64vh); }
.as-orb { aspect-ratio: 4 / 5; border-radius: 24px; background: radial-gradient(110% 90% at 80% 35%, #0a3d8f 0, #04204f 45%, #020b22 100%); }
.as-orb:before { display: none; }
.as-orb .scan { display: none; }
.as-orb .wave { left: 3%; bottom: 8%; width: 18%; height: 14%; }
@media (max-width: 860px) { .as-orbwrap { width: min(50vw, 30vh); } }

.as-orb { background: #01081c; aspect-ratio: 1130 / 1392; }
.as-orb .wave { display: none; }

/* the portrait stays still; only the dots react to the pointer */
.as-orb, .as-orb.talking, .as-orb.listening, .as-orb.thinking { animation: none !important; transform: none !important; translate: none !important; }
.as-orb canvas.face { touch-action: none; }

/* the dot portrait fills the whole page: no card, no frame */
.as-page { background: radial-gradient(120% 100% at 70% 40%, #07194a 0, #020c2c 55%, #01061a 100%); }
:root[data-theme="dark"] .as-page, :root[data-theme="light"] .as-page { background: radial-gradient(120% 100% at 70% 40%, #07194a 0, #020c2c 55%, #01061a 100%); }
.as-orbwrap { position: fixed; inset: 0; width: auto; z-index: 0; place-items: stretch; }
.as-orb { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; background: none; overflow: visible; }
.as-orb canvas.face { width: 100%; height: 100%; }
.as-orb:before, .as-orb .scan, .as-orb .wave { display: none; }
.as-tools { position: relative; z-index: 4; }
.as-stage { position: relative; z-index: 2; pointer-events: none; }
.as-chat, .as-chat * { pointer-events: auto; }
.as-state { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; }
.as-chat .as-body { mask-image: linear-gradient(to bottom, transparent, #000 14%); }
@media (max-width: 860px) { .as-orbwrap { width: auto; } .as-chat { max-height: 52vh; background: linear-gradient(to top, rgba(1, 6, 26, .85), transparent); } }
.as-orbwrap { width: 100vw !important; height: 100vh; height: 100dvh; justify-self: stretch; align-self: stretch; left: 0; top: 0; }

/* logo in the navigation */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 1px 6px rgba(201, 149, 107, .35)); }
.brand span span { color: var(--accent); }
.as-head .spark { background: center / contain no-repeat url(favicon-64.png); box-shadow: none; }
.brand > span { color: var(--ink); }
.brand > span > span { color: var(--accent); }
.brand img { width: 42px; height: 42px; }
