/* ============================================
   Sky Strike — stylesheet
   ============================================ */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#stage {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a3a 0%, #0a0a1f 50%, #050510 100%);
}

#gameWrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 400 / 700;
  max-height: 100vh;
  background: #050818;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(96, 165, 250, 0.15);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
}

/* ============ HUD ============ */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
}
.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.hp-wrap {
  flex: 1;
  max-width: 180px;
}
.hp-label {
  color: #cbd5e1;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.hp-bar {
  height: 14px;
  background: rgba(0,0,0,0.55);
  border: 1px solid #475569;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 200ms ease;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}
.hp-fill.warn {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}
.hp-fill.crit {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  animation: critPulse 700ms ease-in-out infinite;
}
@keyframes critPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.stat-row {
  color: #fff;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.5px;
}
.score-row {
  font-size: 18px;
  color: #fde047;
}
.score-row .ico {
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}
.level-row {
  font-size: 12px;
  color: #93c5fd;
  letter-spacing: 1.5px;
}

.ctrl-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  border: 2px solid rgba(96, 165, 250, 0.55);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.1);
  transition: transform 100ms, background 150ms;
  font-family: inherit;
}
.ctrl-btn:active { transform: scale(0.92); background: rgba(30, 41, 59, 0.95); }
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ctrl-btn .big { font-size: 22px; line-height: 1; }
.ctrl-btn .lbl { font-size: 8px; font-weight: bold; letter-spacing: 1px; margin-top: 2px; opacity: 0.8; }
.ctrl-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #f97316;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #050818;
  padding: 0 4px;
}

/* ============ Overlay screens ============ */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 24, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 16px;
}
.panel {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 14px;
  padding: 20px 20px 22px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  color: #e2e8f0;
}
.panel h2 {
  font-size: 24px;
  margin-bottom: 10px;
  letter-spacing: 2px;
  color: #fde047;
  text-shadow: 0 0 12px rgba(253, 224, 71, 0.5);
}
.panel .desc {
  color: #cbd5e1;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Menu logo */
.logo-img {
  display: block;
  max-width: 260px;
  width: 100%;
  margin: 0 auto 14px;
  filter: drop-shadow(0 6px 20px rgba(96, 165, 250, 0.35));
}

.btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 2px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 120ms, box-shadow 150ms, filter 150ms;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: linear-gradient(135deg, #475569, #334155);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

.stat-card {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: rgba(0,0,0,0.4);
  border-radius: 8px;
  padding: 10px;
  margin: 14px 0;
}
.stat-card .item { text-align: center; }
.stat-card .v {
  font-size: 22px;
  font-weight: bold;
  color: #fde047;
  text-shadow: 0 0 8px rgba(253, 224, 71, 0.4);
}
.stat-card .l {
  font-size: 9px;
  color: #94a3b8;
  letter-spacing: 1px;
  margin-top: 2px;
}

.controls-help {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.7;
  margin-top: 14px;
  text-align: left;
}
.controls-help strong {
  color: #93c5fd;
  letter-spacing: 1px;
}
.controls-help kbd {
  display: inline-block;
  background: #334155;
  border: 1px solid #475569;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 10px;
  color: #f1f5f9;
  margin: 0 1px;
}

/* ============ Loading ============ */
#loading {
  position: absolute;
  inset: 0;
  background: #050818;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
  font-size: 13px;
  letter-spacing: 3px;
  z-index: 20;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(96, 165, 250, 0.2);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Small screen tweaks ============ */
@media (max-height: 600px) {
  .panel { padding: 14px 14px 16px; }
  .panel h2 { font-size: 20px; }
  .logo-img { max-width: 180px; margin-bottom: 8px; }
  .controls-help { font-size: 10px; padding: 8px; }
}
