:root {
  --cobalt: #0b1f3a;
  --cobalt-deep: #071526;
  --cyan: #3ddcff;
  --lime: #b8f24a;
  --chalk: #f2f0e8;
  --chalk-dim: #c8c5b8;
  --graphite: #1a2433;
  --graphite-light: #243044;
  --danger: #ff5c5c;
  --font: "Segoe UI", "Trebuchet MS", sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--cobalt-deep);
  color: var(--chalk);
  font-family: var(--font);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(160deg, var(--cobalt-deep), var(--cobalt) 55%, #12385a);
}

#gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay.panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background:
    radial-gradient(ellipse at 75% 20%, rgba(184, 242, 74, 0.18), transparent 45%),
    radial-gradient(ellipse at 10% 90%, rgba(61, 220, 255, 0.16), transparent 40%),
    linear-gradient(160deg, rgba(7, 21, 38, 0.92), rgba(11, 31, 58, 0.94));
}

.hidden { display: none !important; }

.brand-float { text-align: center; animation: floaty 3.2s ease-in-out infinite; }
.company {
  color: var(--cyan);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.95rem;
  font-weight: 700;
}
h1 {
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0.35rem;
}
.rule {
  width: min(320px, 60vw);
  height: 4px;
  margin: 0.75rem auto 0.9rem;
  border-radius: 999px;
  background: var(--lime);
}
.tagline { color: var(--chalk-dim); font-size: 1.05rem; }

.actions { display: flex; flex-direction: column; gap: 0.75rem; width: min(320px, 80vw); }

button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  background: var(--graphite-light);
  color: var(--chalk);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
button:hover {
  background: var(--cyan);
  color: var(--cobalt-deep);
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(184, 242, 74, 0.35);
}
button.ghost { background: rgba(36, 48, 68, 0.85); }

/* Anchor styled to match the sibling <button> elements in .actions */
.btn-link {
  display: block;
  text-align: center;
  text-decoration: none;
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--lime);
  color: var(--cobalt-deep);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn-link:hover {
  background: var(--cyan);
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(184, 242, 74, 0.35);
}

.footnote { color: var(--chalk-dim); font-size: 0.85rem; margin-top: 0.5rem; }

.legal {
  max-width: min(620px, 88vw);
  margin-top: 0.75rem;
  text-align: center;
  color: var(--chalk-dim);
  font-size: 0.75rem;
  line-height: 1.5;
  opacity: 0.9;
}
.legal strong { color: var(--chalk); }

#levels h2, #pause h2, #banner h2 { font-size: 2rem; }
#levels .sub { color: var(--cyan); margin-bottom: 0.5rem; }

#level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  width: min(900px, 92vw);
  margin: 0.5rem 0 1rem;
}

.card {
  text-align: left;
  background: var(--graphite);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 130px;
}
.card:hover:not(.locked) { border-color: var(--cyan); transform: scale(1.02); }
.card.locked { opacity: 0.55; cursor: not-allowed; }
.card .stage { color: var(--cyan); font-size: 0.8rem; letter-spacing: 0.08em; font-weight: 700; }
.card.done .stage { color: var(--lime); }
.card h3 { margin: 0.4rem 0 0.35rem; font-size: 1.15rem; }
.card p { color: var(--chalk-dim); font-size: 0.9rem; line-height: 1.35; }

#hud { z-index: 2; }

#level-label {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(26, 36, 51, 0.88);
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  font-weight: 700;
  pointer-events: none;
}
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#crosshair::before, #crosshair::after {
  content: "";
  position: absolute;
  background: rgba(242, 240, 232, 0.9);
}
#crosshair::before { left: 7px; top: 0; width: 2px; height: 16px; }
#crosshair::after { left: 0; top: 7px; width: 16px; height: 2px; }

#hotbar {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  gap: 0.45rem;
  background: rgba(26, 36, 51, 0.9);
  padding: 0.45rem;
  border-radius: 14px;
  pointer-events: none;
}
.slot {
  width: 52px;
  height: 44px;
  border-radius: 10px;
  background: var(--graphite-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.7rem;
}
.slot.selected { outline: 2px solid var(--lime); }
.swatch { width: 18px; height: 18px; border-radius: 4px; }

#hint {
  position: absolute;
  left: 16px;
  bottom: 14px;
  color: var(--chalk-dim);
  font-size: 0.8rem;
  pointer-events: none;
}

#banner #banner-title.win { color: var(--lime); }
#banner #banner-title.fail { color: var(--danger); }

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
