* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0e0d0a 0%, #3a2a1a 55%, #6b4a1e 100%);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: #e8e0d0;
}

#game-container {
  position: relative;
  width: 820px;
}

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(15, 12, 8, 0.8);
  border: 3px solid #8a6a3a;
  border-radius: 14px 14px 0 0;
  padding: 10px 16px;
}

#gem-tracker {
  display: flex;
  gap: 10px;
}

.gem-slot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.2);
  filter: grayscale(1) opacity(0.35);
  transition: all 0.3s ease;
}

.gem-slot.collected {
  filter: none;
  border-color: #9fdc4a;
  box-shadow: 0 0 10px #9fdc4a;
  transform: scale(1.1);
}

#meteor-warning {
  font-size: 13px;
  font-weight: bold;
  color: #ff6a3d;
  text-shadow: 0 0 8px rgba(255, 106, 61, 0.7);
  animation: meteor-pulse 1.6s infinite;
  white-space: nowrap;
}

@keyframes meteor-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

#message-bar {
  font-size: 14px;
  max-width: 320px;
  text-align: right;
}

#game-canvas {
  display: block;
  background: #14110c;
  border: 3px solid #8a6a3a;
  border-top: none;
  border-radius: 0 0 14px 14px;
}

.hidden {
  display: none !important;
}

#boss-overlay, #win-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 4, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

#boss-panel, #win-panel {
  background: #241d14;
  border: 3px solid #8a6a3a;
  border-radius: 16px;
  padding: 30px 40px;
  text-align: center;
  max-width: 500px;
}

#boss-panel h1, #win-panel h1 {
  margin-top: 0;
  color: #ff6a3d;
  text-shadow: 0 0 10px rgba(255, 106, 61, 0.6);
}

#battle-bars {
  margin: 20px 0;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.bar-row span {
  width: 60px;
  text-align: right;
  font-weight: bold;
}

.bar-bg {
  flex: 1;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.4s ease;
}

.bar-fill.hero {
  background: linear-gradient(90deg, #7ee8fa, #9fdc4a);
}

.bar-fill.villain {
  background: linear-gradient(90deg, #4a1a0a, #ff3b1a);
}

button {
  background: linear-gradient(90deg, #ff8a3d, #9fdc4a);
  border: none;
  color: #14110c;
  font-weight: bold;
  font-size: 16px;
  padding: 10px 22px;
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.3);
}

button:hover {
  filter: brightness(1.1);
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
  filter: none;
  transform: none;
}

#weakness-hint {
  min-height: 20px;
  font-weight: bold;
  color: #9fdc4a;
  text-shadow: 0 0 8px rgba(159, 220, 74, 0.6);
}

#spell-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.spell-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--spell-color);
  color: #fff;
  border-radius: 12px;
  padding: 10px 8px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.2s ease;
}

.spell-btn .spell-icon {
  font-size: 20px;
}

.spell-btn .spell-name {
  font-weight: bold;
  font-size: 13px;
}

.spell-btn .spell-desc {
  font-size: 10px;
  opacity: 0.8;
  font-weight: normal;
}

.spell-btn:hover {
  background: var(--spell-color);
  color: #14110c;
  transform: translateY(-2px);
}

.spell-btn.weak-target {
  box-shadow: 0 0 14px var(--spell-color), 0 0 0 2px #9fdc4a inset;
  animation: pulse-glow 1s infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 6px var(--spell-color); }
  50% { box-shadow: 0 0 18px var(--spell-color); }
}

.spell-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

#battle-log {
  min-height: 20px;
  font-style: italic;
  color: #d8cdb0;
}
