* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #f0f2f5;
  color: #1c1c1e;
  overflow-x: hidden;
  overflow-y: auto !important;
  min-height: 100vh;
  position: relative !important;
}

/* ── Feature 4: Animated gradient background (light) ─────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    135deg,
    #f0f2f5 0%,
    #fdf0f3 25%,
    #eef3fb 50%,
    #fdf6ee 75%,
    #f0f2f5 100%
  );
  background-size: 400% 400%;
  animation: bgShift 22s ease infinite;
}

@keyframes bgShift {
  0%   { background-position: 0% 50%; }
  33%  { background-position: 100% 0%; }
  66%  { background-position: 50% 100%; }
  100% { background-position: 0% 50%; }
}

/* iOS-style colors */
:root {
  --qatar-maroon: #8a1538;
  --qatar-maroon-light: #a01e46;
  --poseidon-blue: #007aff;
  --poseidon-blue-light: #5e9eff;
  --gray-bg: #f0f2f5;
  --card-bg: #ffffff;
  --text-primary: #1c1c1e;
  --text-secondary: #6e6e73;
  --border-light: #e5e5ea;
}

/* ============================================
   HEADER WITH VIDEO
   ============================================ */
.hero {
  position: relative;
  width: 100%;
  background: url("images/qatar_flag.png") center/cover no-repeat;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 138px;
  padding-bottom: 6px;
}

.hero-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 5% 4px;
  margin-top: 14px;
}

.info-float-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.info-float-btn:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 1);
}

.info-float-btn:active {
  transform: scale(0.95);
}

body.lang-ar .info-float-btn {
  right: auto;
  left: 16px;
}

@media (max-width: 480px) {
  .info-float-btn {
    width: 36px;
    height: 36px;
    top: 10px;
    right: 10px;
  }
  body.lang-ar .info-float-btn {
    right: auto;
    left: 10px;
  }

  .hero {
    min-height: 120px;
  }

  .hero-content {
    margin-top: 8px;
    padding: 6px 5% 4px;
  }

  .kashaf-logo {
    max-width: 60px;
  }
}

.kashaf-logo {
  max-width: 76px;
  width: auto;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s ease;
}

.kashaf-logo:hover {
  transform: scale(1.02);
}

/* ============================================
   CATEGORY BAR
   ============================================ */
.category-bar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-btn {
  background: rgba(0, 122, 255, 0.07);
  border: 0.5px solid rgba(0, 122, 255, 0.15);
  padding: 8px 14px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 36px;
}

.category-btn:hover:not(.active) {
  background: rgba(0, 122, 255, 0.16);
  border-color: rgba(0, 122, 255, 0.35);
  color: var(--poseidon-blue);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 122, 255, 0.18);
}

.category-btn:active:not(.active) {
  transform: translateY(0px) scale(0.96);
  box-shadow: none;
}

.category-btn.active {
  background: var(--poseidon-blue);
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(0, 122, 255, 0.3);
}

/* Desktop - Center category bar */
@media (min-width: 768px) {
  .category-bar {
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
  }
  .category-btn {
    padding: 8px 18px;
    font-size: 0.85rem;
  }
}

/* ============================================
   SEARCH + VIEW TOGGLE ROW (combined)
   ============================================ */
.search-toggle-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.search-toggle-row .search-bar-container {
  flex: 1;
  margin: 0;
}

.view-toggle-bar {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.view-toggle-btn {
  background: rgba(0, 122, 255, 0.07);
  border: 0.5px solid rgba(0, 122, 255, 0.15);
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn.icon-only {
  padding: 0;
  width: 34px;
  height: 34px;
}

.view-toggle-btn:hover:not(.active) {
  background: rgba(0, 122, 255, 0.16);
  border-color: rgba(0, 122, 255, 0.35);
  color: var(--poseidon-blue);
}

.view-toggle-btn.active {
  background: var(--qatar-maroon);
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(138, 21, 56, 0.3);
}

@media (min-width: 768px) {
  .search-toggle-row {
    max-width: 560px;
    margin: 0 auto;
  }
}

/* ============================================
   GLOBE (WORLD) MAP
   ============================================ */
.globe-container {
  position: relative;
  max-width: 100%;
  margin: 0.75rem auto 0.3rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}

.globe-map {
  width: 100%;
  height: 60vh;
  min-height: 380px;
  border-radius: 20px;
  overflow: hidden;
  background: #eef3fb;
}

.globe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(240, 242, 245, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 24px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  z-index: 5;
}

/* Custom Map/Satellite toggle (replaces Google's native control) */
.map-type-toggle {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 6;
}

.map-type-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-type-btn:hover:not(.active) {
  background: rgba(0, 122, 255, 0.1);
}

.map-type-btn.active {
  background: var(--poseidon-blue);
  color: white;
}

@media (min-width: 768px) {
  .globe-map {
    height: 65vh;
  }
}

/* ============================================
   WORLD MODE: map lives inside a big rounded card.
   Category bar and map-type toggle float ON the map,
   but stay inset within the card's padding.
   ============================================ */
body.world-mode .globe-map {
  height: 76vh;
  min-height: 520px;
  border-radius: 18px;
}

.app-footer {
  text-align: center;
  padding: 4px 12px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.install-app-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--qatar-maroon);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.install-app-btn:active {
  transform: translateX(-50%) scale(0.96);
}

/* Category bar is relocated (via JS) to be a child of
   #globeMapContainer while in World mode, so it can float
   directly over the map, inset within the card padding. */
body.world-mode #globeMapContainer .category-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 10;
  background: transparent;
  border-bottom: none;
  border-radius: 30px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

body.world-mode #globeMapContainer .category-bar .category-btn {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--text-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

body.world-mode #globeMapContainer .category-bar .category-btn.active {
  background: var(--qatar-maroon);
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(138, 21, 56, 0.45);
}

body.world-mode .discovery-bar {
  display: none;
}

/* ============================================
   MAP CONTAINER & GRID
   ============================================ */
.map-container {
  max-width: 100%;
  margin: 0.75rem auto;
  padding: 0 0.75rem;
}

.places-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  transition: opacity 0.3s ease;
}

.places-wrapper.loading {
  opacity: 0.5;
}

@media (min-width: 480px) {
  .places-wrapper {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (min-width: 768px) {
  .map-container {
    margin: 1rem auto;
    padding: 0 1rem;
  }
  .places-wrapper {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .places-wrapper {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

@media (min-width: 1280px) {
  .places-wrapper {
    grid-template-columns: repeat(5, 1fr);
    gap: 22px;
  }
}

/* ============================================
   CARDS  (Feature 1: 3D tilt | Feature 2: scroll reveal)
   ============================================ */
.place-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  border: 0.5px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.07),
    0 1px 3px rgba(0, 0, 0, 0.05);

  /* Feature 1: 3D perspective tilt */
  transform-style: preserve-3d;
  transition:
    transform 0.12s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  will-change: transform;

  /* Feature 2: scroll reveal — start hidden */
  opacity: 0;
  translate: 0 28px;
}

/* Feature 2: revealed state (JS adds this class) */
.place-card.visible {
  opacity: 1;
  translate: 0 0;
  transition:
    opacity 0.5s ease,
    translate 0.5s ease,
    transform 0.12s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

/* Feature 1: Desktop hover glow */
.place-card:hover {
  box-shadow:
    0 12px 32px rgba(138, 21, 56, 0.18),
    0 0 0 1px rgba(138, 21, 56, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.06);
  border-color: rgba(138, 21, 56, 0.25);
}

/* Shine overlay for 3D tilt effect */
.place-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(255, 255, 255, 0.55) 0%,
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.place-card:hover::after {
  opacity: 1;
}

.place-card {
  position: relative;
}

.place-card:active {
  transform: scale(0.97) !important;
  transition: transform 0.05s ease !important;
}

/* place-name: dark text on light card */
.place-name {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary);
  margin: 6px 0 2px;
}

.place-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 2px;
}

.place-name-row .place-name {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.access-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}

.access-pill-yes {
  background: rgba(52, 199, 89, 0.15);
  color: #1a7a34;
}

.access-pill-no {
  background: rgba(255, 59, 48, 0.15);
  color: #c0392b;
}

.access-pill-unrated {
  background: rgba(142, 142, 147, 0.15);
  color: #6e6e73;
}

.popup-access-row {
  margin-bottom: 10px;
}

.popup-access-row .access-pill {
  font-size: 0.7rem;
  padding: 4px 10px;
}

@media (min-width: 480px) {
  .place-name {
    font-size: 0.85rem;
  }
}

.image-container {
  width: 100%;
  height: 110px;
  margin-bottom: 10px;
  border-radius: 16px;
  overflow: hidden;
  background: #f0f0f3;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 480px) {
  .image-container {
    height: 120px;
  }
}

.place-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-fallback {
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.map-footer-note {
  text-align: center;
  margin-top: 20px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ============================================
   STORY POPUP  (Feature 6: card flip reveal)
   ============================================ */
.story-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 16px;
  overflow: hidden;
  /* Feature 6: perspective container for the flip */
  perspective: 1200px;
}

/* Feature 6: flip wrapper */
.story-flip-wrapper {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  transform-style: preserve-3d;
  animation: cardFlipIn 0.55s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes cardFlipIn {
  0%   { transform: rotateY(-90deg) scale(0.85); opacity: 0; }
  60%  { transform: rotateY(6deg)   scale(1.02); opacity: 1; }
  100% { transform: rotateY(0deg)   scale(1);    opacity: 1; }
}

.story-card {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  text-align: center;
  border: 0.5px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.18),
    0 8px 20px rgba(138, 21, 56, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.6);
  position: relative;
  scrollbar-width: none;
  color: var(--text-primary);
}

.story-card::-webkit-scrollbar {
  display: none;
}

/* Remove old @keyframes slideUp — replaced by flip */

.story-close {
  position: sticky;
  top: 0;
  float: right;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-secondary);
  z-index: 10;
  margin-bottom: -32px;
  transition: background 0.2s, transform 0.2s;
}

.story-close:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: rotate(90deg);
}

.story-header {
  clear: both;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  margin-top: 8px;
}

.story-emoji {
  font-size: 2.5rem;
}

.story-header h2 {
  font-size: 1.4rem;
  color: var(--text-primary);
  font-weight: 600;
}

.story-image-container {
  width: 100%;
  min-height: 140px;
  max-height: 200px;
  margin: 12px 0;
  border-radius: 24px;
  overflow: hidden;
  background: #f0f0f3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fun-fact-text {
  background: rgba(248, 248, 252, 0.9);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  padding: 16px;
  margin: 16px 0;
  text-align: left;
}

.story-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.read-aloud-btn,
.maps-btn {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 6px 14px;
  border-radius: 30px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.read-aloud-btn:hover,
.maps-btn:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: scale(1.03);
}

.read-aloud-btn.speaking {
  background: rgba(0, 122, 255, 0.15);
  border-color: var(--poseidon-blue);
  color: var(--poseidon-blue);
}

.maps-btn {
  background: rgba(30, 144, 255, 0.12);
  border-color: rgba(30, 144, 255, 0.35);
  color: #1e6fd9;
}

.maps-btn:hover {
  background: rgba(30, 144, 255, 0.2);
}

.story-youtube-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
  margin-bottom: 12px;
}

.did-you-know {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--poseidon-blue);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.fact-content {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-primary);
}

.fact-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fact-list li {
  margin-bottom: 14px;
  line-height: 1.55;
  font-size: 0.9rem;
  color: var(--text-primary);
  position: relative;
  padding-left: 20px;
}

.fact-list li::before {
  content: "•";
  color: var(--poseidon-blue);
  font-weight: bold;
  font-size: 1.2rem;
  position: absolute;
  left: 0;
  top: -2px;
}

.fact-list li strong {
  color: var(--qatar-maroon);
  font-weight: 600;
}

.button-group {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.continue-btn {
  background: linear-gradient(
    135deg,
    var(--poseidon-blue),
    var(--poseidon-blue-light)
  );
  border: none;
  padding: 14px 24px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 1rem;
  color: white;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  min-height: 44px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.continue-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.continue-btn:active {
  transform: scale(0.98);
}

/* 3D Model View button specific styling */
#model3dBtn {
  background: linear-gradient(135deg, #8a1538, #5c0d25);
  border: none;
  margin-top: 0;
}

#model3dBtn:hover {
  background: linear-gradient(135deg, #9e1a42, #6e102b);
}

/* ============================================
   BODY SCROLL PREVENTION
   ============================================ */
/* Only prevent scroll when story popup is open AND panorama is NOT open */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* When panorama is open, body should scroll normally */
/* When panorama is open, lock body scroll so iOS Safari doesn't
   intercept vertical touch-drags as page scroll/bounce instead of
   passing them to A-Frame's look-controls (this was previously
   set to unlock scroll, which broke vertical look on iOS). */
body.panorama-active {
  overflow: hidden !important;
  position: fixed !important;
  width: 100%;
  height: 100%;
}

/* Remove any conflicting styles */
body:not(.modal-open):not(.panorama-active) {
  overflow: auto !important;
  position: relative !important;
}

/* ============================================
   360 PANORAMA MODAL
   ============================================ */
.panorama-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  z-index: 10000;
  display: none;
  flex-direction: column;
}

.panorama-header {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 10001;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  padding: 8px 14px;
  border-radius: 30px;
  color: white;
  transition: opacity 0.5s ease-in-out, background 0.5s ease-in-out,
    backdrop-filter 0.5s ease-in-out, padding 0.5s ease-in-out;
}

/* When header fades: title hides, only X button floats */
.panorama-header.title-hidden {
  background: transparent;
  backdrop-filter: none;
  padding: 4px;
  /* Keep pointer events only on the close button */
  pointer-events: none;
}

.panorama-header.title-hidden .close-panorama {
  pointer-events: all;
  background: rgba(0, 0, 0, 0.5);
}

.panorama-header.title-hidden .panorama-title {
  opacity: 0;
  pointer-events: none;
}

.panorama-title {
  font-weight: 500;
  font-size: 0.8rem;
  transition: opacity 0.4s ease-in-out;
}

.close-panorama {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  color: white;
}

.vr-instruction {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: 25px;
  font-size: 0.7rem;
  z-index: 10001;
  pointer-events: none;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .vr-instruction {
    white-space: normal;
    width: 80%;
    text-align: center;
    font-size: 0.65rem;
    bottom: 10px;
  }
}

.panorama-overlay a-scene {
  width: 100%;
  height: 100%;
}

/* ============================================
   SPLAT VIEWER
   ============================================ */
.splat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  z-index: 10000;
}

#homeButton {
  background: linear-gradient(135deg, #8a1538, #5c0d25);
  border: none;
  padding: 10px 20px;
  border-radius: 40px;
  color: white;
  cursor: pointer;
  font-weight: bold;
  border: 1px solid #1e90ff;
  font-family: inherit;
  min-height: 44px;
  font-size: 0.85rem;
}

/* Splat viewer: movement instructions */
.splat-instructions {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #ffd700;
  padding: 8px 16px;
  border-radius: 40px;
  font-size: 0.8rem;
  z-index: 10001;
  opacity: 1;
  transition: opacity 0.6s ease;
}

/* Splat viewer: loading bar container */
.splat-loading-container {
  position: absolute;
  bottom: 30px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border-radius: 10px;
  z-index: 10001;
  width: 300px;
  opacity: 1;
  transition: opacity 0.6s ease;
}

/* On mobile, move the loading bar to the center so it doesn't
   overlap the bottom-center movement instructions */
@media (max-width: 768px) {
  .splat-loading-container {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 280px;
  }
}

#splatCanvas {
  cursor: grab;
}

#splatCanvas:active {
  cursor: grabbing;
}

/* ============================================
   FOOTER & UTILITIES
   ============================================ */
footer {
  background: rgba(255, 255, 255, 0.7);
  margin-top: 1.5rem;
  padding: 1rem;
  text-align: center;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.particles-container {
  display: none;
}

#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.hidden {
  display: none;
}

.text-center {
  text-align: center;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .story-card {
    max-width: 100%;
    max-height: 90vh;
    padding: 16px;
    border-radius: 28px;
  }

  .story-header h2 {
    font-size: 1.2rem;
  }

  .story-emoji {
    font-size: 2rem;
  }

  .story-image-container {
    min-height: 120px;
    max-height: 160px;
  }

  .fun-fact-text {
    padding: 12px;
    margin: 12px 0;
  }

  .fact-list li {
    margin-bottom: 12px;
    font-size: 0.85rem;
    padding-left: 18px;
  }

  .fact-list li::before {
    font-size: 1rem;
    top: -1px;
  }

  .did-you-know {
    font-size: 0.75rem;
    margin-bottom: 10px;
  }

  .continue-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}

/* Zoom instructions */
.zoom-instruction {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: 25px;
  font-size: 0.7rem;
  z-index: 10001;
  pointer-events: none;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

.zoom-instruction.fade-out {
  opacity: 0;
  visibility: hidden;
}

@media (max-width: 480px) {
  .zoom-instruction {
    white-space: normal;
    width: 80%;
    text-align: center;
    font-size: 0.65rem;
    bottom: 50px;
  }
}

/* ============================================
   CUSTOM 360 PANORAMA LOADER
   ============================================ */
.panorama-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 20000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  transition: opacity 0.3s ease;
}

.panorama-loader-overlay.hide {
  opacity: 0;
  pointer-events: none;
}

.loader-container {
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 280px;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #007aff;
  border-right: 3px solid #8a1538;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loader-text {
  color: white;
  font-size: 1rem;
  margin-bottom: 15px;
  font-weight: 500;
}

.loader-progress-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.loader-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
}

.loader-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #007aff, #8a1538);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.loader-percentage {
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 45px;
  text-align: right;
}

/* Mobile adjustments for loader */
@media (max-width: 768px) {
  .loader-container {
    min-width: 240px;
    padding: 16px;
  }

  .loader-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
  }

  .loader-text {
    font-size: 0.9rem;
  }
}

/* ============================================
   RESPONSIVE HEADER ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
  .hero {
    min-height: 160px;
    height: 25vh;
  }

  .kashaf-logo {
    max-width: 70px;
  }

  .hero-content {
    padding: 0 4%;
  }

  .discovery-bar {
    margin: 0.5rem 0.5rem 0;
    padding: 6px 12px;
  }

  .discovery-bar .stat-pill {
    padding: 3px 12px;
    font-size: 0.75rem;
    gap: 6px;
  }

  .discovery-bar .stat-pill span:nth-child(2) {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .hero {
    min-height: 140px;
    height: 22vh;
  }

  .kashaf-logo {
    max-width: 55px;
  }

  .discovery-bar .stat-pill {
    padding: 2px 10px;
    font-size: 0.7rem;
  }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  .panorama-overlay canvas {
    cursor: pointer;
    touch-action: none;
  }

  .panorama-loader-overlay {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

/* ============================================
   SEARCH BAR
   ============================================ */
.search-bar-container {
  margin: 0.75rem 0.75rem 0;
}

.search-pill {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 14px;
  border-radius: 25px;
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-icon {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 0;
}

.search-input::placeholder {
  color: rgba(0, 0, 0, 0.35);
}

.search-clear-btn {
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.65rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear-btn:hover {
  background: rgba(0, 0, 0, 0.15);
}

body.lang-ar .search-input {
  text-align: right;
}

@media (min-width: 768px) {
  .search-bar-container {
    max-width: 480px;
    margin: 0.75rem auto 0;
  }
  .search-pill {
    padding: 10px 18px;
  }
  .search-input {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .search-pill {
    padding: 6px 14px;
  }
  .search-input {
    font-size: 0.8rem;
  }
}

/* ============================================
   DISCOVERY BAR WITH STATS PILL AND LANGUAGE TOGGLE
   ============================================ */
.discovery-bar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin: 0.75rem 0.75rem 0;
  padding: 8px 16px;
  border-radius: 25px;
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.discovery-bar-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.discovery-bar .stat-pill {
  background: rgba(0, 0, 0, 0.05);
  padding: 4px 16px;
  border-radius: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
  cursor: default;
}

.discovery-bar .stat-pill span:first-child {
  font-size: 1rem;
}

.discovery-bar .stat-pill span:nth-child(2) {
  font-weight: 700;
  color: var(--qatar-maroon);
  font-size: 1rem;
}

.discovery-bar .stat-pill:hover {
  transform: scale(1.02);
  background: rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.12);
}

/* ============================================
   LANGUAGE TOGGLE BUTTON (in discovery bar)
   ============================================ */
.lang-btn {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 4px 14px;
  border-radius: 30px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  min-height: 32px;
  flex-shrink: 0;
}

.lang-btn:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: scale(1.05);
  border-color: var(--qatar-maroon);
}

.lang-btn:active {
  transform: scale(0.95);
}

.access-filter-btn.active {
  background: rgba(52, 199, 89, 0.18);
  border-color: #34c759;
  color: #1a7a34;
}

#langIcon {
  font-size: 1rem;
}

#langLabel {
  font-size: 0.75rem;
  letter-spacing: 0.3px;
}

/* Arabic language body class */
body.lang-ar {
  font-family:
    "Noto Sans Arabic",
    "Inter",
    -apple-system,
    sans-serif;
}

body.lang-ar .lang-btn #langLabel {
  font-family: "Noto Sans Arabic", sans-serif;
}

/* RTL support for the discovery bar */
body.lang-ar .discovery-bar-content {
  direction: rtl;
}

body.lang-ar .lang-btn {
  font-family: "Noto Sans Arabic", sans-serif;
}

body.lang-ar .stat-pill {
  font-family: "Noto Sans Arabic", sans-serif;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .discovery-bar {
    margin: 0.5rem 0.5rem 0;
    padding: 6px 12px;
  }

  .discovery-bar-content {
    gap: 8px;
  }

  .discovery-bar .stat-pill {
    padding: 3px 12px;
    font-size: 0.75rem;
    gap: 6px;
  }

  .discovery-bar .stat-pill span:nth-child(2) {
    font-size: 0.9rem;
  }

  .lang-btn {
    padding: 3px 10px;
    font-size: 0.7rem;
    min-height: 28px;
    gap: 4px;
  }

  #langIcon {
    font-size: 0.85rem;
  }

  #langLabel {
    font-size: 0.65rem;
  }
}

@media (max-width: 480px) {
  .discovery-bar {
    margin: 0.35rem 0.35rem 0;
    padding: 4px 10px;
  }

  .discovery-bar-content {
    gap: 6px;
  }

  .discovery-bar .stat-pill {
    padding: 2px 10px;
    font-size: 0.7rem;
    gap: 4px;
  }

  .lang-btn {
    padding: 2px 8px;
    font-size: 0.65rem;
    min-height: 24px;
    gap: 3px;
  }

  #langIcon {
    font-size: 0.75rem;
  }

  #langLabel {
    font-size: 0.6rem;
  }
}

/* ============================================
   Feature 5: HERO PARTICLE CANVAS
   ============================================ */
#heroParticleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;          /* above video (z-index:1), below logo content (z-index:3) */
  pointer-events: none;
}

/* Bump hero-content above particles */
.hero-content {
  position: relative;
  z-index: 3;
}

/* ============================================
   Mobile responsive tweaks for light theme
   ============================================ */
@media (max-width: 768px) {
  .story-card {
    max-width: 100%;
    max-height: 90vh;
    padding: 16px;
    border-radius: 28px;
  }

  .story-header h2 {
    font-size: 1.2rem;
  }

  .story-emoji {
    font-size: 2rem;
  }

  .story-image-container {
    min-height: 120px;
    max-height: 160px;
  }

  .fun-fact-text {
    padding: 12px;
    margin: 12px 0;
  }

  .fact-list li {
    margin-bottom: 12px;
    font-size: 0.85rem;
    padding-left: 18px;
  }

  .fact-list li::before {
    font-size: 1rem;
    top: -1px;
  }

  .did-you-know {
    font-size: 0.75rem;
    margin-bottom: 10px;
  }

  .continue-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}
