:root {
  color-scheme: dark;
  --bg: #202124;
  --tile: #3c4043;
  --ink: #e8eaed;
  --muted: #9aa0a6;
  --blue: #1a73e8;
  --blue-hover: #1765cc;
  --red: #ea4335;
  --off: #ea4335;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button, input { font: inherit; }

.hidden { display: none !important; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.lobby {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 420px);
  gap: 48px;
  align-items: center;
  padding: 40px 6vw;
}

.preview {
  position: relative;
  background: var(--tile);
  border-radius: 12px;
  overflow: hidden;
  min-height: 420px;
  aspect-ratio: 16 / 10;
}

.preview video,
.self video,
#remote {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #202124;
  display: block;
}

.allow-row {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: min(100% - 24px, 460px);
}

.preview-status {
  flex: 1 0 100%;
  margin: 4px 0 0;
  text-align: center;
  color: #e8eaed;
  font-size: 0.95rem;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.allow {
  border: 0;
  border-radius: 24px;
  background: var(--blue);
  color: #fff;
  padding: 12px 22px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.allow:hover { background: var(--blue-hover); }

.preview-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.round {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--tile);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
}

.round svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.round .icon-off { display: none; }
.round.is-off .icon-on { display: none; }
.round.is-off .icon-off { display: block; }
.round.is-off { background: var(--off); }

.round:hover { filter: brightness(1.15); }

.join-panel h1 {
  margin: 0 0 22px;
  font-size: 2rem;
  font-weight: 400;
}

.join-panel form {
  display: grid;
  gap: 16px;
  max-width: 320px;
}

input {
  background: transparent;
  color: var(--ink);
  border: 1px solid #5f6368;
  border-radius: 4px;
  padding: 14px 12px;
}

input:focus {
  outline: 2px solid var(--blue);
  border-color: transparent;
}

.join {
  justify-self: start;
  border: 0;
  border-radius: 24px;
  background: var(--blue);
  color: #fff;
  padding: 12px 24px;
  font-weight: 500;
  cursor: pointer;
}

.join:hover { background: var(--blue-hover); }
.join:disabled { opacity: 0.6; cursor: default; }

.hint {
  color: var(--muted);
  max-width: 320px;
  line-height: 1.45;
}

.cam-off {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--tile);
}

.person {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #5f6368;
  position: relative;
}

.person::before,
.person::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #202124;
}

.person::before {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  top: 18px;
}

.person::after {
  width: 46px;
  height: 22px;
  border-radius: 22px 22px 0 0;
  bottom: 16px;
}

.person.large { width: 120px; height: 120px; }

.meet {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 12px 16px 20px;
}

.meet-top {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 40px;
  color: var(--muted);
}

.meet-top strong { color: var(--ink); font-weight: 500; }
.meet-top time { margin-left: auto; }

.stage {
  position: relative;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

#remote { position: absolute; inset: 0; }

.remote-off {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  background: #202124;
}

.remote-off p { margin: 0; font-size: 1.25rem; }

.remote-mic {
  position: absolute;
  z-index: 4;
  left: 16px;
  bottom: 16px;
  margin: 0;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(32, 33, 36, 0.92);
  color: #fff;
  font-size: 0.95rem;
}

.wait {
  position: absolute;
  z-index: 3;
  inset: 0;
  margin: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  background: #202124;
}

.wait p { margin: 0; font-size: 1.25rem; }

.notice {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 10px 16px;
  border-radius: 8px;
  background: #1a73e8;
  color: #fff;
  font-size: 0.95rem;
  white-space: nowrap;
}

.self {
  position: absolute;
  z-index: 3;
  right: 16px;
  bottom: 16px;
  width: 220px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--tile);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.dock {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding-top: 16px;
}

.dock .round {
  width: 56px;
  height: 64px;
  border-radius: 0;
  background: transparent;
  padding-top: 4px;
}

.dock .round::before {
  content: "";
  position: absolute;
  top: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--tile);
}

.dock .round.is-off::before { background: var(--off); }
.dock .round svg { position: relative; z-index: 1; }

.dock .hangup::before { background: var(--red); }

.caption {
  position: absolute;
  top: 52px;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
}

@media (max-width: 800px) {
  .lobby {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 20px 16px 32px;
  }

  .preview { min-height: 240px; aspect-ratio: auto; height: 52vw; }
  .join-panel h1 { font-size: 1.5rem; }
  .self { width: 120px; height: 84px; right: 10px; bottom: 10px; }

  .shell.in-call {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 52vh) minmax(0, 1fr);
  }

  .shell.in-call .chat { min-height: 0; border-right: 0; border-top: 1px solid #3c4043; }
  .shell.in-call .meet { order: -1; min-height: 0; }
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.gate-card { width: min(100%, 420px); }

.brand {
  margin: 0 0 8px;
  color: #8ab4f8;
  font-weight: 500;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.shell.in-call {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.chat {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #17181b;
}

.shell.in-call .chat {
  min-height: 0;
  height: 100vh;
  border-right: 1px solid #3c4043;
}

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

.chat-top strong { display: block; font-size: 1.05rem; }

.chat-actions { display: flex; gap: 8px; align-items: center; }

.call-btn, .composer button {
  border: 0;
  border-radius: 20px;
  background: var(--blue);
  color: #fff;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 500;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 8px;
}

.incoming {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 16px 8px;
  padding: 12px;
  border-radius: 12px;
  background: #30343a;
}

.incoming p { margin: 0; flex: 1 0 160px; }

.log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble {
  max-width: min(80%, 420px);
  padding: 10px 12px;
  border-radius: 16px 16px 16px 4px;
  background: #30343a;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.mine {
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  background: #1a73e8;
}

.bubble time {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.75rem;
}

.bubble.system {
  align-self: center;
  max-width: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 0.85rem;
}

.composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
}

.composer input { flex: 1; }

.shell.in-call .meet { min-height: 100vh; }
