/* Jarvis — Midnight Aurora palette (matches the portfolio) */
:root {
  --bg: #05060d;
  --bg-2: #0b0d18;
  --surface: rgba(16, 20, 38, 0.66);
  --surface-2: rgba(24, 30, 54, 0.72);
  --line: rgba(108, 184, 255, 0.14);
  --line-2: rgba(108, 184, 255, 0.28);
  --text: #e6ebff;
  --muted: #8a93b8;
  --mint: #5cf2c8;
  --sky: #6cb8ff;
  --amber: #ffb86b;
  --violet: #9d8cff;
  --rose: #ff6b8a;
  --display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1200px 700px at 20% -10%, #101633 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--display);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow-x: hidden;
}
a { color: var(--sky); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; border-radius: 8px; }
kbd { font: 500 0.78em var(--mono); padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 6px; background: rgba(255,255,255,.04); color: var(--text); }

/* drifting aurora behind everything */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: 0.22; animation: drift 26s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { background: var(--mint); left: -18vmax; top: 20vh; }
.aurora span:nth-child(2) { background: var(--violet); right: -20vmax; top: -18vmax; animation-duration: 32s; opacity: 0.18; }
.aurora span:nth-child(3) { background: var(--sky); left: 30vw; bottom: -36vmax; animation-duration: 38s; opacity: 0.14; }
@keyframes drift { to { transform: translate3d(6vmax, -4vmax, 0) scale(1.12); } }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 3vw, 32px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand strong { display: block; font-size: 1.15rem; letter-spacing: 0.01em; line-height: 1.1; }
.brand small { display: block; font: 400 0.72rem var(--mono); color: var(--muted); letter-spacing: 0.04em; }
.brand-dot { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #eafff8, var(--mint) 45%, var(--sky)); box-shadow: 0 0 24px rgba(92, 242, 200, 0.55); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.ghost-btn, .icon-btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); text-decoration: none; font-size: 0.88rem; cursor: pointer; transition: border-color .15s, background .15s; }
.icon-btn { width: 36px; padding: 0; }
.ghost-btn:hover, .icon-btn:hover, .icon-btn[aria-expanded='true'] { border-color: var(--line-2); background: rgba(108, 184, 255, 0.08); }

/* settings popover */
.settings { position: fixed; top: 66px; right: clamp(16px, 3vw, 32px); width: min(320px, calc(100vw - 32px)); z-index: 20; display: grid; gap: 14px; padding: 18px; background: rgba(12, 15, 30, 0.96); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.7); }
.settings .row { display: flex; justify-content: space-between; align-items: center; }
.settings .col { display: grid; gap: 6px; font-size: 0.86rem; color: var(--muted); }
.settings .col span { display: flex; justify-content: space-between; }
.settings select { width: 100%; height: 36px; padding: 0 10px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 9px; }
.settings input[type='range'] { width: 100%; accent-color: var(--mint); }
.settings input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--mint); }
.fine { margin: 0; font-size: 0.76rem; color: var(--muted); }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(16px, 3vw, 40px); padding: 0 clamp(16px, 3vw, 32px) 18px; max-width: 1280px; width: 100%; margin: 0 auto; min-height: 0; }
.stage { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 10px 0 20px; min-height: 0; }
.orb-wrap { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; width: min(400px, 74vw, 46vh); aspect-ratio: 1; position: relative; -webkit-tap-highlight-color: transparent; }
.orb-wrap canvas { width: 100%; height: 100%; display: block; }
.orb-wrap:focus-visible { outline-offset: -20px; }
.state { margin: 4px 0 0; font-size: 1.05rem; color: var(--text); min-height: 1.6em; }
.interim { margin: 0; min-height: 1.5em; max-width: 34ch; font-size: 1.25rem; color: var(--mint); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; max-width: 560px; }
.chip { appearance: none; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.035); color: var(--text); border-radius: 999px; padding: 8px 14px; font-size: 0.86rem; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.chip:hover { transform: translateY(-1px); border-color: rgba(92, 242, 200, 0.5); background: rgba(92, 242, 200, 0.08); }

/* chat */
.chat-card { display: flex; flex-direction: column; min-height: 0; height: min(76dvh, 760px); align-self: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(16px) saturate(1.2); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7); overflow: hidden; }
.chat { flex: 1; overflow-y: auto; padding: 22px 20px 10px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(108,184,255,.25) transparent; }
.msg { display: flex; gap: 10px; max-width: 92%; animation: rise .35s cubic-bezier(.22, 1, .36, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.msg.you { align-self: flex-end; flex-direction: row-reverse; }
.msg .avatar { flex: none; width: 26px; height: 26px; border-radius: 50%; margin-top: 2px; background: radial-gradient(circle at 35% 30%, #eafff8, var(--mint) 45%, var(--sky)); box-shadow: 0 0 14px rgba(92, 242, 200, 0.4); }
.msg .body { display: grid; gap: 10px; min-width: 0; }
.bubble { padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.msg.you .bubble { background: linear-gradient(135deg, rgba(92, 242, 200, 0.18), rgba(108, 184, 255, 0.18)); border-color: rgba(92, 242, 200, 0.3); border-bottom-right-radius: 6px; }
.msg.jarvis .bubble { border-top-left-radius: 6px; }
.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--sky); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* cards */
.card { border: 1px solid var(--line); border-radius: 14px; background: rgba(8, 10, 20, 0.55); padding: 14px; }
.card .k { font: 500 0.7rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.weather { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; background: linear-gradient(135deg, rgba(108, 184, 255, 0.12), rgba(157, 140, 255, 0.08)); }
.weather .icon { font-size: 2.6rem; line-height: 1; grid-row: span 2; }
.weather .temp { font-size: 2rem; font-weight: 600; line-height: 1; }
.weather .temp small { font-size: 0.9rem; font-weight: 400; color: var(--muted); margin-left: 6px; }
.weather .meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; font: 400 0.8rem var(--mono); color: var(--muted); margin-top: 6px; }
.wiki { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.wiki img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.wiki h4, .define h4 { margin: 2px 0 4px; font-size: 1.02rem; }
.wiki p, .define p { margin: 0; color: #c6cdea; font-size: 0.92rem; }
.wiki a { font-size: 0.84rem; display: inline-block; margin-top: 6px; }
.define .pos { font: 400 0.76rem var(--mono); color: var(--amber); }
.calc { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.calc .expr { font: 400 0.95rem var(--mono); color: var(--muted); }
.calc .value { font-size: 1.7rem; font-weight: 600; color: var(--mint); }
.timer { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(135deg, rgba(255, 184, 107, 0.12), rgba(255, 107, 138, 0.06)); }
.timer .left { font: 600 1.6rem var(--mono); color: var(--amber); font-variant-numeric: tabular-nums; }
.timer.done .left { color: var(--mint); }
.timer .label { color: var(--text); font-size: 0.92rem; }
.small-btn { appearance: none; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); border-radius: 9px; padding: 6px 11px; font-size: 0.82rem; cursor: pointer; color: var(--text); text-decoration: none; }
.small-btn:hover { border-color: var(--mint); }
.notes ul { margin: 6px 0 0; padding-left: 18px; }
.notes li { margin: 4px 0; }
.notes time { font: 400 0.72rem var(--mono); color: var(--muted); margin-left: 6px; }
.link-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--text); transition: border-color .15s, background .15s; }
.link-card:hover { border-color: var(--mint); background: rgba(92, 242, 200, 0.06); }
.link-card .arrow { color: var(--mint); font-size: 1.1rem; }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.help-grid button { appearance: none; text-align: left; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); border-radius: 11px; padding: 9px 11px; cursor: pointer; display: grid; gap: 2px; }
.help-grid button:hover { border-color: rgba(92, 242, 200, 0.45); }
.help-grid strong { font-weight: 500; font-size: 0.88rem; }
.help-grid span { font-size: 0.74rem; color: var(--muted); }

/* composer */
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: rgba(8, 10, 20, 0.5); }
.composer input { flex: 1; min-width: 0; height: 46px; padding: 0 16px; border-radius: 13px; border: 1px solid var(--line-2); background: rgba(5, 6, 13, 0.7); outline: none; transition: border-color .15s, box-shadow .15s; }
.composer input:focus { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(92, 242, 200, 0.12); }
.mic, .send { flex: none; width: 46px; height: 46px; border-radius: 13px; border: 1px solid var(--line-2); display: grid; place-items: center; cursor: pointer; background: rgba(255, 255, 255, 0.04); transition: background .15s, border-color .15s, transform .15s; }
.send { background: linear-gradient(135deg, var(--mint), var(--sky)); color: #04121a; border: 0; }
.send:hover, .mic:hover { transform: translateY(-1px); }
.mic.live { background: rgba(92, 242, 200, 0.18); border-color: var(--mint); color: var(--mint); box-shadow: 0 0 0 6px rgba(92, 242, 200, 0.1); }
.mic:disabled { opacity: .4; cursor: not-allowed; }

.foot { text-align: center; padding: 6px 16px 18px; font-size: 0.78rem; color: var(--muted); }

/* responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .stage { padding: 0; }
  .orb-wrap { width: min(240px, 58vw); }
  .chips { margin-top: 6px; }
  .chat-card { height: auto; min-height: 56dvh; }
  .hide-sm { display: none; }
}
@media (max-width: 520px) {
  .help-grid { grid-template-columns: minmax(0, 1fr); }
  .chip:nth-child(n+5) { display: none; }
  .interim { font-size: 1.05rem; }
}
@media (prefers-reduced-motion: reduce) {
  .aurora span, .msg, .typing i { animation: none; }
}
