:root {
  --bg: #1c2027;
  --panel: #242932;
  --panel-2: #2c323c;
  --line: #363d48;
  --text: #e6e9ee;
  --muted: #8b93a1;
  --amber: #f0b35b;     /* the only accent: speaking + talk key */
  --danger: #e05a5a;
  --radius: 6px;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--radius); padding: 6px 12px; }
button.primary { background: var(--amber); color: #1c2027; border-color: transparent; font-weight: 600; }
button.ghost { background: transparent; }
button.small { padding: 3px 8px; font-size: 12px; }
button:hover { border-color: var(--muted); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
input, select { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; }
kbd { background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 7px; font-family: inherit; }
[hidden] { display: none !important; }

/* ---- Join ---- */
.join { height: 100%; display: grid; place-items: center; }
.join-card { width: 360px; display: flex; flex-direction: column; gap: 14px; }
.join-card h1 { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -0.5px; }
.join-card .lede { margin: -8px 0 8px; color: var(--muted); }
.join-card label { display: flex; flex-direction: column; gap: 5px; }
.join-card small { color: var(--muted); }
.error { color: var(--danger); margin: 0; }

/* ---- App layout ---- */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas: "people feed" "bar bar";
}
.people { grid-area: people; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.people header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.people ul { list-style: none; margin: 0; padding: 8px; overflow: auto; }
.people li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 8px 8px; border-radius: var(--radius); }
.people li .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); transition: background .08s; }
.people li.speaking .dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(240,179,91,.18); }
.people li.speaking { background: var(--panel-2); }
.people li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people li input[type=range] { width: 60px; padding: 0; accent-color: var(--muted); }
.people li.me .name::after { content: " (you)"; color: var(--muted); }

/* ---- Feed ---- */
.feed-wrap { grid-area: feed; position: relative; display: flex; flex-direction: column; min-width: 0; }
.feed { flex: 1; overflow: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.feed .empty { margin: auto; color: var(--muted); max-width: 40ch; text-align: center; line-height: 1.5; }
.item { max-width: 720px; }
.item .meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.item .meta b { color: var(--text); font-weight: 600; }
.item img, .item video { max-width: 100%; max-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); display: block; background: #000; }
.item img { cursor: zoom-in; }
.item .text { white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.item.system .text { color: var(--muted); font-size: 12px; }

.chat-bar { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); }
.chat-bar input[type=text], .chat-bar #chat-input { flex: 1; }

.drop { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(28,32,39,.85); border: 2px dashed var(--amber); font-size: 20px; }
.upload-status { position: absolute; bottom: 60px; right: 20px; background: var(--panel-2); border: 1px solid var(--line); padding: 6px 12px; border-radius: var(--radius); font-size: 12px; }

/* ---- Bottom bar ---- */
.bar {
  grid-area: bar;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--panel); border-top: 1px solid var(--line);
}
.talk { display: flex; align-items: center; gap: 10px; }
.light { width: 14px; height: 14px; border-radius: 50%; background: var(--line); transition: background .06s; }
.light.on { background: var(--amber); box-shadow: 0 0 0 5px rgba(240,179,91,.2); }
.light.armed { background: #4d7a5a; }
.mode { display: flex; gap: 14px; color: var(--muted); }
.mode label { display: flex; align-items: center; gap: 5px; }
.mode input { accent-color: var(--amber); }
.devices { display: flex; gap: 14px; margin-left: auto; color: var(--muted); }
.devices label { display: flex; align-items: center; gap: 6px; }
.devices select { max-width: 200px; padding: 4px 6px; }
#mute-all.active { border-color: var(--danger); color: var(--danger); }

/* ---- Lightbox ---- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: grid; place-items: center; cursor: zoom-out; z-index: 10; }
.lightbox img { max-width: 96vw; max-height: 96vh; }

/* ---- GuildVoice additions ---- */
.app { grid-template-columns: 260px 1fr; }
.side { grid-area: people; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.role { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.role.liege { color: var(--amber); }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.liege { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.targets { display: flex; flex-wrap: wrap; gap: 6px; }
.targets button { padding: 4px 10px; font-size: 13px; }
.targets button.active { background: var(--amber); color: #1c2027; border-color: transparent; font-weight: 600; }
.banner { margin: 10px 14px 0; padding: 8px 10px; border-radius: var(--radius); background: rgba(240,179,91,.12); border: 1px solid rgba(240,179,91,.4); font-size: 12px; }
.banner.live { background: rgba(240,179,91,.28); }
.groups { flex: 1; overflow: auto; padding: 8px; }
.group { margin-bottom: 8px; }
.group > .gh { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 4px; font-weight: 600; font-size: 13px; }
.group > .gh .count { color: var(--muted); font-weight: 400; font-size: 12px; }
.group.mine > .gh { color: var(--amber); }
.group.targeted > .gh::after { content: "◂ speaking"; color: var(--amber); font-weight: 400; font-size: 11px; }
.group ul { list-style: none; margin: 0; padding: 0; }
.group li { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--radius); font-size: 13px; }
.group li .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.group li.speaking .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(240,179,91,.18); }
.group li.speaking { background: var(--panel-2); }
.group li .tag { color: var(--muted); font-size: 11px; }
.group li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group li.me .name::after { content: " (you)"; color: var(--muted); }
.group li.muted { opacity: .5; }
.group li button.act { padding: 1px 6px; font-size: 11px; opacity: 0; }
.group li:hover button.act { opacity: 1; }
.admin { padding: 10px 14px; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--line); background: var(--panel); }
.tab { border: none; background: transparent; padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; border-radius: 0; }
.tab.active { color: var(--text); border-bottom-color: var(--amber); }
.tab .badge { display: inline-block; min-width: 8px; height: 8px; border-radius: 50%; background: var(--amber); margin-left: 6px; vertical-align: middle; }
.item.liege .meta b { color: var(--amber); }
.menu { position: fixed; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; z-index: 20; display: flex; flex-direction: column; min-width: 160px; }
.menu button { border: none; background: transparent; text-align: left; padding: 6px 10px; }
.menu button:hover { background: var(--panel); }
.menu .sep { border-top: 1px solid var(--line); margin: 4px 0; }
