:root {
  --navy: #17224c;
  --ink: #1b2650;
  --cream: #fff4dc;
  --mint: #bff0de;
  --mint-strong: #2ed47a;
  --pink: #ff3d8b;
  --yellow: #ffd21f;
  --gold: #ffc93c;
  --cyan: #49d7ff;
  --red: #ff4757;
  --orange: #ff8a3d;
  --panel-shadow: 0 14px 28px rgba(20, 30, 70, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff3dd;
  color: var(--ink);
  font-family: 'Fredoka', sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

button { font-family: inherit; }

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: #fff3dd;
}

#scene, #scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#scene {
  filter: saturate(1.7) contrast(1.14) brightness(0.97);
  transition: filter 0.45s ease, transform 0.45s ease;
}

#scene.blurred {
  filter: blur(6px) saturate(0.42) brightness(0.93);
  transform: scale(1.035);
}

#vignette {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 48%, transparent 52%, rgba(32, 42, 82, 0.24) 100%);
  opacity: 0.8;
}

#alarmWash {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: #ff2547;
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 0.08s linear;
}

#redpulse {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  box-shadow: inset 0 0 14vw rgba(255, 60, 84, 0.62);
  opacity: 0;
  transition: opacity 0.14s ease;
}

#speedlines {
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
  background: repeating-conic-gradient(from 0deg at 50% 58%, rgba(255, 255, 255, 0.2) 0deg 0.7deg, transparent 0.7deg 7deg);
  -webkit-mask-image: radial-gradient(circle at 50% 58%, transparent 30%, #000 74%);
  mask-image: radial-gradient(circle at 50% 58%, transparent 30%, #000 74%);
  opacity: 0;
  transition: opacity 0.2s linear;
}

#flash {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: radial-gradient(circle at 50% 54%, rgba(255, 255, 255, 0.92), rgba(255, 246, 214, 0.25) 42%, transparent 68%);
  opacity: 0;
  mix-blend-mode: screen;
}

#popLayer {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  overflow: hidden;
}

.pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(16px, 2.1vw, 34px);
  color: var(--yellow);
  -webkit-text-stroke: 2px var(--navy);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(23, 34, 76, 0.45);
  white-space: nowrap;
  animation: popfloat 0.82s cubic-bezier(0.18, 0.8, 0.3, 1) forwards;
}

.pop.good { color: var(--mint); }
.pop.close { color: #fff; }
.pop.combo {
  font-size: clamp(28px, 4vw, 64px);
  color: var(--pink);
  animation: comboBurst 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.2) forwards;
}

@keyframes popfloat {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  16% { opacity: 1; transform: translate(-50%, -60%) scale(1.14); }
  28% { transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(0.94); }
}

@keyframes comboBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35) rotate(-9deg); }
  22% { opacity: 1; transform: translate(-50%, -58%) scale(1.3) rotate(4deg); }
  36% { transform: translate(-50%, -60%) scale(1) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(1.08) rotate(1deg); }
}

.hidden { display: none !important; }

.screen {
  position: absolute;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  overflow: hidden;
}

.screen button { pointer-events: auto; }

#start .title-wrap {
  position: absolute;
  top: clamp(18px, 3.2vh, 42px);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-align: center;
  filter: drop-shadow(0 14px 20px rgba(25, 32, 74, 0.25));
  z-index: 2;
}

.title-line {
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(46px, min(12vw, 18vh), 150px);
  line-height: 0.8;
  letter-spacing: 0.012em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: clamp(4px, 0.55vw, 10px) var(--navy);
  paint-order: stroke fill;
  -webkit-background-clip: text;
  background-clip: text;
  transform-origin: 50% 50%;
  will-change: transform;
}

.line1 {
  background-image: linear-gradient(180deg, #fffbd7 0%, #ffe96a 24%, #ffd21f 54%, #ffb300 78%, #f08c00 100%);
  animation: titleBob 4.6s ease-in-out infinite;
}

.line2 {
  background-image: linear-gradient(180deg, #ffe0ee 0%, #ff83b9 24%, #ff3d8b 58%, #f01470 82%, #c50058 100%);
  animation: titleBob 4.6s ease-in-out -1.5s infinite;
  margin-top: -0.02em;
}

@keyframes titleBob {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(-0.7deg) translateY(-6px); }
}

.play-wrap {
  position: absolute;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.8vh, 18px);
  z-index: 3;
}

.play-btn {
  position: relative;
  min-width: clamp(178px, 19vw, 286px);
  padding: 0.34em 1.5em 0.44em;
  border: 4px solid #fff;
  border-radius: 999px;
  background: linear-gradient(180deg, #d6ffe9 0%, #6aefab 30%, #2ed47a 70%, #12a75a 100%);
  box-shadow:
    0 0 0 5px var(--navy),
    0 16px 28px rgba(20, 32, 74, 0.32),
    inset 0 9px 0 rgba(255, 255, 255, 0.55),
    inset 0 -10px 0 rgba(0, 98, 52, 0.18);
  color: #073f29;
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(25px, 2.9vw, 50px);
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.play-btn span { position: relative; top: -0.02em; }
.play-btn::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 999px;
  box-shadow: 0 0 22px 4px rgba(104, 255, 176, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.25) inset;
  animation: playGlow 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes playGlow {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 0.95; transform: scale(1.035); }
}

.play-btn:hover { transform: translateY(-3px) scale(1.03); filter: brightness(1.04); }
.play-btn:active { transform: translateY(3px) scale(0.985); filter: brightness(0.98); }
.play-btn:focus-visible { outline: 4px dashed #fff; outline-offset: 9px; }
.play-btn[aria-busy="true"] { cursor: progress; filter: saturate(0.55); animation: none; }

@keyframes playPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

.hi-pill {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.3em 1.05em 0.36em;
  border: 3px solid #fff;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff5ba 0%, #ffd84d 34%, #ffc01e 72%, #e99b00 100%);
  box-shadow: 0 0 0 4px var(--navy), 0 10px 18px rgba(20, 30, 70, 0.28), inset 0 5px 0 rgba(255, 255, 255, 0.5);
  color: var(--navy);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 1.45vw, 22px);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hi-pill .trophy { width: 1.25em; height: 1.25em; color: #b86b00; }
.hi-pill b { font-family: 'Lilita One', sans-serif; font-size: 1.35em; letter-spacing: 0.02em; }

.start-controls {
  position: absolute;
  bottom: clamp(26px, 4.2vh, 44px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(10px, 2.2vw, 30px);
  z-index: 3;
}

.key-item { display: flex; flex-direction: column; align-items: center; gap: 5px; }

.keycap {
  display: grid;
  place-items: center;
  min-width: clamp(38px, 4.1vw, 58px);
  height: clamp(38px, 4.1vw, 58px);
  padding: 0 0.42em;
  border: 3px solid #fff;
  border-radius: clamp(10px, 1.1vw, 16px);
  background: linear-gradient(180deg, #ffffff 0%, #fff7e4 45%, #eddcc2 100%);
  box-shadow: 0 0 0 3px var(--navy), 0 6px 0 #cdbb9d, 0 10px 14px rgba(20, 30, 70, 0.22), inset 0 4px 0 rgba(255, 255, 255, 0.9);
  color: var(--navy);
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(16px, 1.7vw, 25px);
  line-height: 1;
  white-space: nowrap;
}

.keycap.wide { min-width: clamp(56px, 6.4vw, 92px); font-size: clamp(12px, 1.3vw, 19px); }
.key-item i {
  font-style: normal;
  font-weight: 600;
  font-size: clamp(10px, 1.05vw, 15px);
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 2px 0 var(--navy), 0 0 8px rgba(23, 34, 76, 0.5);
}

.loading-pill {
  position: absolute;
  left: 50%;
  bottom: clamp(84px, 12vh, 140px);
  transform: translateX(-50%);
  padding: 0.42em 1.1em;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: rgba(23, 34, 76, 0.76);
  box-shadow: 0 8px 18px rgba(20, 30, 70, 0.25);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: clamp(11px, 1.15vw, 16px);
  letter-spacing: 0.08em;
  z-index: 4;
  animation: loadPulse 1.2s ease-in-out infinite;
}

@keyframes loadPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

#hud {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#hud.on { opacity: 1; }

.hud-left {
  position: absolute;
  top: clamp(10px, 1.8vh, 20px);
  left: clamp(10px, 1.4vw, 22px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(7px, 1vh, 12px);
}

.score-card {
  position: relative;
  min-width: clamp(150px, 14vw, 212px);
  padding: 0.32em 1.2em 0.5em;
  border: 4px solid #fff;
  border-radius: clamp(20px, 2vw, 30px);
  background: linear-gradient(165deg, #ffffff 0%, #fff8ea 55%, #ffe4bd 100%);
  box-shadow: 0 0 0 4px var(--navy), var(--panel-shadow), inset 0 5px 0 rgba(255, 255, 255, 0.85);
  text-align: left;
}

.score-label {
  font-weight: 700;
  font-size: clamp(9px, 0.95vw, 14px);
  letter-spacing: 0.22em;
  color: #8a7792;
}

.score-num {
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(32px, 4.2vw, 62px);
  line-height: 0.92;
  color: #fff;
  -webkit-text-stroke: clamp(2px, 0.22vw, 4px) var(--navy);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 rgba(23, 34, 76, 0.24);
  letter-spacing: 0.01em;
}

.mult-tag {
  position: relative;
  display: block;
  width: fit-content;
  margin: 7px 0 -4px auto;
  min-width: 66px;
  padding: 0.16em 0.85em 0.2em;
  border: 3px solid #fff;
  border-radius: 16px 16px 20px 20px;
  background: linear-gradient(180deg, #ff9bc2 0%, #ff4d98 38%, #f01e77 100%);
  box-shadow: 0 0 0 3px var(--navy), 0 8px 13px rgba(20, 30, 70, 0.28);
  color: #fff;
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(18px, 1.8vw, 28px);
  text-align: center;
  text-shadow: 0 3px 0 #a50052;
  transform: rotate(-5deg);
  transform-origin: 50% 60%;
  transition: transform 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.4), filter 0.2s ease;
}
.mult-tag::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 2px #d21b70;
  transform: translateY(-50%);
}
.mult-tag.punch { transform: rotate(-5deg) scale(1.25); }
.mult-tag.hot { filter: drop-shadow(0 0 10px rgba(255, 210, 31, 0.85)); }
.mult-tag.rainbow { animation: rainbowTag 0.8s linear; }
@keyframes rainbowTag {
  0% { filter: hue-rotate(0deg) saturate(1.4); }
  100% { filter: hue-rotate(360deg) saturate(1.4); }
}

.chip-row { display: flex; gap: clamp(6px, 0.8vw, 11px); align-items: flex-start; }

.chip {
  position: relative;
  width: clamp(40px, 4.1vw, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 1;
  transition: opacity 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}
.chip:not(.on) { filter: saturate(0.22) brightness(0.94); }
.chip:not(.on) .chip-core { background: #f6f0e4; }
.chip.on { opacity: 1; filter: none; transform: translateY(-2px); }

.chip-ring {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 4px;
  background: conic-gradient(var(--chip-color, var(--mint-strong)) calc(var(--p, 0) * 1turn), rgba(255, 255, 255, 0.32) 0);
  box-shadow: 0 0 0 3px var(--navy), 0 7px 12px rgba(20, 30, 70, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.chip-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #fffdf8 0%, #fff2d8 100%);
  color: var(--chip-color, var(--mint-strong));
}
.chip-core svg { width: 56%; height: 56%; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.8)); }
#chipBoost { --chip-color: #23c977; }
#chipHover { --chip-color: #21bde8; }
#chipCombo { --chip-color: #ff3d8b; }

.chip-time {
  position: absolute;
  bottom: 18%;
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(8px, 0.8vw, 11px);
  color: var(--navy);
  text-shadow: 0 1px 0 #fff;
}

.hud-right {
  position: absolute;
  top: clamp(10px, 1.8vh, 20px);
  right: clamp(10px, 1.4vw, 22px);
}

.hi-card {
  display: flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.42em 0.85em 0.5em;
  border: 3px solid #fff;
  border-radius: 20px;
  background: linear-gradient(165deg, #fff9c9 0%, #ffe45c 42%, #ffc01e 100%);
  box-shadow: 0 0 0 4px var(--navy), 0 10px 18px rgba(20, 30, 70, 0.25), inset 0 4px 0 rgba(255, 255, 255, 0.7);
  color: var(--navy);
}
.hi-card .trophy { width: clamp(20px, 2.2vw, 32px); height: clamp(20px, 2.2vw, 32px); color: #b56a00; }
.hi-label { font-weight: 700; font-size: clamp(7px, 0.8vw, 11px); letter-spacing: 0.16em; color: #7d5a09; }
.hi-num { font-family: 'Lilita One', sans-serif; font-size: clamp(17px, 1.9vw, 28px); line-height: 1; }

.hud-meter {
  position: absolute;
  top: clamp(10px, 1.8vh, 20px);
  left: 50%;
  transform: translateX(-50%);
  width: clamp(210px, 24vw, 336px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.meter-label {
  display: none;
  font-weight: 700;
  font-size: clamp(8px, 0.8vw, 11px);
  letter-spacing: 0.22em;
  color: #fff;
  text-shadow: 0 2px 0 var(--navy), 0 0 8px rgba(23, 34, 76, 0.55);
}

.meter-track {
  position: relative;
  width: 100%;
  height: clamp(20px, 2.7vh, 28px);
  border: 3px solid #fff;
  border-radius: 999px;
  background: rgba(23, 34, 76, 0.28);
  box-shadow: 0 0 0 3px var(--navy), 0 8px 14px rgba(20, 30, 70, 0.24), inset 0 3px 6px rgba(23, 34, 76, 0.28);
}
.meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14%;
  border-radius: 999px;
  background: linear-gradient(90deg, #49e090 0%, #ffd23f 55%, #ff4757 100%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35);
  transition: width 0.12s linear;
}
.meter-guard {
  position: absolute;
  top: 50%;
  left: 14%;
  width: clamp(24px, 2.6vw, 34px);
  height: clamp(24px, 2.6vw, 34px);
  transform: translate(-50%, -50%);
  color: #ff3d5c;
  filter: drop-shadow(0 2px 0 #fff) drop-shadow(0 0 4px rgba(23, 34, 76, 0.4));
  transition: left 0.12s linear;
}
.meter-shopper {
  position: absolute;
  top: 50%;
  right: 2px;
  width: clamp(22px, 2.4vw, 31px);
  height: clamp(22px, 2.4vw, 31px);
  transform: translateY(-50%);
  color: #49d7ff;
  filter: drop-shadow(0 2px 0 #fff) drop-shadow(0 0 4px rgba(23, 34, 76, 0.4));
}

.play-controls {
  position: absolute;
  left: 50%;
  bottom: clamp(8px, 1.5vh, 16px);
  transform: translateX(-50%);
  z-index: 16;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.3vw, 18px);
  padding: 0.34em 1.15em;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(23, 34, 76, 0.62);
  box-shadow: 0 8px 16px rgba(20, 30, 70, 0.22);
  color: #fff;
  font-weight: 600;
  font-size: clamp(10px, 1.05vw, 15px);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.play-controls b { font-family: 'Lilita One', sans-serif; font-size: 1.22em; color: var(--yellow); letter-spacing: 0.02em; }

.mute-btn {
  position: absolute;
  right: clamp(10px, 1.4vw, 22px);
  bottom: clamp(10px, 1.6vh, 18px);
  z-index: 60;
  width: clamp(38px, 3.6vw, 50px);
  height: clamp(38px, 3.6vw, 50px);
  border: 3px solid #fff;
  border-radius: 50%;
  background: linear-gradient(165deg, #fffdf8 0%, #ffe7c6 100%);
  box-shadow: 0 0 0 3px var(--navy), 0 7px 13px rgba(20, 30, 70, 0.25);
  color: var(--navy);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.mute-btn svg { width: 58%; height: 58%; }
.mute-btn .sound-off { display: none; }
.mute-btn.muted .sound-on { display: none; }
.mute-btn.muted .sound-off { display: block; color: #a63448; }
.mute-btn:hover { transform: translateY(-1px); }
.mute-btn:focus-visible { outline: 4px dashed var(--navy); outline-offset: 4px; }

#over {
  z-index: 45;
  display: grid;
  place-items: center;
  background: rgba(20, 24, 46, 0.08);
}

.over-panel {
  position: relative;
  width: min(88vw, 470px);
  padding: clamp(18px, 3.2vh, 34px) clamp(20px, 3vw, 42px) clamp(16px, 2.6vh, 28px);
  border: 5px solid #fff;
  border-radius: clamp(26px, 3vw, 40px);
  background: linear-gradient(170deg, #fffdf8 0%, #fff4df 55%, #ffe6c8 100%);
  box-shadow: 0 0 0 5px var(--navy), 0 28px 48px rgba(20, 30, 70, 0.38), inset 0 6px 0 rgba(255, 255, 255, 0.9);
  text-align: center;
  animation: panelIn 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

@keyframes panelIn {
  0% { opacity: 0; transform: translateY(30px) scale(0.86); }
  65% { opacity: 1; transform: translateY(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.busted {
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(46px, 6.3vw, 94px);
  line-height: 0.9;
  color: #ff4757;
  -webkit-text-stroke: clamp(3px, 0.35vw, 6px) #fff;
  paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--navy), 0 14px 22px rgba(20, 30, 70, 0.25);
  transform: rotate(-3deg);
  margin-bottom: clamp(4px, 1vh, 10px);
}

.final-label {
  font-weight: 700;
  font-size: clamp(9px, 1vw, 13px);
  letter-spacing: 0.24em;
  color: #9a8495;
}

.final-score {
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(44px, 5.8vw, 82px);
  line-height: 0.92;
  color: var(--pink);
  -webkit-text-stroke: clamp(2px, 0.25vw, 4px) var(--navy);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 rgba(23, 34, 76, 0.18);
}

.best-line {
  font-weight: 700;
  font-size: clamp(12px, 1.2vw, 17px);
  letter-spacing: 0.1em;
  color: #7e7088;
}
.best-line b { font-family: 'Lilita One', sans-serif; font-size: 1.4em; color: #e09400; margin-left: 0.3em; }

.new-best {
  display: inline-block;
  margin: 0.35em auto 0.1em;
  padding: 0.24em 1.1em 0.3em;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7bd 0%, #ffd84d 45%, #ffc01e 100%);
  box-shadow: 0 0 0 3px var(--navy), 0 6px 12px rgba(20, 30, 70, 0.2);
  font-family: 'Lilita One', sans-serif;
  font-size: clamp(15px, 1.6vw, 22px);
  color: var(--navy);
  letter-spacing: 0.03em;
  transform: rotate(-2deg);
  animation: bestPulse 1.1s ease-in-out infinite;
}
@keyframes bestPulse {
  0%, 100% { transform: rotate(-2deg) scale(1); }
  50% { transform: rotate(-2deg) scale(1.06); }
}

.play-btn.again {
  margin-top: clamp(10px, 1.8vh, 18px);
  min-width: clamp(190px, 20vw, 280px);
  font-size: clamp(19px, 2.1vw, 32px);
}

.over-hint {
  margin-top: 0.7em;
  font-weight: 600;
  font-size: clamp(10px, 1vw, 14px);
  letter-spacing: 0.1em;
  color: #a293a6;
}

@media (max-width: 760px), (max-aspect-ratio: 5/6) {
  .title-line { font-size: clamp(40px, 13vw, 100px); }
  .title-wrap { top: clamp(14px, 2.4vh, 30px); }
  .play-wrap { top: 50%; gap: 9px; }
  .play-btn { font-size: clamp(22px, 6vw, 34px); min-width: clamp(160px, 52vw, 240px); }
  .hi-pill { font-size: clamp(12px, 3.6vw, 17px); }
  .start-controls { gap: 7px; bottom: clamp(34px, 5.2vh, 52px); }
  .keycap { min-width: 34px; height: 34px; font-size: 15px; border-radius: 9px; }
  .keycap.wide { min-width: 48px; font-size: 10px; }
  .key-item i { font-size: 9px; letter-spacing: 0.06em; }
  .loading-pill { bottom: clamp(68px, 10vh, 110px); font-size: 10px; }

  .hud-left { top: 8px; left: 7px; gap: 6px; }
  .score-card { min-width: 104px; padding: 0.25em 0.75em 0.35em; border-width: 3px; border-radius: 18px; }
  .score-label { font-size: 7px; letter-spacing: 0.16em; }
  .score-num { font-size: clamp(26px, 7.4vw, 38px); -webkit-text-stroke-width: 2px; }
  .mult-tag { min-width: 46px; font-size: clamp(14px, 4.2vw, 20px); margin: 5px 0 -3px auto; border-width: 2px; }
  .chip-row { gap: 5px; }
  .chip { width: clamp(30px, 8vw, 40px); }
  .chip-ring { padding: 3px; box-shadow: 0 0 0 2px var(--navy), 0 5px 9px rgba(20,30,70,.2); }
  .chip-time { font-size: 7px; }

  .hud-right { top: 8px; right: 7px; }
  .hi-card { gap: 4px; padding: 0.28em 0.55em 0.34em; border-radius: 14px; border-width: 2px; }
  .hi-card .trophy { width: 16px; height: 16px; }
  .hi-label { font-size: 6px; letter-spacing: 0.1em; }
  .hi-num { font-size: clamp(14px, 4vw, 20px); }

  .hud-meter { top: 8px; width: clamp(92px, 26vw, 128px); }
  .meter-label { display: none; }
  .meter-track { height: 17px; border-width: 2px; }
  .meter-guard { width: 20px; height: 20px; }
  .meter-shopper { width: 18px; height: 18px; }

  .play-controls { gap: 6px; padding: 0.28em 0.6em; font-size: 9px; bottom: 6px; }
  .play-controls b { font-size: 1.1em; }
  .mute-btn { width: 34px; height: 34px; border-width: 2px; }

  .over-panel { width: 88vw; padding: 18px 16px 16px; border-width: 4px; }
  .busted { font-size: clamp(38px, 12vw, 62px); }
  .final-score { font-size: clamp(38px, 13vw, 62px); }
  .play-btn.again { min-width: 190px; font-size: 20px; }
}

@media (max-height: 500px) {
  .title-line { font-size: clamp(38px, min(10vw, 21vh), 105px); }
  .play-wrap { top: 55%; gap: 8px; }
  .play-btn { min-width: 170px; font-size: clamp(21px, 4.4vh, 34px); }
  .hi-pill { font-size: clamp(11px, 2.2vh, 16px); }
  .start-controls { bottom: 10px; }
  .keycap { min-width: 32px; height: 32px; font-size: 14px; }
  .keycap.wide { min-width: 46px; font-size: 10px; }
  .score-num { font-size: clamp(26px, 5.4vh, 38px); }
  .over-panel { padding: 14px 20px; }
  .busted { font-size: clamp(36px, 8vh, 56px); }
  .final-score { font-size: clamp(36px, 8.4vh, 56px); }
  .play-btn.again { font-size: 20px; margin-top: 8px; }
}
