*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:     #04070f;
  --bg-panel:    rgba(14, 24, 46, 0.85);
  --border:      rgba(255, 255, 255, 0.08);
  --border-hot:  rgba(91, 200, 255, 0.35);
  --text:        #e6ecf4;
  --text-dim:    rgba(230, 236, 244, 0.55);
  --text-faint:  rgba(230, 236, 244, 0.32);
  --accent:      #5bc8ff;
  --accent-hot:  #7dd9ff;
  --tn:          #ffb347;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}

#loading {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 24px;
  background: var(--bg-deep);
  transition: opacity 0.7s ease;
}
#loading.fade-out { opacity: 0; pointer-events: none; }

#loading-spinner {
  width: 56px; height: 56px;
  border: 2px solid rgba(91,200,255,0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

#loading p {
  color: var(--text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 500;
}

@keyframes spin { to { transform: rotate(360deg); } }

#map-container {
  position: fixed; inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.8s ease;
  background: var(--bg-deep);
}
#map-container.visible { opacity: 1; }

#scan-overlay {
  position: fixed; inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#scan-overlay.active { opacity: 1; }
#scan-overlay.done   { display: none; }

.scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(91,200,255,0.7), transparent);
  box-shadow: 0 0 14px rgba(91,200,255,0.5);
  animation: scanSweep 2.4s ease-in-out infinite;
  top: 0;
}
@keyframes scanSweep {
  0%   { top: 8%;  opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 92%; opacity: 0; }
}

.scan-crosshair {
  position: absolute;
  left: 50%; top: 50%;
  width: 220px; height: 220px;
  transform: translate(-50%, -50%);
}
.ch-h, .ch-v { position: absolute; background: rgba(91,200,255,0.35); }
.ch-h { left: 0; right: 0; top: 50%; height: 1px; }
.ch-v { top: 0; bottom: 0; left: 50%; width: 1px; }
.scan-crosshair::before, .scan-crosshair::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  border: 1px solid rgba(91,200,255,0.6);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: chPulse 2.4s ease-out infinite;
}
.scan-crosshair::before { width: 60px; height: 60px; }
.scan-crosshair::after  { width: 60px; height: 60px; animation-delay: 1.2s; }
@keyframes chPulse {
  0%   { width: 30px;  height: 30px;  opacity: 0.9; }
  100% { width: 240px; height: 240px; opacity: 0; }
}

.leaflet-container {
  background: #04070f !important;
  font-family: 'Inter', sans-serif;
}
.leaflet-control-attribution {
  background: transparent !important;
  color: rgba(230, 236, 244, 0.18) !important;
  font-size: 9px !important;
  padding: 0 4px !important;
  letter-spacing: 0.02em;
}
.leaflet-control-attribution a {
  color: rgba(230, 236, 244, 0.28) !important;
  text-decoration: none !important;
}
.leaflet-control-zoom a {
  background: rgba(10,18,36,0.9) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.andy-pin-wrap { cursor: pointer; }

.andy-map-pin {
  position: relative;
  width: 60px; height: 60px;
  animation: pinDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: transform 0.2s ease;
}
.andy-map-pin:hover { transform: scale(1.08); }

.andy-map-pin img {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(4,7,15,0.9), 0 8px 30px rgba(0,0,0,0.7), 0 0 30px rgba(91,200,255,0.6);
}
.andy-map-pin::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulseRing 1.6s ease-out infinite;
  opacity: 0.6;
}
@keyframes pinDrop {
  from { transform: translateY(-180px) scale(0.6); opacity: 0; }
  60%  { transform: translateY(8px) scale(1.05);   opacity: 1; }
  to   { transform: translateY(0)    scale(1);     opacity: 1; }
}
@keyframes pulseRing {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}

.andy-popup .leaflet-popup-content-wrapper {
  background: rgba(10, 18, 36, 0.96);
  border: 1px solid var(--border-hot);
  border-radius: 12px;
  color: var(--text);
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.andy-popup .leaflet-popup-content {
  margin: 10px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
}
.andy-popup .leaflet-popup-tip {
  background: var(--bg-panel);
  border: 1px solid var(--border-hot);
}
.andy-quip {
  max-width: 260px;
  line-height: 1.35;
  text-align: center;
  word-wrap: break-word;
  animation: quipIn 0.45s ease;
}
@keyframes quipIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

#ui {
  position: fixed; inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#brand, #counter-card, #reveal-card { pointer-events: auto; }

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 32px 40px 0;
  gap: 24px;
}

#brand-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--accent);
  background: rgba(91,200,255,0.08);
  border: 1px solid rgba(91,200,255,0.25);
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
  margin-bottom: 18px;
}

.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.dot.pulse { animation: dotPulse 1.4s ease-in-out infinite; }
@keyframes dotPulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

#hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text);
  text-shadow: 0 4px 40px rgba(0,0,0,0.6);
}
#hero-title .accent {
  color: var(--accent);
  font-style: italic;
  text-shadow: 0 0 30px rgba(91,200,255,0.6);
}

#hero-sub {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0.01em;
  max-width: 360px;
}

#counter-card {
  background: rgba(8, 14, 28, 0.88);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 26px;
  max-width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
}

.counter-text {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-dim);
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
}
.counter-line { flex-basis: 100%; color: var(--text-dim); }

.counter-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color 0.4s ease, text-shadow 0.4s ease;
  margin-top: 6px;
}
.counter-value.flash {
  color: var(--accent-hot);
  text-shadow: 0 0 24px rgba(91,200,255,0.7);
}

.counter-tail {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 6px;
}

.counter-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}


#reveal {
  padding: 0 40px 32px;
  display: flex;
  justify-content: center;
  transform: translateY(140px);
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s ease;
}
#reveal.visible { transform: translateY(0); opacity: 1; }

#reveal-card {
  position: relative;
  display: flex;
  gap: 32px;
  background: rgba(10, 18, 36, 0.95);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px 36px;
  width: 100%;
  max-width: 820px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.6),
    0 0 0 1px rgba(91,200,255,0.05),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

#reveal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
#reveal-close:hover {
  background: rgba(255, 90, 90, 0.15);
  border-color: rgba(255, 90, 90, 0.5);
  color: #ffb0b0;
}

#reveal.dismissed {
  transform: translateY(150%);
  opacity: 0;
  pointer-events: none;
}

#reveal-restore {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 25;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  background: rgba(10, 18, 36, 0.96);
  border: 1px solid var(--border-hot);
  border-radius: 999px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  animation: restoreIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#reveal-restore.visible { display: inline-flex; }
#reveal-restore:hover { transform: translateY(-2px); background: rgba(14, 24, 46, 0.98); border-color: var(--accent); }
#reveal-restore img {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}
@keyframes restoreIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

#reveal-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

#reveal-avatar { position: relative; width: 90px; height: 90px; }
#reveal-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(91,200,255,0.15), 0 0 30px rgba(91,200,255,0.4);
}

#reveal-intro {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.4;
  max-width: 130px;
}

#reveal-right { flex: 1; min-width: 0; }

#reveal-country {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text);
  text-shadow: 0 0 30px rgba(91,200,255,0.4);
}
#reveal-place {
  font-size: 1rem;
  color: var(--text-dim);
  margin-top: 4px;
  font-weight: 400;
  font-style: italic;
}

#reveal-stats {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 20px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
#stat-coords {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent);
}

.stat-wide { grid-column: span 2; }
#stat-ip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
@media (max-width: 600px) {
  .stat-wide { grid-column: span 1; }
}

#reveal-fact {
  margin-top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.45;
}
.fact-icon {
  font-style: normal;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(255,179,71,0.6));
}

#reveal-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#refresh-btn {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  background: rgba(91, 200, 255, 0.12);
  border: 1px solid rgba(91, 200, 255, 0.4);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
#refresh-btn:hover {
  background: rgba(91, 200, 255, 0.22);
  border-color: rgba(91, 200, 255, 0.7);
}
#refresh-btn:active   { transform: translateY(1px); }
#refresh-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#refresh-btn .refresh-icon { display: inline-block; transition: transform 0.4s ease; }
#refresh-btn:hover .refresh-icon { transform: rotate(180deg); }

#mute-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s ease, border-color 0.18s ease;
}
#mute-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
#mute-btn .mute-on  { display: inline; }
#mute-btn .mute-off { display: none; }
#mute-btn.sound-on .mute-on  { display: none; }
#mute-btn.sound-on .mute-off { display: inline; }

#reveal-card.tennessee {
  border-color: rgba(255, 179, 71, 0.5);
  box-shadow:
    0 30px 80px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255, 179, 71, 0.1),
    0 0 60px rgba(255, 179, 71, 0.15);
}
#reveal-card.tennessee #reveal-country {
  color: var(--tn);
  text-shadow: 0 0 30px rgba(255, 179, 71, 0.5);
}
#reveal-card.tennessee #reveal-intro { color: var(--tn); }

#site-footer {
  position: fixed;
  bottom: 6px;
  left: 16px;
  z-index: 15;
  font-size: 10px;
  color: rgba(230, 236, 244, 0.28);
  letter-spacing: 0.02em;
  font-style: italic;
  pointer-events: none;
  font-family: 'Inter', sans-serif;
}

@media (max-width: 900px) {
  #topbar { padding: 22px 22px 0; gap: 16px; }
  #counter-card { padding: 14px 18px; max-width: 260px; }
  .counter-text { font-size: 0.82rem; }
  .counter-value { font-size: 1.9rem; }
  .counter-tail { font-size: 0.9rem; }
  #hero-sub { display: none; }
  #reveal { padding: 0 16px 22px; }
  #reveal-card { padding: 20px 22px; gap: 18px; }
  #reveal-avatar { width: 64px; height: 64px; }
  #reveal-intro { font-size: 0.58rem; max-width: 90px; }
  #reveal-stats { grid-template-columns: repeat(2, 1fr); gap: 12px 16px; padding: 14px 0; }
  #site-footer { font-size: 9px; }
}

@media (max-width: 600px) {
  #topbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 14px 0; }
  #brand-tag { margin-bottom: 10px; }
  #hero-title { font-size: 2rem; line-height: 1; }
  #counter-card { align-self: stretch; max-width: none; padding: 12px 16px; }
  .counter-text { font-size: 0.78rem; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
  .counter-line { flex-basis: auto; }
  .counter-value { font-size: 1.5rem; margin-top: 0; }
  .counter-tail { font-size: 0.85rem; margin-top: 0; }
  .counter-foot { display: none; }
  #reveal { padding: 0 10px 14px; }
  #reveal-card { flex-direction: column; align-items: stretch; padding: 16px 18px; gap: 14px; }
  #reveal-left { flex-direction: row; gap: 12px; justify-content: flex-start; align-items: center; }
  #reveal-avatar { width: 54px; height: 54px; }
  #reveal-intro { text-align: left; max-width: none; font-size: 0.6rem; }
  #reveal-country { font-size: 1.6rem; }
  #reveal-place { font-size: 0.85rem; }
  #reveal-stats { grid-template-columns: repeat(2, 1fr); padding: 12px 0; gap: 10px 12px; }
  .stat-value { font-size: 0.85rem; }
  #stat-coords { font-size: 0.7rem; }
  #reveal-actions { flex-direction: row; gap: 8px; margin-top: 14px; }
  #refresh-btn { font-size: 0.78rem; padding: 9px 12px; }
  #reveal-close { width: 34px; height: 34px; font-size: 1rem; top: 10px; right: 10px; }
  #reveal-restore { bottom: 14px; right: 14px; padding: 6px 14px 6px 6px; font-size: 0.78rem; }
  #reveal-restore img { width: 24px; height: 24px; }
  #site-footer { left: 10px; bottom: 4px; }
  .scan-crosshair { width: 140px; height: 140px; }
}

@media (max-width: 380px) {
  #hero-title { font-size: 1.6rem; }
  #brand-tag { font-size: 0.6rem; padding: 4px 9px; }
}
