/* Design tokens: the only colors, sizes and spaces the app may use. See design/DESIGN.md. */
:root {
  --bg: #0f1115;
  --surface: #181b22;
  --line: #2a2f3a;
  --text: #f2f3f5;
  --text-dim: #9aa1ad;
  --accent: #4f8cff;
  --speaker-1: #7cc4ff;
  --speaker-2: #ffb86b;
  --live: #3ddc84;
  --danger: #ff6b6b;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --size-xs: 11px;
  --size-s: 13px;
  --size-m: 17px;   /* conversation text: small, but not too small */
  --size-l: 22px;
  --size-xl: 28px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;

  --radius: 12px;
  --tap: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* ---------- Screen 1: pick ---------- */
#pick {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--space-6) + env(safe-area-inset-top)) var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.title { font-size: var(--size-xl); font-weight: 700; margin: 0; }
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.label { font-size: var(--size-s); font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.choice {
  min-height: var(--tap);
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--size-m);
  cursor: pointer;
}
.choice[aria-pressed="true"] { border-color: var(--accent); }
.flag { font-size: var(--size-l); line-height: 1; }
.primary {
  min-height: var(--tap);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  font-size: var(--size-m);
  font-weight: 700;
  cursor: pointer;
}
.primary:disabled { opacity: .5; }
.note { font-size: var(--size-s); color: var(--text-dim); line-height: 1.5; margin: 0; }
.note strong { color: var(--text); }
.error { font-size: var(--size-s); color: var(--danger); margin: 0; }

/* ---------- Screen 2: live ---------- */
#live {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  column-gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--size-s); font-weight: 600; color: var(--text-dim); }
#head-right { border-left: 1px solid var(--line); padding-left: var(--space-4); }
.head .status { margin-left: auto; }
.status { display: flex; align-items: center; gap: var(--space-2); font-size: var(--size-xs); color: var(--text-dim); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.status.paused .dot { background: var(--text-dim); }
.stop {
  min-height: 32px;
  padding: 0 var(--space-3);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--size-s);
  font-weight: 600;
  cursor: pointer;
}

.feed {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--space-4);
  row-gap: var(--space-1);
}
.who { grid-column: 1 / -1; font-size: var(--size-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.row[data-speaker="1"] .who { color: var(--speaker-1); }
.row[data-speaker="2"] .who { color: var(--speaker-2); }
.cell { font-size: var(--size-m); line-height: 1.4; margin: 0; overflow-wrap: anywhere; }
.cell + .cell { border-left: 1px solid var(--line); padding-left: var(--space-4); }
.cell.original { color: var(--text); }
.cell.translated { color: var(--text); }
.cell.spoken::after { content: ""; }
.row.pending .cell { color: var(--text-dim); }
.row.draft .cell { color: var(--text-dim); } /* words so far, before the reread */
.empty { color: var(--text-dim); font-size: var(--size-s); text-align: center; margin: auto; }

/* Portrait while live: ask to turn the phone */
.rotate { display: none; }
@media (orientation: portrait) and (max-width: 700px) {
  #live .bar, #live .feed { display: none; }
  #live .rotate {
    display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4);
    font-size: var(--size-m); color: var(--text-dim);
  }
  .rotate-icon { width: 44px; height: 72px; border: 3px solid var(--text-dim); border-radius: 8px; transform: rotate(-90deg); }
}
