/* ═══════════════════════════════════════════════════════════════
   BRIDGE CROSSING CHALLENGE — LUXURY PREMIUM THEME
   "Jor Dar" Neon-Gold Dark Edition
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;600;700&display=swap');

:root {
  --gold:        #FFD700;
  --gold-light:  #FFE96A;
  --gold-dark:   #B8960C;
  --neon-cyan:   #00F5FF;
  --neon-purple: #BF00FF;
  --neon-red:    #FF003C;
  --bg-deep:     #03030A;
  --bg-mid:      #07071A;
  --bg-panel:    rgba(5,5,20,0.92);
  --glass:       rgba(255,215,0,0.06);
  --border-glow: rgba(255,215,0,0.35);
  --text-main:   #F0E6C0;
  --text-dim:    #7A6A40;
  --shadow-gold: 0 0 20px rgba(255,215,0,0.6), 0 0 60px rgba(255,215,0,0.25);
  --shadow-cyan: 0 0 20px rgba(0,245,255,0.5), 0 0 60px rgba(0,245,255,0.15);
  --r:           12px;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  color: var(--text-main);
  user-select: none;
  -webkit-user-select: none;
}

/* ── Animated star background ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%,  rgba(191,0,255,0.10) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%,rgba(0,245,255,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 20% 80%, rgba(255,215,0,0.06) 0%, transparent 60%);
  animation: bgPulse 8s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes bgPulse {
  from { opacity: 0.6; }
  to   { opacity: 1.0; }
}

/* ── Game Container ── */
#game-container {
  position: relative;
  width: 100vw; height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 1;
}

/* ── Canvas ── */
#gameCanvas {
  display: block;
  border-radius: var(--r);
  border: 1.5px solid var(--border-glow);
  box-shadow: var(--shadow-gold), inset 0 0 40px rgba(255,215,0,0.03);
  background: var(--bg-mid);
  max-width: 100vw;
  max-height: 100vh;
  touch-action: none;
}

/* ── HUD Bar ── */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(3,3,10,0.97) 70%, transparent);
  border-bottom: 1px solid var(--border-glow);
  z-index: 100;
  gap: 12px;
}

.hud-block {
  display: flex; flex-direction: column; align-items: center;
  min-width: 80px;
}
.hud-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.15em; color: var(--text-dim);
  text-transform: uppercase;
}
.hud-value {
  font-family: 'Orbitron', monospace;
  font-size: 1.25rem; font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold), 0 0 30px rgba(255,215,0,0.4);
  line-height: 1;
}
.hud-value.cyan  { color: var(--neon-cyan); text-shadow: var(--shadow-cyan); }
.hud-value.red   { color: var(--neon-red);  text-shadow: 0 0 12px var(--neon-red); }

.hud-title {
  font-family: 'Orbitron', monospace;
  font-size: clamp(0.7rem, 2vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-shadow: var(--shadow-gold);
  text-align: center;
  text-transform: uppercase;
}

/* ── Screen Overlays (Start / Game Over / Win) ── */
.screen-overlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(3,3,10,0.96), rgba(7,7,26,0.98));
  z-index: 200;
  gap: 22px;
  padding: 24px;
  animation: overlayIn 0.4s cubic-bezier(.22,1,.36,1);
}
@keyframes overlayIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.screen-overlay.hidden { display: none; }

.overlay-icon {
  font-size: clamp(3rem, 10vw, 5rem);
  filter: drop-shadow(0 0 20px var(--gold));
  animation: floatIcon 3s ease-in-out infinite;
}
@keyframes floatIcon {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-10px) scale(1.05); }
}

.overlay-title {
  font-family: 'Orbitron', monospace;
  font-size: clamp(1.6rem, 6vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold-dark));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: goldShimmer 3s linear infinite;
  text-align: center;
}
@keyframes goldShimmer {
  to { background-position: 200% center; }
}

.overlay-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(0.9rem, 3vw, 1.2rem);
  color: var(--text-dim);
  text-align: center;
  max-width: 340px;
  line-height: 1.5;
}

.overlay-stat {
  font-family: 'Orbitron', monospace;
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: var(--neon-cyan);
  text-shadow: var(--shadow-cyan);
  letter-spacing: 0.1em;
}

/* ── Luxury Button ── */
.btn-luxury {
  position: relative;
  font-family: 'Orbitron', monospace;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-light) 100%);
  border: none;
  border-radius: 8px;
  padding: 14px 36px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(255,215,0,0.5), 0 1px 0 rgba(255,255,255,0.2) inset;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 180px;
}
.btn-luxury::before {
  content: '';
  position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}
.btn-luxury:hover::before { left: 140%; }
.btn-luxury:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(255,215,0,0.7), 0 1px 0 rgba(255,255,255,0.3) inset;
}
.btn-luxury:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(120,100,40,0.4);
  border-radius: 8px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  padding: 10px 24px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-ghost:hover { color: var(--gold); border-color: var(--border-glow); }

/* ── Progress / Lives ── */
.lives-container {
  display: flex; gap: 6px; align-items: center;
}
.life-icon {
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px var(--neon-red));
  transition: transform 0.3s, opacity 0.3s;
}
.life-icon.lost { opacity: 0.15; transform: scale(0.7); }

/* ── Level badge ── */
#level-badge {
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--bg-deep);
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  padding: 3px 10px;
  border-radius: 20px;
  box-shadow: 0 0 10px rgba(255,215,0,0.4);
}

/* ── Toast notifications ── */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--bg-deep);
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  padding: 10px 28px;
  border-radius: 50px;
  box-shadow: var(--shadow-gold);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

/* ── Mobile controls ── */
#mobile-controls {
  position: fixed;
  bottom: 16px; left: 0; right: 0;
  display: none;
  justify-content: center;
  gap: 16px;
  z-index: 150;
  padding: 0 12px;
}
@media (max-width: 700px) {
  #mobile-controls { display: flex; }
}

.ctrl-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid var(--border-glow);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--gold);
  font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-gold);
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:active {
  background: rgba(255,215,0,0.18);
  transform: scale(0.93);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }

/* ── Responsive canvas sizing ── */
@media (max-width: 500px) {
  #hud { padding: 8px 10px; }
  .hud-value { font-size: 1rem; }
  .hud-title { font-size: 0.65rem; }
}