:root {
  --bg-0: #030712;
  --bg-1: #0b1220;
  --bg-2: #111a2f;
  --surface: rgb(9 15 28 / 78%);
  --surface-strong: rgb(9 15 28 / 92%);
  --border: rgb(148 163 184 / 18%);
  --text: #e5ecff;
  --muted: #93a2c7;
  --primary: #5b8cff;
  --primary-strong: #4a79ea;
  --success: #4ccb74;
  --danger: #ff6b6b;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 11px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 700px at 85% -20%, rgb(37 99 235 / 28%), transparent 60%),
    radial-gradient(900px 540px at -10% 5%, rgb(14 165 233 / 24%), transparent 62%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

.layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(820px, 100%);
  background: linear-gradient(180deg, rgb(18 28 48 / 62%) 0%, rgb(7 12 24 / 82%) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow:
    0 32px 80px rgb(2 6 23 / 60%),
    inset 0 1px 0 rgb(255 255 255 / 5%);
  backdrop-filter: blur(8px);
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.015em;
  color: var(--text);
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  font-weight: 700;
}

p,
span,
label,
div {
  color: inherit;
}

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

.page-nav {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(17 25 43 / 78%);
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.auth-page,
.app-page {
  margin-top: 8px;
}

.card label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  color: #bac6e4;
}

.card input,
.card select {
  width: 100%;
  height: 44px;
  border: 1px solid rgb(148 163 184 / 24%);
  border-radius: var(--radius-md);
  padding: 0 13px;
  background: rgb(11 19 35 / 72%);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.card input:focus,
.card select:focus {
  outline: none;
  border-color: rgb(91 140 255 / 88%);
  box-shadow: 0 0 0 3px rgb(91 140 255 / 20%);
  background: rgb(11 19 35 / 92%);
}

.card button:not(.dropdown-item):not(.btn) {
  height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-weight: 600;
  color: #f8fbff;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%);
  transition: transform 0.14s ease, filter 0.18s ease;
}

.card button:not(.dropdown-item):not(.btn):hover {
  filter: brightness(1.06);
}

.card button:not(.dropdown-item):not(.btn):active {
  transform: translateY(1px);
}

.card button.secondary:not(.dropdown-item):not(.btn) {
  background: rgb(51 65 95 / 92%);
}

.nav-btn {
  border-radius: 999px !important;
  height: 34px !important;
  padding: 0 14px !important;
  font-size: 0.92rem;
}

.nav-btn.active {
  color: #fff;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%) !important;
}

.app-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.app-topbar .dropdown-menu {
  min-width: 215px;
  margin-top: 8px !important;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: 0 16px 35px rgb(2 6 23 / 55%);
}

.app-topbar .dropdown-item {
  border-radius: 10px;
  color: #d4def6;
}

.app-topbar .dropdown-item:hover,
.app-topbar .dropdown-item:focus {
  background: rgb(91 140 255 / 16%);
}

.app-topbar .dropdown-item.nav-btn.active {
  color: #fff;
  background: rgb(91 140 255 / 30%);
}

.hamburger-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgb(148 163 184 / 34%);
  background: rgb(17 25 43 / 72%);
}

.hamburger-btn:hover {
  background: rgb(28 40 66 / 88%);
}

.hamburger-btn span {
  font-size: 1.2rem;
  line-height: 1;
}

.room-list-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.app-row {
  display: flex;
  gap: 10px;
}

.rooms-list {
  display: grid;
  gap: 8px;
}

.room-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgb(10 18 35 / 76%);
  color: #c9d7f6;
}

.messages {
  min-height: 180px;
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgb(8 14 28 / 82%);
}

.voice-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgb(8 14 28 / 68%);
}

.message {
  max-width: 95%;
  width: fit-content;
  border-radius: 10px;
  padding: 8px 10px;
  word-break: break-word;
}

.message.self {
  margin-left: auto;
  background: rgb(91 140 255 / 33%);
}

.message.peer {
  background: rgb(55 65 81 / 68%);
}

.debug-log {
  min-height: 150px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgb(6 10 20 / 96%);
  color: #a8b5d6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.status {
  margin-top: 14px;
  min-height: 1.3em;
  color: var(--success);
  font-weight: 600;
}

@media (max-width: 640px) {
  .layout {
    padding: 14px;
  }

  .card {
    padding: 14px;
  }

  .app-row {
    flex-direction: column;
  }
}
