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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.game-container {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  width: 100%;
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 20px;
  text-align: center;
  position: relative;
}

.menu-btn {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 1.5em;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
  min-width: 48px;
  min-height: 48px;
}

.menu-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.05);
}

.menu-btn:active {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-50%) scale(0.98);
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

.points {
  font-size: 1.5em;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: 25px;
  display: inline-block;
}

.message {
  padding: 12px;
  text-align: center;
  font-weight: bold;
  margin-bottom: 15px;
  border-radius: 10px;
}

.message.success {
  background: #d4edda;
  color: #155724;
  border: 2px solid #c3e6cb;
}

.message.error {
  background: #f8d7da;
  color: #721c24;
  border: 2px solid #f5c6cb;
}

.message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 2px solid #bee5eb;
}

main {
  padding: 20px;
}

.game-stats-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.game-area {
  background: linear-gradient(180deg, #87CEEB 0%, #98D8C8 100%);
  border-radius: 15px;
  padding: 40px;
  min-height: 400px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.game-area::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #8FBC8F;
  border-radius: 0 0 15px 15px;
}

.animal-container {
  position: relative;
  z-index: 1;
  text-align: center;
}

.animal-sprite {
  width: 200px;
  height: 200px;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  display: none;
  position: absolute;
  top: 0;
  left: 0;
}

.animal-sprite.active {
  display: block;
}

.animal-sprite-container {
  position: relative;
  width: 200px;
  height: 200px;
  display: inline-block;
}

.animal-name {
  font-size: 1.5em;
  font-weight: bold;
  color: #333;
  margin-top: 10px;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
}

.stats-panel {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 400px;
}

.stats-panel h2 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.3em;
}

.stat-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.stat-label {
  min-width: 140px;
  font-weight: 600;
  color: #555;
  text-transform: capitalize;
}

.stat-bar {
  flex: 1;
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-fill {
  height: 100%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 10px;
}

.stat-value {
  min-width: 40px;
  text-align: right;
  font-weight: bold;
  color: #333;
}

.actions-panel {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
}

.actions-panel h2 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.3em;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.action-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  min-height: 48px;
  touch-action: manipulation;
  user-select: none;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.action-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.controls-panel {
  text-align: center;
}

.controls-panel h2 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.3em;
}

.control-btn {
  background: #f44336;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 10px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.control-btn:hover {
  background: #d32f2f;
}

@media (max-width: 768px) {
  .game-stats-container {
    grid-template-columns: 1fr;
  }

  .stats-panel {
    min-height: auto;
  }

  .game-area {
    min-height: 300px;
  }
}

@media (max-width: 600px) {
  header h1 {
    font-size: 2em;
  }

  .action-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .animal-sprite {
    width: 150px;
    height: 150px;
  }
}

.menu-dialog {
  border: none;
  border-radius: 20px;
  padding: 0;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  z-index: 1000;
}

.menu-dialog:not([open]) {
  display: none;
}

.menu-dialog[open] {
  display: block;
}

.menu-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.dialog-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.dialog-header {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.8em;
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 1.5em;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
  line-height: 1;
  min-width: 48px;
  min-height: 48px;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.close-btn:active {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.tabs {
  display: flex;
  background: #f8f9fa;
  border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 16px 20px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  color: #666;
  transition: all 0.3s;
  border-bottom: 3px solid transparent;
  min-height: 48px;
}

.tab-btn:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: white;
}

.tab-btn:active {
  background: rgba(102, 126, 234, 0.2);
}

.tab-content {
  padding: 20px;
  max-height: calc(80vh - 180px);
  overflow-y: auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.3em;
}

.animal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
}

.animal-card {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  min-height: 140px;
  touch-action: manipulation;
  user-select: none;
}

.animal-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.animal-card:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.animal-card.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.animal-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.animal-card.locked:hover {
  transform: none;
  box-shadow: none;
  border-color: #e0e0e0;
}

.animal-card-icon {
  font-size: 3em;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
}

.animal-card-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: crisp-edges;
  display: block;
}

.animal-card-name {
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
}

.animal-card-type {
  color: #666;
  font-size: 0.9em;
  text-transform: capitalize;
  margin-bottom: 5px;
}

.animal-card-cost {
  color: #667eea;
  font-weight: bold;
  font-size: 0.9em;
}

.animal-card-locked {
  color: #999;
  font-size: 0.85em;
  font-style: italic;
}

.skins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.skin-card {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  min-height: 180px;
  touch-action: manipulation;
  user-select: none;
}

.skin-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.skin-card:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.skin-card.owned {
  border-color: #4CAF50;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(56, 142, 60, 0.1) 100%);
}

.skin-card.active {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
}

.skin-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.skin-card.locked:hover {
  transform: none;
  box-shadow: none;
  border-color: #e0e0e0;
}

.skin-card-preview {
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
}

.skin-card-preview img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  image-rendering: crisp-edges;
}

.skin-card-name {
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
  font-size: 1em;
}

.skin-card-animal {
  color: #666;
  font-size: 0.85em;
  text-transform: capitalize;
  margin-bottom: 5px;
}

.skin-card-description {
  color: #777;
  font-size: 0.8em;
  margin-bottom: 8px;
  font-style: italic;
}

.skin-card-cost {
  color: #667eea;
  font-weight: bold;
  font-size: 0.9em;
}

.skin-card-locked {
  color: #999;
  font-size: 0.85em;
  font-style: italic;
}

.skin-card-status {
  color: #4CAF50;
  font-weight: bold;
  font-size: 0.85em;
}


.skin-selector-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  background: white;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.skin-selector-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.skin-selector-content {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.skin-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 15px;
}

.skin-selector-item {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.skin-selector-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.skin-selector-item.active {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
}

.skin-selector-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.skin-selector-item.locked:hover {
  transform: none;
  box-shadow: none;
  border-color: #e0e0e0;
}

.skin-selector-preview {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 70px;
}

.skin-selector-preview img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  image-rendering: crisp-edges;
}

.skin-selector-name {
  font-weight: bold;
  color: #333;
  font-size: 0.9em;
  margin-bottom: 4px;
}

.skin-selector-status {
  color: #667eea;
  font-size: 0.75em;
  font-weight: bold;
}

.skin-selector-locked {
  color: #999;
  font-size: 0.75em;
  font-style: italic;
}

.animal-container {
  cursor: pointer;
  user-select: none;
}

.animal-container:hover {
  opacity: 0.9;
}

