/* ─── The Campsite — pixel game tab ───────────────────────── */
@font-face {
  font-family: 'Bonfire';
  src: url('BonfireRegular.otf') format('opentype');
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #0a0a0a;
  color: #f0ece6;
  font-family: system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

/* Stage fills the viewport and centers the canvas */
#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 38%, #14110d 0%, #060606 70%);
}

/* The canvas is internally 240x160 (GBA res). We scale it up with
   nearest-neighbor so the pixels stay crisp instead of blurry. */
#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: min(96vw, 960px);
  height: auto;
  aspect-ratio: 240 / 160;
  background: #14110d;
  box-shadow:
    0 0 0 4px #1a1a1a,
    0 0 0 6px #2a2a2a,
    0 24px 60px rgba(0,0,0,0.7);
  border-radius: 3px;
}

/* ─── Overlays ───────────────────────────────────────────── */
/* Title sits over a blurred, dimmed view of the actual campsite. */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(8,16,10,0.45) 0%, rgba(4,8,5,0.86) 80%);
  backdrop-filter: blur(9px) saturate(1.05);
  -webkit-backdrop-filter: blur(9px) saturate(1.05);
  transition: opacity 0.55s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

.title-inner { text-align: center; padding: 0 20px; }
.title-logo {
  font-family: 'Bonfire', sans-serif;
  font-weight: 400;
  font-size: clamp(48px, 9.5vw, 104px);
  line-height: 0.84;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 4px 22px rgba(0,0,0,0.7), 0 0 1px rgba(255,255,255,0.5);
  user-select: none;
  animation: logo-float 5.5s ease-in-out infinite;
}
@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
.start-btn {
  margin-top: 36px;
  padding: 13px 30px;
  font-size: 13px;
  letter-spacing: 3px;
  font-weight: 700;
  color: #fff;
  background: rgba(79,147,192,0.16);            /* brand sky, low alpha */
  border: 1px solid rgba(138,166,143,0.55);     /* brand sage */
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  animation: pulse 2s ease-in-out infinite;
}
.start-btn:hover {
  background: rgba(79,147,192,0.34);
  border-color: rgba(255,255,255,0.7);
  transform: translateY(-1px);
  animation: none;
}
@keyframes pulse { 50% { opacity: 0.55; } }

.title-controls {
  margin-top: 24px;
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.32);
}

/* ─── In-game UI ─────────────────────────────────────────── */
.hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.hint.show { opacity: 1; }

.exit-btn {
  position: absolute;
  top: 16px;
  left: 18px;
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.5s ease, color 0.2s ease;
}
.exit-btn.show { opacity: 1; }
.exit-btn:hover { color: #fff; }

/* ─── Map editor ─────────────────────────────────────────── */
.edit-btn {
  position: absolute;
  top: 16px;
  right: 58px;
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
.edit-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.edit-panel {
  position: absolute;
  top: 54px;
  right: 58px;
  width: 260px;
  background: rgba(8,8,10,0.92);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  padding: 12px;
}
.edit-panel.hidden { display: none; }
.edit-help { font-size: 11px; line-height: 1.5; color: rgba(255,255,255,0.7); margin-bottom: 10px; }
.brush-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.brush-btn {
  font-size: 10px; padding: 4px 7px; cursor: pointer;
  color: #f0ece6; background: rgba(255,255,255,0.05);
  border: 2px solid var(--bc, #555); border-radius: 5px;
}
.brush-btn.on { background: var(--bc, #555); color: #0a0a0a; font-weight: 700; }
.size-row { font-size: 11px; color: rgba(255,255,255,0.7); margin-bottom: 8px; display: flex; align-items: center; gap: 4px; }
.size-row button {
  width: 24px; height: 22px; cursor: pointer; font-size: 11px;
  color: #f0ece6; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.2); border-radius: 4px;
}
.size-row button.on { background: #f5a623; color: #0a0a0a; font-weight: 700; }
.edit-clear {
  width: 100%; margin-top: 6px; font-size: 11px; cursor: pointer;
  color: rgba(255,255,255,0.6); background: transparent;
  border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; padding: 6px;
}
.edit-clear:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
.edit-do {
  width: 100%;
  font-size: 12px; letter-spacing: 1px; font-weight: 700;
  color: #0a0a0a; background: #f5a623; border: none; border-radius: 6px;
  padding: 8px; cursor: pointer;
}
.edit-do:hover { background: #ffb733; }
.edit-out {
  width: 100%; height: 70px; margin-top: 8px;
  font-family: monospace; font-size: 10px;
  background: #14110d; color: #cdbf9a;
  border: 1px solid rgba(255,255,255,0.12); border-radius: 6px;
  padding: 6px; resize: none;
}

/* ─── Sound panel ────────────────────────────────────────── */
.audio-btn {
  position: absolute; top: 16px; right: 18px;
  width: 30px; height: 30px; cursor: pointer; font-size: 15px;
  color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
}
.audio-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.audio-panel {
  position: absolute; top: 54px; right: 18px;
  width: 170px; padding: 12px;
  background: rgba(8,8,10,0.92); border: 1px solid rgba(255,255,255,0.16); border-radius: 8px;
  display: flex; flex-direction: column; gap: 9px;
}
.audio-panel.hidden { display: none; }
.audio-panel label { font-size: 11px; color: rgba(255,255,255,0.7); display: flex; flex-direction: column; gap: 3px; }
.audio-panel input[type=range] { width: 100%; accent-color: #f5a623; }
.audio-mute {
  font-size: 11px; letter-spacing: 1px; cursor: pointer; padding: 6px;
  color: #f0ece6; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
}
.audio-mute.on { background: #b23; color: #fff; border-color: #b23; }

/* ─── Mobile gate ────────────────────────────────────────── */
#mobileGate { display: none; }
@media (max-width: 820px), (pointer: coarse) {
  #stage { display: none; }
  #mobileGate {
    display: flex;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 28px;
  }
  .gate-card { text-align: center; max-width: 340px; }
  .gate-logo { width: min(70vw, 280px); height: auto; margin-bottom: 22px; filter: drop-shadow(0 4px 16px rgba(0,0,0,0.6)); }
  .gate-note { color: rgba(255,255,255,0.6); line-height: 1.6; font-size: 15px; }
  .gate-link {
    display: inline-block;
    margin-top: 24px;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 13px;
    letter-spacing: 1px;
  }
}
