:root {
  --bg: #17181d;
  --guild: #101116;
  --rail: #202229;
  --stage: #262932;
  --tile: #111318;
  --tile-soft: #1b1e26;
  --panel: #2e323d;
  --panel-2: #383d49;
  --text: #f2f4f8;
  --muted: #a7adbb;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #23a995;
  --accent-2: #1f7fc9;
  --danger: #e05252;
  font-family: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.app {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(35, 169, 149, 0.14), transparent 35%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 18px),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, opacity 120ms ease;
}

button:hover {
  background: var(--panel-2);
  transform: translateY(-1px);
}

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

button.primary {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 18px;
  background: linear-gradient(180deg, var(--accent), #158273);
  font-weight: 800;
}

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

input:focus {
  border-color: rgba(35, 169, 149, 0.8);
  box-shadow: 0 0 0 3px rgba(35, 169, 149, 0.15);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

.home {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
}

.home-card {
  display: grid;
  gap: 26px;
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 30px;
  background: rgba(32, 34, 41, 0.86);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

.brand {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), transparent 42%),
    var(--accent);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.brand h1,
.join-card h2,
.rail h2 {
  margin: 0;
}

.brand p,
.rail p {
  margin: 5px 0 0;
  color: var(--muted);
}

.room-form {
  display: grid;
  gap: 14px;
}

.call {
  display: grid;
  grid-template-columns: 72px 260px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.guild {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 14px;
  padding: 14px 0;
  background: var(--guild);
}

.rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 20px;
  background: var(--rail);
  border-right: 1px solid var(--line);
}

.peer-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
}

.peer-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-2);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.peer-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-card {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
}

.status-card strong {
  color: var(--text);
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  padding: 18px;
  background: var(--stage);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  align-content: start;
  gap: 14px;
  min-height: 0;
}

.video-tile {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--tile);
}

.video-tile video {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  background: var(--tile);
}

.peer-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: linear-gradient(135deg, rgba(35, 169, 149, 0.16), rgba(0, 0, 0, 0.35));
}

.peer-placeholder.hidden {
  display: none;
}

.video-tile.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(35, 169, 149, 0.16), transparent),
    var(--tile-soft);
}

.video-tile.empty strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 22px;
}

.tile-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 9px 11px;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(12px);
}

.dock {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 14px 0 2px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex: 0 0 48px;
}

.icon-btn.active {
  background: var(--accent);
}

.icon-btn.off {
  background: var(--danger);
}

.icon-btn.danger {
  background: var(--danger);
}

.join-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 11, 15, 0.72);
  backdrop-filter: blur(10px);
}

.join-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  background: #242731;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

@media (max-width: 900px) {
  .call {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .rail {
    display: none;
  }

  .stage {
    padding: 12px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 12px;
  }
}

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

  .guild {
    display: none;
  }

  .home {
    padding: 14px;
  }

  .home-card {
    padding: 20px;
    gap: 18px;
  }

  .brand {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 12px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 14px;
  }

  .stage {
    padding: 8px 8px 0;
  }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-bottom: 8px;
  }

  .video-tile {
    border-radius: 9px;
  }

  .tile-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    min-height: 38px;
    padding: 7px 9px;
    font-size: 13px;
  }

  .dock {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(38, 41, 50, 0), rgba(38, 41, 50, 0.92) 35%);
  }

  .icon-btn {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .join-modal {
    place-items: end center;
    padding: 12px;
  }

  .join-card {
    width: 100%;
    max-width: 420px;
    padding: 18px;
    border-radius: 10px;
  }
}
