/* ===== Global ===== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: #1a1020;
  color: #ede4d8;
}

/* ===== Landing page ===== */

.landing {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg,
      #110b18 0%,
      #1a1020 15%,
      #2d1b3d 35%,
      #4a2545 50%,
      #6b3040 62%,
      #8b4035 74%,
      #6b3040 86%,
      #3a1e30 100%);
}

/* Soft radial glow behind the sun */
.landing-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -60%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle,
      rgba(200, 120, 60, 0.2) 0%,
      rgba(160, 80, 50, 0.08) 40%,
      transparent 70%);
  pointer-events: none;
}

.landing-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  max-width: 520px;
}

/* CSS sun circle */
.landing-sun {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%,
      #e8a060,
      #c06840 50%,
      #8b4035 100%);
  box-shadow:
    0 0 30px rgba(200, 120, 60, 0.5),
    0 0 80px rgba(160, 80, 50, 0.2);
  margin-bottom: 2.5rem;
  animation: sun-pulse 6s ease-in-out infinite;
}

@keyframes sun-pulse {

  0%,
  100% {
    box-shadow: 0 0 30px rgba(200, 120, 60, 0.5), 0 0 80px rgba(160, 80, 50, 0.2);
  }

  50% {
    box-shadow: 0 0 45px rgba(200, 120, 60, 0.6), 0 0 110px rgba(160, 80, 50, 0.3);
  }
}

.landing-title {
  font-size: 3rem;
  font-weight: 300;
  color: #ede4d8;
  text-shadow: 0 2px 16px rgba(200, 120, 60, 0.25);
  margin-bottom: 0.75rem;
}

.landing-tagline {
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.7;
  color: rgba(237, 228, 216, 0.75);
  max-width: 340px;
  margin-bottom: 2rem;
}

/* Thin decorative horizon line */
.landing-horizon {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      rgba(237, 228, 216, 0.25),
      transparent);
  margin-bottom: 2rem;
}

/* Room input form */
.room-form {
  display: flex;
  gap: 0;
  width: 100%;
  max-width: 340px;
  margin-bottom: 1.5rem;
}

.room-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(237, 228, 216, 0.15);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: #ede4d8;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.room-input::placeholder {
  color: rgba(237, 228, 216, 0.35);
}

.room-input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(200, 120, 60, 0.4);
}

.room-button {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.03em;
  color: #ede4d8;
  background: rgba(200, 120, 60, 0.25);
  border: 1px solid rgba(237, 228, 216, 0.15);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: background 0.2s;
}

.room-button:hover {
  background: rgba(200, 120, 60, 0.4);
}

.landing-sub {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: rgba(237, 228, 216, 0.4);
  margin-bottom: 3rem;
}

.landing-link {
  display: inline-block;
  padding: 0.5rem 1.4rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(237, 228, 216, 0.4);
  text-decoration: none;
  border: 1px solid rgba(237, 228, 216, 0.12);
  border-radius: 100px;
  transition: all 0.3s ease;
}

.landing-link:hover {
  color: rgba(237, 228, 216, 0.7);
  border-color: rgba(237, 228, 216, 0.3);
}

/* ===== Chat room ===== */

.room {
  display: flex;
  height: 100vh;
  background: #1a1020;
}

/* -- Sidebar -- */

.room-sidebar {
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(237, 228, 216, 0.08);
}

.room-sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(237, 228, 216, 0.08);
}

.room-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(237, 228, 216, 0.1);
  border-radius: 8px;
  color: rgba(237, 228, 216, 0.6);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.room-back:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ede4d8;
}

.room-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #ede4d8;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status indicator (clickable) */
.room-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 1px solid rgba(237, 228, 216, 0.06);
  background: transparent;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.room-status:hover {
  background: rgba(255, 255, 255, 0.03);
}

.room-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(237, 228, 216, 0.25);
  transition: background 0.3s;
}

.room-status-dot.room-status-online {
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.room-status-dot.room-status-connecting {
  background: #facc15;
  box-shadow: 0 0 6px rgba(250, 204, 21, 0.3);
  animation: status-pulse 1.5s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.room-status-text {
  flex: 1;
  font-size: 0.8rem;
  color: rgba(237, 228, 216, 0.5);
  text-align: left;
}

.room-status-chevron {
  font-size: 0.65rem;
  color: rgba(237, 228, 216, 0.25);
  margin-left: auto;
}

/* Node info panel (collapsible) */
.room-node-info {
  padding: 0.6rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(237, 228, 216, 0.06);
  background: rgba(0, 0, 0, 0.1);
}

.room-node-info-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.5rem;
}

.room-node-info-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(237, 228, 216, 0.35);
}

.room-node-info-value {
  font-size: 0.7rem;
  font-family: "SF Mono", "Fira Code", monospace;
  color: rgba(237, 228, 216, 0.55);
  word-break: break-all;
  line-height: 1.4;
}

.room-node-info-empty {
  font-size: 0.75rem;
  font-style: italic;
  color: rgba(237, 228, 216, 0.2);
}

.room-node-info-addrs {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.room-node-info-addr {
  font-size: 0.65rem;
  font-family: "SF Mono", "Fira Code", monospace;
  color: rgba(237, 228, 216, 0.45);
  word-break: break-all;
  line-height: 1.35;
  padding: 0.2rem 0.4rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

/* Scrollable sidebar body (between header and voice controls) */
.room-sidebar-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Peers list */
.room-peers {
  padding: 0.75rem 0;
}

.room-peers-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(237, 228, 216, 0.35);
  padding: 0 1rem 0.5rem;
}

.room-peers-empty {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: rgba(237, 228, 216, 0.25);
  font-style: italic;
}

.room-peers-list {
  list-style: none;
}

.room-peer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  transition: background 0.15s;
}

.room-peer:hover {
  background: rgba(255, 255, 255, 0.03);
}

.room-peer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.room-peer-id {
  font-size: 0.8rem;
  font-family: "SF Mono", "Fira Code", monospace;
  color: rgba(237, 228, 216, 0.65);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Voice controls */
.room-voice {
  padding: 1rem;
  border-top: 1px solid rgba(237, 228, 216, 0.08);
}

.room-voice-button {
  width: 100%;
  padding: 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: rgba(237, 228, 216, 0.8);
  background: rgba(200, 120, 60, 0.15);
  border: 1px solid rgba(200, 120, 60, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.room-voice-button:hover {
  background: rgba(200, 120, 60, 0.25);
}

.room-voice-button.room-voice-active {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.room-voice-button.room-voice-active:hover {
  background: rgba(239, 68, 68, 0.3);
}

.room-voice-status {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  min-height: 1.2rem;
}

.room-voice-indicator {
  font-size: 0.75rem;
  color: rgba(237, 228, 216, 0.35);
}

.room-voice-indicator.room-voice-indicator-active {
  color: #4ade80;
}

.room-voice-error {
  font-size: 0.75rem;
  color: #fca5a5;
  margin-top: 0.4rem;
}

/* -- Main chat area -- */

.room-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Messages */
.room-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.room-messages-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: rgba(237, 228, 216, 0.25);
}

.room-messages-empty-icon {
  font-size: 2.5rem;
  opacity: 0.5;
  margin-bottom: 0.5rem;
}

.room-messages-empty-sub {
  font-size: 0.8rem;
  color: rgba(237, 228, 216, 0.15);
}

/* Message bubbles */
.room-msg {
  max-width: 70%;
  padding: 0.1rem 0;
}

.room-msg-self {
  align-self: flex-end;
}

.room-msg-system {
  align-self: center;
  max-width: 90%;
}

.room-msg-sender {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(200, 120, 60, 0.7);
  margin-bottom: 0.15rem;
  padding-left: 0.75rem;
}

.room-msg-body {
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.room-msg .room-msg-body {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(237, 228, 216, 0.85);
}

.room-msg-self .room-msg-body {
  background: rgba(200, 120, 60, 0.2);
  color: #ede4d8;
}

.room-msg-system .room-msg-body {
  background: transparent;
  color: rgba(237, 228, 216, 0.35);
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
  padding: 0.3rem 0.75rem;
}

/* Chat input bar */
.room-input-bar {
  display: flex;
  gap: 0;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(237, 228, 216, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.room-chat-input {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(237, 228, 216, 0.1);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: #ede4d8;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.room-chat-input::placeholder {
  color: rgba(237, 228, 216, 0.3);
}

.room-chat-input:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(200, 120, 60, 0.3);
}

.room-send-button {
  padding: 0.7rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: rgba(237, 228, 216, 0.7);
  background: rgba(200, 120, 60, 0.2);
  border: 1px solid rgba(237, 228, 216, 0.1);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: all 0.2s;
}

.room-send-button:hover {
  background: rgba(200, 120, 60, 0.35);
  color: #ede4d8;
}

/* -- Responsive: collapse sidebar on small screens -- */

@media (max-width: 640px) {
  .room {
    flex-direction: column;
  }

  .room-sidebar {
    width: 100%;
    min-width: unset;
    max-height: 45vh;
    border-right: none;
    border-bottom: 1px solid rgba(237, 228, 216, 0.08);
  }

  .room-main {
    flex: 1;
    min-height: 0;
  }
}