:root {
  --bg: #0a0a0a;
  --card: #141414;
  --line: #2a2a2a;
  --red: #e53935;
  --gold: #f5d76e;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --online: #22c55e;
  --sleep: #64748b;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.hidden { display: none !important; }
.gate {
  min-height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center;
}
.gate .logo { width: 120px; height: auto; }
.gate p { color: var(--muted); max-width: 320px; line-height: 1.45; }
.app {
  height: 100%; max-width: 560px; margin: 0 auto;
  display: grid; grid-template-rows: auto auto 1fr auto;
}
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #0f0f0f;
}
.logo-sm { width: 42px; height: 42px; border-radius: 50%; }
.brand { font-weight: 800; color: var(--red); letter-spacing: .02em; }
.room { font-size: .92rem; font-weight: 700; }
.meta { font-size: .72rem; color: var(--muted); }
.icon-btn {
  margin-left: auto; appearance: none; border: 1px solid var(--line);
  background: var(--card); color: #fff; border-radius: 10px; padding: 8px 10px; font-size: 1.1rem;
}
.toolbar {
  display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #101010;
}
.seg {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.seg select {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: #fff;
  border-radius: 10px; padding: 8px 10px; font-size: .9rem;
}
.msgs {
  overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.bubble {
  max-width: 88%; padding: 10px 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
}
.bubble.me { align-self: flex-end; background: rgba(229,57,53,.18); border-color: rgba(229,57,53,.35); }
.bubble .who { font-size: .68rem; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.bubble .when { font-size: .62rem; color: #666; margin-top: 6px; }
.bubble audio { width: 100%; margin-top: 6px; }
.compose {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line); background: #0f0f0f;
}
.compose input {
  border: 1px solid var(--line); background: var(--card); color: #fff;
  border-radius: 12px; padding: 12px; font-size: 1rem;
}
.send, .ptt {
  appearance: none; border: 0; border-radius: 12px; font-weight: 800; padding: 12px 14px; color: #fff;
}
.send { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.ptt {
  background: #1f1f1f; border: 1px solid var(--line) !important; font-size: .78rem; min-width: 88px;
}
.ptt.recording { background: var(--red); border-color: var(--red) !important; }
.sheet {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: flex-end; justify-content: center; z-index: 40;
}
.sheet-panel {
  width: min(560px, 100%); max-height: 78vh; overflow: auto;
  background: #121212; border-radius: 18px 18px 0 0; padding: 14px;
  border: 1px solid var(--line);
}
.sheet-hd {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.sheet-hd button {
  appearance: none; border: 1px solid var(--line); background: transparent; color: #ccc;
  border-radius: 8px; padding: 6px 10px;
}
.host-row {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.host-row button {
  appearance: none; border: 0; background: transparent; color: #fff; text-align: left; padding: 0;
  font-weight: 700; font-size: .95rem;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.on { background: var(--online); }
.dot.off { background: var(--sleep); }
.map-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.map-btns a {
  flex: 1; text-align: center; text-decoration: none; color: #fff; font-weight: 700;
  padding: 12px; border-radius: 12px; background: #1a1a1a; border: 1px solid var(--line);
}
.map-btns a.gmaps { border-color: #3b82f6; }
.map-btns a.waze { border-color: #33ccff; color: #9fe8ff; }
.desktop-block {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center;
}
