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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #2A2538;
}
::-webkit-scrollbar-thumb {
  background: #8A7A5A;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #8B4513;
}

body {
  background: #6BC5E8;
  min-height: 100vh;
  overflow: hidden;
}

#game-container canvas {
  display: block;
}

.pointer-events-auto {
  pointer-events: auto;
}

.parchment-bg {
  background: linear-gradient(135deg, #D4C5A9 0%, #C4B599 25%, #D4C5A9 50%, #B8A888 75%, #D4C5A9 100%);
}

.stone-bg {
  background: linear-gradient(180deg, #4A3A48 0%, #3A2A38 50%, #302030 100%);
}

.leather-bg {
  background: linear-gradient(180deg, #5A4030 0%, #4A3520 50%, #3A2818 100%);
}

.fog-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 200%; height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(212,197,169,0.06) 20%, rgba(212,197,169,0.12) 40%, rgba(212,197,169,0.06) 60%, transparent 80%, rgba(212,197,169,0.08) 100%);
  animation: fogDrift 20s linear infinite;
  pointer-events: none;
}

@keyframes fogDrift {
  from { transform: translateX(-50%); }
  to { transform: translateX(0%); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
  75% { opacity: 0.95; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.animate-fadein {
  animation: fadeIn 0.4s ease-out;
}

.animate-slidedown {
  animation: slideDown 0.3s ease-out;
}

.hex-tile {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transition: all 0.3s ease;
  cursor: pointer;
}

.hex-tile:hover {
  transform: scale(1.1);
  filter: brightness(1.3);
  z-index: 10;
}

.hex-fog {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: rgba(30, 25, 50, 0.8);
  animation: pulse 3s ease-in-out infinite;
}

.metal-tab {
  background: linear-gradient(180deg, #6A5A50 0%, #4A3A38 40%, #3A2A30 100%);
  border: 2px solid #8A7A5A;
  border-bottom: none;
  position: relative;
  transition: all 0.2s ease;
}

.metal-tab::before {
  content: '';
  position: absolute;
  top: 4px; left: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #888 0%, #555 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.metal-tab::after {
  content: '';
  position: absolute;
  top: 4px; right: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #888 0%, #555 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.metal-tab:hover {
  background: linear-gradient(180deg, #7A6A58 0%, #5A4A42 40%, #4A3A38 100%);
  box-shadow: 0 0 12px rgba(255,184,77,0.4);
}

.metal-tab-active {
  background: linear-gradient(180deg, #8A7048 0%, #6A5030 40%, #5A4020 100%);
  border-color: #D8A820;
  box-shadow: 0 0 18px rgba(216,168,32,0.5);
}

.card-medieval {
  background: linear-gradient(135deg, rgba(70,55,40,0.95), rgba(50,38,28,0.95));
  border: 2px groove #9A8A60;
  transition: all 0.3s ease;
}

.card-medieval:hover {
  border-color: #D8A820;
  box-shadow: 0 4px 20px rgba(216,168,32,0.25), 0 0 30px rgba(255,184,77,0.15);
  transform: translateY(-2px);
}

.ticker-bar {
  background: linear-gradient(180deg, #2A2238, #1A1428);
  border-top: 2px groove #6A5A48;
  overflow: hidden;
}

.ticker-scroll {
  display: flex;
  animation: tickerScroll 60s linear infinite;
  white-space: nowrap;
}

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.glow-node {
  box-shadow: 0 0 10px rgba(184,150,12,0.6), 0 0 20px rgba(184,150,12,0.3);
  animation: flicker 2s ease-in-out infinite;
}

.ambient-mode {
  filter: brightness(0.8) saturate(0.9) hue-rotate(10deg);
}

.tooltip-medieval {
  background: linear-gradient(135deg, #3A3020, #2A2018);
  border: 1px solid #D8A820;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 8px rgba(216,168,32,0.15);
}

.structure-icon {
  font-size: 10px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
}

.boss-portrait {
  border: 3px double #6B1C1C;
  box-shadow: 0 0 20px rgba(107,28,28,0.4);
}

.xp-bar {
  background: linear-gradient(90deg, #B8960C, #FFB84D);
  box-shadow: 0 0 8px rgba(184,150,12,0.5);
  transition: width 0.5s ease;
}

.danger-1 { color: #8BC34A; }
.danger-2 { color: #FFC107; }
.danger-3 { color: #FF9800; }
.danger-4 { color: #F44336; }
.danger-5 { color: #9C27B0; }

.hud-crosshair {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 15;
}

.hud-crosshair::before, .hud-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(212,197,169,0.5);
}

.hud-crosshair::before {
  width: 20px; height: 2px;
  top: -1px; left: -10px;
}

.hud-crosshair::after {
  width: 2px; height: 20px;
  top: -10px; left: -1px;
}

.compass-ring {
  border: 2px solid rgba(184,150,12,0.4);
  border-radius: 50%;
  position: relative;
}

.compass-needle {
  position: absolute;
  top: 2px; left: 50%;
  transform: translateX(-50%);
  color: #F44336;
  font-size: 10px;
  font-weight: bold;
}

.minimap-container {
  border: 2px groove #8A7A58;
  background: rgba(30,28,45,0.85);
  border-radius: 4px;
  overflow: hidden;
}

.boss-hp-hud {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  text-align: center;
}

.boss-hp-bar-bg {
  width: 320px;
  height: 12px;
  background: rgba(40,20,20,0.85);
  border: 2px solid #AA3030;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto;
}

.boss-hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8B0000, #FF2222);
  transition: width 0.3s ease;
  border-radius: 4px;
}

.interaction-prompt {
  background: linear-gradient(180deg, rgba(55,42,28,0.95), rgba(35,30,40,0.95));
  border: 1px solid #D8A820;
  border-radius: 8px;
  animation: breathe 2s ease-in-out infinite;
}

.damage-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(180,20,20,0.4) 100%);
  z-index: 25;
  animation: damageFlash 0.3s ease-out forwards;
}

@keyframes damageFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.health-bar-critical {
  animation: pulse 0.5s ease-in-out infinite;
}

.combat-log-entry {
  animation: fadeIn 0.3s ease-out;
}

.overlay-panel {
  background: rgba(35,28,42,0.90);
  backdrop-filter: blur(10px);
}

.z-25 {
  z-index: 25;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.inventory-slot {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #38301E, #28201A);
  border: 1px solid #8A7A58;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 11px;
  position: relative;
}

.inventory-slot:hover {
  border-color: #B8960C;
  box-shadow: 0 0 8px rgba(184,150,12,0.3);
}

.inventory-slot.equipped {
  border-color: #FFD700;
  box-shadow: 0 0 14px rgba(255,215,0,0.5);
  background: linear-gradient(135deg, #48401E, #383018);
}

.inventory-slot.selected {
  border-color: #FFB84D;
  box-shadow: 0 0 12px rgba(255,184,77,0.5);
}

.quest-tracker {
  background: linear-gradient(135deg, rgba(55,42,28,0.92), rgba(35,28,18,0.92));
  border: 1px solid #D8A820;
  border-radius: 8px;
  max-width: 280px;
}

.weapon-rarity-common { color: #AAAAAA; border-color: #666666; }
.weapon-rarity-uncommon { color: #4ADE80; border-color: #22C55E; }
.weapon-rarity-rare { color: #60A5FA; border-color: #3B82F6; }
.weapon-rarity-epic { color: #C084FC; border-color: #A855F7; }
.weapon-rarity-legendary { color: #FCD34D; border-color: #F59E0B; }

@media (max-width: 768px) {
  .hex-tile {
    width: 48px !important;
    height: 52px !important;
  }
  .inventory-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}