.hh-mascot {
  display: inline-grid;
  max-inline-size: 100%;
  vertical-align: middle;
  transition: transform 360ms cubic-bezier(.2, 1.5, .44, 1);
}

.hh-hedgehog {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
  overflow: visible;
}

.hh-eyes, .hh-quills, .hh-pose, .hh-wave-paw, .hh-mood-accent {
  transform-box: fill-box;
}

.hh-eyes {
  transform-origin: center;
  animation: hh-blink 5.8s ease-in-out infinite;
}

.hh-quills {
  transform-origin: 75% 88%;
  animation: hh-quills-sway 3.6s ease-in-out infinite;
}

.hh-pose { transform-origin: center bottom; }
.hh-mood-sleep .hh-pose { animation: hh-nap 3.8s ease-in-out infinite; }
.hh-mood-sleep .hh-quills { animation: none; }

.hh-wave-paw {
  transform-origin: 82% 85%;
  animation: hh-wave 2.7s ease-in-out infinite;
}

.hh-mood-sleep .hh-mood-accent, .hh-mood-cheer .hh-mood-accent {
  animation: hh-float 2.8s ease-in-out infinite;
}

@media (hover: hover) {
  .hh-mascot:hover { transform: translateY(-5px) rotate(-6deg) scale(1.07); }
  .hh-mascot:hover .hh-quills { animation-duration: 1.2s; }
}

@keyframes hh-blink {
  0%, 42%, 47%, 89%, 94%, 100% { transform: scaleY(1); }
  44.5%, 91.5% { transform: scaleY(.12); }
}

@keyframes hh-quills-sway {
  0%, 100% { transform: rotate(-1.4deg) scale(1); }
  50% { transform: rotate(1.1deg) scale(1.014, 1.025); }
}

@keyframes hh-nap {
  0%, 100% { transform: translateY(1px) scale(1.025, .93); }
  50% { transform: translateY(1px) scale(1, .96); }
}

@keyframes hh-wave {
  0%, 32%, 100% { transform: rotate(0); }
  8%, 23% { transform: rotate(14deg); }
  15% { transform: rotate(-9deg); }
}

@keyframes hh-float {
  0%, 100% { transform: translateY(0); opacity: .75; }
  50% { transform: translateY(-4px); opacity: 1; }
}

html:has(.hh-overlay[open]) { overflow: hidden; }

.hh-overlay {
  --hh-paper: #FBF6EE;
  --hh-forest: #2F6B4F;
  --hh-ink: #23262F;
  --hh-rank-color: #A46C22;
  --hh-spring: cubic-bezier(.21, 1.35, .38, 1);
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: none;
  max-block-size: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--hh-ink);
  font: 1rem/1.5 Nunito, system-ui, sans-serif;
}

.hh-overlay::backdrop {
  background: #183629a8;
  backdrop-filter: blur(5px);
  animation: hh-veil-in 250ms ease-out both;
}

.hh-overlay-scroll {
  position: absolute;
  inset: 0;
  display: flex;
  box-sizing: border-box;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.hh-reward {
  position: relative;
  box-sizing: border-box;
  inline-size: min(100%, 430px);
  margin: auto;
  padding: 18px clamp(18px, 6vw, 36px) 29px;
  border: 1px solid #fff9ef;
  border-radius: 20px;
  background: radial-gradient(ellipse at 50% 15%, #fffaf2 10%, transparent 73%), var(--hh-paper);
  box-shadow: 0 26px 88px #132d254a, 0 7px 20px #2d322b28;
  text-align: center;
  animation: hh-card-in 490ms var(--hh-spring) both;
}

.hh-overlay-rank .hh-reward {
  border-color: #fff1cd;
  border-color: color-mix(in srgb, var(--hh-rank-color) 36%, #fff9ee);
  background: radial-gradient(ellipse at 62% 19%, #ffeac4 0%, transparent 64%), var(--hh-paper);
  background: radial-gradient(ellipse at 62% 19%, color-mix(in srgb, var(--hh-rank-color) 21%, #fff5e6) 0%, transparent 64%), var(--hh-paper);
}

.hh-close {
  display: grid;
  position: absolute;
  z-index: 1;
  inset-block-start: 12px;
  inset-inline-end: 12px;
  place-items: center;
  box-sizing: border-box;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 1px solid #2f6b4f26;
  border-radius: 50%;
  background: #fdfbf1;
  color: var(--hh-forest);
  cursor: pointer;
  transition: background-color 160ms ease;
}

.hh-close:hover { background-color: #e9f0e1; }

.hh-close:focus-visible, .hh-demo-button:focus-visible, .hh-mood-button:focus-visible {
  outline: 2px solid #2F6B4F;
  outline-offset: 3px;
}

.hh-stage {
  position: relative;
  display: grid;
  place-items: center;
  block-size: clamp(139px, 25svh, 178px);
  isolation: isolate;
}

.hh-stage-glow {
  position: absolute;
  z-index: -1;
  inline-size: min(96%, 260px);
  block-size: 100%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #f4a93b43, transparent 70%);
}

.hh-stage-spark {
  position: absolute;
  inline-size: 19px;
  block-size: 19px;
  background: #F4A93B;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: hh-twinkle 660ms var(--hh-spring) 520ms both;
}

.hh-stage-spark-left { inset-block-start: 37%; inset-inline-start: 16%; }
.hh-stage-spark-right { inset-block-start: 65%; inset-inline-end: 14%; inline-size: 13px; block-size: 13px; background: #E2557A; }
.hh-overlay-rank .hh-stage-spark-right { inset-block-start: 75%; inset-inline-end: 9%; }

.hh-arrival {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  inline-size: min(65%, 192px);
  transform: translateX(var(--hh-mascot-offset, 0px));
}

.hh-overlay-rank .hh-arrival {
  --hh-mascot-offset: clamp(-59px, -13vw, -40px);
  inline-size: min(56%, 173px);
}

.hh-roll, .hh-unroll { grid-area: 1 / 1; }
.hh-roll { inline-size: 63%; animation: hh-roll-in 780ms cubic-bezier(.18, .77, .25, 1) both; }
.hh-unroll { display: block; transform-origin: 52% 84%; animation: hh-unroll 680ms var(--hh-spring) 450ms both; }

.hh-rank-emblem {
  position: relative;
  display: grid;
  grid-area: 1 / 1;
  place-items: center;
  inline-size: clamp(69px, 19vw, 92px);
  aspect-ratio: 1;
  margin-inline-start: clamp(112px, 31vw, 149px);
  transform-origin: center;
  animation: hh-badge-in 690ms var(--hh-spring) 780ms both;
}

.hh-rank-rays {
  position: absolute;
  z-index: -1;
  inset: -35%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 8deg, #f9bf60aa 0deg 10deg, transparent 11deg 30deg);
  mask-image: radial-gradient(closest-side, #000 38%, #0009 72%, transparent 100%);
  animation: hh-rays 3.5s ease-out 780ms both;
}

.hh-rank-icon {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  inline-size: 100%;
  block-size: 100%;
  border: 2px solid var(--hh-rank-color);
  border-radius: 50%;
  background: linear-gradient(152deg, #fff8dd 16%, #ffedc0 65%, #f6d693);
  background: linear-gradient(152deg, #fff8dd 16%, color-mix(in srgb, var(--hh-rank-color) 27%, #fff2ca) 84%);
  box-shadow: inset 0 0 0 4px #fff8d4, 0 8px 23px #985a2638;
  font-size: clamp(1.9rem, 10vw, 2.75rem);
  line-height: 1;
}

.hh-reward-title {
  margin: 0;
  color: var(--hh-forest);
  font-size: clamp(1.7rem, 6vw, 2.35rem);
  font-weight: 850;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.hh-rank-name {
  margin: 7px 0 0;
  color: #7c5329;
  color: color-mix(in srgb, var(--hh-rank-color) 30%, #302129);
  font-size: 1.18rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  animation: hh-badge-in 490ms var(--hh-spring) 890ms both;
}

.hh-reward-subtitle {
  margin: 8px auto 0;
  max-inline-size: 30ch;
  color: #51554D;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.hh-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  margin-block-start: 20px;
  padding: 7px 15px;
  border: 1px solid #e7b86b;
  border-radius: 999px;
  background: #fff1d5;
  color: #573715;
  font-size: 1.22rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  line-height: 1.28;
}

.hh-score-star { flex: none; fill: #F4A93B; stroke: #A45D13; stroke-width: 1; stroke-linejoin: round; }
.hh-score-value { min-inline-size: max(1ch, var(--hh-score-width, 1ch)); text-align: center; }
.hh-score-hit { animation: hh-score-pulse 425ms var(--hh-spring); }

.hh-particles {
  position: absolute;
  z-index: 2;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
}

.hh-visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hh-is-closing::backdrop { animation: hh-veil-out 220ms ease-in both; }
.hh-is-closing .hh-overlay-scroll { animation: hh-veil-out 220ms ease-in both; }
.hh-is-closing .hh-particles { animation: hh-veil-out 190ms ease-in both; }

@keyframes hh-veil-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes hh-veil-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes hh-card-in {
  from { opacity: 0; transform: translateY(15px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes hh-roll-in {
  0% { opacity: 0; transform: translate(-100%, 45%) rotate(-260deg) scale(.72); }
  17% { opacity: 1; }
  55% { transform: translate(-10%, -20%) rotate(-28deg) scale(.98); }
  73% { opacity: 1; }
  100% { opacity: 0; transform: translate(0, 14%) rotate(38deg) scale(.58); }
}
@keyframes hh-unroll {
  0% { opacity: 0; transform: translateY(11%) rotate(-13deg) scale(.5, .52); }
  31% { opacity: 1; }
  58% { transform: translateY(-9%) rotate(4deg) scale(1.05, 1.04); }
  82% { transform: translateY(1%) rotate(-1deg) scale(1.03, .96); }
  100% { opacity: 1; transform: none; }
}
@keyframes hh-twinkle {
  from { opacity: 0; transform: rotate(-22deg) scale(.2); }
  to { opacity: .88; transform: rotate(10deg) scale(1); }
}
@keyframes hh-badge-in {
  from { opacity: 0; transform: translateY(13px) scale(.68); }
  to { opacity: 1; transform: none; }
}
@keyframes hh-rays {
  from { opacity: 0; transform: rotate(-21deg) scale(.72); }
  30% { opacity: 1; }
  to { opacity: .7; transform: rotate(26deg) scale(1); }
}
@keyframes hh-score-pulse {
  0%, 100% { transform: scale(1); }
  32% { transform: scale(1.27) rotate(-8deg); }
}

.hh-demo {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  min-block-size: 100svh;
  margin: 0;
  padding: clamp(20px, 6vw, 80px);
  background: radial-gradient(ellipse at 0 0, #f5e5cf 0, transparent 55%), #FBF6EE;
  color: #23262F;
  font: 1rem/1.5 Nunito, system-ui, sans-serif;
}

.hh-demo-main { inline-size: min(100%, 940px); }

.hh-demo-title {
  margin: 0 0 clamp(18px, 4vw, 32px);
  color: #2F6B4F;
  font-size: clamp(2.2rem, 7.5vw, 4.25rem);
  font-weight: 850;
  letter-spacing: -.055em;
  line-height: 1.06;
}

.hh-demo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 17px; }

.hh-demo-panel {
  box-sizing: border-box;
  padding: clamp(16px, 3.7vw, 30px);
  border: 1px solid #eaddcc;
  border-radius: 20px;
  background: #fffaf3;
  box-shadow: 0 9px 23px #6c494308;
}

.hh-demo-panel-title { margin: 0 0 16px; font-size: 1.22rem; font-weight: 800; }
.hh-demo-actions { display: grid; gap: 10px; }

.hh-demo-button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  box-sizing: border-box;
  inline-size: 100%;
  padding: 10px;
  border: 1px solid #e5d5c1;
  border-radius: 14px;
  background: #fffdf8;
  color: #23262F;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, transform 240ms cubic-bezier(.2, 1.35, .4, 1);
}

.hh-demo-button:hover { border-color: #afc5aa; background: #f6f9ee; transform: translateY(-2px); }
.hh-demo-button:active { transform: translateY(1px); }
.hh-demo-button-text { display: grid; line-height: 1.27; }
.hh-demo-button-text > strong { font-size: .95rem; }
.hh-demo-button-text > small { margin-block-start: 4px; color: #586158; font-size: .79rem; }
.hh-demo-arrow { padding-inline-end: 4px; color: #2F6B4F; }

.hh-demo-symbol {
  display: grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  border-radius: 12px;
  background: #fbeccb;
  color: #925910;
  font-size: 1.35rem;
  line-height: 1;
}

.hh-demo-symbol-many { background: #fae3e7; color: #A02B4D; }
.hh-demo-symbol-rank { background: #e7efdd; color: #2F6B4F; }

.hh-demo-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-block-size: 153px;
  margin-block-end: 13px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #d7e4ce;
  border-radius: 15px;
  background: radial-gradient(ellipse at 44% 28%, #fff7dc, transparent 68%), #e9efdd;
}

.hh-demo-preview::before, .hh-demo-preview::after {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: #cfdfbf80;
  content: '';
}

.hh-demo-preview::before { inset: 69% -18% -36% 14%; transform: rotate(-10deg); }
.hh-demo-preview::after { inset: 75% 39% -48% -20%; transform: rotate(11deg); }
.hh-demo-preview .hh-hedgehog { inline-size: min(136px, 35vw); }
.hh-demo-moods { display: flex; flex-wrap: wrap; gap: 6px; }

.hh-mood-button {
  min-block-size: 44px;
  padding: 5px 10px;
  border: 1px solid #dfd4c6;
  border-radius: 999px;
  background: #fffaf3;
  color: #37423b;
  font: 700 .82rem/1.2 Nunito, system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.hh-mood-button:hover { background: #e9f1e3; }
.hh-mood-button[aria-pressed='true'] { border-color: #2F6B4F; background: #2F6B4F; color: #fffaf0; }

@media (max-width: 670px) {
  .hh-demo-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-height: 420px) {
  .hh-stage { block-size: 116px; }
  .hh-arrival { inline-size: min(62%, 145px); }
  .hh-overlay-rank .hh-arrival { inline-size: min(56%, 139px); }
  .hh-reward { padding-block-end: 18px; }
  .hh-score { margin-block-start: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .hh-mascot, .hh-close, .hh-demo-button, .hh-mood-button { transition: none; }
  .hh-mascot:hover, .hh-demo-button:hover, .hh-demo-button:active { transform: none; }
  .hh-eyes, .hh-quills, .hh-wave-paw, .hh-mood-sleep .hh-mood-accent, .hh-mood-cheer .hh-mood-accent,
  .hh-overlay::backdrop, .hh-reward, .hh-unroll, .hh-stage-spark,
  .hh-rank-emblem, .hh-rank-rays, .hh-rank-name, .hh-score-hit { animation: none; }
  .hh-mood-sleep .hh-pose { animation: none; transform: scale(1.025, .94); }
  .hh-overlay-rank .hh-rank-rays { opacity: .7; }
  .hh-roll, .hh-particles { display: none; }
}
