@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Manrope:wght@500;700;800&display=swap");

:root {
  --bg-top: #f9fff2;
  --bg-mid: #d6ebff;
  --bg-bottom: #a8c6db;
  --panel: rgba(10, 29, 41, 0.78);
  --panel-strong: rgba(29, 13, 17, 0.87);
  --panel-border: rgba(240, 255, 246, 0.34);
  --ink: #f4fbff;
  --ink-soft: rgba(244, 251, 255, 0.82);
  --accent: #ffbe3f;
  --accent-2: #2ec4b6;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

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

body {
  background: #000;
}

.stage-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

#gameCanvas {
  display: block;
  background: #a4c8da;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 37, 53, 0.36);
}

.overlay[hidden] {
  display: none;
}

.panel {
  width: min(640px, calc(100% - 2rem));
  padding: 1rem 1rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: 0 20px 70px rgba(6, 10, 16, 0.55);
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
}

.panel h2 {
  margin: 0;
  font-family: "Baloo 2", cursive;
  letter-spacing: 0.035em;
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
}

.panel p {
  margin: 0.55rem 0 0;
  color: rgba(240, 252, 255, 0.94);
  line-height: 1.35;
}

.panel-danger {
  background: var(--panel-strong);
  border-color: rgba(255, 191, 197, 0.54);
}

.btn-primary {
  margin-top: 0.8rem;
  border: 1px solid rgba(255, 237, 204, 0.67);
  border-radius: 12px;
  padding: 0.62rem 0.95rem;
  min-width: 165px;
  cursor: pointer;
  font-family: "Baloo 2", cursive;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #1e2128;
  background: linear-gradient(180deg, #ffd67d, var(--accent));
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.995);
}

.hint {
  font-size: 0.92rem;
  color: rgba(230, 248, 255, 0.85);
}

.credits {
  font-size: 11px;
  opacity: 0.55;
  margin-top: 12px;
}
.credits a {
  color: inherit;
}

.touch-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

@media (pointer: coarse), (max-width: 920px) {
  .touch-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.4rem 1.5rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }

  .touch-controls button {
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    padding: 0.45rem;
    font-size: 1.6rem;
    line-height: 1;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.18);
    opacity: 0.38;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: opacity 0.08s;
  }

  .touch-controls button.active {
    opacity: 0.82;
    background: rgba(255, 200, 80, 0.25);
  }
}
