:root {
  --ink: #f4f8ff;
  --muted: #6a8a70;
  --mint: #7aefb0;
  --pink: #ff7eb6;
  --gold: #ffe27a;
}

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

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

.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(40, 100, 60, 0.4);
  background: #c8f0c0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

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

.panel {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: #5a7860;
  min-width: 96px;
  box-shadow: 0 4px 12px rgba(60, 120, 80, 0.15);
}

.panel.right {
  align-items: flex-end;
}

.panel b {
  color: #2a4838;
  font-size: 16px;
}

.lives-row {
  position: absolute;
  top: 72px;
  left: 12px;
  display: flex;
  gap: 5px;
  z-index: 3;
  pointer-events: none;
}

.life {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.life.empty {
  background: rgba(160, 140, 180, 0.25);
}

.goal-meter {
  position: absolute;
  top: 72px;
  right: 12px;
  left: 88px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
}

.goal-meter i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--pink), var(--gold));
  transition: width 0.15s ease;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 22px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255, 180, 210, 0.4), transparent 50%),
    linear-gradient(180deg, rgba(140, 210, 255, 0.92), rgba(180, 235, 170, 0.95), rgba(255, 210, 230, 0.94));
  backdrop-filter: blur(6px);
  color: #2a4838;
}

.overlay.hidden {
  display: none;
}

.hero-art {
  width: min(42vw, 168px);
  height: min(42vw, 168px);
  object-fit: cover;
  border-radius: 28px;
  margin-bottom: 10px;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.45),
    0 0 0 3px rgba(111, 255, 210, 0.28);
}

.badge {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #e05090;
  background: rgba(255, 126, 182, 0.18);
  border: 1px solid rgba(255, 126, 182, 0.4);
  border-radius: 999px;
  padding: 6px 12px;
}

.badge.soft {
  color: #c09020;
  background: rgba(255, 226, 122, 0.28);
  border-color: rgba(255, 200, 80, 0.45);
}

.overlay h1 {
  margin: 4px 0 0;
  font-family: "Bagel Fat One", "Jua", sans-serif;
  font-size: clamp(34px, 9vw, 46px);
  font-weight: 400;
  line-height: 1.05;
  color: #2a4838;
  text-shadow: 0 3px 0 rgba(255, 180, 210, 0.55);
}

.overlay p {
  margin: 0;
  color: #4a6a50;
  font-size: 15px;
  line-height: 1.45;
}

.title-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 8px;
  font-size: 13px;
  color: #3a5840;
  opacity: 0.9;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  font-family: inherit;
  font-size: 18px;
  color: #1a2848;
  background: linear-gradient(180deg, var(--mint), #5ee0b8);
  box-shadow: 0 5px 0 #2a9870;
  cursor: pointer;
}

.btn.ghost {
  padding: 10px 22px;
  font-size: 15px;
  color: #5a4a78;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(120, 100, 160, 0.25);
  box-shadow: 0 3px 0 rgba(120, 100, 160, 0.2);
}

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

.btn.ghost:active {
  box-shadow: 0 1px 0 rgba(120, 100, 160, 0.2);
}

.overlay a {
  color: #6a5a90;
  text-decoration: none;
  font-size: 14px;
  margin-top: 4px;
}
