/* ============================================
   KIẾM SĨ HUYỀN THOẠI - GAME STYLES
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Be Vietnam Pro', 'Segoe UI', Tahoma, 'Helvetica Neue', Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, #2a1a0a 0%, #0a0500 80%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s;
}
#loading-screen.hide { opacity: 0; pointer-events: none; }

.loading-content {
  text-align: center;
  color: #f5d488;
  max-width: 500px;
  padding: 2rem;
}
.loading-content h1 {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 25px #ff7700, 0 0 50px #ff3300;
  letter-spacing: 2px;
}
#loading-subtitle {
  color: #d4a858;
  font-size: 1rem;
  margin-bottom: 2rem;
}

.progress-bar {
  width: 100%;
  height: 24px;
  background: rgba(20, 12, 8, 0.8);
  border: 2px solid #f5d488;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.5rem;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff7700 0%, #ffaa00 50%, #ffdd00 100%);
  box-shadow: 0 0 10px #ff7700;
  transition: width 0.3s;
}
#loading-text {
  color: #d4a858;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}
.loading-tip {
  margin-top: 1.5rem;
  color: #8a6a48;
  font-size: 0.85rem;
  font-style: italic;
}

/* ===== STORY INTRO SCREEN ===== */
#story-screen {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, rgba(40, 20, 8, 0.95) 0%, rgba(10, 5, 0, 0.98) 80%);
  display: flex; align-items: center; justify-content: center;
  z-index: 950;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.story-content {
  text-align: center;
  color: #f5d488;
  max-width: 640px;
  width: 90%;
  padding: 2rem 1.5rem;
  animation: story-fade-in 0.6s ease-out;
}
@keyframes story-fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.story-title {
  font-size: 2.4rem;
  margin-bottom: 0.3rem;
  text-shadow: 0 0 25px #ff7700, 0 0 50px #ff3300;
  letter-spacing: 3px;
  animation: title-glow 2s ease-in-out infinite;
}
@keyframes title-glow {
  0%, 100% { text-shadow: 0 0 25px #ff7700, 0 0 50px #ff3300; }
  50%      { text-shadow: 0 0 35px #ffaa00, 0 0 70px #ff5500; }
}
.story-subtitle {
  font-size: 1.1rem;
  color: #d4a858;
  font-style: italic;
  margin-bottom: 1.8rem;
  letter-spacing: 2px;
}
.story-text {
  text-align: left;
  background: rgba(20, 12, 8, 0.6);
  border: 1px solid rgba(255, 200, 100, 0.25);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.8rem;
  max-height: 55vh;
  overflow-y: auto;
  line-height: 1.7;
}
.story-text p {
  margin-bottom: 0.9rem;
  color: #e8d4a8;
  font-size: 0.98rem;
  text-align: justify;
}
.story-text p:last-child { margin-bottom: 0; }
.story-drop {
  font-size: 1.6rem;
  color: #ffaa00;
  font-weight: bold;
  float: left;
  line-height: 1;
  margin-right: 4px;
  margin-top: 2px;
  text-shadow: 0 0 8px #ff7700;
}
.hl {
  color: #ffdd44;
  text-shadow: 0 0 6px rgba(255, 170, 0, 0.5);
}
.hl-danger {
  color: #ff5555;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.6);
}
.story-text em {
  color: #ffd700;
  font-style: normal;
  font-weight: 600;
}
.story-motto {
  text-align: center !important;
  font-style: italic;
  color: #ffaa00 !important;
  font-size: 1.05rem !important;
  margin-top: 1rem !important;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 200, 100, 0.2);
  text-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
}
.story-btn {
  background: linear-gradient(135deg, #ff7700, #ffaa00);
  color: #1a0e0a;
  border: none;
  padding: 14px 48px;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 3px;
  box-shadow: 0 4px 20px rgba(255, 170, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
  animation: btn-pulse 2s ease-in-out infinite;
}
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 170, 0, 0.5); }
  50%      { box-shadow: 0 4px 32px rgba(255, 170, 0, 0.8); }
}
.story-btn:hover { transform: translateY(-2px); }
.story-btn:active { transform: translateY(0); }

/* Mobile: story text nhỏ hơn */
@media (max-width: 600px) {
  .story-title { font-size: 1.7rem; letter-spacing: 1.5px; }
  .story-subtitle { font-size: 0.9rem; }
  .story-text { padding: 1rem; max-height: 60vh; }
  .story-text p { font-size: 0.88rem; line-height: 1.55; margin-bottom: 0.7rem; }
  .story-btn { padding: 12px 36px; font-size: 1rem; }
}

/* ===== GAME HUD ===== */
#game-hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* === Touch Controls (mobile) === */
#touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  display: none;  /* hidden on desktop */
}
/* Show on touch devices / portrait orientation */
@media (max-width: 900px), (pointer: coarse) {
  #touch-controls { display: block; }
}
/* Ẩn touch controls khi start overlay / story đang hiện */
body:not(.game-playing) #touch-controls { display: none !important; }

#joystick-area {
  position: absolute;
  left: 0; bottom: 0;
  width: 50%;
  height: 50%;
  pointer-events: auto;
  touch-action: none;
  z-index: 16;
}
#joystick-base {
  position: absolute;
  left: 50%; bottom: 35%;
  transform: translateX(-50%);
  width: 130px; height: 130px;
  border-radius: 50%;
  background: rgba(255, 200, 100, 0.35);
  border: 4px solid rgba(255, 200, 100, 0.7);
  box-shadow: 0 0 30px rgba(255, 150, 0, 0.4), inset 0 0 25px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s;
}
#joystick-knob {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffeeaa, #dd8833);
  border: 3px solid #fff5d0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 24px rgba(255, 150, 0, 0.8);
  transform: translate(0, 0);
  transition: transform 0.05s;
  pointer-events: none;
}

/* === Top-left: Player Stats === */
#player-stats {
  position: absolute;
  top: 16px; left: 16px;
  width: 230px;
  pointer-events: none;
  z-index: 12;
}
.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.level-badge {
  background: linear-gradient(135deg, #ff7700, #ffaa00);
  color: #1a0e0a;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1.1rem;
  box-shadow: 0 0 12px rgba(255,170,0,0.4);
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
.gold-display {
  color: #ffd700;
  font-size: 1.1rem;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(255,215,0,0.5);
}

.hp-bar, .xp-bar {
  position: relative;
  height: 20px;
  background: rgba(20, 12, 8, 0.75);
  border: 2px solid #f5d488;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.hp-bar { height: 22px; }
.xp-bar { height: 14px; border-color: #6a90c8; }
.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.25s;
  position: relative;
}
.hp-fill {
  background: linear-gradient(180deg, #ff5050 0%, #d83030 50%, #a02020 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.xp-fill {
  background: linear-gradient(180deg, #60c0ff 0%, #4080d0 50%, #2060a0 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.bar-shine {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.bar-text {
  position: absolute; inset: 0;
  display: flex;
  align-items: center; justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  text-shadow: 1px 1px 2px #000, 0 0 4px #000;
  letter-spacing: 0.5px;
}

/* === Top-right: Wave Info - gọn, 1 hàng ngang === */
#wave-info {
  position: absolute;
  top: 16px; right: 16px;
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: stretch;
  z-index: 12;
}
.info-card {
  background: rgba(20, 12, 8, 0.85);
  border: 2px solid #f5d488;
  border-radius: 6px;
  padding: 4px 10px;
  min-width: 60px;
  text-align: center;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}
.timer-card { border-color: #6a90c8; }
.info-label {
  color: #b89868;
  font-size: 0.65rem;
  letter-spacing: 1px;
  font-weight: bold;
}
.info-value {
  color: #ffaa00;
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(255,170,0,0.4);
  line-height: 1.2;
}
.timer-card .info-value { color: #60c0ff; text-shadow: 0 0 8px rgba(96,192,255,0.4); }

/* === Bottom: Skill Bar - 2 hàng ở góc dưới-phải === */
#skill-bar {
  position: absolute;
  bottom: 18px;
  right: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 6px;
  pointer-events: auto;
  z-index: 14;
  background: rgba(20, 12, 8, 0.7);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 200, 100, 0.3);
  backdrop-filter: blur(4px);
}
.skill {
  position: relative;
  width: 72px;
  height: 72px;
  background: linear-gradient(180deg, rgba(40, 24, 12, 0.95), rgba(20, 12, 8, 0.95));
  border: 2px solid #f5d488;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #f5d488;
  font-size: 0.7rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  touch-action: manipulation;
}
.skill:hover:not(.locked) {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(255,170,0,0.3);
}
.skill:active:not(.locked) {
  transform: translateY(-1px) scale(0.96);
}
.skill.locked {
  opacity: 0.35;
  border-color: #555;
  color: #888;
  cursor: not-allowed;
}
.skill.ready {
  box-shadow: 0 0 14px rgba(255,170,0,0.5);
  animation: skill-pulse 1.5s ease-in-out infinite;
}
@keyframes skill-pulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255,170,0,0.5); }
  50% { box-shadow: 0 0 22px rgba(255,170,0,0.8); }
}
.skill .key {
  font-size: 1.4rem;
  font-weight: bold;
  color: #ffaa00;
  text-shadow: 0 0 8px rgba(255,170,0,0.4);
  line-height: 1;
}
.skill.locked .key { color: #555; text-shadow: none; }
.skill .skill-name {
  font-size: 0.65rem;
  margin-top: 2px;
  font-weight: bold;
  letter-spacing: 0.5px;
}
.skill .lock-label {
  font-size: 0.55rem;
  color: #888;
  margin-top: 2px;
}
.skill:not(.locked) .lock-label { display: none; }
.skill .default-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #ff7700, #ffaa00);
  color: #1a0e0a;
  font-size: 0.5rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 6px;
  display: none;
  box-shadow: 0 0 6px rgba(255,170,0,0.6);
  z-index: 5;
  letter-spacing: 0.3px;
  pointer-events: none;
}
.skill.default .default-badge { display: block; }
.skill.default {
  border-color: #ffdd44;
  box-shadow: 0 0 14px rgba(255,200,80,0.6);
}
.skill.default::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid #ffdd44;
  border-radius: 10px;
  pointer-events: none;
  animation: default-pulse 1.5s ease-in-out infinite;
}
@keyframes default-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.skill .cooldown-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  pointer-events: none;
}
.skill.on-cooldown .cooldown-overlay { display: flex; }
.skill .cd-text {
  color: #fff;
  font-size: 1.6rem;
  font-weight: bold;
  text-shadow: 0 0 6px #000;
}

/* === Notification === */
.notification {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  color: #ffdd88;
  font-size: 2.2rem;
  font-weight: bold;
  text-shadow: 0 0 12px #ff7700, 2px 2px 4px #000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  z-index: 20;
}
.notification.show { opacity: 1; }
.notification.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
}
.notification .sub {
  display: block;
  font-size: 1rem;
  color: #d4a858;
  margin-top: 4px;
  text-shadow: 0 0 6px #000;
}

/* === Level up flash === */
#levelup-flash {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(255,200,80,0.5) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 11;
}
#levelup-flash.show {
  opacity: 1;
  animation: flash-fade 1s ease-out;
}
@keyframes flash-fade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

/* === Boss HP HUD (top center) === */
#boss-hud {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, 80vw);
  pointer-events: none;
  z-index: 10;
  animation: boss-hud-in 0.4s ease-out;
}
@keyframes boss-hud-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-30px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.boss-name {
  text-align: center;
  color: #ff4040;
  font-size: 1.4rem;
  font-weight: 900;
  text-shadow: 0 0 8px #ff0000, 0 0 16px #ff4400, 2px 2px 3px #000;
  letter-spacing: 4px;
  margin-bottom: 6px;
  animation: boss-name-pulse 1.5s ease-in-out infinite;
}
@keyframes boss-name-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.05); opacity: 0.85; }
}
.boss-bar-bg {
  position: relative;
  height: 22px;
  background: rgba(20, 5, 5, 0.85);
  border: 2px solid #ff4040;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 18px rgba(255, 60, 60, 0.5), inset 0 0 8px rgba(0, 0, 0, 0.7);
}
.boss-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff2020 0%, #ff5530 50%, #ffaa00 100%);
  box-shadow: 0 0 12px rgba(255, 100, 50, 0.7);
  transition: width 0.25s ease-out;
}
.boss-bar-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
  animation: shine-sweep 2.5s linear infinite;
  pointer-events: none;
}
@keyframes shine-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.boss-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  text-shadow: 1px 1px 2px #000, 0 0 4px #000;
  letter-spacing: 1px;
}

/* === Crosshair === */
#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 20px; height: 20px;
  pointer-events: none;
  opacity: 0.7;
  z-index: 13;
}
.cross-line {
  position: absolute;
  background: #fff;
  box-shadow: 0 0 3px #000;
}
.cross-line:not(.cross-v) {
  width: 12px; height: 2px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.cross-line.cross-v {
  width: 2px; height: 12px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

/* === Start overlay === */
#start-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  backdrop-filter: blur(4px);
  z-index: 40;
  overflow-y: auto;
}
.start-content {
  text-align: center;
  color: #f5d488;
  max-width: 540px;
  width: 90%;
  padding: 1.5rem 1rem;
}
.start-content h1 {
  font-size: 2.2rem;
  margin-bottom: 0.3rem;
  text-shadow: 0 0 25px #ff7700, 0 0 50px #ff3300;
  letter-spacing: 2px;
}
.start-content h2 {
  font-size: 1.1rem;
  color: #d4a858;
  font-style: italic;
  margin-bottom: 1.2rem;
  letter-spacing: 1px;
  font-weight: normal;
}
.click-prompt {
  font-size: 1.2rem;
  color: #ffd700;
  margin: 1.2rem 0;
  animation: pulse 1.5s ease-in-out infinite;
  font-weight: bold;
  letter-spacing: 1px;
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.controls-help {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.help-title {
  text-align: center;
  color: #ffaa00;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}
.control-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 200, 100, 0.08);
  border: 1px solid rgba(255, 200, 100, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
}
.control-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}
.control-info {
  flex: 1;
  min-width: 0;
}
.control-label {
  color: #ffdd88;
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.control-desc {
  color: #d4a858;
  font-size: 0.8rem;
  line-height: 1.3;
}
.start-tip {
  margin-top: 1.2rem;
  color: #b89868;
  font-size: 0.85rem;
  font-style: italic;
  padding: 0 0.5rem;
}

/* === Game Over === */
#gameover-screen {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 50;
  backdrop-filter: blur(6px);
  overflow-y: auto;
}
.gameover-content {
  text-align: center;
  color: #f5d488;
  padding: 2rem 1rem;
  max-width: 540px;
  width: 90%;
}
.gameover-content h1 {
  font-size: 2.4rem;
  margin-bottom: 1.5rem;
  color: #ff5555;
  text-shadow: 0 0 20px #ff0000;
  letter-spacing: 2px;
}
.gameover-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: rgba(40, 24, 12, 0.7);
  border: 1px solid #6a4a30;
  border-radius: 8px;
  padding: 14px 10px;
}
.stat-card-label {
  color: #b89868;
  font-size: 0.8rem;
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.stat-card-value {
  color: #ffaa00;
  font-size: 1.8rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255,170,0,0.4);
}
.restart-btn {
  background: linear-gradient(135deg, #ff7700, #ffaa00);
  color: #1a0e0a;
  border: none;
  padding: 14px 36px;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 2px;
  box-shadow: 0 4px 16px rgba(255,170,0,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  pointer-events: auto;
  font-family: inherit;
}
.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,170,0,0.6);
}
.restart-btn:active {
  transform: translateY(0);
}


/* ============================================
   MOBILE / PORTRAIT OPTIMIZATIONS
   (max-width: 900px OR touch device)
   ============================================ */
@media (max-width: 900px), (pointer: coarse) {
  /* Player stats: top-left, gọn để wave-info không bị che */
  #player-stats {
    top: 8px; left: 8px;
    width: 180px;
  }
  .stat-header { font-size: 0.8rem; gap: 6px; }
  .level-badge { padding: 3px 8px; font-size: 0.85rem; }
  .gold-display { font-size: 0.85rem; }
  .hp-bar { height: 16px; }
  .xp-bar { height: 10px; }
  .bar-text { font-size: 0.65rem; }

  /* Wave info: góc trên-phải, compact, KHÔNG đè HP bar */
  #wave-info {
    top: 8px; right: 8px;
    gap: 4px;
  }
  .info-card { padding: 3px 7px; min-width: 48px; }
  .info-label { font-size: 0.55rem; }
  .info-value { font-size: 0.95rem; }

  /* Boss HUD: dưới top HUD, đủ chỗ */
  #boss-hud {
    top: 80px;  /* DƯỚI player stats + wave info */
    width: calc(100vw - 20px);
  }
  .boss-name { font-size: 0.95rem; letter-spacing: 1.5px; }
  .boss-bar-bg { height: 18px; }
  .boss-bar-text { font-size: 0.75rem; }

  /* Skill bar: 2 hàng ở góc dưới-phải, nhỏ gọn, KHÔNG che joystick */
  #skill-bar {
    bottom: 14px;
    right: 12px;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(2, 56px);
    gap: 5px;
    padding: 5px;
    max-width: 188px;
  }
  .skill {
    width: 56px; height: 56px;
    padding: 2px;
  }
  .skill .key { font-size: 1rem; }
  .skill .skill-name { font-size: 0.55rem; }
  .skill.default .default-badge { display: none !important; }
  .skill .lock-label { font-size: 0.5rem; }
  .skill .cd-text { font-size: 1.2rem; }

  /* Notification: nhỏ hơn */
  .notification { font-size: 1.3rem; top: 28%; }
  .notification .sub { font-size: 0.7rem; }

  /* Crosshair: ẩn trên mobile */
  #crosshair { display: none; }

  /* Start screen: card layout đã responsive sẵn */
  .start-content h1 { font-size: 1.6rem; letter-spacing: 1.5px; }
  .start-content h2 { font-size: 0.95rem; }
  .click-prompt { font-size: 0.95rem; }
  .control-card { padding: 8px 10px; }
  .control-icon { font-size: 1.4rem; width: 32px; }
  .control-label { font-size: 0.8rem; }
  .control-desc { font-size: 0.72rem; }

  /* Story screen mobile */
  .story-content { padding: 1.5rem 1rem; }
  .story-title { font-size: 1.5rem; letter-spacing: 1.5px; }
  .story-subtitle { font-size: 0.85rem; }
  .story-text { padding: 1rem; max-height: 60vh; }
  .story-text p { font-size: 0.85rem; line-height: 1.5; }
  .story-btn { padding: 11px 32px; font-size: 0.95rem; }

  /* Game over mobile */
  .gameover-content h1 { font-size: 1.6rem; }
  .stat-card-value { font-size: 1.4rem; }
  .stat-card-label { font-size: 0.7rem; }
  .restart-btn { padding: 12px 28px; font-size: 1rem; }
}

/* Smaller phones (màn nhỏ < 380px) */
@media (max-width: 380px) {
  #player-stats { width: 160px; }
  .info-card { min-width: 42px; padding: 2px 5px; }
  .info-value { font-size: 0.85rem; }
  .skill { width: 50px; height: 50px; }
  #skill-bar { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(2, 50px); }
}
