/* ============================================================================
   intro-lobby.css: the device check behind /talk (views/intro-lobby.ejs)
   ---------------------------------------------------------------------------
   Sits on style_auth.css: same light tokens, same dot grid, same Manrope, same
   primary button. On a laptop the camera is on the left and the card on the
   right holds the one decision. On a phone EVERYTHING fits the first screen:
   a short self-view, the three checks on one line, the question, the live
   status, the button; the device pickers hide behind a gear on the tile.

   Rule kept mechanically here (promoted 2026-08-16): any rule that FORCES a
   display on an element the script may hide with `hidden` carries
   :not([hidden]), or the author rule silently beats the attribute.
   ============================================================================ */

body.auth-v2.tk-page {
  display: block;
  padding: 0;
}

.tk-shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr);
  grid-template-areas: "stage panel";
  align-content: center;
  align-items: center;
  column-gap: 44px;
}

.tk-stage {
  grid-area: stage;
  position: relative;
  min-width: 0;
}
/* A soft accent halo behind the camera: the tile is the one dark object on a
   pale page, and the halo keeps it from reading as a hole in it. */
.tk-stage::before {
  content: "";
  position: absolute;
  inset: -14% -8%;
  z-index: 0;
  background: radial-gradient(55% 52% at 50% 44%, rgba(99, 102, 241, 0.16), rgba(99, 102, 241, 0) 72%);
  pointer-events: none;
}

/* ── The camera tile ─────────────────────────────────────────────────────── */
.tk-video {
  position: relative;
  z-index: 1;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  background: #17171f;
  box-shadow: 0 1px 2px rgba(17, 17, 24, 0.06), 0 26px 60px -22px rgba(17, 17, 24, 0.42);
  isolation: isolate;
}
.tk-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* A mirror, like every self-view: raising your right hand moves the right side. */
  transform: scaleX(-1);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.tk-video[data-state="live"] video {
  opacity: 1;
}

.tk-ov {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  color: #ececf3;
}
.tk-video[data-state="prompt"] .tk-ov--prompt,
.tk-video[data-state="denied"] .tk-ov--denied,
.tk-video[data-state="busy"] .tk-ov--busy,
.tk-video[data-state="failed"] .tk-ov--failed,
.tk-video[data-state="nodevice"] .tk-ov--nodevice,
.tk-video[data-state="unsupported"] .tk-ov--unsupported,
.tk-video[data-state="camoff"] .tk-ov--camoff {
  display: flex;
}
.tk-ov h2 {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}
.tk-ov p {
  margin: 0;
  max-width: 380px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #b9b9c9;
}
.tk-ov-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.92);
}
.tk-ov-icon svg {
  width: 20px;
  height: 20px;
}
.tk-ov-icon--big {
  width: 72px;
  height: 72px;
}
.tk-ov-icon--big svg {
  width: 30px;
  height: 30px;
}
.tk-ov-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.tk-ov-btn {
  height: 36px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: 600 13px/1 var(--sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tk-ov-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}
.tk-ov-btn--primary {
  background: #fff;
  border-color: #fff;
  color: #111118;
}
.tk-ov-btn--primary:hover {
  background: #ececf3;
}
.tk-ov-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.tk-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  animation: tk-spin 0.9s linear infinite;
}
@keyframes tk-spin {
  to { transform: rotate(360deg); }
}

/* The name chip and the level meter: the two answers a visitor looks for
   ("is that me?" and "does it hear me?"), in the corner Meet taught them. */
.tk-you {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 28px);
  padding: 6px 12px 6px 9px;
  border-radius: 999px;
  background: rgba(15, 15, 22, 0.58);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font: 600 12.5px/1.2 var(--sans);
}
.tk-you > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tk-meter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 16px;
  flex: none;
}
.tk-meter i {
  display: block;
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.5);
  /* Scaled, never resized: the level changes on every frame, and a height
     change is a layout pass each time where a transform stays on the
     compositor. The script writes scaleY(0.2 to 1). */
  transform: scaleY(0.2);
  transition: transform 0.07s linear, background-color 0.2s;
}
.tk-meter.is-talking i {
  background: #fff;
}

/* The gear: phone only (see the media query), glass on the tile's corner. */
.tk-gear {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 15, 22, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  display: none;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.2s;
}
.tk-gear svg {
  width: 17px;
  height: 17px;
}
.tk-gear[aria-expanded="true"] {
  background: #fff;
  color: #111118;
  transform: rotate(30deg);
}
.tk-gear:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── Checks under the tile ───────────────────────────────────────────────── */
.tk-checks {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.tk-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--auth-stroke);
  background: var(--auth-surface);
  color: var(--auth-muted);
  font: 600 12.5px/1 var(--sans);
  white-space: nowrap;
}
.tk-check svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.tk-check[data-ok="1"] {
  color: var(--auth-success);
  background: var(--auth-success-bg);
  border-color: var(--auth-success-stroke);
}
.tk-check--btn {
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tk-check--btn:hover {
  border-color: var(--auth-stroke-hover);
  color: var(--auth-ink);
}
.tk-check--btn[data-busy="1"] {
  color: var(--auth-accent-text);
  background: var(--auth-info-bg);
  border-color: var(--auth-info-stroke);
}
.tk-check--btn:focus-visible {
  outline: 2px solid var(--auth-accent-text);
  outline-offset: 2px;
}

/* ── Device pickers ──────────────────────────────────────────────────────── */
.tk-devices {
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin-top: 12px;
}
.tk-devices:not([hidden]) {
  display: flex;
}
.tk-dev {
  position: relative;
  flex: 1 1 190px;
  min-width: 0;
  align-items: center;
}
.tk-dev:not([hidden]) {
  display: flex;
}
.tk-dev svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--auth-muted);
  pointer-events: none;
}
.tk-dev select {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 34px;
  border-radius: var(--auth-r-md);
  border: 1px solid var(--auth-stroke-strong);
  background: var(--auth-surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6b7d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 11px center / 14px 14px;
  color: var(--auth-ink);
  font: 500 13px/1 var(--sans);
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tk-dev select:hover {
  border-color: var(--auth-stroke-hover);
}
.tk-dev select:focus-visible {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px var(--auth-accent-ring);
}

/* ── The card ────────────────────────────────────────────────────────────── */
.tk-panel {
  grid-area: panel;
  align-self: center;
  padding: 34px 32px 26px;
  border-radius: var(--auth-r-lg);
  border: 1px solid var(--auth-stroke);
  background: var(--auth-surface);
  box-shadow: var(--auth-shadow-card);
}
.tk-panel h1 {
  margin: 0 0 12px;
  font-size: 31px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.028em;
  color: var(--auth-ink);
  text-wrap: balance;
}
.tk-sub {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--auth-muted);
}
.tk-panel .auth-error {
  margin: 0 0 14px;
}

/* The live status: a badge that shows the mood of the room, and two lines.
   `data-kind` on the block (checking, present, calling, absent, live) picks
   the glyph, the colours and the motion; `data-via` (call, message) picks the
   glyph inside "calling". Every glyph is display:none until its mood is on. */
.tk-live {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--auth-stroke);
  background: var(--auth-surface-2);
  transition: background 0.3s, border-color 0.3s;
}
.tk-live-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tk-live-text strong {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--auth-ink);
}
.tk-live-text span {
  font-size: 13px;
  line-height: 1.45;
  color: var(--auth-muted);
}
.tk-live-text span:empty {
  display: none;
}
.tk-badge {
  position: relative;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--auth-surface-3);
  color: var(--auth-muted);
  transition: background 0.3s, color 0.3s;
}
.tk-badge > * {
  display: none;
}
.tk-ico {
  width: 20px;
  height: 20px;
}
.tk-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
}
/* Echo's face: the full-body pose (192px, /assets/echo) cropped to the head
   by a round window that is its own box, so the rings and the chip around
   the badge are never clipped with it. */
.tk-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--auth-info-stroke);
}
.tk-face img {
  position: absolute;
  left: 50%;
  top: -2%;
  width: 168%;
  height: 168%;
  transform: translateX(-50%);
  object-fit: cover;
  object-position: 50% 0;
}
/* The chip on the badge's shoulder: what Echo is holding (a phone, a message). */
.tk-chip {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--auth-accent-text);
  color: #fff;
  box-shadow: 0 0 0 2px var(--auth-info-bg);
  place-items: center;
}
.tk-chip svg {
  width: 12px;
  height: 12px;
}
/* Three dots while the roster is being read, and when it is unreadable. */
.tk-dots {
  gap: 3px;
  align-items: center;
}
.tk-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: tk-dot 1.2s ease-in-out infinite;
}
.tk-dots i:nth-child(2) { animation-delay: 0.15s; }
.tk-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes tk-dot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}
.tk-live[data-kind="checking"] .tk-dots,
.tk-live[data-kind="live"] .tk-dots {
  display: flex;
}

/* A founder is inside: green, a check, one calm ring. */
.tk-live[data-kind="present"] {
  background: var(--auth-success-bg);
  border-color: var(--auth-success-stroke);
}
.tk-live[data-kind="present"] .tk-badge {
  background: #dcfce7;
  color: var(--auth-success);
}
.tk-live[data-kind="present"] .tk-ico--check {
  display: block;
  animation: tk-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.tk-live[data-kind="present"] .tk-ring:first-child {
  display: block;
  animation: tk-ripple 2.4s ease-out infinite;
}

/* Nobody inside: Echo takes over, in the product's accent. "absent" is Echo
   picking up the phone (thinking pose, a still chip), nothing delivered yet;
   "calling" is a provider that ACCEPTED the alert: talking pose, the phone
   chip rings, two rings spread out of the badge. "message" swaps the phone
   for a bubble. */
.tk-live[data-kind="absent"],
.tk-live[data-kind="calling"] {
  background: var(--auth-info-bg);
  border-color: var(--auth-info-stroke);
}
.tk-live[data-kind="absent"] .tk-badge,
.tk-live[data-kind="calling"] .tk-badge {
  background: #e0e1fc;
  color: var(--auth-accent-text);
}
.tk-live[data-kind="absent"] .tk-face--think,
.tk-live[data-kind="calling"] .tk-face--talk {
  display: block;
  animation: tk-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.tk-live[data-kind="absent"] .tk-chip--phone,
.tk-live[data-kind="calling"][data-via="call"] .tk-chip--phone,
.tk-live[data-kind="calling"][data-via="message"] .tk-chip--msg {
  display: grid;
}
.tk-live[data-kind="calling"] .tk-ring {
  display: block;
  animation: tk-ripple 1.8s ease-out infinite;
}
.tk-live[data-kind="calling"] .tk-ring:nth-child(2) {
  animation-delay: 0.6s;
}
.tk-live[data-kind="calling"][data-via="call"] .tk-chip--phone {
  transform-origin: 50% 60%;
  animation: tk-ringing 1.8s ease-in-out infinite;
}

/* The ring grows to the block's padding edge and no further: a halo that
   crosses the border reads as a rendering glitch, not as a signal. */
@keyframes tk-ripple {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes tk-ringing {
  0%, 46%, 100% { transform: rotate(0deg); }
  5%, 15%, 25%, 35% { transform: rotate(-14deg); }
  10%, 20%, 30%, 40% { transform: rotate(14deg); }
}
@keyframes tk-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* The one button. */
.auth-v2 .tk-cta {
  height: 52px;
  font-size: 15.5px;
  gap: 10px;
}
.tk-cta svg {
  width: 18px;
  height: 18px;
  flex: none;
  transition: transform 0.2s;
}
.tk-cta:hover svg {
  transform: translateX(3px);
}
.tk-cta:disabled svg {
  display: none;
}
.tk-consent {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  text-align: center;
  color: var(--auth-muted);
}
.tk-consent a {
  color: var(--auth-accent-text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.tk-consent a:hover {
  text-decoration: underline;
}

/* ── Phone and narrow laptop: one column, one screen ─────────────────────── */
@media (max-width: 880px) {
  .tk-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "stage"
      "panel";
    align-content: center;
    row-gap: 16px;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .tk-stage::before {
    display: none;
  }
  /* The self-view is a strip, not a poster: about a third of the screen, so the
     question and the button share the first screen with it. */
  .tk-video {
    aspect-ratio: auto;
    height: clamp(150px, 30vh, 280px);
    height: clamp(150px, 30dvh, 280px);
    border-radius: 16px;
  }
  .tk-ov {
    padding: 14px 16px;
    gap: 6px;
  }
  .tk-ov h2 {
    font-size: 15px;
  }
  .tk-ov p {
    font-size: 12.5px;
    line-height: 1.45;
  }
  .tk-ov-actions {
    margin-top: 6px;
  }
  .tk-ov-btn {
    height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
  }
  .tk-gear:not([hidden]) {
    display: grid;
  }
  .tk-checks {
    gap: 6px;
    margin-top: 10px;
  }
  .tk-check {
    height: 30px;
    font-size: 12px;
  }
  .tk-check--btn {
    padding: 0 9px;
  }
  .tk-check--btn > span {
    display: none;
  }
  /* The pickers become a sheet under the gear, closed by default and opened
     by the script through data-devices on the stage. */
  .tk-devices {
    position: absolute;
    top: 50px;
    right: 0;
    z-index: 6;
    width: min(100%, 340px);
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--auth-stroke);
    background: var(--auth-surface);
    box-shadow: var(--auth-shadow-card);
  }
  .tk-devices:not([hidden]) {
    display: none;
  }
  .tk-stage[data-devices="open"] .tk-devices:not([hidden]) {
    display: flex;
  }
  .tk-dev {
    flex-basis: auto;
  }
  /* At this width the card dissolves into the page: the border and padding
     were 60px of a screen that has none to spare. */
  .tk-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .tk-panel h1 {
    margin-bottom: 8px;
    font-size: 24px;
  }
  .tk-sub {
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.5;
  }
  .tk-live {
    margin-bottom: 14px;
    padding: 10px 12px;
    gap: 11px;
  }
  .tk-badge {
    width: 44px;
    height: 44px;
  }
  .tk-live-text strong {
    font-size: 14px;
  }
  .tk-live-text span {
    font-size: 12.5px;
  }
  .auth-v2 .tk-cta {
    height: 50px;
    font-size: 15px;
  }
  .tk-consent {
    margin-top: 10px;
    font-size: 11px;
  }
}

/* A tablet held upright has the height to spare: a taller self-view, so the
   strip does not read as a letterbox across a 700px-wide page. */
@media (min-width: 600px) and (max-width: 880px) and (orientation: portrait) {
  .tk-video {
    height: clamp(220px, 38vh, 400px);
    height: clamp(220px, 38dvh, 400px);
  }
}

/* A phone held sideways: two columns again, both short. */
@media (max-width: 880px) and (max-height: 520px) and (orientation: landscape) {
  .tk-shell {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 1fr);
    grid-template-areas: "stage panel";
    column-gap: 22px;
    padding: 10px 18px;
  }
  .tk-video {
    height: clamp(120px, 56dvh, 260px);
  }
  .tk-panel h1 {
    font-size: 20px;
  }
  .tk-sub {
    margin-bottom: 10px;
    font-size: 13px;
  }
  .tk-live {
    margin-bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tk-spinner,
  .tk-dots i,
  .tk-ring,
  .tk-ico,
  .tk-face,
  .tk-chip {
    animation: none !important;
  }
  .tk-ring {
    display: none !important;
  }
  .tk-video video,
  .tk-meter i,
  .tk-cta svg,
  .tk-gear {
    transition: none;
  }
}
