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

:root {
  --ink: #eef1ff;
  --muted: rgba(238, 241, 255, 0.55);
  --panel: rgba(10, 12, 28, 0.72);
  --line: rgba(255, 255, 255, 0.1);
}

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #05060f;
  color: var(--ink);
  overflow-x: hidden;
}

#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

/* ---------- menu ---------- */
#menu {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero { text-align: center; margin-bottom: 44px; }

.logo {
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(92deg, #4cc9f0 0%, #a78bfa 35%, #ff5d8f 70%, #ffd166 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(167, 139, 250, 0.35));
  animation: logoGlow 4s ease-in-out infinite;
}
@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(76, 201, 240, 0.3)); }
  50% { filter: drop-shadow(0 0 34px rgba(255, 93, 143, 0.45)); }
}
.logo-dot { color: #fff; -webkit-text-fill-color: #fff; }
.logo-arcade { font-style: italic; }

.subtitle { margin-top: 12px; color: var(--muted); font-size: 17px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  flex: 1;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 15% 0%, color-mix(in srgb, var(--c) 26%, transparent), transparent 60%),
    var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  backdrop-filter: blur(6px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: cardIn 0.5s ease both;
}
.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5) { animation-delay: 0.16s; }
.card:nth-child(6) { animation-delay: 0.2s; }
.card:nth-child(7) { animation-delay: 0.24s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: color-mix(in srgb, var(--c) 60%, transparent);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 26px color-mix(in srgb, var(--c) 28%, transparent);
}
.card:active { transform: scale(0.98); }

.card-emoji { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4)); }
.card-title { font-size: 21px; font-weight: 800; letter-spacing: 0.3px; }
.card-tag { color: var(--muted); font-size: 13.5px; line-height: 1.45; min-height: 38px; }
.card-play {
  margin-top: auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 999px;
  padding: 6px 14px;
  transition: background 0.15s ease, color 0.15s ease;
}
.card:hover .card-play { background: var(--c); color: #0a0a18; }

.foot { text-align: center; margin-top: 44px; color: var(--muted); font-size: 13px; }

/* ---------- stage ---------- */
#stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #05060f;
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(8, 9, 22, 0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 10px; }
.hud-title { font-weight: 800; font-size: 16px; letter-spacing: 0.4px; }
.hud-lives { letter-spacing: 3px; font-size: 15px; }
.hud-score {
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  font-weight: 800;
  background: linear-gradient(92deg, #4cc9f0, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  min-width: 44px;
  text-align: center;
}
.hud-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.hud-btn:hover { background: rgba(255, 255, 255, 0.14); }
.hud-btn:active { transform: scale(0.92); }

#game { flex: 1; width: 100%; display: block; touch-action: none; }

/* ---------- overlay ---------- */
#overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 14, 0.72);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.panel {
  text-align: center;
  padding: 40px 48px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }

.ov-emoji { font-size: 58px; animation: bounce 1.2s ease infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.ov-title { font-size: 30px; font-weight: 900; margin-top: 8px; letter-spacing: 0.5px; }
.ov-score { margin-top: 10px; font-size: 19px; font-weight: 700; }
.ov-best { margin-top: 4px; color: var(--muted); font-size: 15px; }

.ov-btns { display: flex; gap: 14px; justify-content: center; margin-top: 26px; }
.big-btn {
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: #0a0a18;
  background: linear-gradient(92deg, #4cc9f0, #a78bfa);
  transition: transform 0.12s ease, filter 0.15s ease;
}
.big-btn:hover { filter: brightness(1.12); transform: translateY(-2px); }
.big-btn:active { transform: scale(0.96); }
.big-btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.big-btn.ghost:hover { background: rgba(255, 255, 255, 0.08); }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  #menu { padding: 36px 16px 30px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { padding: 16px 14px; min-height: 150px; }
  .card-emoji { font-size: 36px; }
  .card-title { font-size: 17px; }
  .card-tag { font-size: 12px; min-height: 30px; }
  .card-play { display: none; }
  .hud-title { display: none; }
  .panel { padding: 30px 24px; }
}
