:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --ink: #1d1b18;
  --muted: #6f6a62;
  --line: #e6e0d6;
  --accent: #e8613c;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3da;
  --live: #1f9d61;
  --live-soft: #d8f1e4;
  --warn: #b5402a;
  --bar: #d9d2c6;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1d1c19;
    --ink: #f1ede6;
    --muted: #9b958b;
    --line: #2e2c28;
    --accent: #f07a55;
    --accent-ink: #1a0d08;
    --accent-soft: #3a2219;
    --live: #3ccf8a;
    --live-soft: #173426;
    --warn: #ff8a72;
    --bar: #3a3732;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 1rem; }
em { font-style: normal; color: var(--accent); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 64px; }
.top {
  max-width: 960px; margin: 0 auto; padding: 20px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.home { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.home:hover { color: var(--ink); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.muted { color: var(--muted); }
.error { color: var(--warn); margin: 10px 0 0; min-height: 0; font-size: 0.9rem; }
.error:empty { display: none; }

/* buttons */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.stop { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 0.875rem; }
.btn.big { padding: 14px 24px; font-size: 1.05rem; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.discord:hover { background: #4752c4; border-color: #4752c4; }
.share-note {
  margin: -6px 0 16px; padding: 10px 14px; border-radius: 10px; font-size: 0.9rem;
  background: color-mix(in srgb, #5865f2 14%, var(--surface)); border: 1px solid color-mix(in srgb, #5865f2 35%, var(--line));
}
.btn.danger { background: var(--warn); border-color: var(--warn); color: var(--surface); }
.btn:disabled { opacity: 0.5; cursor: default; }

input:not([type]), input[type="text"], input[type="number"], input[type="datetime-local"], textarea, .select {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.field { display: grid; gap: 6px; }
.field > span { font-size: 0.875rem; font-weight: 600; }

/* lobby */
.hero { padding: 40px 0 28px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1.05; }
.lede { max-width: 38em; color: var(--muted); font-size: 1.1rem; margin: 14px 0 0; }
.lobby-card { max-width: 440px; display: grid; gap: 18px; }
.lobby-actions { display: grid; gap: 14px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 8px; }
#code { text-transform: uppercase; letter-spacing: 0.15em; font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 32px; color: var(--muted); font-size: 0.95rem; }
.how b { color: var(--accent); }

/* room */
.room-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 12px 0 18px; gap: 12px; }
.eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.code-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: 0.12em; }

.meeting { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.meeting-status { display: flex; align-items: center; gap: 14px; }
.meeting-label { font-weight: 600; }
.clock { font-variant-numeric: tabular-nums; font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--bar); flex: none; }
.dot.on { background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 50%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

/* people */
.people-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.person { display: grid; gap: 6px; }
.person-top { display: flex; align-items: center; gap: 10px; }
.person-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-name .you { font-size: 0.75rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 1px; }
.person-name .tag { font-size: 0.75rem; font-weight: 500; color: var(--muted); margin-left: 6px; }
.person-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
.person-pct { font-variant-numeric: tabular-nums; font-weight: 700; width: 3.2em; text-align: right; }
.talk-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bar); flex: none; transition: background 0.15s; }
.talk-dot.on { background: var(--live); }
.talk-dot.away { background: transparent; border: 2px solid var(--bar); }
.bar { position: relative; height: 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); overflow: visible; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--bar); transition: width 0.4s ease; }
.person.me .bar-fill { background: var(--accent); }
.person.speaking .bar-fill { background: var(--live); }
.bar-fair { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--muted); opacity: 0.5; border-radius: 1px; }
.empty { margin: 0; }
.fair-note { margin: 16px 0 0; font-size: 0.85rem; }

.center { text-align: center; display: grid; gap: 12px; justify-items: center; margin-top: 60px; padding: 40px 20px; }

/* --------------------------------------------------------------- shared bits */
.wrap.wide { max-width: 1200px; }
.small-note { font-size: 0.82rem; margin: 0; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.icon-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1;
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.link-btn { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--ink); }
.tag { font-size: 0.75rem; font-weight: 500; color: var(--muted); margin-left: 6px; }
textarea { resize: vertical; line-height: 1.5; }

/* ------------------------------------------------------------------- lobby */
.prep { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; margin-top: 32px; align-items: start; }
@media (max-width: 760px) { .prep { grid-template-columns: 1fr; } }
.planner { display: grid; gap: 10px; margin-top: 12px; }
.plan { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.plan.active { border-color: var(--accent); }
.plan summary { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 12px 14px; cursor: pointer; list-style: none; }
.plan summary::-webkit-details-marker { display: none; }
.plan summary::before { content: "\25B8"; color: var(--muted); }
.plan[open] summary::before { content: "\25BE"; }
.plan-title { font-weight: 600; }
.plan-meta { font-size: 0.85rem; }
.plan .tag { color: var(--accent); font-weight: 700; }
.plan-body { display: grid; gap: 12px; padding: 0 14px 14px; }
.plan-body input { background: var(--surface); }
.plan-fields { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
@media (max-width: 520px) { .plan-fields { grid-template-columns: 1fr; } }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- to-dos */
.todos { display: grid; gap: 10px; }
.todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.todo-list li.todo { display: flex; align-items: center; gap: 6px; }
.todo-list label { display: flex; gap: 10px; align-items: flex-start; flex: 1; cursor: pointer; padding: 4px 0; min-width: 0; }
.todo-list input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.todo-list span { overflow-wrap: anywhere; }
.todo-list .done span { text-decoration: line-through; color: var(--muted); }
.todo-add { display: flex; gap: 6px; flex-wrap: wrap; }
.todo-add input { flex: 1 1 160px; width: auto; padding: 7px 10px; }
#room-todo-pick { margin-bottom: 12px; }

/* ------------------------------------------------------------------- notes */
.notes textarea { min-height: 160px; }
.notes .small-note { margin-top: 6px; }

/* -------------------------------------------------------------------- room */
.consent {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; color: var(--muted);
  border: 1px dashed var(--line);
}
.consent b { color: var(--ink); }
.plan-line { font-size: 0.85rem; margin-top: 2px; }
.plan-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field.compact > span:first-child { font-size: 0.8rem; }
.with-unit { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 400; }
.with-unit input { width: 5.5em; padding: 8px 10px; }
.meeting .error { flex-basis: 100%; margin: 0; }
.meeting > p { margin: 0; }

.mic { margin-bottom: 16px; padding: 12px 16px; }
.mic-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mic-live { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; flex: 1; min-width: 0; }
.mic-live .meter { flex: 1 1 140px; min-width: 120px; }
.mic-more { flex-basis: 100%; }
.mic-more summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; width: max-content; }
.mic-more[open] { display: grid; gap: 10px; }
.mic .error { margin-top: 8px; }
.pill { font-size: 0.8rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pill.on { background: var(--live-soft); color: var(--live); border-color: transparent; }
.pill.paused { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.meter { position: relative; height: 12px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--bar); transition: width 0.08s linear; }
.meter-fill.on { background: var(--live); }
.meter-mark { position: absolute; top: 0; bottom: 0; width: 2px; }
.meter-mark.floor { background: var(--muted); }
.meter-mark.thresh { background: var(--accent); }
.slider input { width: 100%; accent-color: var(--accent); }
.slider small { font-size: 0.8rem; }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* Talk time, notes and to-dos down the left; the transcript beside them, in a
   pane that scrolls on its own. One column when narrow (the extension's side
   panel), with the transcript straight after the talk time. */
.room-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "people transcript" "notes transcript" "todo transcript";
}
.room-grid .people { grid-area: people; }
.room-grid .transcript { grid-area: transcript; position: sticky; top: 16px; display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.room-grid .notes-area { grid-area: notes; }
.room-grid .todo { grid-area: todo; }
@media (max-width: 860px) {
  .room-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "people" "transcript" "notes" "todo"; }
  .room-grid .transcript { position: static; max-height: 60vh; }
}

/* people */
.ping-btn { padding: 3px 10px; }
.ping-menu { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.bar-min { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--accent); opacity: 0.7; border-radius: 1px; }

/* transcript */
.transcript .card-head { flex: none; }
.transcript-list { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; flex: 1; min-height: 120px; display: grid; gap: 2px; align-content: start; }
.line { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; padding: 6px 8px; border-radius: 8px; }
.line time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.8rem; padding-top: 2px; grid-row: span 3; }
.line-who { font-weight: 700; font-size: 0.85rem; }
.line.mine .line-who { color: var(--accent); }
.line-text { grid-column: 2; overflow-wrap: anywhere; }
.line-meta { grid-column: 2; display: flex; gap: 10px; align-items: center; font-size: 0.8rem; margin-top: 2px; }
.line.flagged { background: color-mix(in srgb, var(--warn) 12%, transparent); box-shadow: inset 3px 0 0 var(--warn); }
.line .why { color: var(--warn); font-weight: 600; }
.line.interim .line-text { color: var(--muted); font-style: italic; }
.flag-summary { margin: -4px 0 10px; font-size: 0.85rem; color: var(--muted); flex: none; }
.flag-summary.has-flags { color: var(--warn); font-weight: 600; }

/* toasts: nudges and pings */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 10px; z-index: 10; width: min(360px, calc(100vw - 32px)); }
.toast {
  position: relative; padding: 14px 40px 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.18); animation: rise 0.25s ease;
}
.toast p { margin: 4px 0 0; font-size: 0.92rem; }
.toast .icon-btn { position: absolute; top: 8px; right: 8px; }
.toast.nudge { border-color: var(--accent); }
.toast.nudge strong { color: var(--accent); }
.toast.ping { border-color: #5865f2; }
.toast.ping strong { color: #5865f2; }
.toast.sent { padding-block: 10px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast, .dot.on { animation: none; } }

body[data-view="room"] .top { max-width: 1200px; }

/* No sound reaching us: the mic bar blinks until there is. */
.mic-alert { margin: 10px 0 0; font-size: 0.9rem; font-weight: 600; color: var(--accent); }
.mic.attention { border-color: var(--accent); animation: mic-blink 1.2s ease-in-out infinite; }
.btn.attention { animation: mic-btn-blink 1.2s ease-in-out infinite; }
@keyframes mic-blink {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); background: var(--surface); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
}
@keyframes mic-btn-blink {
  0%, 100% { filter: none; transform: none; }
  50% { filter: brightness(1.2); transform: scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  /* Still unmistakable, just not moving. */
  .mic.attention, .btn.attention { animation: none; }
  .mic.attention { background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
}

/* account */
.top-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.account-chip { font-size: 0.85rem; display: inline-flex; gap: 6px; align-items: baseline; }
.signin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.signin-form .btn, .signin-form #signin-invite { grid-column: 1 / -1; }
@media (max-width: 420px) { .signin-form { grid-template-columns: 1fr; } }
input[type="password"] { font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.acct { color: var(--live); font-weight: 700; margin-left: 4px; }

/* Your own speaking habits: small and red, closable. */
.toast.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); padding-block: 10px; }
.toast.warn strong { color: var(--warn); }
.toast.warn p { font-size: 0.85rem; }

/* The host's AI summary, at the top of the transcript pane. */
.summary-box { flex: none; margin-bottom: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.summary-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.summary-head .head-actions { margin-left: auto; }
.summary-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; }
.summary-text:empty { display: none; }
#summary-status:empty { display: none; }

/* Meeting history (lobby, bottom) */
.history { margin-top: 16px; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history-item { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: baseline; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; }
.history-item:hover { border-color: var(--muted); }
.history-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.history-when { font-weight: 600; }
.history-meta { font-size: 0.85rem; }
.history-badges { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.history-badges .tag { margin: 0; padding: 1px 8px; border: 1px solid var(--line); border-radius: 99px; }
.history-badges .tag.flag { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.history-view { display: grid; gap: 10px; }
.hv-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.history-view h3 { margin: 0; }
.history-view h4 { margin: 0 0 8px; font-size: 0.9rem; }
.hv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .hv-grid { grid-template-columns: minmax(0, 1fr); } }
.hv-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hv-person { display: flex; gap: 10px; align-items: baseline; }
.hv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-lines { max-height: 60vh; }

/* Pause, and the host's view of dead mics */
.meeting-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dot.paused { background: #d6a01e; }
.person.mic-dead .person-name { color: var(--warn); }
.person.mic-dead .person-name .tag { color: var(--warn); font-weight: 600; }

/* Sticky header: the logo and Sign in stay at the top as you scroll. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .top { padding-block: 12px; }
.room-grid .transcript { top: 76px; max-height: calc(100vh - 92px); }
#history, #room { scroll-margin-top: 76px; }

/* The sign-in window. */
.signin-dialog {
  width: min(420px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
}
.signin-dialog[open] { display: grid; gap: 10px; animation: rise 0.2s ease; }
.signin-dialog::backdrop { background: rgb(0 0 0 / 0.45); backdrop-filter: blur(2px); }
.signin-dialog .card-head { margin-bottom: 0; }
.signin-dialog .card-head form { margin: 0; }
@media (prefers-reduced-motion: reduce) { .signin-dialog[open] { animation: none; } }

.transcript-form { display: grid; gap: 6px; margin-block: 12px; }
.transcript-form input { flex: 1; min-width: 0; }
.room-notices { grid-column: 1 / -1; }
#room-notices { padding-left: 22px; max-height: 240px; overflow: auto; }
#room-notices li { padding-block: 8px; }
