:root {
  --primary-color: #6b7fff;
  --secondary-color: #e2e6ff;
  --background-color: #f5f7ff;
  --text-color: #2a2f4f;
  --surface-color: #ffffff;
  --menu-height: 70px;
  --shadow-color: rgba(107, 127, 255, 0.1);
  --radius: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

#game-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* Dashboard y botón explorar */
#dashboard {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

#explore-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  cursor: pointer;
  transition: all 0.2s ease;
  filter: drop-shadow(0 4px 12px var(--shadow-color));
}

#explore-button:active {
  transform: scale(0.96);
}

.explore-icon {
  width: 100%;
  height: 100%;
}

.outer-circle {
  fill: var(--secondary-color);
}

.inner-circle {
  fill: var(--primary-color);
  transition: fill 0.3s ease;
}

.explore-icon text {
  fill: var(--surface-color);
  font-size: 14px;
  font-weight: 600;
}

/* Dashboard Stats */
#player-stats {
  position: absolute;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--surface-color);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow-color);
  width: auto;
  max-width: none;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
}

.stat-icon {
  width: 24px;
  height: 24px;
  fill: var(--primary-color);
  color: #6B7FFF; 
}

.stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
}

.location-text {
  width: 100%;
  text-align: center;
  border-top: 1px solid var(--secondary-color);
  padding-top: 8px;
  margin-top: 8px;
}

/* Item Icons */
.item-icon-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.potion-icon {
  fill: #ff6b6b;
}

.gem-icon {
  fill: #6b7fff;
}

.scroll-icon {
  fill: #ffc107;
}

.crystal-icon {
  fill: #63db63;
}

/* Menú inferior */
#bottom-menu {
  height: var(--menu-height);
  background: var(--surface-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 20px var(--shadow-color);
  border-radius: var(--radius) var(--radius) 0 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.menu-item {
  background: none;
  border: none;
  color: var(--text-color);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  font-size: 12px;
  gap: 4px;
}

.menu-item.active {
  opacity: 1;
  color: var(--primary-color);
}

.menu-item i {
  font-size: 24px;
}

/* Secciones de contenido */
#content-sections {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - var(--menu-height));
  background: var(--surface-color);
  display: none;
  z-index: 10;
}

.content-section {
  display: none;
  padding: 20px;
  height: 100%;
  overflow-y: auto;
}

.content-section h2 {
  margin-bottom: 20px;
  font-size: 24px;
  font-weight: 600;
}

.content-section.active {
  display: block;
}

/* Notificaciones */
#notification-area {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 320px;
  z-index: 1000;
}

.notification {
  background: var(--surface-color);
  color: var(--text-color);
  padding: 16px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px var(--shadow-color);
  animation: slideIn 0.3s ease;
  text-align: center;
}

.notification.success {
  background: var(--surface-color);
  border-left: 4px solid #63db63;
}

.notification.error {
  background: var(--surface-color);
  border-left: 4px solid #ff6b6b;
}

.notification.question {
  background: var(--surface-color);
  border-left: 4px solid #6b7fff;
}

/* Grids */
#monster-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 4px;
}

.grid-item {
  background: var(--surface-color);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow-color);
}

.grid-item h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.grid-item p {
  font-size: 14px;
  color: var(--text-color);
  opacity: 0.8;
}

.inventory-container {
  display: flex;
  gap: 16px;
  height: calc(100% - 60px);
}

.money-balance {
  background: var(--surface-color);
  border-radius: var(--radius);
  padding: 12px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px var(--shadow-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.money-balance .balance-amount {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 18px;
}

.money-icon {
  width: 24px;
  height: 24px;
  fill: var(--primary-color);
}

.inventory-grid-container {
  flex: 1;
  background: var(--surface-color);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 8px var(--shadow-color);
}

#inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--background-color);
  padding: 8px;
  border-radius: 12px;
}

.inventory-item {
  aspect-ratio: 1;
  background: var(--surface-color);
  border: 2px solid var(--secondary-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.item-count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: var(--primary-color);
  color: white;
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
}

.inventory-item.selected {
  background: var(--secondary-color);
  border: 2px solid var(--primary-color);
}

.inventory-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px var(--shadow-color);
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.item-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--background-color);
  border-radius: 8px;
}

.stat-label {
  color: var(--text-color);
  opacity: 0.7;
  font-size: 14px;
}

.stat-value {
  font-weight: 500;
  color: var(--primary-color);
}

.item-icon {
  width: 60%;
  height: 60%;
  fill: var(--primary-color);
}

.item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--secondary-color);
}

.item-header .item-icon {
  width: 48px;
  height: 48px;
}

.item-info h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.item-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-weight: 600;
}

/* Settings */
.settings-options {
  background: var(--surface-color);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.setting-item {
  margin-bottom: 20px;
}

.setting-item label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.setting-item input,
.setting-item select {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--secondary-color);
  background: var(--surface-color);
}

/* Adventure Log */
#adventure-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-entry {
  background: var(--surface-color);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow-color);
  font-size: 14px;
}

/* Animations */
@keyframes slideIn {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-100%); opacity: 0; }
}

/* Action button */
#action-button {
  width: 120px;
  height: 120px;
  cursor: pointer;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 4px 12px var(--shadow-color));
  position: absolute;
  bottom: calc(var(--menu-height) + 40px);
  left: 50%;
  transform: translateX(-50%);
  display: none;
}

#action-button:active {
  transform: translateX(-50%) scale(0.96);
}

.action-icon {
  width: 100%;
  height: 100%;
}

.action-icon text {
  fill: var(--surface-color);
  font-size: 14px;
  font-weight: 600;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  .menu-item {
    font-size: 11px;
  }

  #monster-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #player-stats {
    left: 20px;
    padding: 12px;
  }
  
  .stat-item {
    min-width: 48px;
  }
  
  .inventory-container {
    flex-direction: column;
  }
  
  #inventory-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Safe Area Support */
@supports (padding: max(0px)) {
  #bottom-menu {
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
  }
}