:root {
  --teal: #173F3D;
  --mint: #A8D5AD;
  --sage: #98C69F;
  --leaf: #58A85C;
  --lime: #A5D86A;
  --coral: #ED6955;
  --cream: #FFF3DA;
  --gold: #F2C75C;
  --brown: #7A4A2B;
  --black: #1A1A1A;
  --font: "Nunito Sans", system-ui, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background-color: var(--black);
  color: var(--cream);
}

#game-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--teal) 0%, var(--black) 100%);
}

#game-canvas {
  width: 100%;
  height: 100%;
  max-width: 1280px;
  max-height: 720px;
  display: block;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--cream);
  color: var(--black);
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 16px;
  color: var(--teal);
}

.modal-body {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
}

button:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--leaf);
  color: var(--cream);
  min-width: 100px;
}

.btn-primary:hover {
  background: var(--lime);
}

.btn-secondary {
  background: var(--sage);
  color: var(--black);
}

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

/* HUD styles */
.hud {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.score-display {
  display: flex;
  gap: 24px;
  color: var(--cream);
  font-weight: bold;
  font-size: 18px;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.score-label {
  font-size: 12px;
  opacity: 0.7;
}

.score-value {
  font-size: 24px;
}

.controls {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--cream);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.icon-btn:focus {
  outline: 2px solid var(--gold);
}

svg.icon {
  width: 24px;
  height: 24px;
  stroke: var(--cream);
  fill: none;
  stroke-width: 2;
}

/* Direction pad */
.direction-pad {
  position: fixed;
  bottom: 16px;
  left: 16px;
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 4px;
  z-index: 100;
}

.direction-pad button {
  width: 48px;
  height: 48px;
  background: rgba(168, 213, 173, 0.3);
  border: 2px solid var(--mint);
  border-radius: 8px;
  color: var(--mint);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.direction-pad button:hover {
  background: rgba(168, 213, 173, 0.5);
  transform: scale(1.1);
}

.direction-pad button:active {
  background: var(--mint);
  color: var(--black);
}

/* Victory badge */
.victory-badge {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  animation: bounce-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Pause screen */
.pause-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 500;
}

.pause-screen.active {
  display: flex;
}

.pause-content {
  background: var(--cream);
  color: var(--black);
  padding: 32px;
  border-radius: 12px;
  text-align: center;
}

.pause-content h2 {
  font-size: 28px;
  margin-bottom: 24px;
  color: var(--teal);
}

.pause-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* Responsive design */
@media (max-width: 844px) {
  .hud {
    flex-direction: column;
    gap: 12px;
    top: 8px;
    left: 8px;
    right: 8px;
  }

  .controls {
    width: 100%;
    justify-content: center;
  }

  .direction-pad {
    bottom: 8px;
    left: 8px;
  }
}

@media (max-height: 600px) {
  .direction-pad {
    display: none;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .icon-btn:hover {
    transform: none;
  }

  .direction-pad button:hover {
    transform: none;
  }
}
