:root {
  color-scheme: dark;
  --bg: #070b16;
  --surface: rgba(17, 24, 43, 0.9);
  --surface-2: #151d32;
  --line: rgba(255,255,255,.10);
  --text: #f7f9ff;
  --muted: #9da9c4;
  --accent: #7c6cff;
  --accent-2: #42d7b9;
  --danger: #ff5c78;
  --shadow: 0 28px 70px rgba(0,0,0,.35);
  --radius: 24px;
}

* { 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", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(124,108,255,.22), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(66,215,185,.12), transparent 30%),
    var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(124,108,255,.45); outline-offset: 2px; }
.hidden { display: none !important; }

.app-shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), #4e8dff); box-shadow: 0 10px 30px rgba(124,108,255,.28); font-weight: 900; letter-spacing: -.04em; }
.brand strong { display: block; letter-spacing: .05em; }
.brand small { display: block; color: var(--muted); margin-top: 1px; }
.secure-pill, .connection-badge { display: inline-flex; align-items: center; gap: 8px; color: #bdeee3; border: 1px solid rgba(66,215,185,.24); background: rgba(66,215,185,.08); padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 5px rgba(66,215,185,.12); }

main { flex: 1; padding: 36px 0 48px; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 24px; align-items: stretch; }
.card { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(24,33,57,.92), rgba(12,17,31,.94)); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-card { padding: clamp(24px, 4vw, 48px); display: grid; gap: 30px; }
.eyebrow { margin: 0 0 10px; color: #a99fff; font-size: 12px; font-weight: 900; letter-spacing: .15em; }
h1 { margin: 0; font-size: clamp(38px, 6vw, 68px); line-height: .98; letter-spacing: -.055em; max-width: 780px; }
h2 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.lead { margin: 18px 0 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.6; max-width: 700px; }

.preview-wrap { position: relative; min-height: 330px; overflow: hidden; border-radius: 22px; background: #05070c; border: 1px solid rgba(255,255,255,.08); }
.preview-wrap video { width: 100%; height: 100%; min-height: 330px; max-height: 52vh; object-fit: cover; display: block; transform: scaleX(-1); }
.preview-placeholder { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; text-align: center; gap: 8px; color: var(--muted); background: radial-gradient(circle at center, rgba(124,108,255,.14), transparent 55%); padding: 24px; }
.preview-placeholder strong { color: var(--text); font-size: 18px; }
.camera-symbol { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: rgba(124,108,255,.14); color: #c8c2ff; font-size: 30px; }
.preview-name { position: absolute; left: 16px; bottom: 16px; background: rgba(0,0,0,.55); backdrop-filter: blur(8px); padding: 7px 10px; border-radius: 10px; font-size: 13px; font-weight: 800; }
.preview-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.join-card { padding: 30px; align-self: stretch; }
.join-card h2 { margin-bottom: 26px; }
label { display: block; color: #c6cee2; font-size: 13px; font-weight: 800; margin: 18px 0 8px; }
input { width: 100%; min-height: 48px; border-radius: 13px; border: 1px solid var(--line); background: #0c1222; color: var(--text); padding: 0 14px; }
input::placeholder { color: #6f7a94; }
.room-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.share-preview { margin: 18px 0; padding: 14px; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 14px; }
.share-preview span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.share-preview code { color: #d6dcf0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.btn { border: 0; border-radius: 13px; min-height: 44px; padding: 0 16px; cursor: pointer; font-weight: 850; transition: transform .16s ease, background .16s ease, opacity .16s ease; }
.btn:hover:not(:disabled), .control-btn:hover:not(:disabled), .icon-btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled, .control-btn:disabled, .icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #5d91ff); box-shadow: 0 12px 28px rgba(124,108,255,.25); }
.btn-secondary { background: #1b253e; border: 1px solid var(--line); }
.btn-ghost { background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.btn-large { width: 100%; min-height: 52px; margin-bottom: 10px; }
.join-card > .btn-secondary { width: 100%; }
.icon-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: #1b253e; cursor: pointer; }
.icon-btn.off, .control-btn.off { background: rgba(255,92,120,.15); color: #ffd4dc; }
.status { min-height: 20px; color: #9ee8d9; font-size: 13px; line-height: 1.45; margin: 16px 0 0; }
.status.error { color: #ffb6c3; }
.fine-print { color: #75819a; font-size: 12px; line-height: 1.5; margin: 14px 0 0; }

.call-view { display: grid; gap: 18px; }
.call-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.call-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.call-title-row h2 { font-size: clamp(24px, 4vw, 36px); }
.mini-btn { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 10px; padding: 7px 10px; cursor: pointer; font-size: 12px; font-weight: 800; }
.call-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.connection-badge.connecting { color: #ffe4a8; border-color: rgba(255,198,88,.25); background: rgba(255,198,88,.08); }
.connection-badge.connecting .dot { background: #ffc658; box-shadow: 0 0 0 5px rgba(255,198,88,.12); }
.connection-badge.offline { color: #ffc0ca; border-color: rgba(255,92,120,.25); background: rgba(255,92,120,.08); }
.connection-badge.offline .dot { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,92,120,.12); }
.participant-count { border: 1px solid var(--line); padding: 8px 12px; border-radius: 999px; color: #cbd3e5; font-size: 13px; font-weight: 800; }
.video-grid { min-height: 55vh; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; }
.video-tile { position: relative; min-height: 240px; border-radius: 22px; overflow: hidden; background: #05070c; border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.22); }
.video-tile video { width: 100%; height: 100%; min-height: 240px; object-fit: cover; display: block; }
.video-tile.local video { transform: scaleX(-1); }
.video-tile.screen-share.local video { transform: none; }
.video-label { position: absolute; left: 14px; bottom: 14px; display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 10px; background: rgba(0,0,0,.55); backdrop-filter: blur(8px); font-size: 12px; font-weight: 850; }
.video-state { color: #ffb3c0; }
.video-grid:has(.video-tile:only-child) { grid-template-columns: minmax(0, 1fr); }
.video-grid:has(.video-tile:nth-child(3)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.call-dock { position: sticky; bottom: 16px; z-index: 5; margin: 0 auto; display: flex; justify-content: center; gap: 8px; padding: 10px; border-radius: 22px; border: 1px solid var(--line); background: rgba(10,15,27,.85); box-shadow: 0 22px 70px rgba(0,0,0,.4); backdrop-filter: blur(18px); width: fit-content; max-width: 100%; }
.control-btn { border: 0; min-width: 78px; min-height: 62px; border-radius: 15px; background: #172038; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 4px; }
.control-btn span { font-size: 19px; }
.control-btn small { font-size: 10px; font-weight: 800; color: #aeb8ce; }
.control-btn.danger { background: var(--danger); }
.control-btn.danger small { color: white; }
.call-status { text-align: center; margin-top: 0; }

footer { min-height: 68px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 20px; color: #6f7b94; font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px); padding: 11px 16px; background: #eef2ff; color: #151b2a; border-radius: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.35); font-size: 13px; font-weight: 850; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .join-card { order: -1; }
  .hero-card h1, .hero-card .lead { display: none; }
  .hero-card { padding: 18px; }
  .preview-wrap, .preview-wrap video { min-height: 260px; }
  .video-grid { grid-template-columns: 1fr; min-height: 50vh; }
  .call-header { align-items: start; }
  .control-btn { min-width: 62px; }
  .control-btn small { display: none; }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 20px, 1240px); }
  .topbar { min-height: 70px; }
  .secure-pill { display: none; }
  main { padding-top: 18px; }
  .join-card { padding: 22px; }
  .call-header { display: grid; }
  .call-meta { justify-content: start; }
  .video-tile, .video-tile video { min-height: 210px; }
  .call-dock { width: 100%; overflow-x: auto; justify-content: start; bottom: 8px; border-radius: 18px; }
  .control-btn { min-width: 56px; height: 56px; min-height: 56px; flex: 0 0 56px; }
  footer { display: grid; padding: 18px 0; }
}

/* TOQUE SaaS v0.3 */
.top-actions { display:flex; align-items:center; gap:10px; }
.top-link { color:#cdd6eb; text-decoration:none; font-size:13px; font-weight:800; padding:9px 11px; border-radius:10px; border:1px solid var(--line); }
.top-link:hover { background:#151d31; }
@media (max-width:620px) { .top-link { padding:8px; font-size:12px; } .top-actions { gap:6px; } }

/* TOQUE v0.4 - WhatsApp Quick Share */
.btn-whatsapp {
  background: #25d366;
  border-color: #25d366;
  color: #07140c;
  font-weight: 800;
}

.btn-whatsapp:hover {
  filter: brightness(1.04);
}

.whatsapp-control {
  border-color: rgba(37, 211, 102, .45);
}
