/* Narrow-first: the Chrome side panel is ~320–480 px wide and tall. No
   color-scheme: dark anywhere — a dark iframe gets an opaque white backdrop
   behind the presenter's own iframe (1008 README, "舞台版面"). */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e4e7ec;
  --accent: #5b5fc7;
  --warn: #d9480f;
  --ok: #2b8a3e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}

.bar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-weight: 600; }
.status { font-size: 11px; color: var(--muted); text-align: right; }

.stage-wrap { background: #0f1115; }
.stage { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; }
/* <sv-presenter> writes its own inline position/width/height; size the slot. */
.stage sv-presenter { display: block; width: 100%; height: 100%; }
.stage-loading {
  position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; gap: 6px;
}
.stage-loading span {
  width: 8px; height: 8px; border-radius: 50%; background: #9aa0b4; animation: pulse 1.2s infinite ease-in-out;
}
.stage-loading span:nth-child(2) { animation-delay: 0.2s; }
.stage-loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
.stage-error {
  position: absolute; inset: 0; display: flex; justify-content: center; align-items: center;
  padding: 16px; color: #cbd0dc; text-align: center;
}
.start {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  padding: 8px 16px; border: 0; border-radius: 999px; background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.context {
  margin: 0; padding: 4px 12px; font-size: 11px; color: #aab; background: #181b22;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.panel { flex: 1; overflow: auto; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.card h2 { margin: 0 0 6px; font-size: 15px; line-height: 1.35; }
.card h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); margin: 0; }
.spoken { margin: 0 0 8px; padding: 6px 8px; border-left: 3px solid var(--accent); background: #f3f3fb; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.items li { display: flex; gap: 6px; align-items: baseline; }
.badge {
  flex: none; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px;
  background: #eef0f4; color: var(--muted); text-transform: uppercase;
}
.badge.high { background: #ffe8e0; color: var(--warn); }
.badge.low { background: #eef7ef; color: var(--ok); }
.items .chan { color: var(--muted); font-size: 12px; }
.meta { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

.replies { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.replies li { border-top: 1px dashed var(--line); padding-top: 8px; }
.replies li:first-child { border-top: 0; padding-top: 0; }
.replies .quote { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.replies .why { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.replies textarea {
  width: 100%; min-height: 56px; resize: vertical; font: inherit; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 6px;
}
.replies .row { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.replies li.sent textarea { background: #f3f4f6; color: var(--muted); }
button { font: inherit; }
.send, #digest-now, .inject button {
  padding: 5px 12px; border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer;
}
button[disabled] { opacity: .55; cursor: default; }
.feed summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.feed-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.feed-list .who { font-weight: 600; }
.feed-list .chan { color: var(--muted); }
.feed-list time { color: var(--muted); float: right; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inject { display: flex; gap: 6px; flex: 1; min-width: 200px; }
.inject input { flex: 1; font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.log { list-style: none; margin: 0; padding: 0; font: 11px/1.4 ui-monospace, Menlo, monospace; color: var(--muted); }
.log .log-error { color: var(--warn); }

/* ── sign-in (service version) ── */
.signin { padding: 14px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.signin p { margin: 0 0 8px; }
.signin .row { display: flex; gap: 8px; flex-wrap: wrap; }
.signin button { padding: 6px 12px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.signin #signin-dev { background: #fff; color: var(--accent); }
.who { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; }

/* ── connections ── */
.connections { border-top: 1px solid var(--line); }
.connection-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.connection-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.connection-list .prov { font-weight: 600; text-transform: capitalize; }
.connection-list .name { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
