@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800;900&family=Inter:wght@400;600;700&display=swap');

/* ==========================================================
   1. BASE RESET & CORE GAME STYLES
   ========================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  border-width: 0;
  border-style: solid;
  border-color: #334155;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #060913;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #f8fafc;
}

.font-display {
  font-family: 'Orbitron', sans-serif;
}

.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

#game-canvas {
  touch-action: none;
  display: block;
  width: 100%;
  height: 100%;
}

button, .slot-card, .shop-card {
  touch-action: manipulation;
  cursor: pointer;
}

button {
  background: transparent;
  color: inherit;
  font-family: inherit;
}

.glass-panel {
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
}
::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.5);
  border-radius: 9999px;
}

/* ==========================================================
   2. OFFLINE TAILWIND UTILITY EQUIVALENTS (NO CDN REQUIRED)
   ========================================================== */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.relative { position: relative; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-3 { top: 0.75rem; }
.left-3 { left: 0.75rem; }
.bottom-3 { bottom: 0.75rem; }
.right-3 { right: 0.75rem; }

.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.w-1\/2 { width: 50%; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-\[1px\] { width: 1px; }
.w-\[180px\] { width: 180px; }
.h-\[205px\] { height: 205px; }
.w-\[105px\] { width: 105px; }
.h-\[138px\] { height: 138px; }
.max-w-\[160px\] { max-width: 160px; }
.max-w-xs { max-width: 20rem; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-h-\[90vh\] { max-height: 90vh; }

.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-1\.5 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }

.p-0\.5 { padding: 0.125rem; }
.p-1 { padding: 0.25rem; }
.p-3 { padding: 0.75rem; }
.p-3\.5 { padding: 0.875rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-3\.5 { padding-top: 0.875rem; padding-bottom: 0.875rem; }
.pl-3 { padding-left: 0.75rem; }
.pb-4 { padding-bottom: 1rem; }

.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer-events-none { pointer-events: none; }
.select-none { user-select: none; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }
.rounded-full { border-radius: 9999px; }

.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-l { border-left-width: 1px; }

.border-slate-600 { border-color: #475569; }
.border-slate-700 { border-color: #334155; }
.border-slate-700\/80 { border-color: rgba(51, 65, 85, 0.8); }
.border-slate-700\/90 { border-color: rgba(51, 65, 85, 0.9); }
.border-slate-800 { border-color: #1e293b; }
.border-orange-400\/30 { border-color: rgba(251, 146, 60, 0.3); }
.border-orange-400\/50 { border-color: rgba(251, 146, 60, 0.5); }
.border-orange-500 { border-color: #f97316; }
.border-orange-500\/30 { border-color: rgba(249, 115, 22, 0.3); }
.border-orange-500\/50 { border-color: rgba(249, 115, 22, 0.5); }
.border-orange-500\/60 { border-color: rgba(249, 115, 22, 0.6); }
.border-orange-500\/70 { border-color: rgba(249, 115, 22, 0.7); }
.border-amber-400\/40 { border-color: rgba(251, 191, 36, 0.4); }
.border-emerald-500\/40 { border-color: rgba(16, 185, 129, 0.4); }
.border-emerald-500\/50 { border-color: rgba(16, 185, 129, 0.5); }
.border-sky-400 { border-color: #38bdf8; }
.border-sky-400\/50 { border-color: rgba(56, 189, 248, 0.5); }
.border-cyan-400 { border-color: #22d3ee; }
.border-fuchsia-400 { border-color: #e879f9; }
.border-rose-500\/40 { border-color: rgba(244, 63, 94, 0.4); }
.border-rose-500\/80 { border-color: rgba(244, 63, 94, 0.8); }

.bg-slate-700 { background-color: #334155; }
.bg-slate-800 { background-color: #1e293b; }
.bg-slate-800\/90 { background-color: rgba(30, 41, 59, 0.9); }
.bg-slate-900 { background-color: #0f172a; }
.bg-slate-900\/90 { background-color: rgba(15, 23, 42, 0.9); }
.bg-slate-950 { background-color: #020617; }
.bg-slate-950\/85 { background-color: rgba(2, 6, 23, 0.85); }
.bg-orange-500 { background-color: #f97316; }
.bg-orange-500\/15 { background-color: rgba(249, 115, 22, 0.15); }
.bg-orange-500\/20 { background-color: rgba(249, 115, 22, 0.2); }
.bg-amber-500\/15 { background-color: rgba(245, 158, 11, 0.15); }
.bg-emerald-400 { background-color: #34d399; }
.bg-emerald-500\/15 { background-color: rgba(16, 185, 129, 0.15); }
.bg-emerald-500\/20 { background-color: rgba(16, 185, 129, 0.2); }
.bg-emerald-600\/30 { background-color: rgba(5, 150, 105, 0.3); }
.bg-sky-400 { background-color: #38bdf8; }
.bg-sky-500\/20 { background-color: rgba(14, 165, 233, 0.2); }
.bg-cyan-500\/20 { background-color: rgba(6, 182, 212, 0.2); }
.bg-pink-500 { background-color: #ec4899; }
.bg-fuchsia-500\/20 { background-color: rgba(217, 70, 239, 0.2); }

/* Gradients */
.bg-gradient-to-b.from-slate-950.via-slate-900.to-sky-950 {
  background-image: linear-gradient(to bottom, #020617, #0f172a, #082f49);
}
.bg-gradient-to-r.from-red-500.via-orange-500.to-amber-300 {
  background-image: linear-gradient(to right, #ef4444, #f97316, #fcd34d);
}
.bg-gradient-to-r.from-rose-600.via-orange-500.to-amber-300 {
  background-image: linear-gradient(to right, #e11d48, #f97316, #fcd34d);
}
.bg-gradient-to-r.from-orange-400.via-amber-300.to-red-500 {
  background-image: linear-gradient(to right, #fb923c, #fcd34d, #ef4444);
}
.bg-gradient-to-r.from-emerald-500.to-teal-600 {
  background-image: linear-gradient(to right, #10b981, #0d9488);
}
.bg-gradient-to-r.from-orange-500.via-amber-500.to-red-500 {
  background-image: linear-gradient(to right, #f97316, #f59e0b, #ef4444);
}
.bg-gradient-to-r.from-orange-500.via-amber-400.to-red-500 {
  background-image: linear-gradient(to right, #f97316, #fbbf24, #ef4444);
}
.bg-gradient-to-r.from-orange-500.to-amber-500 {
  background-image: linear-gradient(to right, #f97316, #f59e0b);
}
.bg-gradient-to-r.from-orange-500.to-amber-400 {
  background-image: linear-gradient(to right, #f97316, #fbbf24);
}
.bg-gradient-to-r.from-sky-400.to-indigo-500 {
  background-image: linear-gradient(to right, #38bdf8, #6366f1);
}
.bg-gradient-to-r.from-pink-500.to-orange-400 {
  background-image: linear-gradient(to right, #ec4899, #fb923c);
}
.bg-gradient-to-r.from-sky-400.to-cyan-300 {
  background-image: linear-gradient(to right, #38bdf8, #67e8f9);
}

.text-transparent { color: transparent; }
.bg-clip-text { -webkit-background-clip: text; background-clip: text; }

/* Typography */
.text-\[10px\] { font-size: 10px; line-height: 14px; }
.text-\[11px\] { font-size: 11px; line-height: 15px; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-black { font-weight: 900; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.leading-none { line-height: 1; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.tracking-\[0\.25em\] { letter-spacing: 0.25em; }
.text-left { text-align: left; }
.text-center { text-align: center; }

.text-white { color: #ffffff; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-950 { color: #020617; }
.text-orange-300 { color: #fdba74; }
.text-orange-400 { color: #fb923c; }
.text-amber-300 { color: #fcd34d; }
.text-amber-400 { color: #fbbf24; }
.text-emerald-300 { color: #6ee7b7; }
.text-emerald-400 { color: #34d399; }
.text-sky-300 { color: #7dd3fc; }
.text-sky-400 { color: #38bdf8; }
.text-cyan-300 { color: #67e8f9; }
.text-fuchsia-300 { color: #f0abfc; }
.text-rose-400 { color: #fb7185; }
.text-rose-500 { color: #f43f5e; }

/* Effects, Transitions & Animations */
.backdrop-blur-md { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.3); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.35); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.4); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6); }
.drop-shadow-\[0_4px_12px_rgba\(0\,0\,0\,0\.8\)\] { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.8)); }

.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }
.scale-90 { transform: scale(0.9); }
.scale-100 { transform: scale(1); }

.transition { transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1); }
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.duration-75 { transition-duration: 75ms; }
.duration-100 { transition-duration: 100ms; }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }

.active\:scale-95:active { transform: scale(0.95); }
.active\:scale-\[0\.98\]:active { transform: scale(0.98); }
.active\:scale-\[0\.99\]:active { transform: scale(0.99); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@media (min-width: 640px) {
  .sm\:inline { display: inline; }
  .sm\:p-5 { padding: 1.25rem; }
  .sm\:text-xs { font-size: 0.75rem; }
  .sm\:text-sm { font-size: 0.875rem; }
  .sm\:text-base { font-size: 1rem; }
  .sm\:text-lg { font-size: 1.125rem; }
  .sm\:text-2xl { font-size: 1.5rem; }
  .sm\:text-4xl { font-size: 2.25rem; }
  .sm\:text-5xl { font-size: 3rem; }
}
/* ==========================================================
/* ==========================================================
   3. UNIVERSAL SMARTPHONE CUTOUT & SAFE-AREA CUSHION
   ========================================================== */
:root {
  /* Automatically uses the exact hardware cutout injected by MainActivity.java,
     falls back to CSS env(safe-area-inset-*), or defaults to a 24px cushion */
  --safe-top: max(var(--native-cutout-top, 0px), env(safe-area-inset-top, 0px), 24px);
  --safe-bottom: max(var(--native-cutout-bottom, 0px), env(safe-area-inset-bottom, 0px), 12px);
}

#hud-screen {
  padding-top: calc(var(--safe-top) + 6px) !important;
  padding-bottom: calc(var(--safe-bottom) + 8px) !important;
}

#landing-screen {
  padding-top: calc(var(--safe-top) + 10px) !important;
  padding-bottom: calc(var(--safe-bottom) + 12px) !important;
}

#garage-screen > div:first-child {
  padding-top: calc(var(--safe-top) + 8px) !important;
}

#garage-screen > div:last-child {
  padding-bottom: calc(var(--safe-bottom) + 10px) !important;
}

#save-indicator {
  top: calc(var(--safe-top) + 6px) !important;
}

#btn-audio-toggle {
  bottom: calc(var(--safe-bottom) + 10px) !important;
}

/* ==========================================================
   4. RESPONSIVE HUD CARDS (320px COMPACT TO 480px+ ULTRA)
   ========================================================== */
.pointer-events-auto {
  pointer-events: auto !important;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Locks the card width relative to viewport width (vw) so numbers never jitter,
   while scaling down cleanly on 360px phones and up on 440px+ Ultra phones */
#hud-altitude-card {
  width: clamp(136px, 41vw, 178px);
  min-width: clamp(136px, 41vw, 178px);
  max-width: clamp(136px, 41vw, 178px);
}

#hud-status-card {
  min-width: clamp(92px, 28vw, 120px);
}

/* Compact screen adjustments (Galaxy S base models, older/smaller 320px-365px phones, or Display Zoom ON) */
@media (max-width: 370px) {
  #hud-altitude {
    font-size: 1rem !important;
  }
  #hud-speed {
    font-size: 10px !important;
  }
  #btn-pause-flight {
    width: 2.25rem !important;
    height: 2.25rem !important;
  }
}

/* Short-screen vertical scaling so the Landing Screen never requires scrolling on 16:9 phones */
@media (max-height: 700px) {
  #landing-rocket-canvas {
    width: 140px !important;
    height: 160px !important;
  }
}

.heart-lost {
  opacity: 0.25;
  filter: grayscale(100%);
}

@keyframes dangerFlash {
  0%, 100% {
    background-color: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.8);
  }
  50% {
    background-color: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.4);
  }
}

.env-danger-active {
  animation: dangerFlash 1s infinite;
}