/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { 
  height: 100%; 
  width: 100%; 
  overflow: hidden; 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans Hebrew", sans-serif;
  color: #fff;
  direction: rtl;
  text-align: right;
}

/* ---------- Landing screen ---------- */
/* ============ LANDING PAGE (redesigned) ============ */
#landing {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 56px 24px 36px;
  /* Richer UN-themed gradient with a soft glow orb and subtle mesh */
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(79, 195, 247, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 80% 100%, rgba(0, 158, 219, 0.35) 0%, transparent 60%),
    linear-gradient(180deg, #001229 0%, #002247 55%, #003566 100%);
  z-index: 100;
  text-align: center;
  overflow: hidden;
}
/* Subtle animated starfield / noise overlay */
#landing::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.25), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 85% 20%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 10% 70%, rgba(255,255,255,0.15), transparent);
  opacity: 0.6;
  pointer-events: none;
}
#landing.hidden { display: none !important; }

.landing-top {
  max-width: 420px;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  padding: 8px 16px;
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 999px;
  color: #4fc3f7;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.eyebrow::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: #4fc3f7;
  box-shadow: 0 0 8px #4fc3f7;
}

/* ---------- Logo with wave rings ---------- */
.logo-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 4px auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: float 4s ease-in-out infinite;
}
.hero-icon {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 12px 32px rgba(0, 158, 219, 0.55));
}
.logo-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(79, 195, 247, 0.7);
  transform: translate(-50%, -50%) scale(1);
  animation: ringPulse 3.6s ease-out infinite;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 18px rgba(79, 195, 247, 0.35);
}
.logo-ring-1 { animation-delay: 0s; }
.logo-ring-2 { animation-delay: 1.2s; }
.logo-ring-3 { animation-delay: 2.4s; }
@keyframes ringPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0.75;
    border-color: rgba(79, 195, 247, 0.85);
    box-shadow: 0 0 24px rgba(79, 195, 247, 0.6);
  }
  80% {
    opacity: 0.15;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.9);
    opacity: 0;
    border-color: rgba(79, 195, 247, 0);
    box-shadow: 0 0 0 rgba(79, 195, 247, 0);
  }
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

h1 {
  font-size: 32px; font-weight: 800; line-height: 1.15;
  margin-bottom: 12px; letter-spacing: -0.5px;
  background: linear-gradient(180deg, #ffffff 0%, #b8d4ea 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle {
  font-size: 15px; color: rgba(255,255,255,0.7);
  line-height: 1.6; max-width: 340px;
}

.landing-mid {
  width: 100%; max-width: 400px;
  position: relative; z-index: 2;
}
.steps { display: flex; flex-direction: column; gap: 10px; }
.step {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 14px 16px; border-radius: 14px;
  text-align: right; direction: rtl;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.step:hover {
  border-color: rgba(79, 195, 247, 0.3);
  background: rgba(79, 195, 247, 0.06);
}
.step-num {
  flex: 0 0 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, #009edb 0%, #0077b6 100%);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 119, 182, 0.4);
}
.step-text { font-size: 14px; color: rgba(255,255,255,0.92); line-height: 1.5; }

.landing-bottom {
  width: 100%; max-width: 400px;
  position: relative; z-index: 10;
}
.start-btn {
  width: 100%; padding: 18px 22px; border: none; border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
  color: #003566;
  font-size: 17px; font-weight: 800; letter-spacing: 0.2px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow:
    0 10px 30px rgba(0, 119, 182, 0.35),
    0 0 0 1px rgba(255,255,255,0.2) inset;
  transition: transform .15s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
}
.start-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(79, 195, 247, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.start-btn:hover::before { transform: translateX(100%); }
.start-btn:active { transform: scale(0.98); }
.start-btn svg { width: 22px; height: 22px; stroke: #003566; }

.browse-btn {
  width: 100%;
  padding: 14px 20px;
  margin-top: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.browse-btn:hover {
  background: rgba(79, 195, 247, 0.12);
  border-color: rgba(79, 195, 247, 0.55);
}
.browse-btn:active { transform: scale(0.98); }
.browse-btn svg { width: 20px; height: 20px; stroke: #4fc3f7; }

.footnote {
  margin-top: 14px; font-size: 12px;
  color: rgba(255,255,255,0.45);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.footnote::before {
  content: '🔒';
  font-size: 10px;
  opacity: 0.7;
}

/* Small phones */
@media (max-height: 700px) {
  #landing { padding: 32px 20px 28px; }
  .logo-wrap { width: 90px; height: 90px; margin-bottom: 14px; }
  .hero-icon { width: 90px; height: 90px; }
  .logo-ring { width: 90px; height: 90px; }
  h1 { font-size: 26px; }
  .subtitle { font-size: 13px; }
  .steps { gap: 8px; }
  .step { padding: 10px 14px; }
}

/* ---------- AR UI overlay ---------- */
#ar-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  display: none;
}
#ar-overlay.active { display: block; }

/* Exit button: in RTL, placed on the left side (start in RTL) */
.exit-btn {
  position: absolute; top: max(16px, env(safe-area-inset-top)); left: 16px;
  pointer-events: auto;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.45); color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 22px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.scan-hint {
  position: absolute; bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  pointer-events: none;
  background: rgba(0,0,0,0.55); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: opacity .3s ease, transform .3s ease;
  white-space: nowrap;
}
.scan-hint.hidden { opacity: 0; transform: translateX(-50%) translateY(20px); }

/* AR status: in RTL, positioned on the right (end in RTL) */
#ar-status {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  left: auto;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  max-width: 70%;
  pointer-events: none;
  transition: background .3s ease;
  direction: rtl;
}

/* ---------- Info modal ---------- */
#info-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 29, 61, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .25s ease;
}
#info-modal.open { display: flex; opacity: 1; }

.modal-sheet {
  width: 100%; max-width: 560px; height: 92vh; max-height: 780px;
  background: #fff; color: #1a1a1a;
  border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .35s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
#info-modal.open .modal-sheet { transform: translateY(0); }

.modal-header {
  flex: 0 0 auto;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #eee;
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  direction: rtl;
}
.grabber {
  width: 40px; height: 4px; border-radius: 2px; background: #d0d0d0;
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
}
/* In RTL: back button comes first (on the right side) */
.back-btn {
  border: none; background: #f0f4f8; color: #003566;
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 22px; font-weight: 700; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.back-btn.visible { display: flex; }

.modal-title {
  flex: 1; font-size: 18px; font-weight: 700; color: #003566;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}
.close-btn {
  border: none; background: #f0f4f8; color: #003566;
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}

.modal-body { 
  flex: 1; 
  position: relative; 
  width: 100%;
  min-height: 0; /* Critical for flex children with absolute children */
  overflow: hidden; /* Default - iframe mode */
  direction: rtl;
}

/* Scrollable mode for list view */
.modal-body.scrollable {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Frame mode for iframe content */
.modal-body.frame-view {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
}

/* List view */
.list-hero {
  padding: 28px 22px 20px;
  background: linear-gradient(160deg, #003566, #0077b6);
  color: #fff;
  direction: rtl;
  text-align: right;
}
.list-hero h2 { font-size: 26px; font-weight: 800; line-height: 1.3; margin-bottom: 6px; letter-spacing: -0.3px; }
.list-hero p { font-size: 14px; color: rgba(255,255,255,0.85); line-height: 1.6; }

.mission-list { padding: 8px 0 24px; }

/* Empty list placeholder */
.empty-list-message {
  padding: 60px 30px;
  text-align: center;
  direction: rtl;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-title {
  font-size: 17px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}
.empty-subtitle {
  font-size: 14px;
  color: #94a3b8;
}
/* RTL: row layout - arrow on left, image on right, text in middle */
.mission-row {
  display: flex; 
  flex-direction: row;
  align-items: center; 
  gap: 14px;
  padding: 14px 22px; 
  border-bottom: 1px solid #f2f2f2;
  cursor: pointer; 
  transition: background .15s ease;
  text-align: right;
  direction: rtl;
}
.mission-row:active { background: #f5f9ff; }
.mission-row:last-child { border-bottom: none; }
/* Mission ribbon thumbnail - dynamic width based on image's natural aspect ratio.
   Height is fixed so rows stay consistent; width adjusts to the ribbon's shape. */
.mission-thumb {
  flex: 0 0 auto;
  height: 56px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  border-radius: 6px;
  background: #f1f5f9;
  padding: 4px;
  box-sizing: border-box;
}
.mission-meta { flex: 1; min-width: 0; }
.mission-name { font-size: 15px; font-weight: 600; color: #0f172a; line-height: 1.4; margin-bottom: 3px; }
.mission-years { font-size: 13px; color: #64748b; font-weight: 500; }
/* In RTL, the arrow points left (toward the direction of navigation) */
.mission-arrow { 
  color: #cbd5e1; 
  font-size: 22px; 
  flex: 0 0 auto;
}
.mission-arrow.nested-arrow {
  color: #0077b6;
  font-size: 26px;
  font-weight: bold;
}

/* Detail view (iframe) */
.detail-frame {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: 100%;
  border: none;
  background: #fff;
  display: block;
  flex: 1;
  overflow: hidden;
}

/* Container for injected XHTML content */
.xhtml-container {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Hidden style container - styles apply via inheritance */
.xhtml-styles {
  display: none;
}

/* Content wrapper - mimics body behavior */
/* CRITICAL: Override LibreOffice's print-style inline body attributes:
   - max-width: 8.5in (US Letter paper = 816px)
   - margin: 1in on all sides (96px)
   These are for print, not mobile. We override them here. */
.xhtml-content {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Replace 1-inch print margins with mobile-friendly padding */
  margin: 0 !important;
  padding: 16px !important;
}

/* Override any fixed widths from LibreOffice-generated content */
.xhtml-content div,
.xhtml-content section,
.xhtml-content article,
.xhtml-content main,
.xhtml-content table,
.xhtml-content td,
.xhtml-content th {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

/* Ensure images and media scale down */
.xhtml-content img,
.xhtml-content svg,
.xhtml-content video,
.xhtml-content canvas {
  max-width: 100% !important;
  height: auto !important;
}

/* Make wide tables scrollable horizontally */
.xhtml-content table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

/* Prevent pre/code from pushing layout wider */
.xhtml-content pre,
.xhtml-content code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Loading state */
.detail-loading {
  padding: 40px 20px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
  direction: rtl;
}

/* Loading state - also defined above, kept here for clarity */
.detail-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #64748b; font-size: 14px;
}

/* ========== LOADING OVERLAY ========== */
#loading-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: 
    radial-gradient(ellipse 60% 40% at 50% 30%, rgba(79, 195, 247, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, #001229 0%, #002247 55%, #003566 100%);
  color: #fff;
  display: none; align-items: center; justify-content: center;
  direction: rtl;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#loading-overlay.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
#loading-overlay.fade-out {
  opacity: 0;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 320px;
  width: 90%;
}

/* Helmet with orbiting rings */
.loading-helmet {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-icon {
  width: 90px;
  height: 90px;
  object-fit: contain;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 8px 24px rgba(0, 158, 219, 0.55));
  animation: helmetFloat 3s ease-in-out infinite;
}

@keyframes helmetFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.03); }
}

.loading-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #4fc3f7;
  border-right-color: rgba(79, 195, 247, 0.4);
  animation: ringRotate 2s linear infinite;
}

.loading-ring-2 {
  inset: 10px;
  border-top-color: #009edb;
  border-left-color: rgba(0, 158, 219, 0.4);
  border-right-color: transparent;
  animation: ringRotate 3s linear infinite reverse;
}

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

.loading-title {
  font-size: 17px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.3px;
}

/* Loading steps */
.loading-steps {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: right;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  opacity: 0.4;
  transform: translateX(10px);
  transition: all 0.4s ease;
}

.loading-step.active {
  opacity: 1;
  transform: translateX(0);
  background: rgba(79, 195, 247, 0.1);
  border-color: rgba(79, 195, 247, 0.3);
}

.loading-step.done {
  opacity: 0.85;
  transform: translateX(0);
  background: rgba(100, 255, 150, 0.08);
  border-color: rgba(100, 255, 150, 0.3);
}

.step-dot {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  transition: all 0.3s ease;
}

.loading-step.active .step-dot {
  background: #4fc3f7;
  box-shadow: 0 0 12px rgba(79, 195, 247, 0.6);
  animation: dotPulse 1s ease-in-out infinite;
}

.loading-step.done .step-dot {
  background: #64ff96;
  box-shadow: 0 0 10px rgba(100, 255, 150, 0.5);
}

.loading-step.done .step-dot::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #003566;
  font-size: 11px;
  font-weight: 900;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 12px rgba(79, 195, 247, 0.6); }
  50% { transform: scale(1.15); box-shadow: 0 0 18px rgba(79, 195, 247, 0.9); }
}

.step-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* Progress bar */
.loading-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #009edb 0%, #4fc3f7 100%);
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.loading-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

.loading-percent {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.5px;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ========== GAMIFICATION EFFECTS ========== */

/* Glass blink - full-screen flash effect */
.glass-blink {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(79, 195, 247, 0.6) 0%,
    rgba(255, 255, 255, 0.4) 30%,
    rgba(79, 195, 247, 0.2) 60%,
    transparent 100%
  );
  animation: glassBlink 0.8s ease-out forwards;
}

@keyframes glassBlink {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  15% {
    opacity: 1;
    transform: scale(1.1);
  }
  30% {
    opacity: 0.8;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.3);
  }
}

/* Achievement toast - slides up from bottom */
.achievement-toast {
  position: fixed;
  bottom: -120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(0, 53, 102, 0.95) 0%, rgba(0, 119, 182, 0.95) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(79, 195, 247, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #fff;
  min-width: 280px;
  max-width: 90%;
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
}

.achievement-toast.show {
  bottom: max(32px, env(safe-area-inset-bottom));
  opacity: 1;
}

.toast-icon {
  font-size: 32px;
  flex-shrink: 0;
  animation: toastIconPulse 0.6s ease-in-out;
}

@keyframes toastIconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.toast-content {
  flex: 1;
  text-align: right;
  direction: rtl;
}

.toast-title {
  font-size: 14px;
  font-weight: 700;
  color: #4fc3f7;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.toast-message {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.4;
}

/* Special style for completion toast */
.achievement-toast.complete {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%);
  box-shadow: 
    0 8px 32px rgba(255, 215, 0, 0.4),
    0 0 0 1px rgba(255, 215, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.achievement-toast.complete .toast-title {
  color: #fff;
}


/* ========== WORLD PEACE INDICATOR ========== */
#world-peace-indicator {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: auto;
  
  min-width: 200px;
  max-width: 280px;
  padding: 10px 14px 8px;
  background: rgba(0, 29, 61, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 14px;
  border: 1px solid rgba(79, 195, 247, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #fff;
  direction: ltr;
  text-align: center;
  
  transition: all 0.4s ease;
}

/* Complete state - green glow */
#world-peace-indicator.complete {
  background: rgba(0, 80, 40, 0.85);
  border-color: rgba(100, 255, 150, 0.6);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(100, 255, 150, 0.4),
    inset 0 0 20px rgba(100, 255, 150, 0.1);
  animation: peacePulse 2s ease-in-out infinite;
}

@keyframes peacePulse {
  0%, 100% { 
    box-shadow: 
      0 4px 20px rgba(0, 0, 0, 0.4),
      0 0 30px rgba(100, 255, 150, 0.4),
      inset 0 0 20px rgba(100, 255, 150, 0.1);
  }
  50% { 
    box-shadow: 
      0 4px 20px rgba(0, 0, 0, 0.4),
      0 0 50px rgba(100, 255, 150, 0.7),
      inset 0 0 30px rgba(100, 255, 150, 0.2);
  }
}

.peace-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.peace-icon {
  font-size: 14px;
  filter: drop-shadow(0 0 4px rgba(79, 195, 247, 0.5));
}

#world-peace-indicator.complete .peace-icon {
  filter: drop-shadow(0 0 6px rgba(100, 255, 150, 0.8));
  animation: iconSpin 3s linear infinite;
}

@keyframes iconSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.peace-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}

.peace-percentage {
  font-size: 13px;
  font-weight: 800;
  color: #4fc3f7;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

#world-peace-indicator.complete .peace-percentage {
  color: #7fffaa;
}

.peace-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.peace-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #009edb 0%, #4fc3f7 100%);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.peace-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

#world-peace-indicator.complete .peace-progress-fill {
  background: linear-gradient(90deg, #2ecc71 0%, #7fffaa 100%);
}

.peace-counter {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}


/* ========== ULTIMATE PEACEKEEPER TOAST ========== */
.ultimate-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  z-index: 10000;
  
  width: 90%;
  max-width: 400px;
  padding: 30px 24px 24px;
  
  background: linear-gradient(
    135deg,
    rgba(0, 40, 80, 0.98) 0%,
    rgba(0, 100, 150, 0.98) 50%,
    rgba(0, 40, 80, 0.98) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  
  border-radius: 24px;
  border: 2px solid rgba(255, 215, 0, 0.8);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(255, 215, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  
  color: #fff;
  text-align: center;
  direction: ltr;
  
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  overflow: hidden;
}

.ultimate-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
  animation: ultimateFloat 3s ease-in-out infinite 0.5s;
}

@keyframes ultimateFloat {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -52%) scale(1.02); }
}

.ultimate-badge {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 20px;
  background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
  color: #5a3a00;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
}

.ultimate-icon {
  font-size: 56px;
  margin: 10px 0 12px;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
  animation: ultimateIconPulse 1.5s ease-in-out infinite;
}

@keyframes ultimateIconPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 30px rgba(255, 215, 0, 1)); }
}

.ultimate-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #ffd700 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.ultimate-message {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  max-width: 320px;
  margin: 0 auto;
}

/* Moving shine effect across the toast */
.ultimate-shine {
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 215, 0, 0.15) 50%,
    transparent 100%
  );
  pointer-events: none;
  animation: ultimateShine 3s ease-in-out infinite 1s;
}

@keyframes ultimateShine {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

/* Backdrop darkening when ultimate toast is visible */
.ultimate-toast::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.ultimate-toast.show::before {
  opacity: 1;
}
