:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #2f8ecb;
  color: #e8f2ff;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, sans-serif;
}

.app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #7cc4ee;
  box-shadow: 0 18px 46px rgba(14, 62, 102, 0.45);
}

canvas#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  text-align: center;
  background: rgba(12, 52, 92, 0.62);
  backdrop-filter: blur(3px);
  transition: opacity 0.18s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay h1 {
  margin: 0;
  font-size: clamp(22px, 4.2vw, 38px);
  letter-spacing: -0.5px;
  color: #ffffff;
  text-shadow: 0 3px 14px rgba(8, 46, 82, 0.55);
}

.overlay .hint {
  margin: 0;
  max-width: 32em;
  font-size: clamp(12px, 1.7vw, 15px);
  line-height: 1.6;
  color: #d6e9f8;
}

.overlay .hint b {
  color: #ffffff;
}

.overlay .keys {
  display: flex;
  gap: 14px;
  margin: 2px 0 4px;
  padding: 0;
  list-style: none;
  font-size: clamp(12px, 1.6vw, 14px);
  color: #cfe4f8;
}

.overlay .keys b {
  display: inline-block;
  margin-right: 4px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

.overlay button {
  margin-top: 4px;
  padding: 11px 34px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #a9e4ff, #63c1f0);
  color: #06213b;
  font-size: clamp(14px, 1.9vw, 16px);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(70, 170, 240, 0.38);
}

.overlay button:hover {
  filter: brightness(1.06);
}

.overlay button:active {
  transform: translateY(1px);
}

.overlay button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.touch {
  position: absolute;
  inset: auto 0 0 0;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 12px;
  pointer-events: none;
}

.touch.show {
  display: flex;
}

.tgroup {
  display: flex;
  gap: 10px;
}

.tbtn {
  pointer-events: auto;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(10, 32, 56, 0.55);
  color: #e6f3ff;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tbtn.jump {
  width: 76px;
  border-radius: 999px;
  font-size: 15px;
}

.tbtn.dash {
  width: 68px;
  border-radius: 999px;
  font-size: 14px;
}

.tbtn.active {
  background: rgba(120, 200, 255, 0.5);
}

.species {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 34em;
  margin: 4px 0 2px;
}

.overlay .spbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 0;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  color: #eaf4ff;
  font-size: clamp(12px, 1.6vw, 14px);
  font-weight: 700;
  box-shadow: none;
}

.overlay .spbtn span {
  font-size: clamp(10px, 1.3vw, 12px);
  font-weight: 500;
  opacity: 0.85;
}

.overlay .spbtn.on {
  border-color: transparent;
  background: linear-gradient(180deg, #a9e4ff, #63c1f0);
  color: #06213b;
}
