:root {
  --bg: #f4f7fc;
  --card: #ffffff;
  --text: #0e1a2e;
  --muted: #51607a;
  --line: #d8e1ef;
  --accent: #1d4ed8;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --ok: #0f6b46;
  --think: #8a5a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1120;
    --card: #121b2e;
    --text: #eaf0fa;
    --muted: #9aa9c2;
    --line: #223049;
    --accent: #78a6ff;
    --accent-text: #07132b;
    --danger: #ff8a80;
    --ok: #5fd39a;
    --think: #ffc257;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.screen { display: flex; flex-direction: column; gap: 16px; }
.screen[hidden] { display: none; }

.logo { font-size: 44px; margin: 24px 0 0; letter-spacing: -1px; }
.tag { margin: -8px 0 8px; color: var(--muted); }
h2 { margin: 16px 0 0; font-size: 30px; }
.muted, small { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); margin: 0; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-weight: 600; font-size: 14px; }
input[type="text"] {
  font: inherit; color: inherit; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; width: 100%;
}
.notice { margin: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }
.recording { margin: 0; font-size: 14px; color: var(--danger); font-weight: 600; }
.recording[hidden] { display: none; }
.recording::before { content: "\25CF  "; }

button {
  font: inherit; font-weight: 600; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px; min-height: 52px; cursor: pointer;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
button.danger { color: var(--danger); }
button.big { min-height: 64px; font-size: 20px; }
button.link { background: none; border: 0; min-height: 0; padding: 4px 0; color: var(--muted); font-weight: 400; text-decoration: underline; align-self: flex-start; }

.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px;
  padding: 10px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
}
.pill::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.pill[data-status="listening"]::before { background: var(--ok); }
.pill[data-status="thinking"]::before { background: var(--think); }
.pill[data-status="speaking"]::before { background: var(--accent); animation: pulse 1s infinite; }
.pill[data-status="paused"]::before, .pill[data-status="ended"]::before { background: var(--muted); }
@keyframes pulse { 50% { transform: scale(1.5); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { .pill::before { animation: none !important; } }

.banner { background: var(--card); border: 1px solid var(--danger); color: var(--danger); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.banner[hidden] { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card[hidden] { display: none; }
.task { font-size: 20px; font-weight: 600; line-height: 1.25; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.steps[hidden], .card [hidden] { display: none; }
.task, .steps li, .banner, .notice, .error { overflow-wrap: anywhere; }

.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row button { flex: 1; min-width: 52px; }

.log summary { color: var(--muted); font-size: 14px; padding: 8px 0; }
.log ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.log li { overflow-wrap: anywhere; }
.log li.helper { color: var(--accent); }

.cam { display: flex; flex-direction: column; gap: 10px; }
.cam[hidden] { display: none; }
.cam-views { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cam figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cam video, .cam img, .cam-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; border-radius: 12px; border: 1px solid var(--line); }
.cam-empty { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; background: var(--card); }
.cam img[hidden], .cam-empty[hidden] { display: none; }
.cam figcaption { overflow-wrap: anywhere; }
