/* live.appsocom.com/demo: the live demo call. Colours from brand.css. */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.demo { max-width: var(--wrap); margin: 0 auto; padding: 0 20px 80px; }

/* Lobby */
.lobby { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; padding: 72px 0 56px; }
.lobby h1 { font-size: clamp(38px, 5vw, 64px); line-height: 1; }
.join-form { margin-top: 8px; }
.join-form label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.join-row { display: flex; gap: 10px; flex-wrap: wrap; }
.join-row input {
  flex: 1 1 200px; min-width: 0; font: inherit; font-size: 17px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.join-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.join-row .btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 17px; }
.join-row .btn:disabled { opacity: 0.7; cursor: progress; }
.error { color: #ff8a8a; min-height: 1.4em; margin: 10px 0 0; font-size: 15px; }
:root[data-theme="ink-light"] .error { color: #c62828; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; margin: 14px 0 0; list-style: none; color: var(--muted); font-size: 14px; }
.facts li::before { content: "•"; color: var(--accent); margin-right: 8px; }
.preview-card { margin: 0; }
.preview-card figcaption { color: var(--muted); font-size: 14px; margin-top: 12px; }

/* Tiles */
.tile {
  position: relative; overflow: hidden; border-radius: 16px; aspect-ratio: 16 / 9;
  background: radial-gradient(80% 80% at 50% 40%, var(--raise), var(--card));
  border: 1px solid var(--line); transition: box-shadow 0.2s, border-color 0.2s;
}
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
#t-me video, .preview video { transform: scaleX(-1); }
.tile.cam-on video { opacity: 1; }
.tile.screen video { object-fit: contain; background: #000; }
.tile .avatar {
  position: absolute; inset: 0; margin: auto; width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center; font: 700 30px/1 "Bricolage Grotesque", sans-serif;
  background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.preview .avatar { font-size: 18px; }
.tile.cam-on .avatar { display: none; }
.tile .name {
  position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px);
  padding: 5px 10px; border-radius: 8px; font-size: 13px; color: #fff;
  background: rgba(7, 10, 19, 0.62); backdrop-filter: blur(6px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile.muted .name::after { content: " · muted"; color: #cbd5e1; }
.tile.speaking { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 20px 60px -20px var(--accent); }

/* Call */
.call { padding: 28px 0 40px; }
.call-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.call-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 15px; }
.call-info b { color: var(--text); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.timer { font: 500 14px/1 "Geist Mono", monospace; padding: 6px 9px; border-radius: 8px; background: var(--raise); color: var(--text); }
.timer.low { color: #fbbf24; }
.invite { display: flex; gap: 8px; flex: 1 1 340px; max-width: 520px; }
.invite input {
  flex: 1; min-width: 0; font: 14px/1 "Geist Mono", monospace; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.invite .btn { padding: 9px 14px; cursor: pointer; font: inherit; font-size: 14px; white-space: nowrap; }
.invite-hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.banner { background: #fbbf24; color: #1a1300; padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.grid[data-count="1"] { max-width: 880px; margin: 0 auto; }
.grid[data-count="2"], .grid[data-count="3"], .grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.controls { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.ctl {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: 600 15px/1 "Geist", sans-serif; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 12px 18px;
}
.ctl svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ctl:hover { border-color: var(--accent); }
.ctl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ctl.off { background: #3a1d24; border-color: #7f2d3b; color: #ffb4bf; }
:root[data-theme="ink-light"] .ctl.off { background: #fde8eb; border-color: #f2b8c1; color: #9f1d33; }
.ctl.on { background: var(--accent-soft); border-color: var(--accent); }
.ctl.leave { background: #dc2626; border-color: #dc2626; color: #fff; }
.ctl.leave svg { fill: currentColor; stroke: none; }

/* Ended */
.ended { text-align: center; padding: 96px 0 64px; max-width: 760px; margin: 0 auto; }
.ended h1 { font-size: clamp(38px, 5vw, 64px); line-height: 1; }
.ended .lead { margin: 18px auto 0; }
.ended .cta { justify-content: center; margin-top: 30px; }
.again { margin-top: 26px; color: var(--muted); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* How it's built */
.howto { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 48px; max-width: 880px; }
body[data-view="call"] .howto { margin-top: 48px; }
.howto h2 { font: 700 clamp(26px, 3vw, 34px)/1.1 "Bricolage Grotesque", sans-serif; margin: 0 0 10px; }
.howto p { color: var(--muted); }
.howto a { color: var(--accent); }
.howto pre { background: var(--code); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; overflow-x: auto; font: 14px/1.6 "Geist Mono", monospace; color: var(--text); }

@media (max-width: 860px) {
  .lobby { grid-template-columns: 1fr; gap: 28px; padding: 40px 0 32px; }
  .preview-card { order: -1; }
  .nav nav { display: none; }
}
@media (max-width: 560px) {
  .grid[data-count="2"] { grid-template-columns: 1fr; }
  .grid[data-count="2"] .tile { aspect-ratio: 4 / 3; }
  .ctl span { display: none; }
  .ctl { padding: 14px; }
  .invite { flex-basis: 100%; max-width: none; }
  .signin { display: none; }
}
