/* The page of the voice rooms (/vocal/): its own look, nothing of the site's. Dark, three columns (rooms, room, members); one column
   with sliding panels on a narrow screen. */
:root {
  --bg: #16181d; --panel: #1d2027; --panel-2: #252a33; --line: #323845; --text: #e6e8ee; --faint: #98a0b3; --accent: #7aa2ff; --accent-ink: #0d1424;
  --good: #4cc38a; --bad: #ff6b6b; --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
h1, h2 { margin: 0; font-weight: 600; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 8px; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
.faint { color: var(--faint); }
.bad { color: var(--bad); min-height: 1.2em; margin: 0; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text);
  font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { border-color: #6b2f37; color: #ffb3b3; }
.btn.primary.danger { background: #c94a4a; border-color: #c94a4a; color: #fff; }
.btn.round { width: 40px; height: 40px; padding: 0; border-radius: 50%; flex: none; }
.btn.round.off { background: #5a2630; border-color: #8a3b47; color: #ffd0d0; }
.btn.tiny { padding: 2px 6px; font-size: 13px; min-width: 26px; min-height: 26px; background: transparent; }
.btn.tiny svg { width: 15px; height: 15px; }
input[type="text"], textarea, select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; min-width: 0; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 13px; font-weight: 700; color: #fff; flex: none; }
.tag { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; color: var(--faint); }

/* The gate: an invitation to take, or nothing to see */
.gate { height: 100%; display: grid; place-items: center; padding: 16px; }
.gate-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.gate-card h1 { font-size: 20px; }
.logo { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.logo.big { width: 56px; height: 56px; border-radius: 14px; }
.join-form input { font-size: 17px; }
.gm-login summary { cursor: pointer; font-size: 13px; }
.gm-login form { margin-top: 10px; }

/* The page */
.shell { height: 100%; display: grid; grid-template: "top top top" auto "rooms room members" minmax(0, 1fr) / 220px minmax(0, 1fr) 250px; }
.top { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.room-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .me { padding: 3px 10px 3px 3px; border-radius: 20px; }
.top .me .avatar { width: 28px; height: 28px; font-size: 11px; }
.top .me:disabled { opacity: 1; }
.only-narrow { display: none; }
.rooms { grid-area: rooms; background: var(--panel); border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.room-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.room-link:hover { background: var(--panel-2); }
.room-link.current { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.room-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-voice { display: inline-flex; align-items: center; gap: 2px; color: var(--good); font-size: 12px; }
.room-voice svg { width: 14px; height: 14px; }
.room-new { margin-top: 8px; }
.room { grid-area: room; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.room.none { align-items: center; justify-content: center; }
.members { grid-area: members; background: var(--panel); border-left: 1px solid var(--line); padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.members h2 .count { text-transform: none; letter-spacing: 0; }

/* Voice */
.voice { border-bottom: 1px solid var(--line); background: #191c22; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.voice-chips { display: flex; flex-wrap: wrap; gap: 8px; max-height: 30vh; overflow-y: auto; }
.voice-empty { margin: 4px 0; }
.voice-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 24px; background: var(--panel-2); border: 1px solid var(--line); min-width: 0; }
.voice-chip .avatar { box-shadow: 0 0 0 2px transparent; transition: box-shadow .1s; }
.voice-chip.speaking .avatar { box-shadow: 0 0 0 3px var(--good); }
.voice-chip.muted .avatar { opacity: .6; }
.voice-chip.lost { border-color: #8a3b47; }
.voice-who { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.voice-name { font-weight: 600; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-note { font-size: 11px; }
.voice-note:empty { display: none; }
.voice-muted { color: var(--bad); display: inline-flex; }
.voice-muted svg { width: 16px; height: 16px; }
.vol { width: 90px; accent-color: var(--accent); }
.room-install { margin-top: 6px; }
.install-how { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.vol-box { display: inline-flex; align-items: center; gap: 4px; }
.vol-pct { font-size: 11px; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.voice-gm { display: inline-flex; gap: 2px; }
.voice-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.voice-controls .join svg { width: 18px; height: 18px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.btn.talk { touch-action: none; user-select: none; }
.btn.talk.on { background: var(--good); border-color: var(--good); color: #062014; }
.mic-pick { max-width: 190px; padding: 6px 8px; }

/* Conversation */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.chat.dropping::after { content: ""; position: absolute; inset: 6px; border: 2px dashed var(--accent); border-radius: var(--radius); pointer-events: none; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 4px; overflow-wrap: anywhere; }
.messages .empty { text-align: center; margin-top: 30px; }
.day { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--faint); font-size: 12px; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: flex; gap: 10px; padding: 2px 6px; margin-top: 10px; border-radius: 8px; position: relative; }
.msg.follows { margin-top: 0; }
.msg:hover { background: #1b1e25; }
.msg-gutter { width: 34px; flex: none; font-size: 10px; text-align: right; padding-top: 4px; visibility: hidden; }
.msg:hover .msg-gutter { visibility: visible; }
.msg-main { min-width: 0; flex: 1; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head time { font-size: 11px; }
.msg-by { font-weight: 600; }
.msg-text { white-space: pre-wrap; }
.edited { font-size: 11px; }
.msg-image { display: block; padding: 0; margin: 4px 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; overflow: hidden; max-width: 100%; }
.msg-image img { display: block; max-width: min(420px, 100%); max-height: 320px; border-radius: 8px; }
.msg-tools { position: absolute; top: -10px; right: 8px; display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1px; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: inline-flex; }
.msg-tools:empty { display: none !important; }
.msg-edit { width: 100%; resize: vertical; }
.compose { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
.compose-row { display: flex; align-items: flex-end; gap: 8px; }
.compose-field { flex: 1; resize: none; max-height: 160px; min-height: 40px; line-height: 1.4; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.thumbs:empty { display: none; }
.thumb { position: relative; display: inline-block; }
.thumb img { display: block; height: 72px; max-width: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumb .btn { position: absolute; top: -8px; right: -8px; background: var(--panel); border-radius: 50%; }

/* Members */
.member-list { display: flex; flex-direction: column; gap: 2px; }
.member { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 8px; }
.member .avatar { width: 28px; height: 28px; font-size: 11px; }
.member.offline { opacity: .5; }
.member-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-voice { display: inline-flex; color: var(--good); flex: none; }
.member-voice.off { color: var(--bad); }
.member-voice svg { width: 15px; height: 15px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #5b6272; flex: none; }
.member.online .dot { background: var(--good); }
.member .kick { visibility: hidden; }
.member:hover .kick, .member .kick:focus-visible { visibility: visible; }
.invite, .room-admin { display: flex; flex-direction: column; gap: 8px; }
.invite-link { font-size: 12px; width: 100%; }
.room-admin .btn { justify-content: flex-start; }

/* Windows and notes */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: min(420px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal h2 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0; }
.modal.image-modal { width: auto; max-width: 100%; }
.modal.image-modal h2 { display: none; }
.big-image { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 8px; cursor: zoom-out; }
.toasts { position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 60; pointer-events: none; width: max-content; max-width: calc(100% - 24px); }
.toast { background: #2c3340; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.toast.bad { border-color: #8a3b47; background: #3a2228; }

@media (max-width: 900px) {
  .shell { grid-template: "top" auto "room" minmax(0, 1fr) / minmax(0, 1fr); }
  .only-narrow { display: inline-flex; }
  .rooms, .members { position: fixed; top: 57px; bottom: 0; width: min(280px, 86vw); z-index: 20; transition: transform .18s; box-shadow: 0 0 30px rgba(0, 0, 0, .5); }
  .rooms { left: 0; transform: translateX(-105%); }
  .members { right: 0; transform: translateX(105%); }
  .shell.show-rooms .rooms, .shell.show-members .members { transform: none; }
  .top .me span:not(.avatar) { display: none; }
  .top .me { padding: 3px; }
  .member .kick { visibility: visible; }
  .msg-tools { display: inline-flex; position: static; background: none; border: 0; align-self: flex-start; opacity: .7; }
  .vol { width: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
