:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #1b1f22;
  --panel-2: #242a2e;
  --text: #f5f0e8;
  --muted: #aeb7b7;
  --line: #343b40;
  --accent: #e05f3f;
  --accent-2: #36a786;
  --danger: #ff9b8b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(224, 95, 63, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(54, 167, 134, 0.12), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

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

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121618;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

input:focus {
  border-color: var(--accent-2);
}

label {
  display: block;
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 28px 0;
  font-weight: 800;
  letter-spacing: 0;
}

.brand.compact {
  padding: 0;
}

.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
}

.lobby {
  min-height: 100vh;
}

.lobby-grid {
  min-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: 48px;
  align-items: center;
  padding-bottom: 48px;
}

.eyebrow {
  color: var(--accent-2);
  font-weight: 800;
  margin: 0 0 18px;
}

.intro h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.7;
}

.panel,
.control-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 31, 34, 0.92);
  padding: 22px;
}

.primary {
  width: 100%;
  border: 0;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.danger-btn {
  width: 100%;
  margin-top: 10px;
  border-color: rgba(255, 155, 139, 0.5);
  color: var(--danger);
}

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 6px;
  color: var(--muted);
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.join-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.room {
  padding: 28px 0 36px;
}

.room-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}

.room-header h1 {
  margin: 10px 0 0;
  font-size: 28px;
}

.code-box {
  display: grid;
  gap: 7px;
  justify-items: end;
  color: var(--muted);
}

.code-box button {
  padding: 0 18px;
  font-weight: 900;
  color: var(--text);
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.watch-layout.viewer-only {
  grid-template-columns: 1fr;
}

.stage {
  position: relative;
  min-height: 62vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050606;
}

.fullscreen-btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  min-height: 40px;
  padding: 0 14px;
  background: rgba(18, 22, 24, 0.82);
  backdrop-filter: blur(8px);
}

.media {
  width: 100%;
  height: 100%;
  min-height: 62vh;
  border: 0;
  background: #050606;
}

.empty-state {
  min-height: 62vh;
  display: grid;
  place-content: center;
  padding: 28px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 10px;
}

.empty-state p,
.hint {
  color: var(--muted);
  line-height: 1.55;
}

.hint.small {
  margin: 0 0 14px;
  font-size: 13px;
}

.side {
  display: grid;
  align-content: start;
  gap: 14px;
}

.side.guest-only {
  display: none;
}

.control-card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.media-controls {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.legacy-controls {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.legacy-controls summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.mode-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.mode-row input {
  width: auto;
  min-height: auto;
}

.remote {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.users {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.users li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.users li:last-child {
  border-bottom: 0;
}

.external {
  display: block;
  color: var(--accent-2);
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .lobby-grid,
  .watch-layout {
    grid-template-columns: 1fr;
  }

  .lobby-grid {
    align-items: start;
    gap: 24px;
  }

  .intro h1 {
    font-size: 42px;
  }

  .room-header {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
  }

  .join-row,
  .remote {
    grid-template-columns: 1fr;
  }

  .room-header {
    display: grid;
  }

  .code-box {
    justify-items: stretch;
  }
}
