:root {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: #f8fbff;
  background: #111b38;
  color-scheme: dark;
  --ink: #172344;
  --sky: #5fc8ff;
  --sun: #ffe26d;
  --pink: #ff5f9e;
  --mint: #8df0b2;
  --purple: #a47bff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 0%, #2c4d94 0, transparent 52%),
    radial-gradient(circle at 85% 10%, #6d3c8e 0, transparent 45%),
    linear-gradient(180deg, #111b38, #0b1024);
  text-align: center;
}
.topbar {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 14px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  text-align: left;
}
h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3.5vw, 2.1rem);
  letter-spacing: .045em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 3px 0 #1a3766, 0 0 22px rgba(95, 200, 255, .55);
}
.tagline {
  margin: 2px 0 0;
  font-size: .86rem;
  color: #c8dcff;
}
.keys {
  margin: 0;
  font-size: .74rem;
  line-height: 1.5;
  color: #aebfe6;
  text-align: right;
}
.keys b { color: #ffe26d; }
main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  min-height: 0;
  margin: 0 auto;
  padding: 2px 10px calc(10px + env(safe-area-inset-bottom));
  display: flex;
}
.stage {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 330px;
  max-height: calc(100dvh - 78px);
  border-radius: 24px;
  overflow: hidden;
  background: #72d0ff;
  touch-action: none;
  user-select: none;
  box-shadow:
    0 22px 60px rgba(0, 0, 0, .55),
    inset 0 0 0 1px rgba(255, 255, 255, .18);
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
canvas:active { cursor: grabbing; }

.hud {
  position: absolute;
  inset: 0 0 auto;
  z-index: 4;
  padding: 12px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.stats, .hud-buttons { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.hud-buttons { justify-content: flex-end; pointer-events: auto; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(14, 26, 58, .62);
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .18);
  color: #eef7ff;
  font-size: .84rem;
  font-weight: 700;
  backdrop-filter: blur(5px);
}
.chip strong { color: #ffe26d; font-size: 1rem; font-variant-numeric: tabular-nums; }
.hearts {
  color: #ff6e97;
  letter-spacing: .08em;
  text-shadow: 0 0 10px rgba(255, 67, 124, .65);
  font-size: 1.05rem;
}
button {
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  background: linear-gradient(#fff19a, #ffd23f);
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 4px 0 #b67b12;
}
button:active { transform: translateY(2px); box-shadow: 0 2px 0 #b67b12; }
button:disabled { opacity: .45; cursor: default; transform: none; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
button.mini {
  font-size: .76rem;
  padding: 7px 12px;
  background: rgba(14, 26, 58, .62);
  color: #eef7ff;
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: none;
  backdrop-filter: blur(5px);
}
button.mini:active { transform: translateY(1px); box-shadow: none; }
button.secondary {
  background: rgba(255, 255, 255, .13);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .36);
  box-shadow: none;
}
button.quiet {
  background: transparent;
  color: #d5e6ff;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.journey {
  width: min(330px, 52vw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  opacity: .9;
}
.journey-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(12, 24, 52, .52);
  border: 1px solid rgba(255, 255, 255, .3);
  overflow: hidden;
}
.journey-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8df0b2, #ffe26d 65%, #ff7aa8);
  transition: width .15s linear;
}
.journey-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: #f2fbff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}
.boss-bar {
  width: min(430px, 68vw);
  margin: 0 auto;
  padding: 6px 12px 9px;
  border-radius: 14px;
  background: rgba(18, 10, 38, .7);
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: 0 8px 30px rgba(28, 0, 54, .4);
  color: #ffd9f0;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .16em;
}
.boss-track {
  height: 11px;
  margin-top: 5px;
  border-radius: 999px;
  background: #2a1740;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .2);
}
#boss-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff5f9e, #ff9b4d);
  transition: width .18s ease;
}
.action-button {
  position: absolute;
  z-index: 6;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: clamp(78px, 10vw, 104px);
  height: clamp(78px, 10vw, 104px);
  padding: 6px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #fff;
  background: radial-gradient(circle at 35% 25%, #ff9dc2, #e5347c 55%, #9e1a53);
  box-shadow: 0 7px 0 #74113c, 0 12px 24px rgba(0, 0, 0, .38);
  touch-action: manipulation;
}
.action-button:active { transform: translateY(4px); box-shadow: 0 3px 0 #74113c, 0 5px 12px rgba(0, 0, 0, .3); }
.action-button.lick {
  bottom: calc(128px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at 35% 25%, #ffc6df, #ff619e 55%, #b11f5d);
  box-shadow: 0 7px 0 #7d1640, 0 12px 24px rgba(0, 0, 0, .38);
}
.action-button.lick.ready {
  animation: lick-pulse .9s ease-in-out infinite;
}
.action-word {
  font-size: clamp(.72rem, 1.8vw, .92rem);
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(90, 0, 45, .45);
}
.action-tip { font-size: .56rem; opacity: .9; line-height: 1; }
.bomb-shape {
  position: relative;
  width: 27%;
  aspect-ratio: 1 / 1.12;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 34% 28%, #ffd7e8, #ff7cae 48%, #d02d72);
  box-shadow: inset -3px -4px 0 rgba(100, 0, 45, .22), 0 0 12px rgba(255, 255, 255, .4);
}
.bomb-shape::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -42%;
  width: 3px;
  height: 48%;
  border-radius: 2px;
  background: #f1d9a3;
  transform: translateX(-50%) rotate(14deg);
  transform-origin: bottom;
}
.bomb-shape::after {
  content: "";
  position: absolute;
  left: 66%;
  top: -54%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff7a8;
  box-shadow: 0 0 8px 3px #ffc83d;
}
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 16, 40, .5);
  backdrop-filter: blur(5px);
  transition: opacity .18s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.card {
  width: min(520px, 100%);
  max-height: calc(100% - 12px);
  overflow-y: auto;
  padding: clamp(18px, 4vw, 34px);
  border-radius: 26px;
  text-align: center;
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 226, 109, .15), transparent 50%),
    linear-gradient(155deg, rgba(34, 62, 122, .97), rgba(19, 29, 66, .98));
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.kicker {
  margin: 0 0 5px;
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #8df0b2;
}
.card h2 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 5.5vw, 2.8rem);
  line-height: 1.02;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 4px 0 #172b56, 0 0 24px rgba(95, 200, 255, .5);
}
.card p { margin: 0 0 11px; color: #dae9ff; line-height: 1.5; }
.card .controls { color: #aec9ef; font-size: .82rem; }
.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
}
.overlay-actions button { min-width: 140px; }
@keyframes lick-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.22) drop-shadow(0 0 14px #ffb6d4); }
}
@media (max-width: 700px) {
  .keys { display: none; }
  .topbar { justify-content: center; text-align: center; padding-bottom: 2px; }
  .tagline { font-size: .78rem; }
  .chip { min-height: 29px; padding: 4px 9px; font-size: .76rem; }
  .chip strong { font-size: .9rem; }
  button.mini { font-size: .68rem; padding: 6px 9px; }
  .hud { padding: 8px; gap: 5px; }
  .journey { width: min(260px, 52vw); }
  .boss-bar { width: min(320px, 74vw); }
  .action-button { right: calc(10px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); }
  .action-button.lick { bottom: calc(104px + env(safe-area-inset-bottom)); }
  .overlay { padding: 10px; }
  .card { padding: 18px 16px; border-radius: 20px; }
  .overlay-actions button { min-width: 120px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  body { overflow: hidden; }
  .topbar { padding: calc(4px + env(safe-area-inset-top)) 10px 2px; }
  h1 { font-size: 1.05rem; }
  .tagline, .keys { display: none; }
  main { padding: 0 6px calc(6px + env(safe-area-inset-bottom)); }
  .stage { max-height: calc(100dvh - 34px); min-height: 220px; border-radius: 16px; }
  .hud { padding: 6px; gap: 3px; }
  .chip { min-height: 24px; padding: 2px 8px; font-size: .68rem; }
  .hearts { font-size: .86rem; }
  .journey { width: 210px; }
  .journey-label { display: none; }
  .action-button { width: 66px; height: 66px; }
  .action-button.lick { bottom: 84px; }
  .card { padding: 14px 20px; }
  .card h2 { font-size: 1.5rem; }
  .card p { font-size: .8rem; margin-bottom: 8px; }
  .card .controls { display: none; }
  .overlay-actions { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .action-button.lick.ready { animation: none; filter: brightness(1.15); }
}
.ghs-open { display: none !important; }
