@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --bg: #04060c;
  --ink: #e6f3ff;
  --ink-soft: #a9c3dc;
  --ink-faint: #6f8aa6;
  --line: rgba(160, 200, 235, 0.44);
  --line-faint: rgba(150, 200, 240, 0.16);
  --cyan: #6cc6ff;
  --magenta: #ff4fc3;
  --magenta-deep: #a81f78;
  --panel: rgba(6, 11, 23, 0.9);
  /* Set from layout.js */
  --win-x: 40px; --win-y: 60px; --win-w: 900px; --win-h: 700px; --bar-h: 90px; --title-h: 48px; --mic: 0;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body { color: var(--ink); font: 400 15px/1.45 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; }
.icon { width: 1em; height: 1em; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fill, .solid { fill: currentColor; stroke: none; }

#stage { position: fixed; display: block; inset: 0; width: 100vw; height: 100vh; height: 100dvh; }

.figure-error { position: fixed; inset: auto 0 40% 0; text-align: center; color: var(--ink-soft); padding: 0 24px; }

/* ---- Her name, written over the window ---------------------------------------------------------- */
/* ---- The window ------------------------------------------------------------------------------------ */
.window {
  position: fixed;
  left: var(--win-x); top: var(--win-y); width: var(--win-w); height: var(--win-h);
  pointer-events: none;
}
.window > * { pointer-events: auto; }

.titlebar {
  position: absolute; left: 0; right: 0; top: 0; height: var(--title-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 calc(var(--title-h) * 0.9);
  pointer-events: none;
}
.lights { display: inline-flex; gap: calc(var(--title-h) * 0.26); }
.lights i { display: block; width: calc(var(--title-h) * 0.3); height: calc(var(--title-h) * 0.3); border-radius: 50%; background: #3c5166; transition: background 300ms, box-shadow 300ms; }
.lights i:nth-child(1) { background: var(--magenta); box-shadow: 0 0 10px rgba(255, 79, 195, 0.8); }
.lights i:nth-child(2) { background: #6189ac; }
.lights i:nth-child(3) { background: #47596e; }
body[data-call='live'] .lights i:nth-child(1) { animation: live 2.2s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 18px rgba(255, 79, 195, 1); } }
@media (prefers-reduced-motion: reduce) { body[data-call='live'] .lights i:nth-child(1) { animation: none; } }

.status { font-size: 13px; letter-spacing: 0.02em; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.status b { font-weight: 600; color: var(--ink); margin-right: 10px; }
.status time { color: var(--ink-faint); margin-left: 6px; }

.self {
  position: absolute;
  right: calc(var(--win-w) * 0.022);
  top: calc(var(--title-h) * 0.72);
  width: clamp(62px, calc(var(--win-w) * 0.106), 150px);
  aspect-ratio: 1.39;
  display: grid; place-items: center;
  border: 1px solid rgba(150, 200, 240, calc(0.3 + var(--mic) * 0.7));
  border-radius: 7px;
  background: rgba(6, 12, 24, 0.5);
  box-shadow: 0 0 calc(var(--mic) * 22px) rgba(108, 198, 255, calc(var(--mic) * 0.8));
  color: #5f7f9e;
  overflow: hidden;
}
.self .icon { width: 42%; height: auto; aspect-ratio: 1; }
.self canvas { width: 100%; height: 100%; image-rendering: pixelated; filter: saturate(0.3) sepia(1) hue-rotate(165deg) saturate(3.4) brightness(1.05); }

/* ---- Captions -------------------------------------------------------------------------------------- */
.captions {
  position: absolute; left: 50%; bottom: calc(var(--bar-h) + 14px);
  transform: translateX(-50%);
  width: min(84%, 640px);
  display: grid; justify-items: center; gap: 6px;
  text-align: center;
  pointer-events: none;
}
.captions p { margin: 0; max-width: 100%; }
.caption-her, .caption-you {
  padding: 6px 12px; border-radius: 8px;
  background: rgba(3, 7, 16, 0.72);
  opacity: 0; transition: opacity 240ms;
}
.caption-her.on, .caption-you.on { opacity: 1; }
.caption-her { font-size: 16px; color: var(--ink); }
.caption-you { font-size: 13px; color: var(--ink-soft); }
.hint { padding: 5px 12px; border-radius: 8px; background: rgba(3, 7, 16, 0.66); font-size: 12.5px; color: var(--ink-soft); transition: opacity 900ms; }
.hint.quiet { opacity: 0; }
body[data-call='live'] .hint, body[data-call='connecting'] .hint { display: none; }

.toast {
  position: absolute; left: 50%; top: calc(var(--title-h) + 16px); transform: translateX(-50%);
  width: max-content; max-width: min(90%, 520px);
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid rgba(255, 79, 195, 0.55); background: rgba(16, 6, 18, 0.92);
  font-size: 14px; text-align: center;
}

/* ---- Control bar ------------------------------------------------------------------------------------ */
.bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--bar-h);
  display: flex; align-items: center; justify-content: center;
  gap: clamp(10px, calc(var(--win-w) * 0.052), 62px);
}
.round {
  --size: clamp(46px, calc(var(--bar-h) * 0.62), 66px);
  width: var(--size); height: var(--size); padding: 0; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: rgba(10, 18, 30, 0.6);
  color: #8fb0d0;
  font-size: calc(var(--size) * 0.56);
  transition: border-color 160ms, color 160ms, box-shadow 160ms, transform 120ms, opacity 160ms;
}
.round:hover:not(:disabled) { border-color: var(--cyan); color: #d7efff; box-shadow: 0 0 16px rgba(108, 198, 255, 0.35); }
.round:active:not(:disabled) { transform: scale(0.96); }
.round:disabled { opacity: 0.74; }
.round[aria-pressed='true'], .round[aria-expanded='true'] { border-color: var(--cyan); color: #e4f5ff; background: rgba(40, 96, 150, 0.3); }
.round.small { --size: 34px; font-size: 16px; }
#mic[aria-pressed='true'] { border-color: var(--magenta); color: #ffc7ee; background: rgba(168, 31, 120, 0.2); }

.call {
  --size: clamp(54px, calc(var(--bar-h) * 0.74), 76px);
  border: 2.5px solid #ff8be2;
  color: #ffd9f2;
  background: radial-gradient(circle at 50% 46%, #7a2560, #5a1a48);
  box-shadow: 0 0 20px rgba(255, 90, 210, 0.75), inset 0 0 9px rgba(255, 130, 220, 0.42);
  font-size: calc(var(--size) * 0.52);
}
.call:hover:not(:disabled) { border-color: #ffc2ea; color: #fff; box-shadow: 0 0 32px rgba(255, 79, 195, 0.95), inset 0 0 10px rgba(255, 150, 230, 0.5); }
/* Not in a call the handset is lifted; in a call it lies down, as on any phone. */
.call .icon { transition: transform 260ms; transform: rotate(-135deg); }
body[data-call='live'] .call .icon, body[data-call='connecting'] .call .icon { transform: rotate(0); }
body[data-call='connecting'] .call { animation: ringing 1.1s ease-in-out infinite; }
@keyframes ringing { 50% { box-shadow: 0 0 40px rgba(255, 79, 195, 1), inset 0 0 8px rgba(255, 180, 235, 0.4); } }
@media (prefers-reduced-motion: reduce) { .call .icon { transition: none; } body[data-call='connecting'] .call { animation: none; } }

/* ---- Panel ------------------------------------------------------------------------------------------- */
.panel {
  position: fixed;
  right: calc(var(--win-x) + 12px);
  top: calc(var(--win-y) + var(--title-h) + 10px);
  bottom: calc(100vh - var(--win-y) - var(--win-h) + var(--bar-h) + 10px);
  bottom: calc(100dvh - var(--win-y) - var(--win-h) + var(--bar-h) + 10px);
  width: min(344px, calc(100vw - var(--win-x) * 2 - 24px));
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.6), 0 0 24px rgba(108, 198, 255, 0.1);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px 16px; }
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-body { flex: 1; overflow: auto; padding: 0 16px 16px; display: grid; gap: 14px; align-content: start; }
.log { display: grid; gap: 8px; max-height: 26vh; overflow: auto; }
.log-empty { margin: 0; color: var(--ink-faint); font-size: 13px; }
.message { font-size: 13.5px; }
.message .who { display: block; font-size: 11px; color: var(--ink-faint); margin-bottom: 1px; }
.message p { margin: 0; }
.message.assistant p { color: var(--ink); }
.message.user p { color: var(--ink-soft); }
.message p.pending { color: var(--ink-faint); }

.composer { display: flex; gap: 8px; }
.composer input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(4, 8, 18, 0.7); }
.composer input::placeholder { color: var(--ink-faint); }
.send { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border-radius: 9px; border: 1px solid var(--line); background: rgba(40, 96, 150, 0.3); font-size: 18px; }
.send:disabled { opacity: 0.4; }
.text-button { justify-self: start; padding: 2px 0; border: 0; background: none; color: var(--cyan); font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { opacity: 0.45; }

.group { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; min-width: 0; }
.group legend { padding: 0 0 8px; font-size: 12px; color: var(--ink-faint); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.choice { display: block; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; padding: 7px 10px; border: 1px solid var(--line-faint); border-radius: 9px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }
.choice b { display: block; font-weight: 600; color: var(--ink); }
.choice input:checked + span { border-color: var(--cyan); background: rgba(40, 96, 150, 0.26); }
.choice input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.choice input:disabled + span { opacity: 0.5; cursor: default; }
.note { margin: 0; font-size: 12px; color: var(--ink-faint); }

.segments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.segments button { height: 34px; padding: 0 2px; border: 1px solid var(--line-faint); border-radius: 8px; background: none; color: var(--ink-soft); font-size: 12px; }
.segments button[aria-pressed='true'] { border-color: var(--cyan); background: rgba(40, 96, 150, 0.26); color: var(--ink); }
.segments button:disabled { opacity: 0.45; }
.segments.wrap { grid-template-columns: repeat(3, 1fr); }
.segments.wrap button:active { border-color: var(--cyan); }

.slider { display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.slider > span { display: flex; justify-content: space-between; }
.slider output { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.slider input { width: 100%; accent-color: var(--cyan); }

.keys { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12px; color: var(--ink-faint); }
.keys div { display: flex; gap: 6px; }
.keys dt { color: var(--ink-soft); }
.keys dd { margin: 0; }

@media (max-width: 640px) {
  .status { font-size: 12px; }
  .bar { gap: clamp(6px, 3vw, 14px); }
  .caption-her { font-size: 15px; }
  .hint { font-size: 12px; }
}
@media (hover: none) { .keys { display: none; } }

/* ---- Her board: a case, a module or the visitor's process ------------------------------------------- */
.board {
  --auto: #1fa876; --digital: #6cc6ff; --control: #ffb648; --stay: #8aa0b8;
  position: absolute;
  left: calc(var(--win-w) * 0.03);
  top: calc(var(--title-h) + 8px);
  bottom: calc(var(--bar-h) + 10px);
  width: min(40%, 470px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 10, 22, 0.9);
  box-shadow: 0 0 40px rgba(108, 198, 255, 0.16);
  animation: board-in 380ms ease-out;
}
.board[hidden] { display: none; }
@keyframes board-in { from { opacity: 0; transform: translateX(-12px); } }
@media (prefers-reduced-motion: reduce) { .board { animation: none; } }
.board-close { position: absolute; top: 10px; right: 10px; }
.board-body { overflow-y: auto; padding: 18px 20px 20px; scrollbar-width: thin; }
.board-kicker { margin: 0 0 4px; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); }
.board-title { margin: 0 40px 10px 0; font-size: 19px; line-height: 1.3; font-weight: 600; color: var(--ink); }
.board-note { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-faint); }
.board-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.board-points li { position: relative; padding-left: 18px; font-size: 15px; line-height: 1.45; color: var(--ink); }
.board-points li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 7px; height: 7px; border-radius: 2px; background: var(--magenta); box-shadow: 0 0 8px rgba(255, 79, 195, 0.7); }

.flow { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.step { --tone: var(--stay); position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line-faint); border-left: 3px solid var(--tone); background: rgba(12, 20, 38, 0.7); }
.step[data-proposal='automatizare'] { --tone: var(--auto); }
.step[data-proposal='digitalizare'] { --tone: var(--digital); }
.step[data-proposal='control'] { --tone: var(--control); }
.step + .step::before { content: ''; position: absolute; left: 23px; top: -9px; width: 2px; height: 9px; background: var(--line); }
.step-number { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-soft); }
.step-main p { margin: 0; }
.step-name { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.step-meta { font-size: 12px; color: var(--ink-faint); margin-top: 2px !important; }
.step-problem { font-size: 12.5px; color: #ff9fd9; margin-top: 4px !important; }
.step-problem::before { content: '● '; color: var(--magenta); }
.step-proposal { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px !important; }
.step-proposal b { color: var(--tone); font-weight: 600; }
.conclusion { margin-top: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(31, 168, 118, 0.5); background: rgba(31, 168, 118, 0.08); }
.conclusion p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); }
.conclusion .board-kicker { color: var(--auto); margin-bottom: 4px; }
.conclusion .next { margin-top: 8px; color: var(--ink-soft); font-size: 13px; }

@media (max-width: 640px) {
  .board { left: 8px; right: 8px; width: auto; top: 42%; }
}
.readers { margin-top: 10px; display: grid; gap: 6px; }
.readers[hidden] { display: none; }
.readers .sub { margin: 0; font-size: 12px; color: var(--ink-faint); }
