:root {
  color-scheme: dark;
  --bg: #0b1120;
  --bg-accent: #111c34;
  --panel: rgba(13, 25, 47, 0.78);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --muted: #9eb1cd;
  --primary: #44d19f;
  --primary-strong: #1eb980;
  --danger: #ff7a7a;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.28);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(68, 209, 159, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(63, 132, 252, 0.22), transparent 26%),
    linear-gradient(160deg, var(--bg), #050916 60%, #0d1a2f);
}

button,
input {
  font: inherit;
}

.layout {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
  display: grid;
  gap: 20px;
}

.panel {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 0.98;
}

.lede {
  max-width: 56rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.actions {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  cursor: pointer;
  background: #dbe7ff;
  color: #0e1730;
  font-weight: 700;
  transition:
    transform 140ms ease,
    background 140ms ease,
    opacity 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

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

button.primary {
  background: linear-gradient(135deg, var(--primary), #8ef0c2);
}

.join-form {
  display: grid;
  gap: 8px;
}

.join-form label,
.video-meta span,
.chat-header span,
dt {
  color: var(--muted);
}

.join-controls,
.chat-form {
  display: flex;
  gap: 12px;
}

input {
  width: 100%;
  border: 1px solid rgba(158, 177, 205, 0.22);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  color: var(--text);
  background: rgba(4, 12, 24, 0.55);
}

input:focus {
  outline: 2px solid rgba(68, 209, 159, 0.35);
  outline-offset: 2px;
}

.status-grid {
  margin: 24px 0 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.status-grid div {
  padding: 16px;
  border-radius: 18px;
  background: rgba(5, 14, 29, 0.5);
}

dt {
  margin-bottom: 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

dd {
  margin: 0;
  font-weight: 700;
}

.status-message {
  margin-bottom: 0;
  min-height: 1.5rem;
}

.status-message.error {
  color: var(--danger);
}

.media-panel,
.chat-panel {
  padding: 22px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.video-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(5, 14, 29, 0.58);
}

.video-meta {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.video-meta h2,
.chat-header h2 {
  margin-bottom: 0;
}

video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  background: #02060d;
  object-fit: cover;
}

.chat-panel {
  display: grid;
  gap: 16px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.chat-log {
  min-height: 220px;
  max-height: 360px;
  overflow-y: auto;
  padding: 16px;
  border-radius: 20px;
  background: rgba(5, 14, 29, 0.58);
}

.chat-entry {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(158, 177, 205, 0.12);
}

.chat-entry.self {
  background: rgba(68, 209, 159, 0.16);
}

.chat-entry:last-child {
  margin-bottom: 0;
}

.chat-author {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 820px) {
  .layout {
    width: min(100% - 24px, 1200px);
    padding-top: 24px;
  }

  .status-grid,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .join-controls,
  .chat-form {
    flex-direction: column;
  }
}
