:root {
  --ink: #2f4a55;
  --muted: #5a7380;
  --sky: #7ec8ff;
  --mint: #6fd6b0;
  --pink: #ff6b9d;
  --lemon: #ffe27a;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: "Jua", system-ui, sans-serif;
  color: var(--ink);
  background: #163048;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage {
  position: relative;
  width: min(100vw, calc(100dvh * 0.557));
  height: min(100dvh, calc(100vw / 0.557));
  max-width: 420px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  background: var(--sky);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.home {
  pointer-events: auto;
  text-decoration: none;
  color: #fff;
  background: rgba(30, 50, 70, 0.45);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.score-pill {
  background: rgba(30, 50, 70, 0.45);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.score-pill b {
  color: var(--lemon);
  font-size: 16px;
}

.score-pill.soft b {
  color: #9ed8ff;
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 3;
  margin: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(circle at 22% 16%, rgba(255, 255, 255, 0.55), transparent 28%),
    linear-gradient(180deg, rgba(126, 200, 255, 0.94), rgba(200, 255, 220, 0.96));
}

.overlay.hidden {
  display: none;
}

.badge {
  background: linear-gradient(180deg, #9effd0, var(--mint));
  color: #1f4a40;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  box-shadow: 0 4px 0 #3aa882;
}

.hero-art {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 28px;
  border: 4px solid #fff;
  box-shadow: 0 12px 28px rgba(40, 60, 90, 0.28);
}

h1 {
  margin: 0;
  font-family: "Bagel Fat One", "Jua", cursive;
  font-weight: 400;
  font-size: 34px;
  color: #2db88a;
  text-shadow: 0 3px 0 #fff;
}

.overlay p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.rank-form {
  width: min(280px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.rank-form label {
  font-size: 13px;
  color: var(--muted);
}

.rank-form input {
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
}

.rank-msg {
  min-height: 1.2em;
  font-size: 13px !important;
  color: #2f7a45 !important;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 13px 30px;
  font: inherit;
  font-size: 18px;
  color: #1f4a40;
  background: linear-gradient(180deg, #9effd0, var(--mint));
  box-shadow: 0 6px 0 #3aa882;
  cursor: pointer;
}

.btn.soft {
  color: #fff;
  background: linear-gradient(180deg, #ff9ec4, var(--pink));
  box-shadow: 0 6px 0 #d93f74;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #3aa882;
}

.btn.soft:active {
  box-shadow: 0 3px 0 #d93f74;
}

.link {
  margin-top: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
