/* Fitness Empire Online - Core Game Styles */

/* ===== FONTS & BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Crimson Text', Georgia, serif;
  background: #0a0515;
  color: #f4e4c1;
  height: 100%;
  overflow: hidden;
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background: #c9a84c; border-radius: 2px; }

/* ===== APP SHELL =====
   screen-container: position:fixed, scrollable, set via HTML inline styles.
   bottom-nav: position:fixed bottom, set via HTML inline styles. */

/* ===== SCREEN CONTENT =====
   .rr-screen is just a normal block inside the scrollable container. */
.rr-screen {
  width: 100%;
  min-height: 100%;
}

/* scrollable-y no longer needed but keep for compat */
.scrollable-y {
  width: 100%;
}

/* ===== NAV ===== */
.nav-btn {
  color: rgba(244, 228, 193, 0.5);
  transition: all 0.2s;
}
.nav-btn.active {
  color: #f0d060;
  background: rgba(201, 168, 76, 0.15);
}
.nav-btn:hover { color: #f4e4c1; }

/* ===== PARCHMENT CARDS ===== */
.parchment-card {
  background: linear-gradient(135deg, #f4e4c1 0%, #e8d5a3 100%);
  color: #2c1810;
  border: 2px solid #c9a84c;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative;
}

.parchment-card::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 5px;
  pointer-events: none;
}

/* ===== DUNGEON CARD ===== */
.dungeon-card {
  background: linear-gradient(135deg, rgba(45, 27, 105, 0.9) 0%, rgba(26, 10, 46, 0.95) 100%);
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

/* ===== BUTTONS ===== */
.btn-gold {
  background: linear-gradient(135deg, #c9a84c, #f0d060, #c9a84c);
  color: #1a0a2e;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.4);
  letter-spacing: 0.5px;
}
.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(201, 168, 76, 0.6);
  filter: brightness(1.1);
}
.btn-gold:active { transform: translateY(0); }
.btn-gold:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-royal {
  background: linear-gradient(135deg, #4a2d8c, #2d1b69);
  color: #f0d060;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  border: 1px solid rgba(201, 168, 76, 0.5);
  border-radius: 6px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-royal:hover {
  background: linear-gradient(135deg, #5a3daa, #3d2b7e);
  border-color: #c9a84c;
}

.btn-blood {
  background: linear-gradient(135deg, #8b1a1a, #6b0f0f);
  color: #f4e4c1;
  font-family: 'Cinzel', serif;
  border: 1px solid rgba(200, 50, 50, 0.4);
  border-radius: 6px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-blood:hover { background: linear-gradient(135deg, #a02020, #8b1a1a); }

.btn-forest {
  background: linear-gradient(135deg, #2a6a3e, #1a4a2e);
  color: #f4e4c1;
  font-family: 'Cinzel', serif;
  border: 1px solid rgba(50, 180, 80, 0.3);
  border-radius: 6px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-forest:hover { background: linear-gradient(135deg, #3a8a4e, #2a6a3e); }

/* ===== INPUTS ===== */
.fantasy-input {
  background: rgba(26, 10, 46, 0.8);
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 6px;
  color: #f4e4c1;
  padding: 10px 14px;
  font-family: 'Crimson Text', serif;
  font-size: 16px;
  width: 100%;
  transition: border-color 0.2s;
}
.fantasy-input:focus {
  outline: none;
  border-color: #c9a84c;
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.2);
}
.fantasy-input::placeholder { color: rgba(244, 228, 193, 0.4); }

/* ===== STAT BARS ===== */
.stat-bar-container {
  background: rgba(0,0,0,0.4);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.stat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.hp-bar { background: linear-gradient(90deg, #c0392b, #e74c3c); }
.stamina-bar { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.xp-bar { background: linear-gradient(90deg, #2980b9, #3498db); }
.enemy-hp-bar { background: linear-gradient(90deg, #8b1a1a, #c0392b); }

/* ===== RARITY COLORS ===== */
.rarity-common { color: #aaaaaa; }
.rarity-uncommon { color: #1eff00; }
.rarity-rare { color: #0070dd; }
.rarity-epic { color: #a335ee; }
.rarity-legendary { color: #ff8000; }

.rarity-border-common { border-color: rgba(170,170,170,0.5); }
.rarity-border-uncommon { border-color: rgba(30,255,0,0.5); }
.rarity-border-rare { border-color: rgba(0,112,221,0.5); }
.rarity-border-epic { border-color: rgba(163,53,238,0.5); }
.rarity-border-legendary { border-color: rgba(255,128,0,0.6); }

/* ===== BATTLE SPRITES ===== */
.battle-arena {
  background: linear-gradient(180deg, #1a0a2e 0%, #0d1a0d 60%, #1a1a0a 100%);
  position: relative;
  overflow: hidden;
}

.battle-arena::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.5));
}

.sprite-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.3s;
}

.sprite-container.defeated {
  opacity: 0.3;
  filter: grayscale(1);
}

.sprite-emoji {
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.8));
  transition: transform 0.15s;
}

.sprite-emoji.attacking {
  animation: attackPulse 0.3s ease;
}

.sprite-emoji.hit {
  animation: hitShake 0.3s ease;
}

@keyframes attackPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3) translateX(10px); }
  100% { transform: scale(1); }
}

@keyframes hitShake {
  0% { transform: translateX(0); filter: brightness(1); }
  25% { transform: translateX(-5px); filter: brightness(2) sepia(1) hue-rotate(320deg); }
  50% { transform: translateX(5px); filter: brightness(2) sepia(1) hue-rotate(320deg); }
  100% { transform: translateX(0); filter: brightness(1); }
}

/* ===== DAMAGE NUMBERS ===== */
.damage-float {
  position: absolute;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 20px;
  color: #ff4444;
  text-shadow: 0 0 10px rgba(255,68,68,0.8), 1px 1px 0 #000;
  pointer-events: none;
  animation: floatUp 1.2s ease forwards;
  z-index: 100;
}

.damage-float.heal {
  color: #44ff88;
  text-shadow: 0 0 10px rgba(68,255,136,0.8), 1px 1px 0 #000;
}

.damage-float.crit {
  color: #ffaa00;
  font-size: 24px;
  text-shadow: 0 0 15px rgba(255,170,0,0.9), 1px 1px 0 #000;
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(0.5); opacity: 1; }
  20% { transform: translateY(-15px) scale(1.1); opacity: 1; }
  100% { transform: translateY(-60px) scale(0.8); opacity: 0; }
}

/* ===== MAP NODES ===== */
.map-node {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  position: absolute;
  transform: translate(-50%, -50%);
}

.map-node.available {
  border-color: #f0d060;
  box-shadow: 0 0 12px rgba(240, 208, 96, 0.6);
  animation: nodeGlow 1.5s ease-in-out infinite alternate;
}

.map-node.visited {
  opacity: 0.4;
  cursor: default;
}

.map-node.current {
  border-color: #ffffff;
  box-shadow: 0 0 15px rgba(255,255,255,0.8);
}

@keyframes nodeGlow {
  from { box-shadow: 0 0 8px rgba(240, 208, 96, 0.4); }
  to { box-shadow: 0 0 20px rgba(240, 208, 96, 0.9); }
}

/* ===== VILLAGE BUILDINGS ===== */
.building-card {
  background: linear-gradient(135deg, rgba(45,27,105,0.8), rgba(26,10,46,0.9));
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.building-card:hover {
  border-color: rgba(201, 168, 76, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.building-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transition: left 0.5s;
}

.building-card:hover::after { left: 150%; }

/* ===== RACE/CLASS CARDS ===== */
.selection-card {
  background: linear-gradient(135deg, rgba(45,27,105,0.7), rgba(26,10,46,0.9));
  border: 2px solid rgba(201, 168, 76, 0.2);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.selection-card:hover {
  border-color: rgba(201, 168, 76, 0.6);
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(74,45,140,0.8), rgba(45,27,105,0.9));
}

.selection-card.selected {
  border-color: #f0d060;
  background: linear-gradient(135deg, rgba(74,45,140,0.9), rgba(45,27,105,1));
  box-shadow: 0 0 20px rgba(240, 208, 96, 0.3);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 1000;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  transition: transform 0.3s ease;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.toast.show { transform: translateX(-50%) translateY(0); }

.toast-success {
  background: linear-gradient(135deg, #1a4a2e, #2a6a3e);
  border: 1px solid #44aa66;
  color: #aaffcc;
}

.toast-error {
  background: linear-gradient(135deg, #4a1a1a, #6a2a2a);
  border: 1px solid #aa4444;
  color: #ffaaaa;
}

.toast-info {
  background: linear-gradient(135deg, #1a1a4a, #2a2a6a);
  border: 1px solid #4444aa;
  color: #aaaaff;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 12px;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ===== HEADER ===== */
.game-header {
  background: linear-gradient(180deg, rgba(26,10,46,0.98), rgba(26,10,46,0.9));
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

/* ===== BATTLE LOG ===== */
.battle-log {
  height: 80px;
  overflow-y: auto;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}

.battle-log-entry {
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  animation: logFadeIn 0.3s ease;
}

@keyframes logFadeIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== EXPEDITION MAP ===== */
.map-canvas {
  position: relative;
  background: linear-gradient(180deg, #050210 0%, #0a0a1a 50%, #0d1005 100%);
  border-radius: 10px;
  overflow: hidden;
}

.map-canvas svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

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

.fade-in { animation: fadeIn 0.3s ease; }

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 5px rgba(201, 168, 76, 0.4); }
  50% { box-shadow: 0 0 20px rgba(201, 168, 76, 0.8); }
}

.pulse-gold { animation: pulse-gold 2s infinite; }

/* ===== SAFE AREA ===== */
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== LEVEL BADGE ===== */
.level-badge {
  background: linear-gradient(135deg, #c9a84c, #f0d060);
  color: #1a0a2e;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 11px;
  border-radius: 999px;
  padding: 1px 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

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

.inventory-slot {
  aspect-ratio: 1;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 24px;
  position: relative;
}

.inventory-slot.equipped {
  border-color: #f0d060;
  background: rgba(201, 168, 76, 0.15);
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.3);
}

.inventory-slot:hover {
  border-color: rgba(201, 168, 76, 0.6);
  transform: scale(1.05);
}

.quantity-badge {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  font-family: 'Cinzel', serif;
  color: #f0d060;
}

/* ===== PROGRESS RING ===== */
.progress-ring { transform: rotate(-90deg); }
.progress-ring-circle { transition: stroke-dashoffset 0.5s ease; }

/* ===== SCROLLABLE SECTIONS ===== */
.scrollable-y {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
