:root {
  --primary: #0EA5E9;
  --secondary: #64748B;
  --accent: #F59E0B;
  --background: #1E293B;
  --surface: #334155;
  --text: #F8FAFC;
  --font-family: 'Inter', system-ui, sans-serif;
  --radius: 8px;
}

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

#game-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--background);
  z-index: 10;
  transition: opacity 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  margin: 10px;
  transition: transform 0.1s, filter 0.2s;
  width: 200px;
}

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

.primary {
  background-color: var(--primary);
  color: white;
}

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

.btn-icon {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 10px;
}

/* HUD */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  box-sizing: border-box;
  z-index: 5;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: 600;
  background: rgba(30, 41, 59, 0.8);
  padding: 10px;
  border-radius: var(--radius);
  backdrop-filter: blur(5px);
}

.hud-bottom {
  display: flex;
  justify-content: center;
  gap: 20px;
  pointer-events: auto;
  background: rgba(30, 41, 59, 0.8);
  padding: 10px;
  border-radius: var(--radius);
  align-self: center;
  backdrop-filter: blur(5px);
}

canvas {
  touch-action: none;
  width: 100%;
  height: auto;
  max-width: 100%; /* Ensure it fits */
  max-height: 80vh;
  aspect-ratio: 1;
  background-color: #0F172A;
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Modal */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

.modal-content {
  background-color: var(--surface);
  padding: 30px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.stars {
  font-size: 2rem;
  color: var(--accent);
  margin: 10px 0;
}

.level-grid-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.level-btn {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    background-color: var(--surface);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: none;
    font-weight: bold;
}

.level-btn.completed {
    background-color: var(--primary);
}

.level-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
}
