@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #1e1f22;
  --panel: #2b2d31;
  --panel-soft: #313338;
  --line: #3a3d44;
  --text: #f2f3f5;
  --muted: #b5bac1;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --ok: #23a55a;
  --bubble-me: #4e5d94;
  --bubble-peer: #383a40;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: Manrope, 'Segoe UI', sans-serif;
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.brand p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted {
  color: var(--muted);
}

.status-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6d7280;
}

.dot.online {
  background: var(--ok);
  box-shadow: 0 0 0 2px rgba(35, 165, 90, 0.25);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.icon-btn:hover {
  background: #3a3d44;
}

.chat-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  overflow: hidden;
}

.chat-header {
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.chat-header h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

.messages {
  padding: 16px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  overscroll-behavior: contain;
}

.bubble {
  max-width: min(72%, 760px);
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.35;
  border: 1px solid transparent;
}

.bubble.me {
  align-self: flex-end;
  background: var(--bubble-me);
}

.bubble.peer {
  align-self: flex-start;
  background: var(--bubble-peer);
}

.bubble.system {
  align-self: center;
  background: #3e3f45;
  color: #f0b232;
}

.bubble .meta {
  display: block;
  margin-top: 4px;
  font-size: 0.74rem;
  color: #c9ccd1;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  bottom: 0;
}

textarea,
button {
  font: inherit;
}

#message-input,
#invite-input,
#voice-invite-input {
  width: 100%;
  background: #1f2124;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  resize: none;
  outline: none;
}

#message-input {
  max-height: 140px;
}

textarea:focus {
  border-color: #5965f27c;
}

button {
  border: none;
  border-radius: 8px;
  padding: 9px 13px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
}

button:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: #4f545c;
}

button.secondary:hover {
  background: #5d6269;
}

button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(360px, 92vw);
  padding: 12px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 10px;
  z-index: 50;
  transform: translateX(-105%);
  transition: transform 180ms ease;
  overflow-y: auto;
}

.menu-drawer.open {
  transform: translateX(0);
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-header h2 {
  margin: 0;
  font-size: 1rem;
}

.menu-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.menu-card h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
}

.stack {
  display: grid;
  gap: 8px;
}

.voice-stack button {
  width: 100%;
}

.caption {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.mono {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.77rem;
}

.block {
  margin: 8px 0;
  word-break: break-all;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (min-width: 1100px) {
  .menu-drawer {
    width: 340px;
  }
}

@media (max-width: 640px) {
  .brand p {
    max-width: 48vw;
  }

  .messages {
    padding: 12px;
    gap: 8px;
  }

  .bubble {
    max-width: 84%;
  }
}
