:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1d2430; --dim: #6b7483; --line: #dde1e8;
  --accent: #2563eb; --ok: #15803d; --bad: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, sans-serif; }
header { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 12px 20px;
         background: var(--panel); border-bottom: 1px solid var(--line); }
h1 { font-size: 17px; margin: 0; }
h2 { font-size: 12px; margin: 0; padding: 10px 12px; text-transform: uppercase; letter-spacing: .06em;
     color: var(--dim); border-bottom: 1px solid var(--line); }
#controls { display: flex; gap: 8px; }
input, button { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; }
button { background: var(--panel); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .65; cursor: default; }
#help { width: 36px; border-radius: 50%; padding: 6px 0; }
[hidden] { display: none !important; }
#state { margin-left: auto; display: flex; gap: 12px; align-items: center; }
#status::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px;
                  border-radius: 50%; background: var(--dim); }
#status[data-state=listening]::before { background: var(--ok); }
#status[data-state=speaking]::before { background: var(--accent); }
#status[data-state=working]::before { background: #d97706; }
#timer { color: var(--dim); font-variant-numeric: tabular-nums; }
#message { margin: 0; padding: 8px 20px; color: var(--dim); }
#message.error { color: var(--bad); }
main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; padding: 0 20px 20px; }
#stage { align-self: start; }
#stage { position: relative; }
#placeholder { aspect-ratio: 1440 / 900; display: grid; grid-template: 1fr 2fr / 1fr 3fr 3fr; gap: 3%;
               padding: 3%; background: #e9ecf1; border: 1px solid var(--line); border-radius: 8px; }
#placeholder i { background: #fff; border-radius: 6px; }
#placeholder i:first-child { grid-row: span 2; background: #d5dae3; }
.onboarding #screen, .onboarding #placeholder { filter: blur(7px); }
#overlay { position: absolute; inset: 0; display: grid; place-items: center; overflow: auto; padding: 16px; }
#onboard { display: block; width: min(560px, 100%); margin: auto; padding: 18px 24px; background: var(--panel);
           border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
#onboard h2 { padding: 0; border: 0; font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--ink); }
#onboard p { margin: 6px 0; }
#onboard ul { list-style: disc; margin: 4px 0 12px; padding-left: 20px; overflow: visible; }
#onboard label { display: block; margin-bottom: 12px; }
#onboard input { display: block; width: 100%; margin-top: 4px; }
#onboard .note { color: var(--dim); font-size: 12px; }
#problem { color: var(--bad); background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px;
           padding: 8px 12px; }
.callout { display: none; margin: 8px 12px 0; padding: 7px 10px; font-size: 13px; background: #fff7ed;
           border: 1px solid #f97316; border-radius: 8px; }
.onboarding .callout { display: block; }
#header-notes { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 16px; padding: 0 8px; }
#header-notes .right { margin-left: auto; }
#screen { display: block; width: 100%; height: auto; aspect-ratio: 1440 / 900; background: #e9ecf1;
          border: 1px solid var(--line); border-radius: 8px; color: var(--dim); }
aside { display: flex; flex-direction: column; gap: 16px; height: calc(100vh - 130px); min-height: 420px; }
aside > .panel:not(#readback) { flex: 1; }
#readback { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
#readback h2 { color: var(--accent); }
#readback dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 0; padding: 10px 12px; }
#readback dt { color: var(--dim); }
#readback dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
#readback .spelled { display: block; font: 13px ui-monospace, Consolas, monospace; color: var(--dim); }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel);
         border: 1px solid var(--line); border-radius: 8px; }
ol { list-style: none; margin: 0; padding: 8px 12px; overflow-y: auto; flex: 1; }
#talk li { margin-bottom: 8px; }
#talk li b { display: block; font-size: 12px; color: var(--dim); }
#talk li.user span { color: var(--accent); }
#actions li { padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13px;
              overflow-wrap: anywhere; }
#actions .name { font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
#actions .ok { color: var(--ok); }
#actions .refused, #actions .failed { color: var(--bad); }
#actions .detail { color: var(--dim); }
@media (max-width: 900px) {
  #overlay { position: static; padding: 0; }                 /* no room over the screen: in its place */
  .onboarding #screen, .onboarding #placeholder { display: none; }
  main { grid-template-columns: 1fr; }
  aside { height: auto; }
  aside > .panel:not(#readback) { flex: none; height: 260px; }
}
