/* Audient HUD: black, white and electric blue. */
:root {
  --bg: #000306;
  --bg-2: #050b16;
  --text: #f4f8ff;
  --muted: #8ea3c3;
  --faint: #55688a;
  --blue: #2f7bff;
  --blue-2: #66a8ff;
  --blue-3: #b9d6ff;
  --line: rgba(80, 150, 255, .22);
  --line-2: rgba(110, 170, 255, .42);
  --glow: 0 0 18px rgba(47, 123, 255, .55);
  --green: #6fe0ff;
  --amber: #ffd27a;
  --red: #ff6b7d;
  --display: "Orbitron", "Exo 2", system-ui, sans-serif;
  --body: "Exo 2", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: hidden; }
body {
  min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--body);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(60% 50% at 50% 42%, rgba(30, 90, 255, .16), transparent 70%),
    radial-gradient(40% 40% at 50% 100%, rgba(20, 60, 160, .18), transparent 70%);
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }

/* ---------- background texture */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.hex { position: absolute; width: 360px; height: 300px; opacity: .14;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='48' viewBox='0 0 56 48'%3E%3Cpath d='M14 1 L42 1 L55 24 L42 47 L14 47 L1 24 Z' fill='none' stroke='%2366a8ff' stroke-width='1'/%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(closest-side, #000, transparent); mask-image: radial-gradient(closest-side, #000, transparent); }
.hex-l { left: -60px; bottom: 40px; } .hex-r { right: -60px; top: 120px; }

/* ---------- top: wordmark and status */
.top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 30px 48px 0; }
.wordmark { margin: 0; font-family: var(--display); font-weight: 600; font-size: 34px; letter-spacing: .14em; line-height: 1;
  background: linear-gradient(90deg, var(--blue-2), var(--blue-3) 40%, #fff 60%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark span { color: transparent; }
.tagline { margin: 8px 0 0; font-size: 17px; color: #c9d6ea; letter-spacing: .01em; }
.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; font-size: 14px; color: #cfdaea; }
.clock { font-family: var(--display); font-size: 13px; letter-spacing: .08em; }

/* ---------- stage: readouts either side of the amoeba */
.stage { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) minmax(220px, 300px);
  gap: 12px; align-items: center; max-width: 1400px; margin: 0 auto; padding: 0 48px; }
.core { position: relative; min-width: 0; display: grid; place-items: center; }
.creature { position: relative; width: min(100%, 520px); aspect-ratio: 1; touch-action: none; cursor: crosshair; }
.creature .amoeba { position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  filter: drop-shadow(0 0 10px rgba(47, 123, 255, .75)) drop-shadow(0 0 34px rgba(47, 123, 255, .35)); }
/* the 3D puffer fish; its halo takes the colour of what it's doing */
.creature .listener { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: filter .6s ease;
  filter: drop-shadow(0 0 14px rgba(127, 180, 255, .3)) drop-shadow(0 0 40px rgba(127, 180, 255, .12)); }
.creature[data-state="listening"] .listener { filter: drop-shadow(0 0 16px rgba(31, 224, 255, .45)) drop-shadow(0 0 46px rgba(31, 224, 255, .2)); }
.creature[data-state="thinking"] .listener { filter: drop-shadow(0 0 16px rgba(138, 92, 255, .45)) drop-shadow(0 0 46px rgba(138, 92, 255, .2)); }
.creature[data-state="speaking"] .listener { filter: drop-shadow(0 0 16px rgba(255, 79, 216, .45)) drop-shadow(0 0 46px rgba(255, 79, 216, .2)); }
.creature[data-state="interrupted"] .listener { filter: drop-shadow(0 0 18px rgba(255, 210, 122, .55)) drop-shadow(0 0 46px rgba(255, 122, 154, .25)); }

.readout { position: relative; padding: 14px 16px 16px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(10, 30, 70, .35), rgba(0, 6, 16, .4));
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); min-width: 0; }
.readout::before { content: ""; position: absolute; top: 0; left: 14px; width: 60px; height: 2px; background: var(--blue-2); box-shadow: var(--glow); }
.readout-title { margin: 14px 0 8px; font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--blue-2);
  display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.readout-title:first-child { margin-top: 0; }
.readout-note { font-family: var(--body); font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--faint); display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue-2); display: inline-block; box-shadow: 0 0 6px var(--blue-2); }

/* ---------- sidebar: the Tasks button opens a panel beside it */
.rail { position: fixed; z-index: 20; left: 18px; top: 140px; padding: 6px; border: 1px solid var(--line);
  border-radius: 20px; background: rgba(4, 12, 28, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rail-btn { position: relative; width: 60px; padding: 10px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0;
  border-radius: 14px; background: transparent; color: var(--blue-2); transition: background .2s, color .2s; }
.rail-btn:hover { background: rgba(47, 123, 255, .12); color: #fff; }
.rail-btn[aria-expanded="true"] { background: rgba(47, 123, 255, .22); color: #fff; }
.rail-btn .i { width: 22px; height: 22px; }
.rail-label { font-family: var(--display); font-size: 9.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.badge { position: absolute; top: 4px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 600; line-height: 1; color: #fff; background: var(--blue); box-shadow: 0 0 10px rgba(47, 123, 255, .7); }
.badge.busy { animation: beat 1.2s ease-in-out infinite; }
.badge.needs { background: var(--amber); color: #1a1000; box-shadow: 0 0 10px rgba(255, 210, 122, .7); }
@keyframes beat { 50% { transform: scale(1.18); } }
.drawer { position: fixed; z-index: 19; left: 98px; top: 140px; width: min(340px, calc(100vw - 120px)); max-height: max(200px, min(480px, calc(100vh - 330px)));
  display: flex; flex-direction: column; padding: 14px 14px 16px; border: 1px solid var(--line-2); border-radius: 18px;
  background: rgba(3, 10, 24, .94); box-shadow: 0 30px 80px -20px #000, 0 0 30px rgba(47, 123, 255, .12);
  opacity: 0; visibility: hidden; transform: translateX(-10px); transition: opacity .2s, transform .2s, visibility 0s .2s; }
.drawer.open { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .2s; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer-head .readout-title { margin: 0; }
.drawer-head .ic-btn { width: 30px; height: 30px; }

/* tasks */
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto; }
.tasks-empty { font-size: 13px; color: var(--faint); padding: 2px 0 4px; }
.task { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-left: 2px solid var(--line-2); border-radius: 4px 10px 10px 4px; background: rgba(47, 123, 255, .06); }
.task.fresh { animation: rise .3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.task-ic { color: var(--blue-2); display: grid; place-items: center; }
.task-ic .i { width: 16px; height: 16px; }
.task b { display: block; font-size: 12.5px; font-weight: 500; }
.task small { display: block; font-size: 11px; color: var(--muted); line-height: 1.3; }
.task.cancelled { border-left-color: var(--red); opacity: .85; }
.task.done { border-left-color: var(--green); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--blue-2); white-space: nowrap; }
.pill .i { width: 12px; height: 12px; }
.pill.green { color: var(--green); } .pill.red { color: var(--red); } .pill.amber { color: var(--amber); }

/* examples */
.demo-list { display: flex; flex-direction: column; gap: 6px; }
.demo { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border: 1px solid var(--line); background: transparent; transition: border-color .2s, background .2s; }
.demo:hover:not(:disabled) { border-color: var(--blue-2); background: rgba(47, 123, 255, .1); }
.demo .play { color: var(--blue-2); }
.demo .play .i { width: 14px; height: 14px; }
.demo b { display: block; font-size: 12.5px; font-weight: 500; }
.demo small { display: block; font-size: 11px; color: var(--muted); }
.demo.running { border-color: var(--blue-2); }


/* ---------- dialogue */
.dialogue { position: relative; z-index: 1; width: min(92%, 760px); margin: 4px auto 0; display: flex; flex-direction: column; gap: 6px; }
.line { margin: 0; display: grid; grid-template-columns: 74px 1fr; gap: 10px; font-size: 18px; line-height: 1.4; }
.line .who { text-align: right; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 16px; padding-top: 1px; }
.line.agent { color: #a9b8cf; } .line.agent .who { color: #8ea3c3; }
.line.user { color: #fff; } .line.user .who { color: #fff; }
.line.user.live { color: var(--blue-3); font-style: italic; }
.line span:last-child { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- actions: interrupt button, input, controls */
.actions { position: relative; z-index: 3; width: min(92%, 760px); margin: 18px auto 0; padding-bottom: 34px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.actions::before { content: ""; position: absolute; top: 31px; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--line-2) 20%, var(--line-2) 80%, transparent); z-index: -1; }
.interrupt { min-width: 320px; height: 62px; padding: 0 30px; display: inline-flex; align-items: center; justify-content: center; gap: 16px; border: 0;
  font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #001433; border-radius: 999px;
  background: linear-gradient(180deg, #8fc2ff, #3d86ff); box-shadow: 0 0 24px rgba(47, 123, 255, .45), inset 0 0 0 2px rgba(255, 255, 255, .55);
  transition: transform .12s, filter .2s; }
.interrupt:hover { filter: brightness(1.1); }
.interrupt:active { transform: scale(.98); }
.interrupt.live { background: linear-gradient(180deg, #e9f3ff, #8fc2ff); }
.interrupt.recording { background: linear-gradient(180deg, #ffd0d6, #ff8a99); }
.bars { display: inline-flex; align-items: center; gap: 3px; height: 22px; }
/* the bars are a live level meter of the user's voice (--lvl is set from the mic) */
.bars i { width: 3px; height: calc(18% + var(--lvl, 0) * 82% * var(--k, 1)); background: #001433; border-radius: 2px; transition: height .08s linear; }
.bars i:nth-child(1) { --k: .55; } .bars i:nth-child(2) { --k: .85; } .bars i:nth-child(3) { --k: 1; } .bars i:nth-child(4) { --k: .75; } .bars i:nth-child(5) { --k: .5; }
.interrupt:not(.live) .bars i { height: 18%; }

.input-row { position: relative; width: min(100%, 560px); }
.composer { display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid var(--line-2); border-radius: 999px; background: rgba(0, 10, 30, .65); }
.composer:focus-within { border-color: var(--blue-2); box-shadow: var(--glow); }
.composer input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 15px; padding: 8px 6px; outline: none; }
.composer input::placeholder { color: var(--faint); }
.ic-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--blue-2); flex: none; }
.ic-btn:hover { color: #fff; }
.ic-btn.send { background: rgba(47, 123, 255, .2); color: #fff; }

.hint { min-height: 18px; margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* attachment menu */
.menu { position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 30; width: min(100%, 440px); padding: 14px; background: rgba(2, 10, 26, .97); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 30px 80px -20px #000; }
.menu-title { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.frame-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.frame-grid button { padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #000; display: flex; flex-direction: column; gap: 4px; align-items: stretch; overflow: hidden; }
.frame-grid button:hover { border-color: var(--blue-2); }
.frame-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.frame-grid small { font-size: 10.5px; color: var(--muted); padding: 0 4px 5px; }
.menu-actions { display: flex; gap: 8px; margin-top: 10px; }
.menu-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; font-size: 12.5px; border: 1px solid var(--line); border-radius: 999px; color: var(--blue-3); cursor: pointer; }
.menu-btn:hover { border-color: var(--blue-2); }

/* loader */
.loader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 3, 8, .92); }
.loader-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.loader-card b { font-family: var(--display); letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.loader-card p { margin: 0; color: var(--muted); font-size: 13px; }
.loader-ring { width: 70px; height: 70px; border-radius: 50%; border: 3px solid rgba(102, 168, 255, .25); border-top-color: var(--blue-2); box-shadow: var(--glow); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- smaller screens: readouts under the dialogue */
@media (max-width: 1080px) {
  /* amoeba, then the conversation and buttons, then the readouts */
  body { display: flex; flex-direction: column; }
  .stage { display: contents; }
  .core { order: 1; padding: 0 20px; }
  .dialogue { order: 2; }
  .actions { order: 3; }
  .readout { order: 4; width: min(calc(100% - 32px), 560px); margin: 0 auto 16px; }
  .side-spacer { display: none; }
}
@media (max-width: 640px) {
  .top { padding: 22px 22px 0; flex-direction: column; gap: 8px; }
  .top-right { align-items: flex-start; }
  .wordmark { font-size: 26px; }
  .tagline { font-size: 15px; }
  .stage { padding: 0 16px; }
  .line { grid-template-columns: 58px 1fr; font-size: 15.5px; } .line .who { font-size: 13px; }
  .interrupt { min-width: 0; width: 100%; font-size: 15px; }
  .hex { display: none; }
  /* the sidebar becomes a button at the top right; its panel drops down below it */
  .rail { top: 16px; right: 16px; left: auto; transform: none; padding: 4px; border-radius: 16px; }
  .rail-btn { width: 52px; padding: 7px 0 6px; gap: 4px; }
  .drawer { left: 16px; right: 16px; top: 92px; width: auto; max-height: 65vh; transform: translateY(-8px); }
  .drawer.open { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .loader-ring, .task.fresh { animation: none !important; } }
.num { font-family: var(--body); font-weight: 600; letter-spacing: .04em; }
