:root {
  --bg: #10110e;
  --bg-2: #1b1d16;
  --bg-3: #26291f;
  --line: rgba(230, 236, 214, 0.14);
  --text: #f4f6ee;
  --muted: #a3ab96;
  --accent: #e2ff57;
  --accent-ink: #1a2200;
  --danger: #e15a45;
  --ok: #b6f2c4;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(880px 380px at 0% -10%, rgba(226, 255, 87, 0.09), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

#app { min-height: 100vh; }

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-size: 22px;
}

.mark i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--accent);
  display: block;
}

.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.card {
  background: rgba(24, 26, 21, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.actions { display: grid; gap: 12px; }

button.primary, button.ghost, button.danger-text {
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 14px 16px;
  text-align: left;
}

button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
button.ghost { background: var(--bg-3); border-color: var(--line); }
button.danger-text { background: transparent; color: #ffb4a8; border-color: var(--line); }
button:disabled { opacity: 0.55; cursor: default; }

label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select {
  background: #12140f;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
}

.list { display: grid; gap: 10px; margin-top: 14px; }
.meet {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  background: #141610;
  border: 1px solid var(--line);
}
.meet a { font-weight: 650; text-decoration: none; }
.badge {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  padding: 4px 8px;
}
.badge.ended { background: #3a3d34; color: var(--muted); }
.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(226, 255, 87, 0.12);
}

.login { max-width: 420px; margin: 12vh auto; display: grid; gap: 14px; }

.prejoin, .waiting, .done {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.prejoin .panel, .waiting .panel, .done .panel {
  width: min(860px, 100%);
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  gap: 18px;
}
.preview {
  position: relative;
  background: #000;
  border-radius: 22px;
  min-height: 320px;
  overflow: hidden;
}
.preview video, .tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #070806;
}
.preview video { min-height: 320px; transform: scaleX(-1); }

.room {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #0b0c09;
}
.room-bar, .controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.room-bar strong { font-size: 16px; }
.stage, .grid { padding: 0 16px; }
.stage:empty, .lobby:empty { display: none; }
.stage {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 38vh;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-content: start;
  padding-bottom: 12px;
}
.tile {
  position: relative;
  background: #15170f;
  border-radius: 18px;
  min-height: 180px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.tile.screen { min-height: 38vh; }
.tile .name, .tile .hand {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}
.tile .hand { left: auto; right: 10px; bottom: auto; top: 10px; }
.tile.local video { transform: scaleX(-1); }
.tile.screen video { transform: none; }
.tile .kick {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.55);
}

.controls { justify-content: center; }
.controls .group, .reacts { display: flex; gap: 8px; align-items: center; }
.controls button.round {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 0;
  background: var(--bg-3);
}
.controls button.round.on { background: var(--accent); color: var(--accent-ink); }
.controls button.round.off { background: var(--danger); color: white; }
.controls button.leave { background: var(--danger); color: white; width: auto; padding: 0 16px; }

.side {
  position: fixed;
  top: 64px;
  right: 16px;
  bottom: 92px;
  width: min(340px, calc(100% - 32px));
  background: rgba(18, 20, 15, 0.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: none;
  grid-template-rows: auto 1fr auto;
  padding: 12px;
  z-index: 3;
}
.side.open { display: grid; }
.chat-log { overflow: auto; display: grid; align-content: start; gap: 8px; }
.chat-log p { margin: 0; }
.chat-log span { color: var(--muted); font-size: 12px; }
.lobby {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px 8px;
}
.lobby article {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-2);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
}
.audio-sink { position: absolute; width: 0; height: 0; overflow: hidden; }

@media (max-width: 800px) {
  .hero, .prejoin .panel, .waiting .panel { grid-template-columns: 1fr; }
  .side { top: auto; bottom: 88px; height: 46vh; }
}
