/* ============================================================
   WHERE ARE FALKO'S AIRPODS?
   Aesthetic: Lost & Found Notice Board × Flight Ops Terminal
   ============================================================ */

:root {
  --bg:          #060c1a;
  --bg-card:     #0b1427;
  --bg-panel:    #080e1e;
  --blue:        #4a9eff;
  --blue-dim:    rgba(74, 158, 255, 0.12);
  --blue-glow:   rgba(74, 158, 255, 0.35);
  --red:         #ff3b3b;
  --red-dim:     rgba(255, 59, 59, 0.12);
  --yellow:      #ffc93c;
  --green:       #3bffb0;
  --text:        #d2e8ff;
  --text-dim:    #4a6a8a;
  --text-muted:  #2a4a6a;
  --border:      rgba(74, 158, 255, 0.18);
  --border-dim:  rgba(74, 158, 255, 0.07);

  --mono:    'IBM Plex Mono', 'Courier New', monospace;
  --display: 'Barlow Condensed', sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  position: relative;
}

/* ── Background grid ── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(74, 158, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 158, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* Subtle CRT scanline overlay */
.scanline {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* ── App layout ── */
.app {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 12, 26, 0.97);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.header-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.case-badge {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge-blink {
  color: var(--blue);
  font-size: 8px;
  animation: blink 1.1s step-end infinite;
}

.status-open {
  color: var(--green);
  font-weight: 700;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(24px, 4.5vw, 44px);
  letter-spacing: 0.01em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 40px rgba(74, 158, 255, 0.45);
}

.subtitle {
  font-size: clamp(10px, 1.8vw, 13px);
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.anywhere {
  color: var(--yellow);
  font-weight: 700;
}

/* Last seen block */
.header-right { flex-shrink: 0; }

.last-seen-block {
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--blue-dim);
  border-radius: 3px;
  min-width: 130px;
}

.last-seen-label {
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--blue);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-dim);
}

.last-seen-row {
  font-size: 10px;
  line-height: 1.7;
  color: var(--text);
  letter-spacing: 0.03em;
}

.last-seen-row.muted { color: var(--text-dim); }
.highlight { color: var(--blue); font-weight: 700; }

/* ── Instruction bar ── */
.instruction-bar {
  flex-shrink: 0;
  padding: 5px 16px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  background: rgba(6, 12, 26, 0.8);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  gap: 7px;
  animation: pulse-bar 3s ease-in-out infinite;
}

@keyframes pulse-bar {
  0%, 100% { opacity: 0.65; }
  50%       { opacity: 1; }
}

.crosshair {
  color: var(--blue);
  font-size: 13px;
  animation: spin-slow 8s linear infinite;
  display: inline-block;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Map ── */
.map-container {
  flex: 1;
  position: relative;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #070d1a;
}

/* Dark-mode map tiles */
.leaflet-tile-pane {
  filter: hue-rotate(185deg) invert(92%) brightness(0.8) contrast(1.15) saturate(0.75);
}

.leaflet-container {
  background: #070d1a !important;
  cursor: crosshair !important;
}

/* Vignette */
.map-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(6, 12, 26, 0.65) 100%);
  pointer-events: none;
  z-index: 400;
}

/* Corner brackets */
.map-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  z-index: 401;
  pointer-events: none;
}
.map-corner-tl { top: 8px;    left: 8px;    border-top: 2px solid var(--blue); border-left: 2px solid var(--blue); }
.map-corner-tr { top: 8px;    right: 8px;   border-top: 2px solid var(--blue); border-right: 2px solid var(--blue); }
.map-corner-bl { bottom: 8px; left: 8px;    border-bottom: 2px solid var(--blue); border-left: 2px solid var(--blue); }
.map-corner-br { bottom: 8px; right: 8px;   border-bottom: 2px solid var(--blue); border-right: 2px solid var(--blue); }

/* Leaflet controls style */
.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--blue) !important;
  border-color: var(--border) !important;
  font-family: var(--mono) !important;
}
.leaflet-control-zoom a:hover {
  background: var(--blue-dim) !important;
}
.leaflet-control-attribution {
  background: rgba(6, 12, 26, 0.75) !important;
  color: var(--text-muted) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a {
  color: var(--text-dim) !important;
}

/* ── Custom marker ── */
.airpod-marker {
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(74, 158, 255, 0.9))
          drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.marker-pulse {
  animation: marker-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes marker-enter {
  from { transform: translateY(-16px) scale(0.4); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}

/* ── Response panel ── */
.response-panel {
  flex-shrink: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.response-panel.visible {
  max-height: 72px;
}

.response-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.response-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.response-icon {
  font-size: 22px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.response-text {
  font-size: clamp(11px, 2vw, 13px);
  color: var(--text);
  font-style: italic;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Submit button */
.submit-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--yellow);
  border: 2px solid var(--yellow);
  color: #000;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
  animation: btn-pulse 1.8s ease-in-out infinite;
}

@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 201, 60, 0.5); }
  50%       { box-shadow: 0 0 28px rgba(255, 201, 60, 0.9), 0 0 8px rgba(255, 201, 60, 0.4); }
}

.btn-arrow {
  font-size: 18px;
  transition: transform 0.15s;
}

.submit-btn:hover:not(:disabled) {
  background: #fff;
  border-color: #fff;
  color: #000;
  transform: scale(1.03);
  box-shadow: 0 0 36px rgba(255, 255, 255, 0.4);
  animation: none;
}

.submit-btn:hover:not(:disabled) .btn-arrow {
  transform: translateX(4px);
}

.submit-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.submit-btn:disabled {
  opacity: 0.2;
  cursor: default;
  background: transparent;
  border-color: var(--text-dim);
  border-width: 1px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  animation: none;
  padding: 8px 16px;
}

/* ── Footer ── */
.footer {
  flex-shrink: 0;
  padding: 5px 16px;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  border-top: 1px solid var(--border-dim);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Modal ── */
.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255, 59, 59, 0.4);
  max-width: 480px;
  width: 100%;
  padding: 0;
  box-shadow:
    0 0 0 1px rgba(255, 59, 59, 0.15),
    0 0 60px rgba(255, 59, 59, 0.18),
    0 24px 48px rgba(0, 0, 0, 0.6);
  transform: translateY(24px) scale(0.95);
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
  overflow: hidden;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header-bar {
  background: var(--red);
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 4px 16px;
}

.modal-wrong {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(56px, 14vw, 88px);
  color: var(--red);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-shadow: 0 0 50px rgba(255, 59, 59, 0.45);
  padding: 16px 20px 4px;
}

.modal-tagline {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  padding: 0 20px 16px;
  letter-spacing: 0.03em;
}

.modal-divider {
  height: 1px;
  background: rgba(255, 59, 59, 0.2);
  margin: 0 20px 16px;
}

.modal-section-label {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--blue);
  text-transform: uppercase;
  padding: 0 20px 8px;
}

.modal-story {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  padding: 0 20px 16px;
  letter-spacing: 0.02em;
}

.modal-story strong { color: var(--yellow); }

/* Battery row */
.battery-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 12px;
}

.battery-label {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
}

.battery-bar {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.battery-fill {
  height: 100%;
  width: 0%;
  background: var(--red);
  border-radius: 3px;
  box-shadow: 0 0 8px var(--red);
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}

.battery-pct {
  font-size: 10px;
  color: var(--red);
  font-weight: 700;
  white-space: nowrap;
}

.modal-ominous {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  padding: 0 20px 20px;
  letter-spacing: 0.02em;
}

.modal-ominous strong {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Close button */
.modal-close {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: rgba(74, 158, 255, 0.05);
  border: none;
  border-top: 1px solid var(--border-dim);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  text-align: center;
}

.close-dim { opacity: 0.5; }

.modal-close:hover {
  background: var(--blue-dim);
  color: var(--text);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .header { flex-direction: column; gap: 8px; }
  .header-right { align-self: flex-start; }
  .last-seen-block { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: unset; padding: 5px 8px; }
  .last-seen-label { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
  .last-seen-row { font-size: 9px; line-height: 1.5; }
  .title { font-size: 28px; }
  .response-text { font-size: 11px; }
  .submit-btn { padding: 8px 14px; font-size: 15px; }
  .submit-btn:disabled { padding: 7px 10px; font-size: 10px; }
  .modal-wrong { font-size: 56px; }
  .modal-story { font-size: 12px; }
  .footer { font-size: 8px; }
}

@media (max-width: 380px) {
  .title { font-size: 24px; }
  .response-icon { font-size: 18px; }
}
