/* Number Dash — Sesame-inspired chunky preschool UI */

.dash-root {
  --dash-ink: #263238;
  --dash-yellow: #ffd54f;
  --dash-red: #e53935;
  --dash-blue: #1e88e5;
  --dash-green: #43a047;
  --dash-pink: #f48fb1;
  --dash-orange: #ff9800;
  --dash-sky: #81d4fa;
  --dash-white: #ffffff;
  --outline: 5px;
  --radius-chunky: 1.75rem;
  --ease-pop: cubic-bezier(0.34, 1.4, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #5c9ef0;
  overflow: hidden;
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  color: white;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.dash-chrome {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.65rem;
  padding: max(0.85rem, env(safe-area-inset-top)) 0.9rem 0.55rem;
  pointer-events: none;
}

.dash-chrome > * {
  pointer-events: auto;
}

/* Circular exit — bright + thick white ring */
.dash-exit {
  display: grid;
  place-items: center;
  justify-self: start;
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 999px;
  background: var(--dash-orange);
  border: var(--outline) solid var(--dash-white);
  color: var(--dash-white);
  font-size: 1.55rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.18);
  transition: transform 160ms var(--ease-pop);
}

.dash-exit:active {
  transform: scale(0.9) translateY(3px);
  box-shadow: 0 2px 0 rgba(38, 50, 56, 0.18);
}

.dash-level {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  min-height: 2.85rem;
  padding: 0.35rem 1.1rem;
  border-radius: 999px;
  background: var(--dash-blue);
  border: var(--outline) solid var(--dash-white);
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  letter-spacing: 0.02em;
  color: var(--dash-white);
  white-space: nowrap;
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.16);
  text-shadow: none;
}

.dash-hud-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dash-hearts {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  min-height: 2.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #fff3f3;
  border: var(--outline) solid var(--dash-white);
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.16);
  font-size: 1.7rem;
  line-height: 1;
}

.dash-hearts.is-compact {
  gap: 0.2rem;
  padding: 0.25rem 0.75rem 0.25rem 0.55rem;
}

.dash-heart-count {
  color: var(--dash-red);
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dash-heart {
  display: inline-block;
  color: var(--dash-red);
  -webkit-text-stroke: 2.5px #ffffff;
  paint-order: stroke fill;
  text-shadow:
    1px 0 0 #fff,
    -1px 0 0 #fff,
    0 1px 0 #fff,
    0 -1px 0 #fff;
  transition: transform 180ms var(--ease-pop);
}

.dash-heart.is-empty {
  color: #ffcdd2;
  opacity: 0.7;
  -webkit-text-stroke: 2px #ffffff;
}

.dash-heart.is-lost {
  animation: heart-lost 0.5s var(--ease-pop);
}

@keyframes heart-lost {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35) rotate(-10deg);
  }
  100% {
    transform: scale(1);
  }
}

/* Star score — chunky yellow pill */
.dash-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.85rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--dash-yellow);
  border: var(--outline) solid var(--dash-white);
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--dash-ink);
  white-space: nowrap;
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.16);
}

.dash-badge.is-pulse {
  animation: star-pulse 0.55s var(--ease-pop);
}

@keyframes star-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.16);
  }
}

.dash-stage {
  flex: 1;
  position: relative;
  min-height: 0;
}

#dash-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.dash-flash {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle at 50% 60%,
    rgba(229, 57, 53, 0.32),
    transparent 65%
  );
}

.dash-flash.is-wrong {
  animation: flash-wrong 0.45s var(--ease-out);
}

.dash-flash.is-correct {
  background: radial-gradient(
    circle at 50% 60%,
    rgba(67, 160, 71, 0.32),
    transparent 65%
  );
  animation: flash-correct 0.4s var(--ease-out);
}

@keyframes flash-wrong {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes flash-correct {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Answer tray — sky strip with chunky number tiles */
.dash-answers {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  padding: 1rem 0.85rem max(1.2rem, env(safe-area-inset-bottom));
  background: none;
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 380ms var(--ease-pop),
    opacity 260ms var(--ease-out);
}

.dash-answers.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.dash-answers.is-shake {
  animation: answers-shake 0.42s var(--ease-out);
}

.dash-answers[hidden] {
  display: none !important;
}

@keyframes answers-shake {
  0%,
  100% {
    transform: translateY(0) translateX(0);
  }
  20% {
    transform: translateY(0) translateX(-8px);
  }
  40% {
    transform: translateY(0) translateX(8px);
  }
  60% {
    transform: translateY(0) translateX(-5px);
  }
  80% {
    transform: translateY(0) translateX(4px);
  }
}

.dash-answer {
  flex: 1 1 0;
  max-width: 7.75rem;
  min-height: 5rem;
  border: var(--outline) solid var(--dash-white);
  border-radius: var(--radius-chunky);
  background: var(--dash-yellow);
  color: var(--dash-ink);
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 8px 0 rgba(38, 50, 56, 0.35),
    0 12px 18px rgba(38, 50, 56, 0.18);
  transform: translateY(14px) scale(0.9);
  opacity: 0;
  transition:
    transform 220ms var(--ease-pop),
    box-shadow 160ms ease,
    background 160ms ease,
    opacity 200ms ease;
}

/* Rotate bright tile colors like Sesame character filters */
.dash-answer:nth-child(1) {
  background: var(--dash-yellow);
}
.dash-answer:nth-child(2) {
  background: var(--dash-pink);
}
.dash-answer:nth-child(3) {
  background: #80deea;
}
.dash-answer:nth-child(4) {
  background: #aed581;
}

.dash-answers.is-visible .dash-answer:not([hidden]) {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.dash-answers.is-visible .dash-answer:nth-child(1):not([hidden]) {
  transition-delay: 40ms;
}
.dash-answers.is-visible .dash-answer:nth-child(2):not([hidden]) {
  transition-delay: 80ms;
}
.dash-answers.is-visible .dash-answer:nth-child(3):not([hidden]) {
  transition-delay: 120ms;
}
.dash-answers.is-visible .dash-answer:nth-child(4):not([hidden]) {
  transition-delay: 160ms;
}

.dash-answer:active:not(:disabled) {
  transform: translateY(6px) scale(0.96);
  box-shadow: 0 2px 0 rgba(38, 50, 56, 0.2);
  transition-delay: 0ms;
}

.dash-answer.is-correct {
  background: var(--dash-green) !important;
  color: var(--dash-white);
  animation: answer-pop 0.4s var(--ease-pop);
}

.dash-answer.is-wrong {
  background: var(--dash-red) !important;
  color: var(--dash-white);
  animation: answer-pop 0.35s var(--ease-out);
}

@keyframes answer-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.dash-answer[hidden] {
  display: none !important;
}

.dash-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.35rem;
  background: rgba(38, 50, 56, 0.4);
  opacity: 0;
  transition: opacity 260ms var(--ease-out);
}

.dash-overlay.is-shown {
  opacity: 1;
}

.dash-overlay[hidden] {
  display: none !important;
}

.dash-overlay__card {
  width: min(100%, 26rem);
  padding: 1.75rem 1.35rem 1.45rem;
  border-radius: 2rem;
  text-align: center;
  background: linear-gradient(160deg, #43a047 0%, #1e88e5 100%);
  border: 6px solid var(--dash-white);
  box-shadow: 0 12px 0 rgba(38, 50, 56, 0.22);
  max-height: calc(100% - 0.5rem);
  overflow-y: auto;
  transform: scale(0.84) translateY(18px);
  opacity: 0;
  transition:
    transform 420ms var(--ease-pop),
    opacity 260ms var(--ease-out);
}

.dash-overlay.is-shown .dash-overlay__card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.dash-overlay[data-mode="gameover"] .dash-overlay__card {
  background: linear-gradient(160deg, #90a4ae 0%, #5c6bc0 100%);
}

.dash-overlay[data-mode="gameover"] .dash-celebrate__side {
  display: none;
}

.dash-celebrate {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.35rem;
  min-height: 4.4rem;
  margin: -0.4rem 0 0.2rem;
}

.dash-celebrate__hero {
  font-size: clamp(3.2rem, 13vw, 4.4rem);
  line-height: 1;
  filter: drop-shadow(0 6px 0 rgba(38, 50, 56, 0.18));
}

.dash-celebrate__side {
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  line-height: 1;
  transform: translateY(-0.6rem) rotate(-12deg);
}

.dash-celebrate__side--r {
  transform: translateY(-0.35rem) rotate(14deg);
}

.dash-overlay.is-shown .dash-celebrate__hero {
  animation: dash-hero-bounce 0.7s var(--ease-pop) 0.1s both;
}

.dash-overlay.is-shown .dash-celebrate__side {
  animation: dash-side-wiggle 0.8s var(--ease-pop) 0.2s both;
}

@keyframes dash-hero-bounce {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(4deg); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes dash-side-wiggle {
  0% { opacity: 0; transform: translateY(8px) scale(0.5); }
  60% { opacity: 1; transform: translateY(-10px) scale(1.15) rotate(-14deg); }
  100% { opacity: 1; }
}

.dash-shop__btn-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.dash-overlay__title {
  margin: 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(2.15rem, 7vw, 2.9rem);
  font-weight: 700;
  color: var(--dash-white);
  text-shadow: 0 3px 0 rgba(38, 50, 56, 0.2);
}

.dash-overlay__sub {
  margin: 0.5rem 0 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dash-white);
  opacity: 0.98;
}

.dash-overlay__hint {
  margin: 1rem 0 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dash-yellow);
}

.dash-overlay__extra {
  margin: 0.3rem 0 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dash-white);
  opacity: 0.92;
}

/* ── End-of-run score + local leaderboard ── */
.dash-board {
  margin-top: 0.9rem;
}

.dash-board[hidden],
.dash-name[hidden] {
  display: none !important;
}

.dash-final {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.8rem 0.6rem;
  border-radius: 1.3rem;
  background: var(--dash-yellow);
  border: 4px solid var(--dash-white);
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.2);
  color: var(--dash-ink);
}

.dash-final__label {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.dash-final__score {
  font-size: clamp(2.4rem, 10vw, 3.2rem);
  font-weight: 800;
  line-height: 1.05;
}

.dash-final__best {
  position: absolute;
  top: -0.8rem;
  right: -0.5rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--dash-red);
  border: 3px solid var(--dash-white);
  color: var(--dash-white);
  font-size: 0.85rem;
  font-weight: 800;
  transform: rotate(8deg);
  animation: best-wiggle 0.9s ease-in-out infinite;
}

.dash-name {
  margin-top: 0.8rem;
}

.dash-name__label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.dash-name__row {
  display: flex;
  gap: 0.4rem;
}

.dash-name__input {
  flex: 1;
  min-width: 0;
  min-height: 2.9rem;
  padding: 0.2rem 0.9rem;
  border-radius: 999px;
  border: 4px solid var(--dash-white);
  background: #fff8e7;
  color: var(--dash-ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.dash-name__input:focus {
  border-color: var(--dash-yellow);
}

.dash-name__save {
  min-height: 2.9rem;
  padding: 0.2rem 1.1rem;
  border-radius: 999px;
  border: 4px solid var(--dash-white);
  background: var(--dash-orange);
  color: var(--dash-white);
  font-family: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 5px 0 rgba(38, 50, 56, 0.2);
  cursor: pointer;
}

.dash-name__save:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(38, 50, 56, 0.2);
}

.dash-board__title {
  margin: 0.9rem 0 0.4rem;
  font-weight: 800;
  font-size: 1.1rem;
}

.dash-board__list {
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: 1.1rem;
  background: #fff8e7;
  border: 4px solid var(--dash-white);
  color: var(--dash-ink);
  text-align: left;
}

.dash-board__list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.55rem;
  border-radius: 0.8rem;
  font-weight: 700;
  font-size: 1rem;
}

.dash-board__list li:nth-child(odd):not(.is-me) {
  background: rgba(38, 50, 56, 0.05);
}

.dash-board__list li.is-me {
  background: #ffe082;
  animation: answer-pop 0.5s var(--ease-pop);
}

.dash-board__rank {
  width: 1.7rem;
  text-align: center;
  font-weight: 800;
}

.dash-board__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.dash-board__lvl {
  font-size: 0.8rem;
  color: #78909c;
}

.dash-board__score {
  min-width: 3.4rem;
  text-align: right;
  font-weight: 800;
  color: #ef6c00;
}

.dash-board__empty {
  justify-content: center;
  color: #78909c;
}

@keyframes best-wiggle {
  0%, 100% { transform: rotate(8deg) scale(1); }
  50% { transform: rotate(-4deg) scale(1.08); }
}

.dash-overlay__action {
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.55rem 1.6rem;
  border: var(--outline) solid var(--dash-white);
  border-radius: 999px;
  background: var(--dash-yellow);
  color: var(--dash-ink);
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 7px 0 rgba(38, 50, 56, 0.2);
  transition: transform 180ms var(--ease-pop), box-shadow 140ms ease;
}

.dash-overlay__action:active {
  transform: translateY(5px) scale(0.97);
  box-shadow: 0 2px 0 rgba(38, 50, 56, 0.2);
}

@media (min-width: 768px) {
  .dash-answer {
    min-height: 6rem;
    max-width: 9.25rem;
  }

  .dash-exit {
    width: 3.4rem;
    height: 3.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-badge.is-pulse,
  .dash-overlay__card,
  .dash-answer,
  .dash-shop__btn,
  .dash-answers,
  .dash-flash,
  .dash-heart.is-lost,
  .dash-overlay,
  .dash-exit {
    animation: none !important;
    transition: none !important;
  }

  .dash-answers.is-visible {
    transform: none;
    opacity: 1;
  }

  .dash-overlay.is-shown .dash-overlay__card {
    transform: none;
    opacity: 1;
  }
}

/* ── Boss meter + Chomper Gym button (under the top bar) ── */
.dash-bossbar {
  position: absolute;
  top: calc(max(0.85rem, env(safe-area-inset-top)) + 3.7rem);
  left: 50%;
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transform: translateX(-50%);
}

.dash-boss-meter,
.dash-gym-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  border-radius: 999px;
  border: 4px solid var(--dash-white);
  box-shadow: 0 5px 0 rgba(38, 50, 56, 0.16);
  color: var(--dash-white);
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
}

.dash-boss-meter {
  padding: 0.15rem 0.75rem 0.15rem 0.45rem;
  background: #6a1b9a;
}

.dash-boss-meter__icon {
  font-size: 1.35rem;
  line-height: 1;
}

.dash-boss-meter__pips {
  display: inline-flex;
  gap: 0.2rem;
}

.dash-boss-meter__pips i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  border: 2px solid var(--dash-white);
}

.dash-boss-meter__pips i.on {
  background: #ff5252;
}

.dash-boss-meter.is-bump {
  animation: dash-boss-bump 0.5s var(--ease-pop) both;
}

.dash-boss-meter.is-ready {
  background: repeating-linear-gradient(-45deg, #e53935 0 10px, #c62828 10px 20px);
  animation: dash-boss-ready 0.35s ease-in-out infinite;
}

.dash-gym-btn {
  justify-content: center;
  width: 2.5rem;
  padding: 0;
  background: #7e57c2;
  font-size: 1.2rem;
}

.dash-boss-meter:active,
.dash-gym-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(38, 50, 56, 0.16);
}

@keyframes dash-boss-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@keyframes dash-boss-ready {
  0%, 100% { transform: rotate(-3deg) scale(1.05); }
  50% { transform: rotate(3deg) scale(1.1); }
}

@media (orientation: landscape) and (max-height: 500px) {
  /* short phones on their side: sit next to the exit button */
  .dash-bossbar {
    top: calc(max(0.85rem, env(safe-area-inset-top)) + 0.3rem);
    left: calc(max(0.9rem, env(safe-area-inset-left)) + 3.8rem);
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-boss-meter.is-ready,
  .dash-boss-meter.is-bump {
    animation: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .dash-overlay {
    padding: 0.5rem;
  }
  .dash-overlay__card {
    padding: 0.8rem 1rem 1rem;
  }
  .dash-celebrate {
    min-height: 2.8rem;
  }
  .dash-celebrate__hero {
    font-size: 2.6rem;
  }
  .dash-board {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0 0.7rem;
    align-items: start;
    margin-top: 0.5rem;
  }
  .dash-final,
  .dash-name {
    grid-column: 1;
  }
  .dash-board__title,
  .dash-board__list {
    grid-column: 2;
  }
  .dash-board__title {
    grid-row: 1;
    margin: 0 0 0.3rem;
  }
  .dash-board__list {
    grid-row: 2 / span 3;
    max-height: 9.5rem;
    overflow-y: auto;
  }
  .dash-overlay[data-mode="gameover"] .dash-overlay__card {
    width: min(40rem, 100%);
  }
  .dash-answer {
    min-height: 3.8rem;
  }
}

/* ── Settings button + pop-up ── */
.dash-settings-btn {
  display: grid;
  place-items: center;
  width: 2.85rem;
  height: 2.85rem;
  padding: 0;
  border-radius: 999px;
  background: #7e57c2;
  border: var(--outline) solid var(--dash-white);
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.16);
  cursor: pointer;
  flex: none;
}

.dash-settings-btn:active {
  transform: translateY(3px) scale(0.95);
  box-shadow: 0 2px 0 rgba(38, 50, 56, 0.16);
}

/* Narrow phones: tighten the top bar so everything fits in one row */
@media (max-width: 430px) {
  .dash-chrome {
    gap: 0.35rem;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }
  .dash-hud-right {
    gap: 0.3rem;
  }
  .dash-exit,
  .dash-settings-btn {
    width: 2.6rem;
    height: 2.6rem;
    --outline: 4px;
  }
  .dash-level {
    min-height: 2.6rem;
    padding: 0.25rem 0.7rem;
    font-size: 1rem;
    --outline: 4px;
  }
  .dash-hearts,
  .dash-badge {
    min-height: 2.6rem;
    --outline: 4px;
  }
  .dash-hearts.is-compact {
    padding: 0.2rem 0.5rem 0.2rem 0.4rem;
    font-size: 1.35rem;
  }
  .dash-badge {
    padding: 0.25rem 0.6rem;
    font-size: 1.05rem;
  }
  .dash-bossbar {
    top: calc(max(0.85rem, env(safe-area-inset-top)) + 3.3rem);
  }
}

.dash-settings {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(38, 50, 56, 0.45);
}

.dash-settings[hidden] {
  display: none !important;
}

.dash-settings__card {
  width: min(23rem, 100%);
  max-height: 100%;
  overflow: auto;
  border-radius: 1.5rem;
  background: #fff8e7;
  border: var(--outline) solid var(--dash-white);
  box-shadow: 0 12px 0 rgba(38, 50, 56, 0.25);
  color: var(--dash-ink);
  animation: settings-pop 0.45s var(--ease-pop) both;
}

.dash-settings__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.7rem 0.7rem 1.1rem;
  background: #7e57c2;
  color: var(--dash-white);
}

.dash-settings__head h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
}

.dash-settings__close {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 999px;
  background: var(--dash-orange);
  border: 4px solid var(--dash-white);
  color: var(--dash-white);
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.dash-settings__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  padding: 0.9rem 0.9rem 0.2rem;
}

.dash-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0.15rem;
  border-radius: 1rem;
  background: var(--dash-white);
  border: 3px solid #eadfc8;
}

.dash-stat b {
  font-size: 1.2rem;
  font-weight: 800;
}

.dash-stat span {
  font-size: 0.72rem;
  font-weight: 700;
  color: #78909c;
}

.dash-settings__section {
  padding: 0.7rem 1rem 0.3rem;
  text-align: center;
}

.dash-settings__section + .dash-settings__section {
  border-top: 3px dashed #eadfc8;
  margin-top: 0.4rem;
  padding-bottom: 1rem;
}

.dash-settings__label {
  margin: 0.2rem 0 0.15rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.dash-settings__help,
.dash-settings__hint {
  margin: 0;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.35;
  color: #546e7a;
}

.dash-settings__hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.dash-settings__restart,
.dash-hold {
  position: relative;
  width: 100%;
  min-height: 3.1rem;
  margin-top: 0.7rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: var(--outline) solid var(--dash-white);
  font-family: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.22);
  cursor: pointer;
}

.dash-settings__restart {
  background: var(--dash-yellow);
  color: var(--dash-ink);
}

.dash-settings__restart:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 rgba(38, 50, 56, 0.22);
}

.dash-hold {
  background: var(--dash-red);
  color: var(--dash-white);
  overflow: hidden;
  touch-action: none;
}

.dash-hold__fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: #b71c1c;
}

.dash-hold.is-holding .dash-hold__fill {
  width: 100%;
  transition: width 2s linear;
}

.dash-hold__text {
  position: relative;
}

.dash-hold.is-done {
  background: var(--dash-green);
}

.dash-hold.is-done .dash-hold__fill {
  display: none;
}

@keyframes settings-pop {
  from { opacity: 0; transform: scale(0.72) translateY(18px); }
  to { opacity: 1; transform: none; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .dash-settings {
    padding: 0.5rem;
  }
  .dash-settings__stats {
    padding-top: 0.5rem;
  }
  .dash-settings__section {
    padding-top: 0.4rem;
  }
  .dash-settings__card {
    width: min(40rem, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .dash-settings__head,
  .dash-settings__stats {
    grid-column: 1 / -1;
  }
  .dash-settings__section + .dash-settings__section {
    border-top: 0;
    border-left: 3px dashed #eadfc8;
    margin-top: 0;
  }
}

/* ── JG-043: tap Chomper to dress him up ── */
.dash-wardrobe {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  background: rgba(38, 50, 56, 0.45);
}
.dash-wardrobe[hidden] {
  display: none !important;
}
.dash-wardrobe__card {
  width: min(26rem, 100%);
  max-height: calc(100% - 5rem);
  text-align: center;
}
.dash-wardrobe__head {
  background: #43a047;
}
.dash-wardrobe__me img {
  display: block;
  width: 7rem;
  height: 7rem;
  margin: 0.4rem auto 0;
}
.dash-wardrobe__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.45rem;
  padding: 0.3rem 0.9rem 0.4rem;
}
.dash-wardrobe__hat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.25rem 0.2rem 0.35rem;
  border-radius: 1rem;
  background: var(--dash-white);
  border: 3px solid #eadfc8;
  color: var(--dash-ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.72rem;
  line-height: 1.15;
  cursor: pointer;
}
.dash-wardrobe__hat img {
  width: 3.6rem;
  height: 3.6rem;
}
.dash-wardrobe__hat.is-on {
  border-color: var(--dash-green);
  background: #e8f5e9;
  box-shadow: 0 0 0 3px rgba(67, 160, 71, 0.35);
}
.dash-wardrobe__hat:active:not(:disabled) {
  transform: scale(0.94);
}
.dash-wardrobe__hat.is-locked {
  color: #90a4ae;
  cursor: default;
}
.dash-wardrobe__hat.is-locked img {
  filter: brightness(0) opacity(0.2);
}
.dash-wardrobe__hint {
  margin: 0.2rem 0 0.8rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #78909c;
}
/* the way out is outside the card, so it's never scrolled away */
.dash-wardrobe__go {
  min-width: min(18rem, 80vw);
  min-height: 3.6rem;
  padding: 0.45rem 1.4rem;
  border-radius: 999px;
  border: var(--outline) solid var(--dash-white);
  background: var(--dash-yellow);
  color: var(--dash-ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: 0 6px 0 rgba(38, 50, 56, 0.35);
  cursor: pointer;
}
.dash-wardrobe__go:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 rgba(38, 50, 56, 0.35);
}
@media (max-height: 520px) {
  .dash-wardrobe__card {
    width: min(40rem, 100%);
    display: block; /* not the settings card's two-column grid */
  }
  .dash-wardrobe__me {
    display: none;
  }
  .dash-wardrobe__grid {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }
  .dash-wardrobe__hat img {
    width: 100%;
    max-width: 3.2rem;
    height: auto;
  }
  .dash-wardrobe__hint {
    margin: 0 0 0.5rem;
  }
  .dash-wardrobe__hat span {
    display: none;
  }
  .dash-wardrobe__go {
    min-height: 3rem;
  }
}
