/* Shared styles for phone, viewer and landing pages. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  color: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Landing ---------- */
.landing-body {
  /* Subtle radial gradient backdrop for the landing page only. */
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(31, 111, 235, 0.25), transparent 60%),
    radial-gradient(900px 500px at 90% 110%, rgba(255, 45, 45, 0.16), transparent 55%),
    #0a0a0a;
  min-height: 100%;
}
.landing {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 5rem) clamp(1rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: 100dvh;
  justify-content: center;
}
.landing-header { text-align: center; }
.landing-header h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.landing-header .tagline {
  margin: 0;
  color: #a0a0a0;
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
}

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .role-grid { grid-template-columns: 1fr; }
}

.role-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
  padding: 1.75rem 1.25rem;
  background: rgba(20, 20, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
  transition: transform 120ms ease-out, border-color 120ms ease-out,
              background 120ms ease-out, box-shadow 120ms ease-out;
}
.role-card:hover, .role-card:focus-visible {
  transform: translateY(-2px);
  background: rgba(28, 28, 32, 0.95);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  outline: none;
}
.role-card:active { transform: translateY(0); }

.role-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}
.role-icon svg { width: 36px; height: 36px; }

.role-card--phone .role-icon {
  background: linear-gradient(135deg, #1f6feb, #6da7ff);
  color: #fff;
  box-shadow: 0 8px 24px rgba(31, 111, 235, 0.35);
}
.role-card--viewer .role-icon {
  background: linear-gradient(135deg, #ff2d2d, #ff7373);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 45, 45, 0.3);
}

.role-card-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.role-card-desc {
  margin-top: 0.35rem;
  color: #aaa;
  font-size: 0.92rem;
  line-height: 1.45;
}

.landing-footer {
  text-align: center;
  color: #777;
  font-size: 0.85rem;
}
.landing-footer p { margin: 0; }

.ended-banner {
  background: rgba(255, 45, 45, 0.16);
  border: 1px solid rgba(255, 45, 45, 0.4);
  color: #ffc8c8;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  text-align: center;
  font-size: 0.95rem;
}
.ended-banner.hidden { display: none; }

code { background: #222; padding: 0.1rem 0.35rem; border-radius: 4px; }

/* ---------- Stage (video container, shared) ---------- */
.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}
.stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;        /* letterboxed; overlay math accounts for this */
  display: block;
  /* Suppress double-tap-to-zoom and pan gestures so our pointerdown handler
     is the only response to a tap on the viewer. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- Splash ring (set-dot animation) ---------- */
.splash {
  position: absolute;
  pointer-events: none;
  width: 24px;
  height: 24px;
  margin-left: -12px;          /* center on (left, top) */
  margin-top:  -12px;
  border-radius: 50%;
  border: 3px solid rgba(255, 45, 45, 0.85);
  background: transparent;
  z-index: 1;                  /* below the marker, above the video */
  animation: splash-ring 480ms cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}
@keyframes splash-ring {
  from {
    transform: scale(0.6);
    opacity: 0.9;
    border-width: 3px;
  }
  to {
    transform: scale(5);
    opacity: 0;
    border-width: 1px;
  }
}

/* ---------- Marker overlay (Phase 6) ---------- */
.marker {
  --marker-size: 20px;
  position: absolute;
  width:  var(--marker-size);
  height: var(--marker-size);
  margin-left: calc(var(--marker-size) / -2);
  margin-top:  calc(var(--marker-size) / -2);
  border-radius: 50%;
  background: #ff2d2d;
  /* Halo + glow scale with the dot so a tiny dot doesn't have a huge halo. */
  box-shadow:
    0 0 0 calc(var(--marker-size) * 0.18) rgba(255, 45, 45, 0.25),
    0 0   calc(var(--marker-size) * 0.55) rgba(255, 45, 45, 0.6);
  pointer-events: none;
  transition:
    left  60ms linear,
    top   60ms linear,
    width 120ms ease-out,
    height 120ms ease-out;
}
.marker.hidden { display: none; }

/* ---------- UI overlays ---------- */
.phone-ui, .viewer-ui {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}
.primary {
  appearance: none;
  border: none;
  padding: 0.9rem 1.4rem;
  border-radius: 999px;
  background: #1f6feb;
  color: white;
  font-size: 1rem;
  font-weight: 600;
}
.primary:disabled { background: #555; }
.status {
  color: #ddd;
  font-size: 0.9rem;
  background: rgba(0,0,0,0.4);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
}

/* ---------- Pairing code card (phone) ---------- */
.code-card {
  position: fixed;
  top: env(safe-area-inset-top, 16px);
  left: 50%;
  transform: translateX(-50%);
  margin-top: 16px;
  padding: 1.1rem 1.6rem 1rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  z-index: 5;
  max-width: calc(100vw - 32px);
}
.code-label {
  color: #bbb;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.code-value {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(3rem, 14vw, 5.5rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #fff;
  margin: 0.35rem 0 0.25rem;
  line-height: 1;
}
.code-hint {
  color: #aaa;
  font-size: 0.85rem;
}
.code-card.hidden { display: none; }

/* ---------- Code entry overlay (viewer) ---------- */
.code-entry {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.code-entry.hidden { display: none; }
.code-entry-card {
  width: 100%;
  max-width: 420px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.75rem;
  text-align: center;
}
.code-entry-card h2 {
  margin: 0 0 0.5rem;
  font-weight: 700;
}
.code-entry-card p {
  color: #aaa;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}
.code-entry-card input[type="text"] {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-align: center;
  text-transform: uppercase;
  padding: 0.6rem 0.5rem;
  border-radius: 12px;
  border: 1px solid #333;
  background: #000;
  color: #fff;
  outline: none;
  margin-bottom: 1rem;
}
.code-entry-card input[type="text"]:focus {
  border-color: #1f6feb;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.25);
}
.code-entry-card .primary {
  width: 100%;
}
.code-error {
  margin-top: 0.85rem;
  color: #ff7a7a;
  font-size: 0.9rem;
  min-height: 1.2em;
}
.code-error.hidden { display: none; }

/* ---------- Dot size slider (viewer only) ---------- */
.size-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #ddd;
  font-size: 0.9rem;
  background: rgba(0,0,0,0.4);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}
.size-control input[type="range"] {
  width: 140px;
  accent-color: #ff2d2d;
}
.size-value {
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
  color: #f5f5f5;
}
