:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --ink: #17202a;
  --muted: #647184;
  --line: #dce2ea;
  --accent: #16a085;
  --accent-2: #f2b705;
  --danger: #d94d3f;
  --dark: #101418;
  --dark-2: #171d23;
  --dark-3: #202832;
  --white: #ffffff;
  --shadow: 0 18px 48px rgba(27, 39, 51, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.page {
  min-height: 100vh;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

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

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

.wallet-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wallet-address {
  color: var(--muted);
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

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

.btn-primary {
  background: var(--accent);
  color: var(--white);
}

.btn-dark {
  background: var(--dark);
  color: var(--white);
}

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

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-icon {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 32px;
  align-items: stretch;
  padding: 48px 0 64px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 540px;
}

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

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

h1 {
  margin-bottom: 18px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.96;
}

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

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.panel {
  align-self: center;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.panel p {
  color: var(--muted);
  line-height: 1.55;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

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

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(22, 160, 133, 0.12);
}

.divider {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
}

.status-line {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

.join-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 28px;
  align-items: start;
  padding: 32px 0 60px;
}

.room-card,
.preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.room-card {
  padding: 24px;
}

.room-code {
  display: inline-flex;
  margin-bottom: 16px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}

.room-title {
  margin-bottom: 10px;
  font-size: 30px;
}

.room-meta {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  color: var(--muted);
}

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

.preview-card {
  overflow: hidden;
}

.preview-video {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  background: #111920;
  color: var(--white);
}

.preview-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.control-pair {
  display: flex;
  gap: 8px;
}

.meeting-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--dark);
  color: var(--white);
}

.meeting-shell {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
}

.meeting-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 20, 24, 0.96);
}

.meeting-title {
  min-width: 0;
}

.meeting-title strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meeting-title span {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.meeting-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
}

.stage {
  display: grid;
  min-height: 0;
  padding: 14px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: minmax(150px, 1fr);
  gap: 12px;
  min-height: 0;
}

.tile {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--dark-2);
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0b0e11;
}

.tile[data-screen='true'] {
  grid-column: 1 / -1;
  min-height: min(62vh, 680px);
}

.tile-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.54);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--dark-2);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.member-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding: 12px;
}

.member {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: var(--dark-3);
}

.member-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.member small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.62);
  text-overflow: ellipsis;
}

.host-tools {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.meeting-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 78px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 20, 24, 0.96);
}

.meeting-controls .btn {
  background: var(--dark-3);
  color: var(--white);
}

.meeting-controls .is-active {
  background: var(--accent);
}

.meeting-controls .is-off {
  background: #3a2021;
}

.meeting-controls .leave {
  background: var(--danger);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--dark);
  color: var(--white);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast[data-type='error'] {
  background: var(--danger);
}

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

  .hero {
    padding-top: 24px;
  }

  .hero-copy {
    min-height: auto;
    padding: 36px 0 6px;
  }

  .meeting-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 64px 0 78px auto;
    width: min(340px, 92vw);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 12;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .meeting-controls {
    overflow-x: auto;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .meeting-controls::-webkit-scrollbar {
    display: none;
  }

  .meeting-controls .btn {
    flex: 0 0 auto;
    min-width: 68px;
    min-height: 48px;
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

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

  h1 {
    font-size: 42px;
  }

  .topbar {
    min-height: 62px;
  }

  .wallet-area {
    gap: 6px;
  }

  .wallet-address {
    display: none;
  }

  .panel,
  .room-card {
    padding: 18px;
  }

  .preview-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .control-pair {
    justify-content: center;
  }
}
