:root {
  --bg-0: #0f1013;
  --bg-1: #15171b;
  --bg-2: #191b20;
  --bg-3: #202228;
  --bg-4: #292c33;
  --line: #30333a;
  --text: #f1f3f5;
  --muted: #9399a5;
  --red: #df3438;
  --red-dark: #9f272b;
  --green: #43d16d;
  --yellow: #e4b74d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-width: 320px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

.mobile-only { display: none; }

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(223,52,56,.14), transparent 34%),
    radial-gradient(circle at 80% 80%, rgba(223,52,56,.08), transparent 35%),
    #0f1013;
}

.login-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid #343840;
  border-radius: 18px;
  background: #181a1f;
  box-shadow: 0 28px 80px rgba(0,0,0,.42);
}

.brand {
  font-weight: 800;
  letter-spacing: -.6px;
}

.brand span { color: var(--red); }

.brand-large {
  font-size: 38px;
  margin-bottom: 4px;
}

.login-subtitle {
  margin-bottom: 24px;
  color: var(--muted);
}

.login-card label {
  display: block;
  margin-bottom: 7px;
  color: #b9bec7;
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #3a3e47;
  border-radius: 10px;
  outline: none;
  background: #111318;
  color: white;
}

.login-card input:focus { border-color: var(--red); }

.login-hint {
  margin-top: 13px;
  color: #7f8692;
  font-size: 12px;
  line-height: 1.45;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.btn:disabled {
  opacity: .45;
  cursor: default;
}

.btn-primary {
  background: var(--red);
}

.btn-primary:not(:disabled):hover {
  background: #ef3d42;
}

.login-card .btn { width: 100%; }

.app-shell {
  display: grid;
  grid-template-columns: 72px 260px minmax(0, 1fr) 250px;
  width: 100vw;
  height: 100vh;
}

.server-rail {
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  padding: 12px 10px;
  background: #101115;
  border-right: 1px solid #25282e;
}

.server-logo,
.server-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  color: white;
  cursor: pointer;
  transition: .15s ease;
}

.server-logo {
  border-radius: 15px;
  background: var(--red);
  font-size: 18px;
  font-weight: 800;
}

.server-icon {
  border-radius: 50%;
  background: #292c33;
  font-size: 13px;
  font-weight: 700;
}

.server-icon:hover,
.server-icon.active {
  border-radius: 15px;
  background: var(--red);
}

.server-icon.add {
  font-size: 23px;
  font-weight: 400;
}

.rail-separator {
  width: 34px;
  height: 1px;
  background: #30333a;
}

.channel-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #191b20;
  border-right: 1px solid #2b2e35;
}

.server-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid #2d3037;
}

.server-name {
  font-weight: 800;
  font-size: 15px;
}

.server-code {
  margin-top: 3px;
  color: #747b87;
  font-size: 11px;
}

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 18px;
}

.section-label {
  margin: 16px 7px 7px;
  color: #7f8793;
  font-size: 11px;
  font-weight: 800;
}

.channel {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #b5bbc5;
  cursor: pointer;
  text-align: left;
}

.channel:hover { background: #25282e; color: white; }

.channel.active {
  background: #30343c;
  color: white;
}

.channel.connected::after {
  content: "LIVE";
  margin-left: auto;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}

.sidebar-room-users {
  padding: 2px 0 5px 30px;
}

.sidebar-user {
  padding: 4px 5px;
  overflow: hidden;
  color: #9da4af;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user.speaking {
  color: #6de08b;
}

.user-panel {
  min-height: 72px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) repeat(3, 34px);
  align-items: center;
  gap: 7px;
  padding: 9px;
  border-top: 1px solid #2b2e35;
  background: #15171b;
}

.avatar,
.person-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #393d45;
  color: white;
  font-weight: 800;
}

.avatar {
  width: 38px;
  height: 38px;
  background: var(--red);
}

.user-meta { min-width: 0; }

.user-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-state {
  margin-top: 3px;
  overflow: hidden;
  color: #818894;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-state.connected { color: var(--green); }
.connection-state.connecting { color: var(--yellow); }
.connection-state.disconnected { color: #818894; }
.connection-state.error { color: #ff7074; }

.control-btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  background: #2a2d34;
  color: white;
  cursor: pointer;
}

.control-btn {
  width: 34px;
  height: 34px;
}

.control-btn:disabled {
  opacity: .35;
  cursor: default;
}

.control-btn.active {
  background: var(--red-dark);
}

.control-btn.leave:not(:disabled):hover { background: var(--red-dark); }

.icon-btn {
  min-width: 36px;
  height: 36px;
  font-size: 20px;
}

.main-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #202228;
}

.topbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid #30333a;
  background: #1e2025;
}

.topbar-title {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-status {
  margin-left: auto;
  color: #737b87;
  font-size: 11px;
}

.content-view {
  flex: 1;
  overflow-y: auto;
  padding: 26px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.eyebrow {
  margin-bottom: 6px;
  color: #808894;
  font-size: 11px;
  font-weight: 800;
}

.hero h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -.7px;
}

.hero p {
  max-width: 720px;
  margin: 8px 0 0;
  color: #969da8;
  line-height: 1.5;
}

.voice-stage,
.placeholder-card {
  width: min(760px, 100%);
  padding: 16px;
  border: 1px solid #343840;
  border-radius: 14px;
  background: #181a1f;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  color: #8a929e;
  font-size: 11px;
  font-weight: 800;
}

.voice-grid {
  display: grid;
  gap: 9px;
}

.voice-person {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: #24272d;
  transition: .12s ease;
}

.voice-person.speaking {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(67,209,109,.7), 0 0 20px rgba(67,209,109,.08);
}

.person-avatar {
  width: 42px;
  height: 42px;
}

.person-name {
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-state {
  color: #818894;
  font-size: 12px;
}

.voice-person.speaking .person-state {
  color: var(--green);
}

.empty-state,
.member-empty {
  padding: 18px 10px;
  color: #777f8b;
  font-size: 13px;
}

.notice {
  width: min(760px, 100%);
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #4b3b23;
  border-radius: 10px;
  background: #2d2619;
  color: #efc875;
  font-size: 13px;
  line-height: 1.45;
}

.notice.error {
  border-color: #5a292b;
  background: #2f1d1f;
  color: #ff898c;
}

.placeholder-card {
  text-align: center;
  padding: 48px 24px;
}

.placeholder-icon { font-size: 40px; }
.placeholder-title { margin-top: 14px; font-weight: 800; }
.placeholder-text { margin-top: 7px; color: #868e99; }

.member-panel {
  overflow-y: auto;
  padding: 18px 12px;
  border-left: 1px solid #2b2e35;
  background: #191b20;
}

.member-heading {
  margin-bottom: 10px;
  color: #7f8793;
  font-size: 11px;
  font-weight: 800;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border-radius: 8px;
  color: #bdc2ca;
}

.member-item.speaking {
  color: #79e397;
  background: #202b24;
}

.member-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #59606b;
}

.member-item.speaking .member-dot,
.member-item.local .member-dot {
  background: var(--green);
}

.remote-audio {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 72px 250px minmax(0, 1fr);
  }
  .member-panel { display: none; }
}

@media (max-width: 720px) {
  .mobile-only { display: inline-grid; place-items: center; }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .server-rail,
  .member-panel {
    display: none;
  }

  .channel-sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: min(84vw, 300px);
    transform: translateX(-105%);
    box-shadow: 20px 0 60px rgba(0,0,0,.4);
    transition: transform .18s ease;
  }

  .channel-sidebar.open { transform: translateX(0); }

  .topbar { padding: 0 13px; }
  .content-view { padding: 18px 14px 100px; }

  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .hero .btn { width: 100%; }

  .voice-person {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .person-state {
    grid-column: 2;
    margin-top: -8px;
  }

  .user-panel {
    padding-bottom: max(9px, env(safe-area-inset-bottom));
  }
}
