:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #121b2d;
  --panel-border: #1f2b43;
  --text: #f3f6fb;
  --muted: #9cb0cd;
  --primary: #7ce7ba;
  --primary-hover: #94efc8;
  --secondary: #1a2640;
  --secondary-hover: #243353;
  --danger: #ea5b6f;
  --danger-hover: #f26b7d;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #09111d 0%, #0d1627 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

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

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

button:not(.secondary):not(.danger) {
  color: #06111b;
  background: var(--primary);
}

button:not(.secondary):not(.danger):hover:not(:disabled) {
  background: var(--primary-hover);
}

button.secondary {
  color: var(--text);
  background: var(--secondary);
}

button.secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
}

button.danger {
  color: #fff;
  background: var(--danger);
}

button.danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

input {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  color: var(--text);
  background: #0d1626;
}

input:focus {
  outline: 0;
  border-color: #35548b;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #08131e;
  font-weight: 800;
  background: linear-gradient(135deg, #7ce7ba, #90baff);
}

.brand h1,
.brand p,
.panel-head h2 {
  margin: 0;
}

.brand p {
  color: var(--muted);
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-chip {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  color: var(--muted);
  background: #10192a;
}

.sidebar,
.main {
  display: grid;
  gap: 18px;
}

.panel,
.stage,
.controls {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
}

.participants-list {
  display: grid;
  gap: 10px;
}

.participant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #0f1728;
}

.participant-item strong {
  font-size: 0.95rem;
}

.participant-item span {
  color: var(--muted);
  font-size: 0.85rem;
}

.panel-chat {
  min-height: 320px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-messages {
  display: grid;
  gap: 10px;
  overflow: auto;
  align-content: start;
}

.chat-message {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #0f1728;
}

.chat-message strong {
  display: block;
  margin-bottom: 4px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
}

.main {
  grid-template-rows: 1fr auto;
  min-width: 0;
}

.stage {
  padding: 16px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.video-grid:empty::before {
  content: "Подключитесь к комнате";
  display: grid;
  place-items: center;
  min-height: 360px;
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: #0d1626;
}

.video-tile {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #08111d;
}

.video-tile video {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  background: #08111d;
}

.tile-meta {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(6, 10, 18, 0.72);
}

.tile-meta strong {
  display: block;
}

.tile-meta span {
  color: var(--muted);
  font-size: 0.85rem;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .header {
    display: grid;
  }
}

@media (max-width: 720px) {
  .layout {
    padding: 12px;
  }

  .header-actions,
  .chat-form,
  .controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .controls button {
    width: 100%;
  }
}
