* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 30%, #0b1230 0%, #05060f 70%);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: #dfe9ff;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
canvas { display: block; background: #040710; touch-action: none; max-width: 100%; max-height: 100%; }
#wrap {
  position: relative;
  outline: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(60,120,255,0.35);
  border: 1px solid rgba(120,170,255,0.25);
}
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,6,18,0.9);
  backdrop-filter: blur(6px);
  z-index: 30;
  padding: 16px;
}
.hidden { display: none !important; }
.panel { text-align: center; max-width: 460px; width: 100%; }
h1 {
  font-size: 40px; letter-spacing: 8px; font-weight: 800;
  background: linear-gradient(180deg, #fff 0%, #6fb6ff 55%, #2a5fd6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(90,160,255,0.35);
}
h2 { font-size: 28px; letter-spacing: 5px; color: #9fd0ff; margin-bottom: 12px; }
.sub { font-size: 12px; letter-spacing: 3px; color: #7f96c9; margin-top: 6px; text-transform: uppercase; }
.ctrls { font-size: 13px; color: #9fb2dd; line-height: 1.9; margin: 10px 0 16px; }
.ctrls b { color: #ffd35c; font-weight: 600; }
.btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
button {
  font-family: inherit; cursor: pointer; border: none; outline: none;
  border-radius: 8px; padding: 12px 26px; font-size: 16px; letter-spacing: 3px;
  color: #eaf4ff;
  background: linear-gradient(180deg, #2f6fe0, #1740a8);
  box-shadow: 0 4px 18px rgba(35,90,220,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform 0.12s, filter 0.12s;
}
button:hover { filter: brightness(1.18); }
button:active { transform: translateY(2px) scale(0.98); }
button.primary {
  background: linear-gradient(180deg, #ffb01a, #e05a12);
  box-shadow: 0 4px 20px rgba(255,140,30,0.45), inset 0 1px 0 rgba(255,255,255,0.35);
  color: #2a1200; font-weight: 700;
}
button.ghost { background: rgba(60,90,170,0.35); box-shadow: inset 0 0 0 1px rgba(140,180,255,0.4); }
button.mini { padding: 6px 12px; font-size: 12px; letter-spacing: 1px; border-radius: 6px; }
#loading { margin-top: 14px; font-size: 13px; color: #8fb8ff; letter-spacing: 2px; }
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 20; pointer-events: none;
  padding: 8px 10px 0;
  font-family: Consolas, "Courier New", monospace;
}
#hud .row { display: flex; align-items: center; justify-content: space-between; }
#hud .row + .row { margin-top: 6px; }
.stat { font-size: 11px; letter-spacing: 2px; color: #7f96c9; }
.stat b { display: block; font-size: 18px; color: #ffe9a0; letter-spacing: 1px; text-shadow: 0 0 12px rgba(255,210,90,0.5); }
.stat.center { text-align: center; }
.stat.right { text-align: right; }
.slot {
  font-size: 10px; letter-spacing: 1px; color: #8fb8ff;
  background: rgba(10,20,50,0.55);
  border: 1px solid rgba(110,160,255,0.25);
  border-radius: 6px; padding: 3px 7px;
  display: flex; align-items: center; gap: 5px;
}
.slot b { color: #7dffc8; font-size: 12px; }
#lives { display: flex; gap: 3px; align-items: center; }
#combo {
  position: absolute; top: 112px; left: 50%; transform: translateX(-50%);
  z-index: 21; font-family: Consolas, monospace;
  font-size: 16px; letter-spacing: 3px; color: #ffd35c;
  text-shadow: 0 0 14px rgba(255,190,60,0.85);
  pointer-events: none;
  animation: comboPop 0.35s ease-out;
}
#combo b { font-size: 24px; color: #fff2c2; }
#combo.hot { animation: comboHot 0.5s ease-in-out infinite alternate; }
@keyframes comboPop { from { transform: translateX(-50%) scale(1.5); } to { transform: translateX(-50%) scale(1); } }
@keyframes comboHot { from { filter: brightness(1); } to { filter: brightness(1.6); } }
#ctrls { position: absolute; top: 70px; right: 10px; z-index: 22; display: flex; flex-direction: column; gap: 6px; }
#bombBtn { position: absolute; right: 12px; bottom: 12px; z-index: 22; width: 72px; height: 72px; border-radius: 50%; padding: 0; font-size: 14px; letter-spacing: 1px; background: radial-gradient(circle at 35% 30%, #ffcf5c, #e0561a 70%); color: #3a1500; font-weight: 800; box-shadow: 0 0 24px rgba(255,130,30,0.5), inset 0 2px 6px rgba(255,255,255,0.4); border: 2px solid rgba(255,235,190,0.65); touch-action: none; }
#mslBtn { position: absolute; left: 12px; bottom: 12px; z-index: 22; width: 72px; height: 72px; border-radius: 50%; padding: 0; font-size: 14px; letter-spacing: 1px; background: radial-gradient(circle at 35% 30%, #7ff0e0, #1f7fd8 70%); color: #032038; font-weight: 800; box-shadow: 0 0 24px rgba(60,190,255,0.5), inset 0 2px 6px rgba(255,255,255,0.4); border: 2px solid rgba(210,250,255,0.65); touch-action: none; }
#bossbar { position: absolute; top: 94px; left: 50%; transform: translateX(-50%); width: 66%; height: 12px; z-index: 20; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,130,150,0.6); border-radius: 7px; overflow: hidden; }
#bossbar .fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff9d2e, #ff4d6a); transition: width 0.2s; }
#bossbar span { position: absolute; inset: 0; text-align: center; font-size: 9px; letter-spacing: 6px; line-height: 12px; color: #fff2f4; text-shadow: 0 1px 2px #000; }
#banner { position: absolute; top: 30%; left: 0; right: 0; z-index: 25; text-align: center; font-size: 30px; letter-spacing: 8px; font-weight: 800; color: #ffe9a0; text-shadow: 0 0 24px rgba(255,180,60,0.8); opacity: 0; transform: translateY(12px) scale(0.94); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
#banner.show { opacity: 1; transform: translateY(0) scale(1); }
#gallery { position: fixed; z-index: 60; align-items: flex-start; overflow-y: auto; background: rgba(4,6,18,0.98); display: block; }
#gallery.hidden { display: none !important; }
#gallery::-webkit-scrollbar { width: 10px; }
#gallery::-webkit-scrollbar-track { background: #06081a; }
#gallery::-webkit-scrollbar-thumb { background: #2a4a9a; border-radius: 5px; }
#gallery::-webkit-scrollbar-thumb:hover { background: #3f68d0; }
.galHead { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 16px 18px 12px; background: linear-gradient(180deg, rgba(8,12,32,0.98), rgba(8,12,32,0.9)); border-bottom: 1px solid rgba(110,160,255,0.25); }
.galHead h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: 3px; }
.galHead p { font-size: 11px; color: #8fa4d4; line-height: 1.6; max-width: 620px; }
.galHead code { color: #7dffc8; background: rgba(30,60,90,0.5); padding: 1px 5px; border-radius: 4px; font-size: 10px; }
.galCtl { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #9fb2dd; white-space: nowrap; }
.galCtl input[type="range"] { width: 120px; accent-color: #ffb01a; }
.galCtl b { color: #ffe9a0; font-size: 16px; min-width: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 14px 18px 26px; }
.card { background: linear-gradient(180deg, rgba(16,24,56,0.85), rgba(10,14,36,0.9)); border: 1px solid rgba(110,160,255,0.22); border-radius: 10px; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,0.4); display: flex; flex-direction: column; }
.cardTitle { padding: 7px 11px; font-size: 12px; letter-spacing: 2px; color: #cfe1ff; background: rgba(40,70,150,0.35); border-bottom: 1px solid rgba(110,160,255,0.2); }
.cardBody { flex: 1; display: flex; align-items: center; justify-content: center; padding: 6px; background: linear-gradient(rgba(80,120,220,0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(80,120,220,0.07) 1px, transparent 1px), #070b1c; background-size: 14px 14px, 14px 14px, auto; }
.card svg { max-width: 100%; max-height: 100%; display: block; }
.cardMeta { padding: 6px 11px; font-size: 9px; letter-spacing: 1px; color: #7f96c9; border-top: 1px solid rgba(110,160,255,0.15); }
.card.selected { border-color: #ffd35c; box-shadow: 0 0 15px rgba(255, 211, 92, 0.4); }
.card.selected .cardTitle { color: #ffd35c; }
.scoreHint { margin-top: 14px; font-size: 11px; color: #6f83b3; letter-spacing: 2px; }
@media (max-width: 520px) {
  h1 { font-size: 28px; }
  h2 { font-size: 20px; }
  .btns { flex-direction: column; width: 100%; }
  .panel { padding: 0 12px; }
  #wrap { border-radius: 0; }
}
