/* Same visual language as the previous player - this is the same product, just
   a different transport underneath. */

:root {
  --accent: #0a7;
  --ink: #222;
  --muted: #7c848c;
  --line: #e3e5ea;
  --card: #fcfcfd;
  --bg: #ffffff;
  --said: #1a1d21;        /* conversation text, explicit so it cannot inherit
                             a near-white --ink onto a light bubble */
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, system-ui, "Segoe UI", sans-serif;
  max-width: 940px; margin: 22px auto; padding: 0 16px;
  /* --bg is painted EXPLICITLY, in both schemes. It used to be set only inside
     the dark media query, so light mode inherited whatever the browser chose.
     When the query matched dark (--ink goes near-white) but the painted
     background did not follow, the result was white text on white - the whole
     conversation invisible. Never leave the page background to the browser. */
  background: var(--bg);
  color: var(--ink); line-height: 1.45;
}

h1 { font-size: 1.35rem; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: .88rem; margin: 0 0 16px; }
section { margin-bottom: 14px; }

button {
  font-size: 1.02rem; padding: 9px 20px; cursor: pointer; border-radius: 6px;
  border: 1px solid #ccd; background: #f7f8fa; color: var(--ink);
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.stop { background: #c33; border-color: #c33; color: #fff; }
button.ghost { font-size: .85rem; padding: 5px 12px; }
button:disabled { opacity: .5; cursor: default; }

.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: .78rem; background: #eee; color: #555;
}
.pill.listening { background: #e7f3ff; color: #26c; }
.pill.thinking  { background: #fff8e1; color: #7a5c00; }
.pill.speaking  { background: #e6f7ef; color: #076; }
.pill.error     { background: #fdd; color: #900; }

.ctrls {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  background: #f7f8fa; border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 12px; font-size: .9rem;
}
.sw { cursor: pointer; color: #555; user-select: none; }
.note { color: #9aa2aa; font-size: .78rem; margin-left: auto; }

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
}
.stat {
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
  background: var(--card);
}
.sk { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
      color: #8a939c; }
.sv { font-size: 1.12rem; font-weight: 600; color: var(--accent);
      font-variant-numeric: tabular-nums; margin: 2px 0 1px; }
.sn { font-size: .68rem; color: #aab; line-height: 1.3; }

.lbl { color: #888; font-size: .82rem; margin: 0 0 4px; }

.convo {
  border: 1px solid var(--line); border-radius: 6px; padding: 10px;
  max-height: 380px; overflow-y: auto; background: var(--card);
}
.empty { color: #999; font-size: .9rem; margin: 4px 0; }
.turn { margin-bottom: 12px; }
.turn:last-child { margin-bottom: 2px; }
.who { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
       color: #999; margin-bottom: 3px; }
.said { padding: 8px 11px; border-radius: 6px; font-size: 1rem;
        color: var(--said); }
.said.you { background: #eef4ff; border-left: 3px solid #47f; }
.said.sw  { background: #f2fbf6; border-left: 3px solid var(--accent); }
/* the spoken variant reads differently on purpose: it is the same answer in a
   different script, so it should not look like a second answer */
.said.spoken { background: #fbf7ef; border-left: 3px solid #c9a227;
               font-style: italic; opacity: .92; }
.who.spokenlbl { opacity: .75; }
.tmeta { font-size: .76rem; color: #999; margin-top: 3px;
         font-variant-numeric: tabular-nums; }

.err { color: #c00; font-family: ui-monospace, monospace; font-size: .84rem;
       white-space: pre-wrap; }

@media (prefers-color-scheme: dark) {
  :root { --ink: #e6e8ea; --muted: #8b949e; --line: #2b3138; --card: #171b20;
          --bg: #0e1116; --said: #e6e8ea; }
  button { background: #1d232b; border-color: #333b45; color: var(--ink); }
  .ctrls { background: #151a20; }
  .sw { color: #aeb6be; }
  .convo { background: var(--card); }
  .said.you { background: #16233a; }
  .said.sw  { background: #10241c; }
  .said.spoken { background: #241f12; }
  .pill { background: #232a32; color: #aeb6be; }
}

select {
  font: inherit; font-size: .86rem; padding: 2px 5px; margin-left: .3rem;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--card); color: var(--ink);
}
select:disabled { opacity: .55; }

/* The in-flight transcript. Dimmed and dashed on purpose: it is provisional -
   words can still change until the sentence is final - and it must not be
   mistaken for the settled turn that lands underneath it a moment later. */
.said.live { opacity: .72; border-left-style: dashed; }
