/* Faithful Action Alert resident PWA + county push — commercial interaction scene */
.aa-commercial__resident-scene {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  animation: aa-resident-scene-show 30s ease-in-out infinite;
  background: radial-gradient(ellipse 80% 60% at 30% 50%, rgba(34, 211, 238, 0.08), transparent 55%),
    linear-gradient(135deg, #030712 0%, #0a1628 50%, #030712 100%);
}

@keyframes aa-resident-scene-show {
  0%,
  28% {
    opacity: 0;
  }
  32%,
  52% {
    opacity: 1;
  }
  56%,
  100% {
    opacity: 0;
  }
}

.aa-res-layout {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: clamp(0.75rem, 2vw, 1.5rem);
  height: 100%;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  align-items: center;
}

@media (max-width: 720px) {
  .aa-res-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    padding-bottom: 4.5rem;
  }
}

.aa-res-phone {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.aa-res-device {
  position: relative;
  width: min(248px, 42vw);
  height: min(500px, 72vh);
  border-radius: 28px;
  border: 2px solid #475569;
  background: #05060a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.aa-res-device__notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 22px;
  background: #0b0f1a;
  border-radius: 0 0 14px 14px;
  z-index: 5;
}

.aa-res-device__scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 28px 10px 12px;
  background: linear-gradient(145deg, #0b0f1a, #05060a);
  scrollbar-width: none;
}

.aa-res-device__scroll::-webkit-scrollbar {
  display: none;
}

/* County push — matches aa-resident__push from Command Center feed */
.aa-res-push {
  margin-bottom: 8px;
  padding: 10px;
  border: 3px solid #3d3224;
  border-radius: 4px;
  background: #241c12;
  color: #ece6da;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
  transform: translateY(-120%);
  animation: aa-res-push-in 30s ease-out infinite;
}

.aa-res-push--emergency {
  border-color: #c41e3a;
  animation: aa-res-push-in 30s ease-out infinite, aa-res-push-pulse 2.5s ease-in-out infinite;
}

@keyframes aa-res-push-in {
  0%,
  30% {
    transform: translateY(-120%);
    opacity: 0;
  }
  34%,
  52% {
    transform: translateY(0);
    opacity: 1;
  }
  56%,
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes aa-res-push-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(196, 30, 58, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(196, 30, 58, 0);
  }
}

.aa-res-push__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.aa-res-push__badge {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 3px;
  background: #c41e3a;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.aa-res-push h3 {
  margin: 0;
  flex: 1;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.aa-res-push p {
  margin: 0;
  font-size: 8px;
  line-height: 1.35;
  color: #c9bfb0;
}

.aa-res-push__time {
  display: block;
  margin-top: 6px;
  font-size: 7px;
  font-weight: 700;
  color: #f5a623;
}

/* Production PwaShell chrome */
.aa-res-pwa__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.aa-res-pwa__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aa-res-pwa__logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: radial-gradient(circle at 30% 20%, #ffebee 0, #e53935 40%, #b71c1c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 0 12px rgba(229, 57, 53, 0.6);
}

.aa-res-pwa__brand-text {
  display: flex;
  flex-direction: column;
}

.aa-res-pwa__brand-text span:first-child {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ea3b0;
}

.aa-res-pwa__brand-text span:last-child {
  font-size: 11px;
  font-weight: 600;
  color: #f5f5f5;
}

.aa-res-pwa__lang {
  display: flex;
  gap: 3px;
}

.aa-res-pwa__lang span {
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 8px;
  color: #f5f5f5;
}

.aa-res-pwa__lang span.is-on {
  border-color: rgba(229, 57, 53, 0.7);
  background: rgba(229, 57, 53, 0.15);
}

.aa-res-pwa__county {
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.35);
  font-size: 9px;
  color: #c8e6c9;
}

.aa-res-pwa__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.aa-res-pwa__btn {
  min-height: 52px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.aa-res-pwa__btn--medical {
  background: radial-gradient(circle at 30% 0, #ff8a80 0, #e53935 45%, #b71c1c 100%);
  box-shadow: 0 6px 16px rgba(229, 57, 53, 0.4);
}

.aa-res-pwa__btn--shelter {
  background: radial-gradient(circle at 30% 0, #ffe082 0, #ffb300 45%, #ff8f00 100%);
  color: #1a1200;
  box-shadow: 0 6px 16px rgba(255, 179, 0, 0.35);
}

.aa-res-pwa__btn--evacuating {
  background: radial-gradient(circle at 30% 0, #e1bee7 0, #9c27b0 45%, #6a1b9a 100%);
  box-shadow: 0 6px 16px rgba(156, 39, 176, 0.4);
  position: relative;
  z-index: 2;
}

.aa-res-pwa__btn--evacuating.is-tapped {
  animation: aa-res-btn-tap 30s ease-in-out infinite;
}

@keyframes aa-res-btn-tap {
  0%,
  38% {
    transform: scale(1);
  }
  40% {
    transform: translateY(1px) scale(0.96);
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.55);
  }
  42%,
  52% {
    transform: scale(1);
  }
  100% {
    transform: scale(1);
  }
}

.aa-res-pwa__btn--safe {
  background: radial-gradient(circle at 30% 0, #a5d6a7 0, #4caf50 45%, #2e7d32 100%);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.35);
}

.aa-res-touch {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
  opacity: 0;
  z-index: 10;
  left: 28%;
  bottom: 28%;
  animation: aa-res-touch-tap 30s ease-in-out infinite;
}

.aa-res-touch::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.5);
  opacity: 0;
  animation: aa-res-touch-ring 30s ease-out infinite;
}

@keyframes aa-res-touch-tap {
  0%,
  36% {
    opacity: 0;
    transform: translate(40px, 40px) scale(0.8);
  }
  38% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  42% {
    opacity: 0;
    transform: translate(0, 0) scale(0.85);
  }
  100% {
    opacity: 0;
  }
}

@keyframes aa-res-touch-ring {
  0%,
  38% {
    opacity: 0;
    transform: scale(0.6);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
  44% {
    opacity: 0;
    transform: scale(1.4);
  }
  100% {
    opacity: 0;
  }
}

.aa-res-toast {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%) translateY(120%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(5, 6, 10, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 9px;
  color: #f5f5f5;
  white-space: nowrap;
  z-index: 11;
  animation: aa-res-toast-in 30s ease-in-out infinite;
}

@keyframes aa-res-toast-in {
  0%,
  40% {
    opacity: 0;
    transform: translateX(-50%) translateY(120%);
  }
  43%,
  51% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  54%,
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(120%);
  }
}

/* Population movement intelligence panel */
.aa-res-intel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem;
  min-width: 0;
}

.aa-res-intel__kicker {
  margin: 0;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #22d3ee;
}

.aa-res-intel__title {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #f8fafc;
}

.aa-res-intel__lead {
  margin: 0;
  font-size: clamp(0.8rem, 1.6vw, 0.95rem);
  line-height: 1.45;
  color: #94a3b8;
}

.aa-res-pwa__safety-map {
  margin-top: 8px;
}

.aa-res-pwa__safety-map-title {
  margin: 0 0 4px;
  font-size: 8px;
  font-weight: 700;
  color: #e2e8f0;
}

.aa-res-pwa__safety-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.aa-res-legend {
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.aa-res-legend--danger::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 3px;
  border-radius: 1px;
  background: #ff9800;
  vertical-align: middle;
}

.aa-res-legend--shelter::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 3px;
  border-radius: 50%;
  background: #22c55e;
  vertical-align: middle;
}

.aa-res-legend--route::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 2px;
  margin-right: 3px;
  background: #ef4444;
  vertical-align: middle;
}

.aa-res-pwa__safety-map-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.aa-res-flow {
  position: relative;
  height: clamp(120px, 20vh, 168px);
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: #0b1724;
  overflow: hidden;
}

.aa-res-flow__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  opacity: 1;
  display: block;
}

.aa-res-flow__dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a78bfa;
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.8);
  animation: aa-res-flow-dot 30s linear infinite;
}

.aa-res-flow__dot--1 {
  left: 18%;
  top: 62%;
  animation-delay: 0s;
}

.aa-res-flow__dot--2 {
  left: 22%;
  top: 58%;
  animation-delay: 0.4s;
}

.aa-res-flow__dot--3 {
  left: 26%;
  top: 65%;
  animation-delay: 0.8s;
}

.aa-res-flow__cmd {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 8px;
  font-weight: 700;
  color: #a5f3fc;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.aa-res-flow__cmd-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 8px #22d3ee;
  flex-shrink: 0;
}

@keyframes aa-res-flow-dot {
  0%,
  40% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  42% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(120px, -40px) scale(1);
  }
  52%,
  100% {
    opacity: 0;
    transform: translate(140px, -48px) scale(0.5);
  }
}

.aa-res-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.aa-res-stats li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.78rem;
  color: #cbd5e1;
}

.aa-res-stats strong {
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}

.aa-res-stats li.is-live strong {
  color: #c4b5fd;
  animation: aa-res-stat-pulse 30s ease-in-out infinite;
}

@keyframes aa-res-stat-pulse {
  0%,
  40% {
    color: #cbd5e1;
  }
  43%,
  52% {
    color: #c4b5fd;
  }
  56%,
  100% {
    color: #cbd5e1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aa-commercial__resident-scene {
    opacity: 1;
    animation: none;
  }

  .aa-res-push,
  .aa-res-pwa__btn--evacuating,
  .aa-res-touch,
  .aa-res-toast,
  .aa-res-flow__dot {
    animation: none;
  }

  .aa-res-push {
    transform: none;
    opacity: 1;
  }
}
