:root {
  --bg: #07080b; --text: #f5f5f7; --text-2: #a1a1aa; --line: rgba(255,255,255,.14); --surface: rgba(255,255,255,.055); --surface-2: rgba(255,255,255,.1);
  --accent: #3f7cf0; --accent-2: #8ab4ff; --red: #ff6b61; --green: #32d74b; --ease: cubic-bezier(.2,.8,.2,1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Arabic", "Segoe UI", Roboto, "Noto Sans Arabic", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { height: 100dvh; display: flex; flex-direction: column; color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  background: radial-gradient(110% 70% at 50% 40%, #11141d 0%, var(--bg) 58%) fixed; }
h1 { font: 600 clamp(1.5rem, 5.5vw, 1.9rem)/1.35 var(--font); margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { min-height: 44px; padding: 8px 18px; border: 0; border-radius: 14px; background: var(--surface-2); font-weight: 500; cursor: pointer; transition: background .2s, transform .1s; -webkit-tap-highlight-color: transparent; }
button:hover { background: rgba(255,255,255,.15); } button:active { transform: scale(.98); } button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.primary { background: var(--accent); font-weight: 600; min-height: 50px; } .primary:hover { background: #5189f5; }
.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); } .ghost:hover { background: var(--surface); }
.quiet { background: transparent; color: var(--text-2); padding-inline: 12px; }
.fine { color: var(--text-2); font-size: .8125rem; }
.error { color: var(--red); font-size: .875rem; } .error:empty { display: none; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

header { flex: none; display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top) + 10px) 20px 6px; }
.brand { display: flex; align-items: center; gap: 10px; } .brand img { width: 36px; height: 36px; }
main { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; padding: 12px 20px; }
main > *, footer > * { width: 100%; max-width: 560px; margin-inline: auto; }
footer { flex: none; display: grid; gap: 12px; padding: 8px 16px calc(env(safe-area-inset-bottom) + 14px); }

/* The orb is drawn by orb.js (AK's own shader) on a canvas behind the page, wherever #orb is laid out. */
#holo { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
header, main, footer { position: relative; z-index: 1; }
body[data-view=chat] #holo, body[data-view=done] #holo { visibility: hidden; }
.stage { margin-block: auto; display: flex; flex-direction: column; align-items: center; gap: 36px; text-align: center; padding-block: 16px; }
.lines { display: grid; gap: 8px; } #status { color: var(--text-2); } #heard { color: var(--accent-2); } #heard:empty { display: none; }
#orb { width: clamp(150px, min(46vw, 28dvh), 272px); aspect-ratio: 1; min-height: 0; padding: 0; border-radius: 50%; background: none; flex: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#orb:active { transform: none; } #orb:focus-visible { outline: 2px solid rgba(255,255,255,.55); outline-offset: 14px; }
.no-webgl #orb { background: radial-gradient(circle at 35% 30%, #b9ccff 0%, #5a7bff 30%, #7b4fe0 62%, #1b1240 100%); box-shadow: 0 0 80px rgba(90,110,255,.45); }
.voice-actions { display: none; } body[data-view=voice] .voice-actions { display: block; }
body[data-view=voice] footer, body[data-view=done] footer { display: none; }
body[data-view=chat] .stage, body[data-view=done] .stage, body[data-view=home] #log, body[data-view=voice] #log, body[data-view=done] #log { display: none; }
body:not([data-view=home]) #chips, body:not([data-view=home]) .privacy { display: none; }

#chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
#chips button { font-size: .9375rem; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); border-radius: 22px; padding-inline: 16px; }
#composer { display: flex; align-items: flex-end; gap: 4px; padding: 5px; border-radius: 27px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
#composer:focus-within { box-shadow: inset 0 0 0 1px var(--accent-2); }
#text { flex: 1; min-width: 0; min-height: 44px; max-height: 148px; padding: 10px 6px; border: 0; outline: 0; background: none; resize: none; }
::placeholder { color: var(--text-2); opacity: 1; }
.icon { flex: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; }
.icon.go { background: var(--accent); }
.privacy { text-align: center; }

#log { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-block: 12px; }
.msg { max-width: 84%; padding: 10px 16px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; animation: rise .25s var(--ease); }
.bot { align-self: flex-start; background: var(--surface-2); border-end-start-radius: 6px; }
.me { align-self: flex-end; background: #2a56ad; border-end-end-radius: 6px; }
.msg img { display: block; max-width: 180px; max-height: 220px; border-radius: 10px; margin-block: 4px; }
.dots i { display: inline-block; width: 7px; height: 7px; margin-inline: 2px; border-radius: 50%; background: var(--text-2); animation: blink 1.1s infinite; } .dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .2; } } @keyframes rise { from { opacity: 0; transform: translateY(6px); } }

#card { display: grid; gap: 8px; padding: 20px; margin-block: 6px 12px; border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); animation: rise .3s var(--ease); }
#card label, #card .label { font-size: .875rem; color: var(--text-2); } #summary { margin-bottom: 8px; overflow-wrap: anywhere; }
#card input { min-height: 48px; width: 100%; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 4px; }
#card input:focus { outline: 2px solid var(--accent-2); } #card input[aria-invalid=true] { box-shadow: inset 0 0 0 1px var(--red); }
[dir=rtl] #email { text-align: right; }
#done { margin-block: auto; display: grid; justify-items: center; gap: 12px; text-align: center; outline: 0; animation: rise .35s var(--ease); } #done p { color: var(--text-2); }
#done svg { width: 84px; height: 84px; padding: 14px; border-radius: 50%; color: var(--green); background: rgba(50,215,75,.12); stroke-width: 3; }
#done .ref { margin-block: 4px 12px; } #ref { color: var(--text); font-weight: 600; letter-spacing: .04em; user-select: all; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; } }
footer { grid-template-columns: minmax(0, 1fr); }
@media (max-height: 700px) { #chips button:nth-child(n+4) { display: none; } #orb { width: 120px; } .stage { gap: 22px; padding-block: 4px; } }
@media (max-height: 600px) { #chips { display: none; } }
@media (max-height: 430px) { body[data-view=home] .stage { flex-direction: row; text-align: start; } #orb { width: 84px; } }
