/* ==========================================================
   Street Hoop Challenge (街球霸王) - Modern H5 Game Styles
   ========================================================== */

:root {
  --bg-color: #060913;
  --panel-bg: rgba(15, 23, 42, 0.78);
  --panel-border: rgba(255, 255, 255, 0.12);
  --neon-orange: #ff7700;
  --neon-cyan: #00e5ff;
  --neon-pink: #ff0055;
  --neon-gold: #ffcc00;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-impact: "Impact", "Arial Black", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: var(--font-family);
  color: var(--text-main);
  touch-action: none;
  position: fixed;
}

#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #04060d;
}

#gameCanvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#gameCanvas:active {
  cursor: grabbing;
}

/* ==========================================================
   HUD Overlay
   ========================================================== */
.hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  z-index: 10;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--neon-cyan);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.level-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding-left: 6px;
}

/* Score Center Box */
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: max(10px, env(safe-area-inset-top));
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(10, 16, 32, 0.72);
  border: 1px solid rgba(255, 200, 0, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 4px 20px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.score-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--neon-gold);
}

.score-val {
  font-family: var(--font-impact);
  font-size: 34px;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 0 16px rgba(255, 180, 0, 0.6);
}

/* Streak Flame Badge */
.streak-badge {
  display: none;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ff4500, #ff8c00);
  padding: 2px 10px;
  border-radius: 12px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 2px 10px rgba(255, 69, 0, 0.5);
  animation: pulse-flame 1.2s infinite alternate ease-in-out;
}

.streak-badge.on-fire {
  background: linear-gradient(135deg, #ff0055, #ff5500);
  box-shadow: 0 0 16px rgba(255, 0, 85, 0.8);
  animation: mega-flame 0.7s infinite alternate ease-in-out;
}

@keyframes pulse-flame {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

@keyframes mega-flame {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.15); filter: brightness(1.25); }
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Life Balls Container */
.balls-row {
  display: flex;
  gap: 5px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 9px;
  border-radius: 20px;
}

.ball-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ball-dot.filled {
  background: radial-gradient(circle at 35% 35%, #ffaa55, #ff5500, #b83300);
  box-shadow: 0 0 6px rgba(255, 100, 0, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.3);
}

.ball-dot.empty {
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.25);
}

/* Timer Container */
.timer-box {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 5px 12px;
  border-radius: 20px;
}

.timer-val {
  font-family: var(--font-impact);
  font-size: 20px;
  color: var(--neon-cyan);
}

.timer-val.urgent {
  color: #ff3b30;
  animation: urgent-blink 0.5s infinite alternate;
}

@keyframes urgent-blink {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.7; transform: scale(1.08); }
}

.hud-actions {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.15);
}

/* Record Pill */
.hud-sub {
  position: absolute;
  top: max(74px, calc(env(safe-area-inset-top) + 64px));
  left: 50%;
  transform: translateX(-50%);
}

.best-pill {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.best-pill strong {
  color: var(--neon-gold);
}

/* Fire Banner */
.fire-banner {
  position: absolute;
  top: 130px;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 5;
}

.fire-banner.active {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.fire-text {
  font-family: var(--font-impact);
  font-size: 20px;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(90deg, #ff0055, #ff7700, #ff0055);
  background-size: 200% auto;
  padding: 6px 20px;
  border-radius: 24px;
  box-shadow: 0 0 25px rgba(255, 60, 0, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.5);
  animation: shine-bar 2s linear infinite;
}

@keyframes shine-bar {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* Aim Tip */
.aim-tip {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 15, 30, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.3);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 8px 18px;
  border-radius: 24px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: opacity 0.3s ease;
  margin-bottom: 20px;
}

.tip-hand {
  font-size: 18px;
  animation: bounce-hand 1.2s infinite ease-in-out;
}

@keyframes bounce-hand {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

.tip-desc {
  font-size: 13px;
  font-weight: 700;
  color: var(--neon-cyan);
}

/* ==========================================================
   Modals & Overlays
   ========================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 6, 14, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: linear-gradient(170deg, rgba(20, 28, 50, 0.95), rgba(12, 16, 30, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 35px rgba(0, 200, 255, 0.15);
  border-radius: 26px;
  padding: 26px 22px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

/* Start Card */
.brand-header {
  margin-bottom: 20px;
}

.logo-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 12px rgba(255, 120, 0, 0.6));
  animation: bounce-ball 2.2s infinite ease-in-out;
}

@keyframes bounce-ball {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.game-title {
  font-family: var(--font-impact);
  font-size: 40px;
  letter-spacing: 2px;
  line-height: 1;
  background: linear-gradient(180deg, #ffffff 10%, #ffaa00 70%, #ff5500 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 25px rgba(255, 120, 0, 0.4);
}

.game-subtitle {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--neon-cyan);
  margin-top: 4px;
}

.tagline {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Mode Selection Grid */
.mode-select-grid {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 20px;
}

.mode-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(25, 34, 58, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 13px 16px;
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: all 0.2s ease;
  overflow: hidden;
}

.mode-card:active {
  transform: scale(0.97);
  background: rgba(35, 48, 80, 0.85);
}

.mode-card.primary {
  background: linear-gradient(135deg, rgba(30, 45, 80, 0.8), rgba(20, 32, 60, 0.9));
  border-color: rgba(0, 229, 255, 0.4);
  box-shadow: 0 4px 18px rgba(0, 229, 255, 0.15);
}

.card-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: linear-gradient(90deg, #ff0055, #ff5500);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 10px;
  border-bottom-left-radius: 10px;
  color: #fff;
}

.card-icon {
  font-size: 30px;
  flex-shrink: 0;
}

.card-info h3 {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
}

.card-info p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.card-arrow {
  margin-left: auto;
  font-size: 14px;
  color: var(--neon-cyan);
  opacity: 0.8;
}

/* Records Strip */
.records-strip {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(10, 15, 28, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 8px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.record-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rec-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.rec-val {
  font-family: var(--font-impact);
  font-size: 16px;
  color: var(--neon-gold);
}

.record-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.start-footer-tip {
  font-size: 11px;
  color: var(--neon-cyan);
  opacity: 0.85;
  line-height: 1.4;
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 20px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #00d4ff, #0077ff);
  color: #050b18;
  font-weight: 900;
  box-shadow: 0 4px 18px rgba(0, 150, 255, 0.45);
}

.btn-glow {
  animation: glow-pulse 1.8s infinite alternate;
}

@keyframes glow-pulse {
  0% { box-shadow: 0 4px 18px rgba(0, 150, 255, 0.45); }
  100% { box-shadow: 0 4px 30px rgba(0, 200, 255, 0.8); }
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.modal-title {
  font-family: var(--font-impact);
  font-size: 26px;
  letter-spacing: 1px;
  color: #ffffff;
  margin-bottom: 6px;
}

/* Level Clear Card */
.celebrate-badge {
  font-size: 26px;
  margin-bottom: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.stat-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 10px;
  border-radius: 14px;
}

.stat-name {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.stat-val {
  font-family: var(--font-impact);
  font-size: 22px;
}

.stat-val.highlight {
  color: var(--neon-gold);
}

.stat-val.bonus {
  color: #00ff88;
}

/* Game Over Card */
.new-record-ribbon {
  background: linear-gradient(90deg, #ff0055, #ffaa00);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 10px;
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.6);
  animation: shine-bar 1.5s linear infinite;
}

.over-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.score-display-panel {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(10, 16, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 12px;
  border-radius: 18px;
  margin-bottom: 14px;
}

.main-score-box .label, .best-score-box .label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.main-score-box .num {
  font-family: var(--font-impact);
  font-size: 38px;
  color: #ffffff;
  text-shadow: 0 0 15px rgba(255, 180, 0, 0.5);
}

.best-score-box .num {
  font-family: var(--font-impact);
  font-size: 28px;
  color: var(--neon-gold);
}

.stats-strip {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.strip-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.s-label {
  font-size: 10px;
  color: var(--text-muted);
}

.s-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--neon-cyan);
}

/* ==========================================================
   Small Screens / Mobile Viewport Tweaks
   ========================================================== */
@media (max-width: 420px) {
  .modal-content {
    padding: 20px 16px;
    border-radius: 22px;
  }
  .game-title {
    font-size: 34px;
  }
  .game-subtitle {
    font-size: 15px;
    letter-spacing: 6px;
  }
  .mode-card {
    padding: 11px 12px;
  }
  .card-icon {
    font-size: 26px;
  }
  .score-val {
    font-size: 28px;
  }
  .main-score-box .num {
    font-size: 32px;
  }
}
