:root {
  --bg0: #070a12;
  --bg1: #121a2e;
  --accent: #6ee7ff;
  --accent2: #a78bfa;
  --danger: #fb7185;
  --text: #e8eefc;
  --muted: #8b9bb8;
  --glass: rgba(255, 255, 255, 0.06);
  --ok: #34d399;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 800px at 50% -10%, #1a2744 0%, var(--bg0) 55%);
  color: var(--text);
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
}

.app {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.view {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadein 0.45s ease;
}

.view[hidden] {
  display: none !important;
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.orb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent), transparent 55%),
    radial-gradient(circle at 70% 70%, var(--accent2), transparent 50%);
  filter: blur(2px);
  opacity: 0.85;
  animation: breathe 3.2s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

.hit-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(160deg, rgba(110, 231, 255, 0.2), rgba(167, 139, 250, 0.15));
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hit-circle:active {
  transform: scale(0.96);
}

.hit-circle.ghost {
  width: 56px;
  height: 56px;
  background: var(--glass);
}

.age-btn {
  width: 128px;
  height: 128px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.whisper {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  max-width: 16rem;
  min-height: 1.2em;
}

.ring-wrap {
  position: relative;
  width: 240px;
  height: 240px;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
}

.ring-fg {
  fill: none;
  stroke: url(#none);
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.2s linear, stroke 0.3s ease;
}

.ring-fg.urgent {
  stroke: var(--danger);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
}

.digits {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.digits.access {
  font-size: 1.05rem;
  color: var(--muted);
}

.digits.temp {
  font-size: 1.85rem;
  color: var(--text);
}

.countdown {
  font-size: 0.85rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.pair-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.call-btn {
  background: linear-gradient(160deg, rgba(52, 211, 153, 0.35), rgba(110, 231, 255, 0.2));
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}

.status-dot.pulse {
  animation: pulse 1.2s ease-in-out infinite;
}

.status-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 16px var(--ok);
  animation: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.55;
  }
}

.qr {
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.icon-stack {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 64px;
}

.icon-stack .bar {
  width: 14px;
  height: 56px;
  border-radius: 8px;
  background: linear-gradient(to top, var(--accent2), var(--accent));
  opacity: 0.85;
  animation: bars 1s ease-in-out infinite alternate;
}

.icon-stack .bar:nth-child(2) {
  animation-delay: 0.15s;
  height: 44px;
}

.icon-stack .bar.short {
  height: 28px;
  animation-delay: 0.3s;
}

@keyframes bars {
  from {
    transform: scaleY(0.7);
    opacity: 0.5;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.top-bar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.hit-sm {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
}

.mask {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2em;
  font-size: 1.25rem;
  color: var(--accent);
}

.sheet {
  width: 100%;
  margin-top: 12px;
  padding: 16px;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.85rem;
  color: var(--muted);
}

.device-list li.current {
  color: var(--text);
  outline: 1px solid rgba(110, 231, 255, 0.35);
}

.hit-pill {
  align-self: center;
  min-width: 56px;
  height: 44px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  background: rgba(251, 113, 133, 0.2);
  color: var(--danger);
}

/* —— Live session —— */
.live {
  width: min(440px, 100%);
  min-height: 85dvh;
  justify-content: flex-start;
  gap: 12px;
}

.phase {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  animation: fadein 0.35s ease;
}

.phase[hidden] {
  display: none !important;
}

.net-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 340px;
  margin-top: 12px;
}

.net-btn {
  aspect-ratio: 1;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--glass);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 88px;
}

.net-btn .net-ico {
  font-size: 1.85rem;
  line-height: 1;
}

.net-btn .net-num {
  font-size: 0.85rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.net-btn:active {
  transform: scale(0.96);
}

.net-btn.forum {
  background: linear-gradient(160deg, rgba(167, 139, 250, 0.28), rgba(110, 231, 255, 0.12));
}

.net-btn.micro {
  background: linear-gradient(160deg, rgba(52, 211, 153, 0.35), rgba(110, 231, 255, 0.15));
  box-shadow: 0 0 24px rgba(52, 211, 153, 0.25);
}

.net-btn.private {
  background: linear-gradient(160deg, rgba(251, 191, 36, 0.25), rgba(110, 231, 255, 0.1));
}

.net-btn.closed {
  opacity: 0.28;
  pointer-events: none;
}

.net-btn.waiting,
.net-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.net-grid.not-ready .net-btn {
  opacity: 0.4;
}

.net-grid.busy .net-btn {
  pointer-events: none;
  opacity: 0.55;
}

#phase-netlist:not([hidden]) {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px 24px;
  box-sizing: border-box;
}

.net-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.85rem;
  opacity: 0.85;
  color: var(--text);
}

.net-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.net-legend-item .net-ico {
  font-size: 1.15rem;
}

.net-hint {
  margin: 4px 0 0;
  font-size: 0.9rem;
  opacity: 0.75;
  text-align: center;
  max-width: 320px;
  line-height: 1.35;
}

/* First micro-network CTA: pulse so authenticated users always find "record name" */
.net-btn.micro.cta-primary {
  outline: 2px solid rgba(52, 211, 153, 0.55);
  animation: net-pulse 1.8s ease-in-out infinite;
}

@keyframes net-pulse {
  0%,
  100% {
    box-shadow: 0 0 18px rgba(52, 211, 153, 0.2);
  }
  50% {
    box-shadow: 0 0 28px rgba(52, 211, 153, 0.45);
  }
}

.card {
  width: min(280px, 80vw);
  height: min(280px, 80vw);
  border-radius: 32px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--accent2) 60%, #1a2035);
  box-shadow: 0 0 40px rgba(110, 231, 255, 0.25);
}

.avatar.peer {
  background: radial-gradient(circle at 30% 30%, #34d399, #6ee7ff 55%, #1a2035);
}

.wave {
  position: absolute;
  bottom: 28px;
  left: 20%;
  right: 20%;
  height: 28px;
  border-radius: 14px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0 3px,
    transparent 3px 8px
  );
  opacity: 0.55;
  animation: wave 0.6s linear infinite;
}

.wave[hidden] {
  display: none !important;
}

@keyframes wave {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 16px 0;
  }
}

.badge {
  position: absolute;
  top: 16px;
  right: 16px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.browse-actions .hit-circle {
  width: 56px;
  height: 56px;
}

.hit-circle.rec {
  background: linear-gradient(160deg, rgba(251, 113, 133, 0.45), rgba(251, 113, 133, 0.15));
}

.hit-circle.ok {
  background: linear-gradient(160deg, rgba(52, 211, 153, 0.4), rgba(52, 211, 153, 0.12));
}

.hit-circle.stop {
  background: rgba(251, 113, 133, 0.25);
}

.hit-sm.danger,
.hit-pill.danger {
  color: var(--danger);
}

.admin-actions {
  margin-top: 4px;
}

.hit-pill.admin {
  min-width: 72px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(167, 139, 250, 0.2);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.leave-net {
  margin-top: 8px;
}

.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  margin: auto;
}

.conn-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}

.conn-dot.bad {
  background: var(--danger);
}

.pin-display {
  font-size: 2rem;
  letter-spacing: 0.4em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: min(260px, 100%);
}

.pad button {
  height: 56px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--glass);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
}

.time-warn {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--danger), var(--accent));
  animation: pulse 1s ease-in-out infinite;
  z-index: 50;
}

.photo-btn {
  display: grid;
  place-items: center;
  cursor: pointer;
  margin: 0;
}

.avatar.has-photo {
  background-size: cover;
  background-position: center;
}

.live-mic {
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: ringpulse 1.4s ease-out infinite;
}

@keyframes ringpulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

.hit-circle.danger-fill {
  background: linear-gradient(160deg, rgba(251, 113, 133, 0.5), rgba(251, 113, 133, 0.15));
}

.swipe-card.swipe-left {
  animation: swipeL 0.28s ease forwards;
}
.swipe-card.swipe-right {
  animation: swipeR 0.28s ease forwards;
}

@keyframes swipeL {
  to {
    transform: translateX(-40%) rotate(-6deg);
    opacity: 0;
  }
}
@keyframes swipeR {
  to {
    transform: translateX(40%) rotate(6deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
