/* Define CSS Variables for colors */
:root {
  /* Base Colors */
  --bg-primary: #1A1B1E;
  --bg-secondary: #2A2B2F;
  --bg-elevated: #34363C;
  
  /* Interactive Elements */
  --btn-primary: #6B4EE6;
  --btn-primary-hover: #8469FF;
  --btn-primary-active: #5B3ED6;
  --btn-secondary: #404249;
  --btn-secondary-hover: #4A4D55;
  --btn-danger: #D64E4E;
  
  /* Text Colors */
  --text-primary: #FFFFFF;
  --text-secondary: #B4B5B8;
  --text-disabled: #6C6D70;
  
  /* Stats Colors */
  --stat-high: #4CAF50;
  --stat-medium: #FFA726;
  --stat-low: #EF5350;
  
  /* Borders & Dividers */
  --border-primary: #404249;
  --border-secondary: #2E2F34;
  
  /* Status Indicators */
  --status-success: #43A047;
  --status-warning: #FB8C00;
  --status-error: #E53935;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* Main Game Layout */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.game-container {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.dragon-details {
  flex: 0 0 45%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Dragon container */
.dragon-animation-box {
  position: relative;
  border: 3px solid var(--border-primary);
  padding: 10px;
  background-color: var(--bg-secondary);
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.dragon-animation-box img {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.lair {
  position: relative;
}

.dragon-container {
  position: absolute;
  width: 50%;
  height: 50%;
  z-index: 1;
  top: 25%;
  left: 25%;
}

/* Health bar */
.health-bar-container {
  display: flex;
  gap: 2px;
  padding: 2px;
  background-color: var(--bg-elevated);
  border: 2px solid var(--border-primary);
  border-radius: 4px;
}

.health-unit {
  width: 20px;
  height: 20px;
  background-color: var(--stat-high);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.health-unit.medium {
  background-color: var(--stat-medium);
}

.health-unit.low {
  background-color: var(--stat-low);
}

.controls {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Dragon Stats */
.dragon-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-left: 5%;
}

/* Stats heading */
.dragon-stats h2 {
  margin-bottom: 20px;
  font-size: 150%;
  font-weight: bold;
  text-align: center;
  height: 100%;
  color: var(--text-primary);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5%;
}

/* Individual Stat Style */
.dragon-stats .stat {
  background-color: var(--bg-secondary);
  width: 100%;
  height: 100px;
  border-radius: 15px;
  text-align: center;
  font-size: 100%;
  font-weight: bold;
  border: 2px solid var(--border-primary);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.dragon-stats .stat:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
  background-color: var(--bg-elevated);
}

/* Game Actions */
.game-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-radius: 10px;
  max-width: 600px;
  margin: 0 auto;
}

.game-actions button {
  flex: 1;
  padding: 15px;
  background-color: var(--btn-primary);
  color: var(--text-primary);
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.game-actions button:hover {
  background-color: var(--btn-primary-hover);
  box-shadow: var(--shadow-md);
}

.game-actions button:active {
  background-color: var(--btn-primary-active);
}

/* Modal CSS */
.modal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  width: 85%;
  max-width: 450px;
  padding: 1.3rem;
  min-height: 250px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  z-index: 100;
}

.modal .flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal input {
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 5px;
  font-size: 0.9em;
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.modal p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0.4rem 0 0.2rem;
}

button {
  cursor: pointer;
  border: none;
  font-weight: 600;
}

.btn-submit {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  font-weight: 700;
  background-color: var(--btn-primary);
  color: var(--text-primary);
  border-radius: 5px;
  text-align: center;
  font-size: 1em;
  margin-top: 5%;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.btn-submit:hover {
  background-color: var(--btn-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-open {
  position: absolute;
  bottom: 150px;
}

.btn-close {
  transform: translate(10px, -20px);
  padding: 0.5rem 0.7rem;
  background: var(--btn-secondary);
  border-radius: 50%;
  color: var(--text-primary);
  transition: background-color 0.3s ease;
}

.btn-close:hover {
  background-color: var(--btn-secondary-hover);
}

.overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  z-index: 99;
}

.hidden {
  display: none;
}

/* Media Queries */
@media (max-width: 700px) {
  .game-container {
    flex-direction: column;
  }
  
  .dragon-stats {
    margin-left: 0;
    margin-top: 20px;
    width: 100%;
  }
  
  .game-actions {
    flex-direction: column;
  }
  
  .game-actions button {
    width: 100%;
  }
}