:root {
  --color-primary: #7C3AED;
  --color-secondary: #F59E0B;
  --color-accent: #EF4444;
  --color-bg: #0F0A1A;
  --color-text: #E5E7EB;
  --font-base: 'Courier New', monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-base);
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 800px;
  max-height: 600px;
  background: black;
  border: 4px solid var(--color-primary);
  display: flex;
  flex-direction: column;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.screen, .modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 10, 26, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  padding: 20px;
  text-align: center;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 3rem;
  color: var(--color-secondary);
  text-shadow: 2px 2px var(--color-primary);
  margin-bottom: 2rem;
}

.btn {
  background: var(--color-primary);
  color: white;
  border: 2px solid var(--color-secondary);
  padding: 1rem 2rem;
  font-size: 1.2rem;
  cursor: pointer;
  margin: 0.5rem;
  font-family: inherit;
  transition: transform 0.1s;
}

.btn:active {
  transform: scale(0.95);
}

.secondary {
  background: transparent;
  border-color: var(--color-text);
}

.stat {
  margin: 0 10px;
  color: var(--color-secondary);
  font-weight: bold;
}

#game-ui {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.8);
  border-top: 2px solid var(--color-primary);
  display: flex;
  flex-direction: column;
  padding: 10px;
}

#stats-bar {
  display: flex;
  justify-content: space-around;
  margin-bottom: 10px;
  width: 100%;
}

#combat-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 10px 15px;
  font-size: 1rem;
}

#math-modal {
  background: rgba(0, 0, 0, 0.95);
  z-index: 100;
}

#math-problem {
  font-size: 4rem;
  color: var(--color-text);
  margin-bottom: 1rem;
}

#math-answer {
  background: #333;
  border: 2px solid var(--color-secondary);
  color: white;
  font-size: 2rem;
  padding: 10px;
  text-align: center;
  width: 200px;
  margin-bottom: 1rem;
}

#timer-bar {
  width: 80%;
  height: 20px;
  background: #333;
  margin: 1rem 0;
  border: 1px solid white;
}

#timer-fill {
  width: 100%;
  height: 100%;
  background: var(--color-accent);
  transition: width 0.1s linear;
}

#message-log {
  color: #aaa;
  font-size: 0.9rem;
  height: 1.5rem;
  text-align: center;
  overflow: hidden;
  margin-bottom: 5px;
}
