/* ============================================================
   Fantasy Mela VR v1.2 — 2D overlay styles
   (Boot splash · Main menu · In-game bar · Results card · HUD)
   Colour palette: carnival-purple + hot-pink + gold.
   Cricket-inspired splash with continue button and version tag.
   ============================================================ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; overflow: hidden;
  background: #0a0418; color: #fff;
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.hidden { opacity: 0 !important; pointer-events: none !important; }

/* ================= BOOT OVERLAY ================= */
#boot-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(ellipse at center, #2a0a4a 0%, #0a0418 70%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.7s ease;
}
.boot-card {
  text-align: center;
  padding: 44px 48px;
  background: rgba(255, 215, 0, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 40px rgba(255, 102, 204, 0.3);
  max-width: 92vw;
}
.boot-logo {
  font-size: clamp(3em, 8vw, 4.5em);
  margin-bottom: 4px;
  filter: drop-shadow(0 0 20px #ff66cc);
  animation: bootSpin 3s ease-in-out infinite;
}
@keyframes bootSpin {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50%      { transform: rotate( 6deg) scale(1.04); }
}
.boot-card h1 {
  font-size: clamp(1.8em, 5vw, 2.8em); margin: 0 0 4px;
  background: linear-gradient(45deg, #ffd700, #ff66cc, #66ccff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
  letter-spacing: 0.05em;
}
.boot-subtitle {
  font-size: 0.8em; letter-spacing: 0.25em;
  color: #ffd700; opacity: 0.75; margin-bottom: 16px;
}
#boot-status { margin: 8px 0 20px; opacity: 0.85; min-height: 1.2em; }
.boot-bar { width: 320px; max-width: 60vw; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; margin: 0 auto; }
#boot-bar-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #ffd700, #ff66cc); transition: width 0.3s ease; }
.boot-hint { margin-top: 22px; opacity: 0.6; font-size: 0.9em; }
.boot-skip {
  margin-top: 18px;
  background: linear-gradient(135deg, #ffd700, #ff66cc);
  color: #1a0033; border: none; padding: 11px 22px; border-radius: 10px;
  font-weight: 800; cursor: pointer; font-size: 1em; letter-spacing: 0.04em;
  box-shadow: 0 6px 18px rgba(255, 215, 0, 0.4);
  transition: transform 0.2s ease;
  animation: pulseEnter 1.6s ease-in-out infinite;
}
.boot-skip:hover { transform: translateY(-2px); }
@keyframes pulseEnter {
  0%, 100% { box-shadow: 0 6px 18px rgba(255, 215, 0, 0.4); }
  50%      { box-shadow: 0 8px 26px rgba(255, 102, 204, 0.6); }
}

/* ================= MENU OVERLAY ================= */
#menu-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: radial-gradient(ellipse at 20% 0%, #2a0a4a 0%, #0a0418 60%),
              radial-gradient(ellipse at 80% 100%, #4a0a3a 0%, #0a0418 60%);
  display: flex; flex-direction: column;
  transition: opacity 0.5s ease;
  overflow-y: auto;
}
.menu-header {
  padding: 22px 28px 10px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.18);
  position: relative;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon { font-size: 2em; filter: drop-shadow(0 0 8px #ff66cc); }
.brand h1 {
  margin: 0; font-size: clamp(1.4em, 3.8vw, 2.2em);
  background: linear-gradient(45deg, #ffd700, #ff66cc, #66ccff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.menu-subtitle {
  margin-top: 10px; display: flex; align-items: center; gap: 14px;
  opacity: 0.9; font-size: 0.95em; flex-wrap: wrap;
}
.device-badge {
  position: absolute; top: 22px; right: 28px;
  font-size: 0.78em; padding: 6px 10px;
  background: rgba(255, 215, 0, 0.1); border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 20px; opacity: 0.85;
}

.vr-btn {
  background: linear-gradient(135deg, #ffd700, #ff9500);
  color: #1a0033; border: none; padding: 9px 16px; border-radius: 8px;
  font-weight: 700; cursor: pointer; font-size: 0.95em;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.35);
}
.vr-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 215, 0, 0.5); }
.vr-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.4); box-shadow: none; }

/* ================= GAME CARD GRID ================= */
.menu-grid {
  flex: 1; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; padding: 22px 28px 28px;
  max-width: 1200px; width: 100%; margin: 0 auto;
}
.game-card {
  position: relative; overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  padding: 22px 18px 18px;
  cursor: pointer; user-select: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  color: #fff;
  text-align: left;
  font: inherit;
}
.game-card::before {
  content: ''; position: absolute; inset: -2px;
  background: radial-gradient(circle at 30% 0%, var(--accent, #ff66cc) 0%, transparent 60%);
  opacity: 0.25; z-index: 0; transition: opacity 0.2s ease;
}
.game-card > * { position: relative; z-index: 1; }
.game-card:hover, .game-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent, #ff66cc);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 18px var(--accent, #ff66cc);
  outline: none;
}
.game-card:hover::before { opacity: 0.4; }
.game-card .icon { font-size: 2.4em; margin-bottom: 6px; filter: drop-shadow(0 0 6px var(--accent, #ff66cc)); }
.game-card .title { font-size: 1.2em; font-weight: 700; margin: 4px 0 6px; }
.game-card .desc { opacity: 0.78; font-size: 0.88em; min-height: 2.8em; }
.game-card .meta { margin-top: 10px; font-size: 0.75em; opacity: 0.6; letter-spacing: 0.04em; text-transform: uppercase; }
.game-card .best { position: absolute; top: 14px; right: 14px; font-size: 0.75em; padding: 3px 8px; border-radius: 20px; background: rgba(255,215,0,0.15); border: 1px solid rgba(255,215,0,0.3); }

.menu-footer {
  padding: 14px 28px;
  border-top: 1px solid rgba(255, 215, 0, 0.18);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  font-size: 0.85em; opacity: 0.8;
}
.menu-footer .tip { opacity: 0.55; }
.menu-footer .build-tag { font-variant-numeric: tabular-nums; opacity: 0.55; letter-spacing: 0.04em; }

/* ================= IN-GAME TOP BAR ================= */
#ingame-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 4000;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(to bottom, rgba(10,4,24,0.92), rgba(10,4,24,0.4));
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
  color: #fff; font-size: 0.95em;
}
#ingame-bar button {
  background: rgba(255, 102, 204, 0.18);
  border: 1px solid rgba(255, 102, 204, 0.6);
  color: #fff; padding: 7px 12px; border-radius: 8px;
  cursor: pointer; font-weight: 600;
  transition: background 0.15s;
}
#ingame-bar button:hover { background: rgba(255, 102, 204, 0.35); }
#ingame-bar button.vr-btn {
  background: linear-gradient(135deg, #ffd700, #ff9500); color: #1a0033; border: none;
}
#ingame-title { flex: 1; text-align: center; font-weight: 700; color: #ffd700; letter-spacing: 0.03em; }
#ingame-score { color: #66ccff; font-variant-numeric: tabular-nums; }

.a-fullscreen #ingame-bar { display: none; }

/* ================= HELP BANNER ================= */
#help-banner {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  z-index: 4500;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.45);
  padding: 8px 14px; border-radius: 10px;
  font-size: 0.85em; color: #ffd700;
  backdrop-filter: blur(6px);
  transition: opacity 0.4s ease;
}

/* ================= RESULTS OVERLAY ================= */
#results-overlay {
  position: fixed; inset: 0; z-index: 6000;
  background: rgba(10, 4, 24, 0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
.results-card {
  text-align: center; max-width: 92vw;
  padding: 36px 44px;
  background: linear-gradient(145deg, rgba(255, 215, 0, 0.08), rgba(255, 102, 204, 0.05));
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 18px;
  box-shadow: 0 0 60px rgba(255, 102, 204, 0.4);
}
.results-card h2 {
  margin: 0 0 10px; font-size: 1.8em;
  background: linear-gradient(45deg, #ffd700, #ff66cc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.big-score { font-size: 3.5em; font-weight: 800; color: #ffd700; margin: 10px 0 6px; }
.big-score small { font-size: 0.4em; color: #aaa; font-weight: 400; }
.results-actions { margin-top: 22px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.results-actions button {
  padding: 10px 20px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06); color: #fff;
  cursor: pointer; font-weight: 600; font-size: 0.95em;
}
.results-actions button.primary {
  background: linear-gradient(135deg, #ffd700, #ff66cc); color: #1a0033; border: none;
}

/* ================= A-FRAME ENTER-VR BUTTON ================= */
.a-enter-vr-button, .a-enter-ar-button {
  background-color: rgba(255, 215, 0, 0.85) !important;
  border-radius: 8px !important;
}

/* ================= MOBILE ================= */
@media (max-width: 640px) {
  .menu-header { padding: 18px 16px 10px; }
  .device-badge { position: static; margin-top: 8px; display: inline-block; }
  .menu-grid { grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; }
  .game-card { padding: 14px 12px; }
  .game-card .icon { font-size: 1.8em; }
  .game-card .title { font-size: 1em; }
  .game-card .desc { font-size: 0.78em; min-height: 2.4em; }
  #ingame-bar { font-size: 0.8em; padding: 8px 10px; gap: 8px; }
  #ingame-bar button { padding: 6px 10px; font-size: 0.85em; }
  .results-card { padding: 24px 22px; }
  .big-score { font-size: 2.6em; }
}
