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

:root {
  --navy: #0f1f3d;
  --navy-light: #1a3360;
  --gold: #c9922a;
  --gold-light: #f0b84a;
  --cream: #f8f4ee;
  --white: #ffffff;
  --red: #c0392b;
  --green: #27ae60;
  --gray: #8a97a8;
  --border: rgba(15,31,61,0.12);
  --shadow: 0 4px 24px rgba(15,31,61,0.12);
  --shadow-lg: 0 12px 48px rgba(15,31,61,0.2);
  --radius: 16px;
  --radius-sm: 10px;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Screens ──────────────────────────────────────────────── */
.screen {
  display: none !important;
  min-height: 100dvh;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}
.screen.active { display: flex !important; }

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

/* ── Screen 1: Passcode ───────────────────────────────────── */
.passcode-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 60%, #2a5080 100%);
  z-index: 0;
}

.globe-decoration {
  position: absolute;
  font-size: 320px;
  opacity: 0.06;
  right: -80px;
  top: -60px;
  transform: rotate(-15deg);
  filter: blur(2px);
}

.passcode-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 0 20px 40px;
  justify-content: center;
  gap: 40px;
}

.brand { text-align: center; }

.brand-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(52px, 14vw, 80px);
  font-weight: 900;
  color: var(--white);
  line-height: 0.95;
  letter-spacing: -2px;
}

.brand-sub {
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  margin-top: 12px;
  letter-spacing: 0.5px;
}

.passcode-card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.input-label {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.passcode-inputs {
  display: flex;
  gap: 12px;
}

.pin-input {
  width: 60px;
  height: 72px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  caret-color: var(--gold-light);
}

.pin-input:focus {
  border-color: var(--gold-light);
  background: rgba(255,255,255,0.15);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--navy);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.3px;
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:not(:disabled):active { transform: scale(0.97); }

.btn-ghost {
  display: inline-block;
  padding: 12px 20px;
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--border);
  border-radius: 50px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-ghost:hover { background: rgba(15,31,61,0.06); }

/* ── Screen Header ────────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  font-weight: 600;
  font-size: 16px;
  color: var(--navy);
}

.back-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--navy);
  padding: 4px 8px 4px 0;
  line-height: 1;
}

/* ── Screen 2: User Info ──────────────────────────────────── */
.screen-body {
  flex: 1;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-hero {
  text-align: center;
  padding: 8px 0;
}

.missionary-avatar {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
}

.missionary-name {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.info-subtitle {
  color: var(--gray);
  font-size: 14px;
}

.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.form-field input {
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: var(--navy);
  background: var(--cream);
  outline: none;
  transition: border-color 0.2s;
}
.form-field input:focus { border-color: var(--navy-light); background: var(--white); }

.field-hint {
  font-size: 12px;
  color: var(--gray);
}

/* ── Screen 3: Landing ────────────────────────────────────── */
#screen-landing {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
}

.landing-header {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  padding: 40px 24px 32px;
  text-align: center;
}

.missionary-avatar-lg { font-size: 64px; margin-bottom: 16px; }

.landing-missionary-name {
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 6px;
}

.landing-subtitle {
  color: rgba(255,255,255,0.65);
  font-size: 14px;
}

#pre-reveal, #post-reveal {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Countdown */
.countdown-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.countdown-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray);
  margin-bottom: 16px;
}

.countdown-timer {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
}

.time-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
}

.time-unit span:first-child {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.time-unit span:last-child {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
  margin-top: 4px;
}

.time-sep {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  padding-bottom: 8px;
  align-self: center;
}

.announcement-when {
  margin-top: 12px;
  font-size: 13px;
  color: var(--gray);
}
.opening-address {
  margin-top: 6px;
  font-size: 13px;
  color: var(--navy);
  font-weight: 500;
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 12px;
}

.stat-bubble {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-num {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--navy);
}

.stat-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
  margin-top: 4px;
}

.stat-countries {
  font-size: 11px;
  color: var(--gray);
  margin-top: 4px;
  line-height: 1.3;
  text-align: center;
}

.stat-cta {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.3;
  text-align: center;
}

/* Meet banner */
#meet-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-align: center;
  background: rgba(26,51,96,0.06);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--navy);
  width: 100%;
}
#meet-banner.info-banner {
  background: rgba(201,146,42,0.1);
  cursor: default;
}

/* Action Cards */
.action-cards { display: flex; flex-direction: column; gap: 12px; }

.action-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  text-decoration: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--navy);
  transition: transform 0.15s, box-shadow 0.15s;
  width: 100%;
}
.action-card:active { transform: scale(0.98); }

.action-share { border-left: 4px solid var(--navy-light); }

.action-card-centered {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 10px;
  flex-direction: row;
}
.action-card-centered strong {
  font-size: 15px;
  font-weight: 700;
}

.action-icon { font-size: 28px; flex-shrink: 0; }
.action-card div { flex: 1; }
.action-card strong { display: block; font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.action-card small { font-size: 12px; color: var(--gray); }
.action-arrow { font-size: 18px; color: var(--gray); flex-shrink: 0; }

/* Post reveal */
.reveal-banner {
  background: linear-gradient(135deg, var(--navy) 0%, #1e4080 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
}

.reveal-emoji { font-size: 48px; margin-bottom: 12px; }
.reveal-country {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}
.reveal-reports { color: rgba(255,255,255,0.7); font-size: 14px; }

.winners-section {
  background: #fffbea;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px;
}
.winners-section h4 { font-size: 16px; margin-bottom: 12px; }
.winner-item { font-size: 15px; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
.winner-item:last-child { border: none; }

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(15,31,61,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
  opacity: 0.85;
}
.back-to-top:active {
  transform: scale(0.93);
  opacity: 1;
}

/* Map preview */
.map-section {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 16px 16px;
  cursor: pointer;
}
#landing-map {
  height: 320px !important;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
}
.map-explore-hint {
  position: absolute;
  bottom: 28px;
  right: 28px;
  background: rgba(15,31,61,0.75);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 50px;
  pointer-events: none;
  z-index: 500;
  backdrop-filter: blur(4px);
}

/* Map lightbox */
.map-lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
}
.lightbox-close-float {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6000;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15,31,61,0.75);
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.lightbox-map {
  flex: 1;
  width: 100%;
  height: 100%;
}

/* ── Picks Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,31,61,0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
}
.modal-slots {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.modal-slot label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
}
.modal-slot input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: var(--navy);
  background: var(--cream);
  outline: none;
  transition: border-color 0.2s;
}
.modal-slot input:focus {
  border-color: var(--navy);
  background: var(--white);
}
.modal-slot input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--cream);
}
.modal-slot .locked-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #e8f5e9;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: #2e7d32;
}
.modal-actions {
  display: flex;
  gap: 12px;
}
.modal-actions .btn-ghost { flex: 1; text-align: center; }
.modal-actions .btn-primary { flex: 2; }
.modal-save-btn { display: block; }
.modal-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 3000;
  margin-top: 4px;
  list-style: none;
}
.modal-dropdown li {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.modal-dropdown li:last-child { border: none; }
.modal-dropdown li:hover, .modal-dropdown li:active { background: var(--cream); }

/* ── Shared Utilities ─────────────────────────────────────── */
.hidden { display: none !important; }

.error-msg {
  background: #fdf0ef;
  border: 1px solid #f5c6c2;
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  text-align: center;
  width: 100%;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  animation: toastFade 2s ease forwards;
}

@keyframes toastFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* Mobile map corners */
@media (max-width: 640px) {
  #landing-map {
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

/* ── All Picks Page ──────────────────────────────────────── */
.allpicks-toolbar {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 57px;
  z-index: 10;
}
.sort-btn {
  flex: 1;
  padding: 10px;
  border-radius: 50px;
  border: 2px solid var(--border);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.2s;
}
.sort-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.allpicks-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 40px;
}
.pick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.pick-row-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--navy);
  flex-shrink: 0;
}
.pick-row-countries {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pick-pill {
  font-size: 13px;
  color: var(--navy);
  background: var(--cream);
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
}
.country-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--cream);
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 113px;
}
.country-group-name {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px 10px 32px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--navy);
}

/* Identity bar */
.identity-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  font-size: 13px;
  color: var(--gray);
}
.identity-reset {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* Leaflet override */
.leaflet-container { font-family: 'DM Sans', sans-serif; }
.leaflet-control-attribution { font-size: 10px !important; }
