/* ==========================================================================
   CYBER GALAXY HERO – main.css
   Dùng chung cho Landing / Host / Join / Player.
   ========================================================================== */

:root {
  --bg-1: #0F172A;
  --bg-2: #1E1B4B;
  --bg-3: #312E81;
  --primary: #4F46E5;
  --cyan: #06B6D4;
  --violet: #7C3AED;
  --pink: #EC4899;
  --green: #22C55E;
  --amber: #F59E0B;
  --red: #EF4444;
  --text: #F8FAFC;
  --muted: #C7D2FE;
  --card: rgba(30, 27, 75, 0.72);
  --card-border: rgba(165, 180, 252, 0.28);
  --radius: 22px;
  --font-display: "Baloo 2", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --opt-0: #4F46E5;
  --opt-1: #EC4899;
  --opt-2: #F59E0B;
  --opt-3: #06B6D4;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%) fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display { font-family: var(--font-display); font-weight: 800; letter-spacing: .5px; }

.app-shell { position: relative; z-index: 2; min-height: 100vh; min-height: 100dvh; }

/* --------------------------------------------------------------------------
   Nền thiên hà
   -------------------------------------------------------------------------- */
.galaxy { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#starfield { position: absolute; inset: 0; width: 100%; height: 100%; }

.nebula { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: nebulaDrift 28s ease-in-out infinite alternate; }
.nebula-1 { width: 55vmax; height: 55vmax; left: -15vmax; top: -18vmax; background: radial-gradient(circle, #7C3AED 0%, transparent 65%); }
.nebula-2 { width: 50vmax; height: 50vmax; right: -18vmax; top: 10vh; background: radial-gradient(circle, #EC4899 0%, transparent 65%); animation-delay: -8s; opacity: .4; }
.nebula-3 { width: 60vmax; height: 60vmax; left: 20vw; bottom: -35vmax; background: radial-gradient(circle, #06B6D4 0%, transparent 65%); animation-delay: -15s; opacity: .35; }
@keyframes nebulaDrift { from { transform: translate(0, 0) scale(1); } to { transform: translate(4vw, 3vh) scale(1.12); } }

.planet { position: absolute; border-radius: 50%; }
/* Hành tinh có vành: SVG (#bg-saturn trong _icons.svg) – vành sau bị hành tinh che, vành trước đè lên */
.planet-ringed {
  position: absolute; width: 270px; height: 177px; right: 3vw; top: 11vh; overflow: visible;
  filter: drop-shadow(0 0 28px rgba(236,72,153,.45)) drop-shadow(0 0 60px rgba(124,58,237,.35));
  animation: ringedFloat 10s ease-in-out infinite;
}
@keyframes ringedFloat { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-14px) rotate(3deg); } }
.planet-small {
  width: 80px; height: 80px; left: 5vw; bottom: 16vh;
  background: radial-gradient(circle at 35% 30%, #a5f3fc, #06B6D4 50%, #1e40af 100%);
  box-shadow: inset -10px -8px 20px rgba(0,0,0,.35), 0 0 40px rgba(6,182,212,.45);
  animation: planetFloat 7s ease-in-out infinite reverse;
}
.planet-small::before { content: ""; position: absolute; width: 100%; height: 100%; border-radius: 50%;
  background: repeating-linear-gradient(170deg, transparent 0 12px, rgba(255,255,255,.12) 12px 18px); animation: spin 12s linear infinite; }
.planet-tiny {
  width: 34px; height: 34px; left: 42vw; top: 7vh;
  background: radial-gradient(circle at 35% 30%, #fde68a, #F59E0B 60%, #b45309 100%);
  box-shadow: 0 0 25px rgba(245,158,11,.6);
  animation: orbit 30s linear infinite;
}
@keyframes planetFloat { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-16px) rotate(6deg); } }
@keyframes ringSpin { from { transform: rotate(-18deg) scaleX(1); } 50% { transform: rotate(-14deg) scaleX(1.04); } to { transform: rotate(-18deg) scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes orbit { from { transform: rotate(0deg) translateX(60px) rotate(0deg); } to { transform: rotate(360deg) translateX(60px) rotate(-360deg); } }

@media (max-width: 640px) {
  .planet-ringed { width: 150px; height: 98px; right: -28px; top: 68vh; }
  .planet-small { display: none; }
}

/* Lớp phủ hiệu ứng */
.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 55; opacity: 0; }
.flash.flash-green { animation: flash 0.7s ease-out; background: radial-gradient(circle, rgba(34,197,94,.15), rgba(34,197,94,.55)); }
.flash.flash-red { animation: flash 0.7s ease-out; background: radial-gradient(circle, rgba(239,68,68,.15), rgba(239,68,68,.6)); }
.flash.flash-gold { animation: flash 1.2s ease-out; background: radial-gradient(circle, rgba(253,224,71,.5), rgba(236,72,153,.3)); }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

.shake { animation: shake .5s ease-in-out; }
@keyframes shake {
  0%,100% { transform: translate(0,0); }
  15% { transform: translate(-9px, 3px) rotate(-.6deg); }
  30% { transform: translate(9px, -3px) rotate(.6deg); }
  45% { transform: translate(-7px, -2px); }
  60% { transform: translate(7px, 2px); }
  80% { transform: translate(-3px, 1px); }
}

/* --------------------------------------------------------------------------
   Nút game (phong cách Brawl Stars / Fall Guys: dày, bo tròn, có "đáy")
   -------------------------------------------------------------------------- */
.btn-game {
  --btn-bg: linear-gradient(135deg, var(--primary), var(--cyan));
  --btn-shadow: #312E81;
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 14px 26px; border: 3px solid rgba(255,255,255,.85); border-radius: 20px;
  background: var(--btn-bg); color: #fff; text-decoration: none; cursor: pointer;
  font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: 1px; line-height: 1.1;
  box-shadow: 0 7px 0 var(--btn-shadow), 0 12px 24px rgba(0,0,0,.35);
  transition: transform .12s ease, box-shadow .12s ease, filter .2s;
  user-select: none; text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.btn-game:hover { color: #fff; filter: brightness(1.1) saturate(1.1); transform: translateY(-2px); }
.btn-game:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--btn-shadow), 0 4px 10px rgba(0,0,0,.3); }
.btn-game:disabled, .btn-game.disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; transform: none; }
.btn-game small { font-family: var(--font-body); font-size: .8rem; opacity: .9; letter-spacing: 0; font-weight: 700; }
.btn-game .btn-icon { font-size: 1.6em; }
.btn-game-primary { --btn-bg: linear-gradient(135deg, #4F46E5, #06B6D4); --btn-shadow: #1e3a8a; }
.btn-game-secondary { --btn-bg: linear-gradient(135deg, #7C3AED, #EC4899); --btn-shadow: #6b21a8; }
.btn-game-success { --btn-bg: linear-gradient(135deg, #16a34a, #22C55E); --btn-shadow: #14532d; }
.btn-game-warning { --btn-bg: linear-gradient(135deg, #ea580c, #F59E0B); --btn-shadow: #9a3412; }
.btn-game-danger { --btn-bg: linear-gradient(135deg, #dc2626, #f43f5e); --btn-shadow: #7f1d1d; }
.btn-game-dark { --btn-bg: linear-gradient(135deg, #312E81, #1E1B4B); --btn-shadow: #0F172A; }
.btn-game-xl { min-width: 280px; padding: 20px 34px; font-size: 1.9rem; }
.btn-game-sm { padding: 8px 14px; font-size: 1rem; border-width: 2px; border-radius: 14px; box-shadow: 0 4px 0 var(--btn-shadow); }

/* Thẻ "kính" */
.glass {
  background: var(--card); border: 2px solid var(--card-border); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(2, 6, 23, .45), inset 0 1px 0 rgba(255,255,255,.12);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1.5px solid rgba(255,255,255,.25); font-weight: 800; white-space: nowrap;
}
.energy { color: #FDE68A; text-shadow: 0 0 12px rgba(245,158,11,.7); font-family: var(--font-display); font-weight: 800; }

/* --------------------------------------------------------------------------
   Landing
   -------------------------------------------------------------------------- */
.landing { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 36px; padding: 32px 16px 160px; text-align: center; }
.logo-rocket { font-size: clamp(3.5rem, 9vw, 6rem); animation: rocketBob 2.4s ease-in-out infinite; filter: drop-shadow(0 0 22px rgba(236,72,153,.8)); }
@keyframes rocketBob { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-18px) rotate(6deg); } }
.game-title { margin: 0; line-height: .9; font-size: clamp(3rem, 11vw, 8rem); }
.title-line { display: block; background: linear-gradient(90deg, #a5f3fc, #c4b5fd, #f9a8d4, #fde68a, #a5f3fc); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 6s linear infinite; filter: drop-shadow(0 6px 0 #312E81) drop-shadow(0 0 24px rgba(124,58,237,.6)); }
.title-line:nth-child(2) { animation-delay: -1s; }
.title-hero { font-size: 1.15em; animation-delay: -2s; }
@keyframes shimmer { to { background-position: 300% 0; } }
.game-subtitle { margin: 14px 0 0; font-size: clamp(1.2rem, 3.4vw, 2rem); color: #FDE68A; text-shadow: 0 0 18px rgba(245,158,11,.6); font-family: var(--font-display); }
.landing-actions { display: flex; flex-wrap: wrap; gap: 26px; justify-content: center; }
.landing-features { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.landing-features li { padding: 8px 16px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.18); font-size: 1rem; }
.landing-features span { margin-right: 6px; }

/* --------------------------------------------------------------------------
   Astro Bot
   -------------------------------------------------------------------------- */
.astro-bot { position: fixed; left: 14px; bottom: 12px; z-index: 50; display: flex; align-items: flex-end; flex-direction: row-reverse; justify-content: flex-end; gap: 6px; pointer-events: none; max-width: min(560px, calc(100vw - 28px)); }
.astro-img { width: 96px; height: 96px; flex: none; animation: astroFloat 3s ease-in-out infinite; filter: drop-shadow(0 0 16px rgba(6,182,212,.7)); }
.astro-bot.talking .astro-img { animation: astroFloat 3s ease-in-out infinite, astroTalk .35s ease-in-out 4; }
.astro-bubble {
  position: relative; margin-bottom: 52px; padding: 10px 16px; background: #fff; color: #1E1B4B; border-radius: 20px 20px 20px 4px;
  font-size: 1.05rem; font-weight: 800; box-shadow: 0 8px 0 rgba(49,46,129,.45), 0 0 26px rgba(6,182,212,.4); border: 3px solid #a5f3fc;
  transform-origin: bottom left; transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
.astro-bubble.pop { animation: bubblePop .45s cubic-bezier(.34,1.56,.64,1); }
.astro-bot.hidden-bubble .astro-bubble { opacity: 0; transform: scale(.4); }
@keyframes astroFloat { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
@keyframes astroTalk { 50% { transform: translateY(-4px) scale(1.06); } }
@keyframes bubblePop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.astro-bot.astro-right { left: auto; right: 14px; flex-direction: row; }
.astro-bot.astro-right .astro-bubble { border-radius: 20px 20px 4px 20px; transform-origin: bottom right; }
@media (max-width: 640px) {
  .astro-img { width: 64px; height: 64px; }
  .astro-bubble { font-size: .9rem; margin-bottom: 36px; padding: 8px 12px; }
}

/* Âm thanh & thông báo */
.mute-btn { position: fixed; top: 12px; right: 12px; z-index: 70; width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); background: rgba(30,27,75,.8); color: #fff; font-size: 1.3rem; cursor: pointer; }
.game-toast {
  position: fixed; left: 50%; top: 18px; z-index: 80; transform: translate(-50%, -150%); max-width: calc(100vw - 32px);
  padding: 12px 22px; border-radius: 16px; background: #fff; color: #1E1B4B; font-weight: 800; box-shadow: 0 8px 0 rgba(0,0,0,.3);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.game-toast.show { transform: translate(-50%, 0); }
.game-toast.error { background: #fee2e2; color: #991b1b; border: 3px solid #f87171; }
.game-toast.success { background: #dcfce7; color: #14532d; border: 3px solid #4ade80; }

/* --------------------------------------------------------------------------
   Đáp án trắc nghiệm (dùng chung host & player)
   -------------------------------------------------------------------------- */
.options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.option-tile {
  --c: var(--opt-0);
  position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 20px; min-height: 92px;
  border-radius: 20px; border: 3px solid rgba(255,255,255,.75); background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 70%, #000));
  color: #fff; font-size: 1.35rem; font-weight: 800; text-align: left; box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 55%, #000);
  transition: transform .15s, filter .3s, opacity .3s, box-shadow .3s; overflow: hidden;
}
.option-tile .opt-shape { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,.22); font-size: 1.6rem; }
.option-tile[data-i="1"] { --c: var(--opt-1); }
.option-tile[data-i="2"] { --c: var(--opt-2); }
.option-tile[data-i="3"] { --c: var(--opt-3); }
.option-tile.correct { --c: var(--green); box-shadow: 0 0 0 5px #bbf7d0, 0 0 40px rgba(34,197,94,.9); animation: correctPulse 1s ease-in-out 2; }
.option-tile.wrong { filter: grayscale(.85) brightness(.55); }
.option-tile.picked::after { content: "👆 Em chọn"; position: absolute; right: 10px; top: 8px; padding: 2px 10px; border-radius: 999px; background: #fff; color: #1E1B4B; font-size: .8rem; }
.option-tile .opt-bar { position: absolute; left: 0; bottom: 0; height: 8px; width: 0; background: rgba(255,255,255,.85); transition: width 1s cubic-bezier(.22,1,.36,1); }
.option-tile .opt-count { margin-left: auto; font-family: var(--font-display); font-size: 1.6rem; }
@keyframes correctPulse { 50% { transform: scale(1.04); } }

/* Radar: 2 nút lớn */
.radar-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.radar-btn { min-height: 150px; font-size: 1.8rem; justify-content: center; text-align: center; flex-direction: column; }
.radar-btn[data-i="0"] { --c: #16a34a; }
.radar-btn[data-i="1"] { --c: #dc2626; }

/* --------------------------------------------------------------------------
   Đồng hồ đếm ngược
   -------------------------------------------------------------------------- */
.countdown { position: relative; width: 108px; height: 108px; flex: none; }
.countdown svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown .track { stroke: rgba(255,255,255,.15); }
.countdown .ring { stroke: var(--cyan); stroke-linecap: round; transition: stroke .3s; filter: drop-shadow(0 0 8px currentColor); }
.countdown.warn .ring { stroke: var(--amber); }
.countdown.danger .ring { stroke: var(--red); }
.countdown.danger { animation: tick 1s ease-in-out infinite; }
.countdown .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 2.4rem; }
@keyframes tick { 50% { transform: scale(1.08); } }

.progress-energy { height: 16px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; border: 2px solid rgba(255,255,255,.2); }
.progress-energy > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink)); transition: width .5s ease; }

/* --------------------------------------------------------------------------
   Cyber Detective – khung cảnh giả lập
   -------------------------------------------------------------------------- */
.scene { position: relative; margin: 0 auto; max-width: 720px; border-radius: 18px; overflow: hidden; background: #fff; color: #111827; font-family: var(--font-body);
  box-shadow: 0 0 0 4px rgba(255,255,255,.4), 0 20px 50px rgba(0,0,0,.5); text-align: left; }
.scene-chrome { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #e5e7eb; border-bottom: 1px solid #d1d5db; }
.scene-chrome .dots { display: flex; gap: 6px; }
.scene-chrome .dots i { width: 12px; height: 12px; border-radius: 50%; background: #f87171; display: block; }
.scene-chrome .dots i:nth-child(2) { background: #fbbf24; }
.scene-chrome .dots i:nth-child(3) { background: #34d399; }
.scene-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.scene.frame-chat .scene-body { background: #ecfeff; }
.scene.frame-social .scene-body { background: #f8fafc; }
.scene.frame-email .scene-body { background: #fff; }

.el { position: relative; cursor: pointer; border-radius: 12px; padding: 8px 12px; border: 3px dashed transparent; transition: transform .12s, border-color .2s, background .2s; font-weight: 700; }
.el:active { transform: scale(.98); }
.el-url { flex: 1; background: #fff; border-radius: 999px; padding: 6px 14px; font-family: ui-monospace, Consolas, monospace; font-size: .95rem; color: #374151; border: 2px solid #d1d5db; }
.el-header { font-family: var(--font-display); font-size: 1.5rem; color: #1E1B4B; text-align: center; }
.el-banner { background: linear-gradient(90deg, #f43f5e, #f59e0b); color: #fff; text-align: center; font-size: 1.3rem; font-weight: 900; animation: blink 1.2s steps(2) infinite; }
.el-text { color: #374151; }
.el-timer { background: #fef3c7; color: #b45309; text-align: center; font-weight: 900; }
.el-input { background: #f3f4f6; border: 2px solid #9ca3af; color: #6b7280; }
.el-button { align-self: center; background: #2563eb; color: #fff; padding: 10px 26px; border-radius: 12px; font-weight: 900; }
.el-image { text-align: center; font-size: 3rem; }
.el-footer { font-size: .85rem; color: #9ca3af; text-align: center; }
.el-sender { font-weight: 900; color: #1f2937; background: #f1f5f9; }
.el-subject { font-size: 1.15rem; font-weight: 900; color: #111827; }
.el-meta { font-size: .85rem; color: #6b7280; }
.el-badge { font-size: .95rem; color: #6b7280; }
.el-bubble { align-self: flex-start; max-width: 85%; background: #fff; border-radius: 16px 16px 16px 4px; box-shadow: 0 2px 4px rgba(0,0,0,.12); }
.scene.frame-social .el-bubble { background: #e0e7ff; }
@keyframes blink { 50% { filter: brightness(1.25); } }

.el.tapped { border-color: #EC4899; background: rgba(236,72,153,.12); }
.el.tapped::after { content: "🔍"; position: absolute; right: -6px; top: -12px; font-size: 1.4rem; animation: bubblePop .3s; }
.el.reveal-hit { border: 3px solid #22C55E; background: rgba(34,197,94,.14); }
.el.reveal-hit::before { content: "🚨"; position: absolute; left: -10px; top: -14px; font-size: 1.3rem; }
.el.reveal-miss { border: 3px dashed #ef4444; background: rgba(239,68,68,.08); }
.el .why { display: block; margin-top: 6px; padding: 6px 10px; border-radius: 10px; background: #14532d; color: #dcfce7; font-size: .85rem; font-weight: 800; }
.el .tap-count { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 2px 10px; border-radius: 999px; background: #1E1B4B; color: #fff; font-size: .85rem; }
.scene.locked .el { cursor: default; }

/* --------------------------------------------------------------------------
   Leaderboard
   -------------------------------------------------------------------------- */
.leaderboard { display: flex; flex-direction: column; gap: 12px; }
.lb-row {
  --team: var(--primary);
  position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 20px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--team) 55%, transparent), rgba(30,27,75,.75));
  border: 3px solid color-mix(in srgb, var(--team) 80%, #fff); box-shadow: 0 6px 0 rgba(0,0,0,.3);
  will-change: transform;
}
.lb-row.rank-1 { box-shadow: 0 6px 0 rgba(0,0,0,.3), 0 0 30px rgba(253,224,71,.55); }
.lb-medal { font-size: 2.4rem; width: 52px; text-align: center; flex: none; }
.lb-emoji { font-size: 2.2rem; flex: none; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; }
.lb-avatars { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .95; }
.lb-mvp { font-size: .9rem; color: #FDE68A; }
.lb-energy { font-size: 2rem; text-align: right; white-space: nowrap; }
.lb-move { font-size: 1rem; margin-left: 4px; }
.lb-move.up { color: #4ade80; }
.lb-move.down { color: #f87171; }
.lb-compact .lb-row { padding: 8px 12px; gap: 10px; border-radius: 16px; }
.lb-compact .lb-medal { font-size: 1.6rem; width: 34px; }
.lb-compact .lb-emoji { font-size: 1.5rem; }
.lb-compact .lb-name { font-size: 1.15rem; }
.lb-compact .lb-energy { font-size: 1.25rem; }
.lb-compact .lb-avatars, .lb-compact .lb-mvp { display: none; }
.energy-pop { position: absolute; right: 20px; top: -14px; color: #4ade80; font-family: var(--font-display); font-size: 1.4rem; animation: popUp 1.8s ease-out forwards; text-shadow: 0 0 12px rgba(34,197,94,.9); }
@keyframes popUp { 0% { opacity: 0; transform: translateY(16px) scale(.6); } 20% { opacity: 1; transform: translateY(0) scale(1.2); } 100% { opacity: 0; transform: translateY(-26px) scale(1); } }

/* --------------------------------------------------------------------------
   Boss
   -------------------------------------------------------------------------- */
.boss-hp { position: relative; height: 34px; border-radius: 999px; background: #1f2937; border: 3px solid #fff; overflow: hidden; box-shadow: 0 0 22px rgba(236,72,153,.6); }
.boss-hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ef4444, #EC4899, #7C3AED); transition: width 1.1s cubic-bezier(.22,1,.36,1); }
.boss-hp-ghost { position: absolute; left: 0; top: 0; height: 100%; background: #fde68a; transition: width 1.8s .5s ease; z-index: -1; }
.boss-hp-text { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 1.15rem; text-shadow: 0 2px 0 rgba(0,0,0,.6); }
.boss-img { width: min(46vh, 380px); animation: bossFloat 3s ease-in-out infinite, pulseGlow 2s ease-in-out infinite; }
.boss-img.hit { animation: bossHit .45s ease-in-out; }
.boss-img.attacking { animation: bossAttack .7s ease-in-out; }
.boss-img.dead { animation: bossDie 1.6s ease-in forwards; }
@keyframes bossFloat { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-18px) rotate(2deg); } }
@keyframes pulseGlow { 0%,100% { filter: drop-shadow(0 0 14px #EC4899); } 50% { filter: drop-shadow(0 0 40px #7C3AED); } }
@keyframes bossHit { 0% { filter: brightness(3) drop-shadow(0 0 30px #fff); transform: translateX(0); } 30% { transform: translateX(-16px) rotate(-4deg); } 60% { transform: translateX(14px) rotate(4deg); } 100% { transform: none; } }
@keyframes bossAttack { 0% { transform: scale(1); } 40% { transform: scale(1.18) translateY(10px); filter: drop-shadow(0 0 50px #ef4444) hue-rotate(-30deg); } 100% { transform: scale(1); } }
@keyframes bossDie { 0% { transform: scale(1) rotate(0); opacity: 1; filter: brightness(1); } 60% { transform: scale(1.3) rotate(10deg); filter: brightness(4); opacity: 1; } 100% { transform: scale(.1) rotate(-30deg); opacity: 0; filter: brightness(6); } }

/* Tia laser / tên lửa bay vào boss */
.projectile { position: fixed; z-index: 58; pointer-events: none; font-size: 2.4rem; filter: drop-shadow(0 0 12px currentColor); }
.beam { position: fixed; z-index: 57; pointer-events: none; height: 10px; border-radius: 999px; transform-origin: 0 50%; box-shadow: 0 0 18px currentColor, 0 0 36px currentColor; }

/* Tiện ích */
.text-glow { text-shadow: 0 0 18px rgba(165,180,252,.8); }
.fade-in { animation: fadeIn .45s ease both; }
.zoom-in { animation: zoomIn .5s cubic-bezier(.34,1.56,.64,1) both; }
.slide-up { animation: slideUp .5s cubic-bezier(.22,1,.36,1) both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
