/* ═══════════════════════════════════════════════════════════════
   NEPAL ADVENTURE — Main CSS
   Design: Dark Himalayan theme (deep green, teal, golden accents)
═══════════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg:          #0D1F1A;
  --bg-2:        #112820;
  --bg-3:        #172F25;
  --card:        #1A3528;
  --card-2:      #1F3D2F;
  --border:      rgba(78, 205, 196, 0.18);
  --teal:        #4ECDC4;
  --teal-dark:   #38B2A8;
  --gold:        #F7C948;
  --gold-dark:   #D4A017;
  --red:         #E85D75;
  --orange:      #F7931E;
  --purple:      #9B59B6;
  --green:       #2ECC71;
  --text:        #E8F5F3;
  --text-muted:  #8BB5AA;
  --text-dim:    #4D8076;
  --shadow:      rgba(0,0,0,0.5);
  --glow-teal:   0 0 20px rgba(78,205,196,0.4);
  --glow-gold:   0 0 20px rgba(247,201,72,0.5);
  --radius:      14px;
  --radius-lg:   22px;
  --font:        'Nunito', sans-serif;
  --font-title:  'Rubik', 'Montserrat', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; font-family: var(--font); }

/* ── App shell ── */
#app {
  flex: 1 1 0%;
  min-height: 0;
  height: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Himaltrex Top Header Banner ── */
.himaltrex-header {
  height: 52px;
  width: 100%;
  flex-shrink: 0;
  position: relative;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 2px solid rgba(78, 205, 196, 0.45);
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.himaltrex-header-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  text-decoration: none;
  cursor: pointer;
  padding: 0 18px;
  gap: 16px;
  transition: all 0.25s ease;
}

.himaltrex-header:hover .himaltrex-header-link {
  background: #f8fafc;
}

.himaltrex-banner-left {
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
}

.himaltrex-banner-img {
  height: 36px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.himaltrex-header:hover .himaltrex-banner-img {
  transform: scale(1.02);
}

.himaltrex-slogan {
  display: flex;
  align-items: center;
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  color: #102D24;
  letter-spacing: 0.5px;
  white-space: nowrap;
  opacity: 0.95;
  transition: color 0.25s ease;
}

.himaltrex-header:hover .himaltrex-slogan {
  color: #0d221b;
}

.himaltrex-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #102d24 0%, #1a4538 100%);
  border: 1px solid rgba(78, 205, 196, 0.5);
  padding: 6px 14px;
  border-radius: 20px;
  color: #fff;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  transition: all 0.25s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.himaltrex-header:hover .himaltrex-cta {
  background: linear-gradient(135deg, #0e857b 0%, #102d24 100%);
  border-color: var(--teal);
  box-shadow: 0 4px 14px rgba(14, 133, 123, 0.35);
  transform: translateY(-1px);
}

.cta-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ECC71;
  box-shadow: 0 0 8px #2ECC71;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.cta-arrow {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.himaltrex-header:hover .cta-arrow {
  transform: translate(2px, -2px);
}

@media (max-width: 1100px) {
  .himaltrex-slogan { display: none; }
}

@media (max-width: 600px) {
  .himaltrex-header { height: 44px; }
  .himaltrex-header-link { padding: 0 10px; }
  .himaltrex-banner-img { height: 28px; }
  .himaltrex-cta { padding: 4px 10px; font-size: 0.78rem; gap: 5px; }
}

/* ── Screens Container ── */
.app-screens {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* ── Screens ── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.25s, transform 0.25s;
  overflow-y: auto;
  overflow-x: hidden;
}
.screen:not(.active) {
  display: none !important;
}
.screen.active {
  display: flex !important;
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

#screen-game.active {
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}
#screen-game:not(.active) {
  display: none !important;
}

/* ════════════════════════════════════════════════════════
   HOME SCREEN
════════════════════════════════════════════════════════ */
#screen-home {
  justify-content: flex-start;
  align-items: center;
  background: radial-gradient(ellipse at top, #0a2e24 0%, #061510 100%);
}

.home-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Mountains silhouette via CSS */
.mountains-svg {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  height: 50%;
  background:
    /* Multiple mountain layers */
    radial-gradient(ellipse 300px 200px at 10% 100%, #0a1f18 0%, transparent 70%),
    radial-gradient(ellipse 400px 250px at 35% 100%, #0d2720 0%, transparent 70%),
    radial-gradient(ellipse 350px 220px at 60% 100%, #0a1f18 0%, transparent 70%),
    radial-gradient(ellipse 300px 200px at 85% 100%, #0d2720 0%, transparent 70%);
  clip-path: polygon(0 100%, 5% 65%, 12% 72%, 18% 50%, 25% 65%, 30% 40%, 37% 55%, 42% 30%, 50% 48%, 55% 20%, 62% 38%, 68% 15%, 75% 35%, 80% 55%, 85% 40%, 90% 60%, 95% 45%, 100% 55%, 100% 100%);
  background-color: #0d2418;
}

/* ── Tibetan Prayer Flags Garland (Full Width, Same as Tetris) ── */
.prayer-flags {
  display: flex;
  width: 100%;
  height: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1000;
  flex-shrink: 0;
}

.flag {
  flex: 1;
  height: 100%;
  clip-path: polygon(0 0, 100% 0, 100% 80%, 50% 100%, 0 80%);
  animation: flagWave 3s ease-in-out infinite alternate;
}

.flag.blue   { background-color: #1e6fa8; animation-delay: 0s; }
.flag.white  { background-color: #f8fafc; animation-delay: 0.3s; }
.flag.red    { background-color: #cd2e48; animation-delay: 0.6s; }
.flag.green  { background-color: #43a047; animation-delay: 0.9s; }
.flag.yellow { background-color: #f5a425; animation-delay: 1.2s; }

@keyframes flagWave {
  0%   { transform: translateY(0) skewY(0deg); }
  100% { transform: translateY(2px) skewY(3deg); }
}

/* Home background decorative prayer flags */
.home-prayer-flags {
  position: absolute;
  top: 10%;
  left: 0; right: 0;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    #4ECDC4 0px, #4ECDC4 40px,
    #F7C948 40px, #F7C948 80px,
    #E85D75 80px, #E85D75 120px,
    #2ECC71 120px, #2ECC71 160px,
    #9B59B6 160px, #9B59B6 200px
  );
  opacity: 0.6;
}
.home-prayer-flags::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px, transparent 18px,
    rgba(0,0,0,0.4) 18px, rgba(0,0,0,0.4) 22px,
    transparent 22px, transparent 40px
  );
}

/* Floating snowflakes */
.snowflakes { position: absolute; inset: 0; }

.home-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px 24px;
  gap: 12px;
}

.logo-area { text-align: center; }

.logo-badge {
  font-size: 4rem;
  filter: drop-shadow(0 0 20px rgba(78,205,196,0.6));
  animation: float 3s ease-in-out infinite;
}

.game-title {
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--gold) 0%, #FFA500 50%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: -1px;
}

.home-title-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-title);
  font-size: clamp(1.65rem, 3.8vw, 2.85rem);
  font-weight: 900;
  white-space: nowrap;
  letter-spacing: 0.5px;
  line-height: 1.05;
  background: linear-gradient(135deg, var(--gold) 0%, #FFA500 45%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-title-inline span:not(.inline-mountain-icon) {
  font-size: 1em;
  letter-spacing: 1px;
}

.inline-mountain-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-text-fill-color: initial;
  filter: drop-shadow(0 0 16px rgba(78, 205, 196, 0.7));
  animation: pulseMountain 2.2s ease-in-out infinite;
  transform-origin: center center;
}

.inline-adventure-icon {
  width: 1.85em;
  height: 1.85em;
  object-fit: contain;
  display: block;
}

@keyframes pulseMountain {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 12px rgba(78, 205, 196, 0.6));
  }
  50% {
    transform: scale(1.22);
    filter: drop-shadow(0 0 26px rgba(247, 201, 72, 0.95)) drop-shadow(0 0 14px rgba(78, 205, 196, 0.8));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 12px rgba(78, 205, 196, 0.6));
  }
}

.game-subtitle {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--teal);
  letter-spacing: 5px;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
}

.game-tagline {
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  margin: -4px 0 2px;
  letter-spacing: 0.2px;
}

/* Characters carousel on home */
.home-characters-marquee {
  width: 100%;
  max-width: 920px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  padding: 4px 0;
  mask-image: linear-gradient(to right, transparent 0%, #000 7%, #000 93%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 7%, #000 93%, transparent 100%);
}
.home-characters-marquee.is-dragging {
  cursor: grabbing;
}
.home-characters-track {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
  width: max-content;
  will-change: transform;
}
.home-char-card {
  position: relative;
  flex: 0 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 3px solid rgba(78,205,196,0.35);
  box-shadow: var(--glow-teal);
  transition: transform 0.25s, box-shadow 0.25s;
}
.home-char-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 18px 36px rgba(78,205,196,0.42);
}
.home-char {
  display: block;
  width: 132px;
  height: 188px;
  object-fit: cover;
  object-position: top;
  pointer-events: none;
}
.home-char-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 8px 6px;
  background: linear-gradient(to top, rgba(8, 22, 17, 0.92), transparent);
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.3px;
  pointer-events: none;
}

/* Home actions */
.home-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 540px;
}
.home-actions .btn-xl {
  width: 100%;
  max-width: 420px;
}

/* Difficulty selector */
.difficulty-selector {
  width: 100%;
  max-width: 540px;
  text-align: center;
}
.diff-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.diff-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px;
}
.diff-buttons::-webkit-scrollbar {
  display: none;
}
.diff-btn {
  padding: 7px 12px;
  border-radius: 20px;
  background: var(--card);
  border: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font);
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.diff-btn:hover { border-color: var(--teal); color: var(--teal); }
.diff-btn.active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--bg);
  box-shadow: var(--glow-teal);
}

/* Home stats */
.home-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.home-stat-item {
  text-align: center;
  padding: 10px 18px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.home-stat-value { font-weight: 900; font-size: 1.4rem; color: var(--gold); }
.home-stat-label { font-size: 0.75rem; color: var(--text-muted); }


/* ════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .game-title { font-size: 1.8rem; }
  .home-title-inline { font-size: 1.65rem; gap: 8px; flex-wrap: wrap; }
  .diff-btn { font-size: 0.72rem; padding: 5px 9px; }

  .home-content {
    padding: 16px 12px 30px;
    width: 100%;
  }
  .home-leaderboard-section {
    padding: 16px 10px;
    border-radius: 18px;
    margin: 18px auto 14px;
  }
  .leaderboard-title {
    font-size: 1.05rem;
  }
  .leaderboard-badge-icon {
    font-size: 1.8rem;
  }
  .leaderboard-podium {
    gap: 6px;
    margin: 6px 0 16px;
    padding: 4px 0;
  }
  .podium-step {
    max-width: 86px;
    min-width: 0;
  }
  .podium-pillar {
    max-width: 82px;
    font-size: 0.65rem;
    letter-spacing: 0;
    padding: 0 2px;
  }
  .pillar-1 { height: 72px; }
  .pillar-2 { height: 54px; }
  .pillar-3 { height: 40px; }
  .podium-avatar-wrap {
    width: 44px;
    height: 44px;
  }
  .podium-first .podium-avatar-wrap {
    width: 54px;
    height: 54px;
  }
  .podium-crown {
    font-size: 1.1rem;
    top: -18px;
  }
  .podium-rank-badge {
    font-size: 0.95rem;
  }
  .podium-name {
    font-size: 0.72rem;
    max-width: 78px;
  }
  .podium-xp {
    font-size: 0.68rem;
  }
  .leaderboard-table th {
    padding: 8px 6px;
    font-size: 0.7rem;
  }
  .leaderboard-table td {
    padding: 10px 6px;
    font-size: 0.82rem;
  }
  .lb-avatar {
    width: 30px;
    height: 30px;
  }
  .lb-rank {
    width: 30px;
    font-size: 0.85rem;
  }
}

@media (max-width: 360px) {
  .home-content { padding: 14px 8px 24px; }
  .home-leaderboard-section { padding: 14px 6px; }
  .leaderboard-podium { gap: 4px; }
  .podium-step { max-width: 74px; }
  .podium-pillar { max-width: 70px; font-size: 0.58rem; }
  .podium-name { max-width: 68px; font-size: 0.66rem; }
  .podium-avatar-wrap { width: 38px; height: 38px; }
  .podium-first .podium-avatar-wrap { width: 48px; height: 48px; }
}

@media (min-width: 900px) {
  .home-content { max-width: 960px; padding: 18px 20px 28px; }
  .home-char { width: 150px; height: 212px; }
}
