@font-face {
  font-family: 'Fredoka';
  src: url('/vendor/fonts/fredoka-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #f5efe8;
  --card: #fffdfb;
  --ink: #2d2624;
  --muted: #9a8680;
  --soft: #d8c9c1;
  --line: #e8ded5;
  --red: #ec3a33;
  --red-hi: #ff6b5d;
  --red-side: #b8211c;
  --gold: #ffb52e;
  --gold-hi: #ffd986;
  --gold-side: #cc840a;
  --kibble: #b8581f;
  --green: #74c27b;
  --shadow: 0 14px 40px rgba(96, 64, 44, 0.14);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  font-weight: 450;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition: opacity 0.8s ease;
}

body.loading #scene,
body.loading .hud,
body.loading .press-zone {
  opacity: 0;
}

/* ------------------------------------------------------------------ HUD */

.hud {
  position: fixed;
  top: max(26px, calc(env(safe-area-inset-top) + 14px));
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.hud-label {
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 2.1vw, 22px);
  font-weight: 500;
}

#cat-name {
  color: #8b736b;
}

.timer {
  margin: 0;
  font-size: clamp(58px, 11vw, 124px);
  font-weight: 640;
  line-height: 1;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.timer .d {
  font-size: 0.62em;
  margin-right: 0.18em;
  color: #5b4c47;
}

.hud.urgent .timer {
  animation: urgent-timer 1s ease-in-out infinite;
}

.hud.dead .timer {
  color: var(--soft);
}

@keyframes urgent-timer {
  50% {
    color: #c9362e;
  }
}

.record {
  margin: 4px auto 0;
  width: fit-content;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.record svg {
  width: 15px;
  height: 15px;
  fill: #e0b04f;
}

.record b {
  font-weight: 600;
  color: #7e6a63;
}

.record.beaten {
  color: #c78a10;
}

.record.beaten b {
  color: #c78a10;
}

.stats {
  display: inline-flex;
  align-items: center;
  gap: clamp(16px, 3vw, 30px);
  margin-top: clamp(10px, 1.6vh, 18px);
}

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  min-width: 0;
}

.stat small {
  display: block;
  color: var(--muted);
  font-size: 15px;
  font-weight: 450;
  margin-bottom: 1px;
}

.stat b {
  font-size: 30px;
  font-weight: 620;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#left-label {
  color: var(--muted);
  font-size: 17px;
}

.stat.bump b {
  animation: bump 0.35s ease;
}

@keyframes bump {
  40% {
    transform: scale(1.25);
  }
}

/* Belly and health gauges */
.gauges {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.gauge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

.g-icon {
  width: 17px;
  height: 17px;
  flex: none;
}

.belly .g-icon {
  fill: var(--kibble);
}

.health .g-icon {
  fill: #ef7f93;
}

.g-bar {
  width: 92px;
  height: 8px;
  border-radius: 999px;
  background: #ece3da;
  overflow: hidden;
}

.g-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: #f3a35b;
  transition:
    width 0.25s linear,
    background-color 0.4s;
}

.health .g-bar i {
  background: #7cc47f;
}

.belly .g-bar {
  position: relative;
}

.belly .g-bar::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--notch, 75%);
  width: 2px;
  background: rgba(255, 255, 255, 0.95);
}

.gauge small {
  min-width: 52px;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gauge.warn .g-bar i {
  background: #f2b450;
}

.gauge.bad .g-bar i {
  background: #e8574e;
}

.gauge.bad small {
  color: #c8342d;
  font-weight: 560;
}

.gauge.bad {
  animation: gauge-alarm 1s ease-in-out infinite;
}

@keyframes gauge-alarm {
  50% {
    background: rgba(255, 228, 224, 0.9);
  }
}

.divider {
  width: 1.5px;
  height: 50px;
  background: var(--line);
}

.stat-icon {
  flex: none;
}

.kibble-icon {
  width: 36px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(ellipse 70% 60% at 45% 35%, #d9813f, var(--kibble) 72%);
  box-shadow: 0 6px 0 #8d3d12;
  transform: rotate(-14deg) translateY(-3px);
}

.paw-icon {
  width: 34px;
  height: 34px;
  fill: #dccbc4;
}

/* ------------------------------------------------------------------ corners */

.corner {
  position: fixed;
  top: max(16px, calc(env(safe-area-inset-top) + 8px));
  z-index: 5;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  padding: 8px 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s;
}

.corner:hover {
  background: rgba(255, 255, 255, 0.6);
}

.corner.right {
  right: 12px;
}

.corner.right {
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--soft);
  text-decoration-thickness: 1.5px;
}

.corner.left {
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--soft);
}

.dot.online {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(116, 194, 123, 0.5);
  animation: live 2.4s infinite;
}

.dot.local {
  background: var(--gold);
}

@keyframes live {
  70% {
    box-shadow: 0 0 0 7px rgba(116, 194, 123, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(116, 194, 123, 0);
  }
}

/* ------------------------------------------------------------------ the button */

.press-zone {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px));
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.press-zone > * {
  pointer-events: auto;
}

/* Equal side columns keep the button centred whatever chips are showing. */
.press-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  gap: clamp(8px, 2.4vw, 26px);
}

.big {
  --depth: 26px;
  --push: 0px;
  position: relative;
  width: 280px;
  height: 160px;
  flex: none;
}

.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ring .track {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}

.ring .fill {
  fill: none;
  stroke: var(--red);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.12s ease;
}

.ring .pip {
  fill: var(--line);
  transition: fill 0.15s, r 0.15s;
}

.ring .pip.on {
  fill: var(--red);
}

.big.boost .ring .fill,
.big.boost .ring .pip.on {
  stroke: var(--gold);
  fill: var(--gold);
}

.big.boost .ring .fill {
  fill: none;
}

.ring .flash {
  fill: none;
  stroke: var(--red);
  stroke-width: 8;
  opacity: 0;
}

.ring .flash.go {
  animation: flash 0.5s ease-out;
}

@keyframes flash {
  0% {
    opacity: 0.5;
    stroke-width: 2;
  }
  100% {
    opacity: 0;
    stroke-width: 22;
  }
}

.base {
  position: absolute;
  left: 30px;
  right: 30px;
  top: 52px;
  height: 92px;
  border-radius: 50%;
  background: linear-gradient(180deg, #faf8f6 0%, #e9e4df 100%);
  box-shadow:
    0 12px 0 #d3ccc5,
    0 24px 26px rgba(110, 76, 54, 0.18);
  transition: box-shadow 0.08s;
}

.cap {
  position: absolute;
  left: 58px;
  right: 58px;
  top: 18px;
  height: 76px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse 80% 75% at 50% 28%, var(--red-hi), var(--red) 60%, #dc2a24 100%);
  box-shadow:
    0 var(--depth) 0 var(--red-side),
    inset 0 -6px 12px rgba(120, 0, 0, 0.12),
    inset 0 3px 6px rgba(255, 255, 255, 0.4);
  transform: translateY(var(--push));
  transition:
    transform 0.07s ease-out,
    box-shadow 0.07s ease-out,
    background 0.3s;
  outline: none;
}

.cap span {
  display: block;
  color: #fff;
  font-size: 34px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 0 rgba(140, 18, 12, 0.25);
  transform: translateY(-1px);
}

.cap:focus-visible {
  box-shadow:
    0 var(--depth) 0 var(--red-side),
    0 0 0 4px rgba(236, 58, 51, 0.25);
}

.big.down {
  --depth: 10px;
  --push: 16px;
}

.big.down .base {
  box-shadow:
    0 12px 0 #d3ccc5,
    0 18px 16px rgba(110, 76, 54, 0.2);
}

.big.shake {
  animation: shake 0.13s linear;
}

@keyframes shake {
  25% {
    transform: translate(-1.5px, 0.5px);
  }
  50% {
    transform: translate(1.5px, -0.5px);
  }
  75% {
    transform: translate(-1px, 0);
  }
}

.big.boost .cap {
  background: radial-gradient(ellipse 80% 75% at 50% 28%, var(--gold-hi), var(--gold) 60%, #f3a011 100%);
  box-shadow:
    0 var(--depth) 0 var(--gold-side),
    inset 0 -6px 12px rgba(120, 60, 0, 0.12),
    inset 0 3px 6px rgba(255, 255, 255, 0.5);
}

.big.boost .cap span {
  text-shadow: 0 2px 0 rgba(150, 80, 0, 0.3);
}

.big.urgent::before {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  top: 34px;
  height: 128px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(236, 58, 51, 0.32), rgba(236, 58, 51, 0) 70%);
  animation: glow 0.9s ease-in-out infinite;
}

@keyframes glow {
  50% {
    transform: scale(1.12);
    opacity: 0.4;
  }
}

.big.off .cap {
  background: radial-gradient(ellipse 80% 75% at 50% 28%, #efe8e3, #ddd3cc 70%);
  box-shadow: 0 var(--depth) 0 #c6bbb3;
  cursor: default;
}

.big.off .cap span {
  color: #b8aaa3;
  text-shadow: none;
}

.boost-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 3px 11px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(204, 132, 10, 0.3);
}

.plus {
  position: absolute;
  left: 50%;
  top: 10px;
  font-size: 22px;
  font-weight: 650;
  color: var(--red);
  pointer-events: none;
  animation: plus 0.75s ease-out forwards;
}

.big.boost .plus {
  color: var(--gold-side);
}

@keyframes plus {
  0% {
    opacity: 1;
    transform: translate(calc(-50% + var(--dx, 0px)), 0) scale(0.8);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px) * 1.6), -46px) scale(1.1);
  }
}

.paw-pop {
  position: absolute;
  width: 16px;
  height: 16px;
  fill: #e4d4cd;
  pointer-events: none;
  animation: paw-pop 0.9s ease-out forwards;
}

@keyframes paw-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(var(--r, 0deg));
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(var(--r, 0deg));
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 16px)) scale(0.9) rotate(var(--r, 0deg));
  }
}

.chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.chips.left {
  align-items: flex-end;
}

.chips.right {
  align-items: flex-start;
}

.chip.wait {
  cursor: default;
  opacity: 0.7;
  box-shadow: none;
  font-variant-numeric: tabular-nums;
}

#ad-play svg {
  fill: #ee7799;
}

.play-badge {
  margin: 0 0 8px;
  background: #fff;
  color: #d4517a;
  border-radius: 999px;
  padding: 7px 15px 7px 10px;
  font-size: 15px;
  font-weight: 560;
  box-shadow: 0 8px 22px rgba(212, 81, 122, 0.18);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: pop 0.3s ease-out;
}

.play-badge b {
  font-variant-numeric: tabular-nums;
}

.yarn-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    repeating-linear-gradient(35deg, transparent 0 3px, rgba(255, 255, 255, 0.55) 3px 4.5px),
    radial-gradient(circle at 35% 30%, #ffb3c8, #ee7799);
  animation: spin 3s linear infinite;
}

body.playtime #scene {
  cursor:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='11' fill='%23ff9fba' stroke='%23ee7799' stroke-width='2'/%3E%3Cpath d='M8 12c5 3 11 3 16 0M7 18c6 3 12 3 18 0M13 6c-3 6-3 14 0 20' stroke='%23ee7799' stroke-width='1.6' fill='none'/%3E%3C/svg%3E")
      16 16,
    pointer;
}

.ripple {
  position: absolute;
  width: 54px;
  height: 22px;
  margin: -11px 0 0 -27px;
  border-radius: 50%;
  border: 2.5px solid #ee7799;
  pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
}

@keyframes ripple {
  from {
    transform: scale(0.3);
    opacity: 1;
  }
  to {
    transform: scale(1.4);
    opacity: 0;
  }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--line);
  background: rgba(255, 253, 251, 0.8);
  color: #806c66;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 13px 8px 10px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(96, 64, 44, 0.07);
  transition:
    transform 0.15s,
    opacity 0.2s,
    background 0.2s;
  white-space: nowrap;
}

.chip:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff;
}

.chip:disabled {
  opacity: 0.55;
  cursor: default;
}

.chip svg {
  width: 13px;
  height: 13px;
  fill: var(--red);
}

#ad-boost svg {
  fill: var(--gold);
}

.chip b {
  font-weight: 650;
  color: var(--ink);
}

.alert {
  margin: 0 0 8px;
  background: #fff;
  color: #c8342d;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(200, 52, 45, 0.18);
  animation: alert 1s ease-in-out infinite;
}

.alert.sick {
  color: #4f9a45;
  box-shadow: 0 8px 22px rgba(79, 154, 69, 0.2);
}

.alert b {
  font-variant-numeric: tabular-nums;
}

@keyframes alert {
  50% {
    transform: scale(1.05);
  }
}

.hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  animation: hint 1.6s ease-in-out infinite;
}

@keyframes hint {
  50% {
    transform: translateY(-4px);
  }
}

.toast {
  margin: 4px 0 0;
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.3s,
    transform 0.3s;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast b {
  color: var(--red);
  font-weight: 600;
}

/* ------------------------------------------------------------------ floating fx */

#fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.fx {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  transition: opacity 0.3s;
}

.fx.out {
  opacity: 0;
}

.fx > span {
  display: block;
  transform: translate(-50%, -100%);
  white-space: nowrap;
}

.tag > span {
  background: #fff;
  color: #75625b;
  font-size: 13px;
  font-weight: 560;
  padding: 3px 9px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(96, 64, 44, 0.14);
  animation: pop 0.25s ease-out;
}

.tag.mine > span {
  background: var(--red);
  color: #fff;
}

.say > span {
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 560;
  padding: 6px 13px;
  border-radius: 18px 18px 18px 5px;
  box-shadow: 0 6px 16px rgba(96, 64, 44, 0.14);
  animation: pop 0.25s ease-out;
  transform: translate(-10%, -100%);
}

.say.sad > span {
  color: #c8342d;
}

.say.think > span {
  color: var(--muted);
  font-size: 20px;
  line-height: 0.8;
  padding: 2px 12px 10px;
}

.say.crunch > span {
  font-size: 13px;
  color: var(--kibble);
}

.thought > span {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 16px rgba(96, 64, 44, 0.16);
  animation:
    pop 0.3s ease-out,
    bob 1.4s ease-in-out infinite;
  transform: translate(-30%, -100%);
}

.thought .kib {
  width: 24px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(ellipse 70% 60% at 45% 35%, #d9813f, var(--kibble) 72%);
  box-shadow: 0 4px 0 #8d3d12;
  transform: translateY(-2px) rotate(-10deg);
  animation: want 1.4s ease-in-out infinite;
}

.thought i {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(96, 64, 44, 0.14);
}

.thought i:nth-of-type(1) {
  width: 11px;
  height: 11px;
  left: 2px;
  bottom: -9px;
}

.thought i:nth-of-type(2) {
  width: 6px;
  height: 6px;
  left: -5px;
  bottom: -18px;
}

@keyframes bob {
  50% {
    margin-top: -5px;
  }
}

@keyframes want {
  50% {
    transform: translateY(-2px) rotate(8deg) scale(1.08);
  }
}

@keyframes pop {
  0% {
    scale: 0.5;
    opacity: 0;
  }
  70% {
    scale: 1.08;
  }
  100% {
    scale: 1;
    opacity: 1;
  }
}

/* Sick of a dirty litter box: a tiny box with stink lines in the bubble. */
.thought .box {
  position: relative;
  width: 24px;
  height: 11px;
  margin-top: 8px;
  border-radius: 3px;
  background: linear-gradient(#f2dfb8 0 35%, #a9dccf 35%);
}

.thought .box s {
  position: absolute;
  bottom: 12px;
  width: 3px;
  height: 9px;
  border-radius: 2px;
  background: #8fcf7a;
  animation: stink-wave 1s ease-in-out infinite;
}

.thought .box s:nth-child(1) {
  left: 3px;
}

.thought .box s:nth-child(2) {
  left: 10px;
  animation-delay: 0.2s;
}

.thought .box s:nth-child(3) {
  left: 17px;
  animation-delay: 0.4s;
}

@keyframes stink-wave {
  50% {
    transform: translateX(2px) skewX(-15deg);
  }
}

.petter > span {
  font-size: 13px;
  font-weight: 560;
  color: #e86a8a;
  animation: rise 1.4s ease-out forwards;
}

.healed > span {
  font-size: 15px;
  font-weight: 650;
  color: #4f9a45;
  animation: rise 1.2s ease-out forwards;
}

/* A sick cat with a clean box wants cuddles. */
.thought .heart {
  width: 18px;
  height: 18px;
  background: #ff8aa1;
  clip-path: path('M9 16.5S1.5 12 1.5 6.8A3.8 3.8 0 0 1 9 5a3.8 3.8 0 0 1 7.5 1.8C16.5 12 9 16.5 9 16.5z');
  animation: want 1.2s ease-in-out infinite;
}

.growl > span {
  font-size: 13px;
  font-weight: 560;
  font-style: italic;
  color: #b07a52;
  animation: rumble 1.6s ease-out forwards;
}

@keyframes rumble {
  0% {
    opacity: 0;
  }
  15%,
  70% {
    opacity: 1;
  }
  20%,
  30%,
  40% {
    translate: -2px 0;
  }
  25%,
  35%,
  45% {
    translate: 2px 0;
  }
  100% {
    opacity: 0;
    translate: 0 -16px;
  }
}

.say.sick > span {
  color: #4f9a45;
}

/* Over the litter box: the smell, and who just cleaned it. */
.stink > span {
  display: flex;
  gap: 10px;
  transform: translate(-50%, -100%);
  opacity: 0;
  transition: opacity 0.6s;
}

.stink.on > span {
  opacity: 0.55;
}

.stink.strong > span {
  opacity: 1;
}

.stink i {
  width: 6px;
  height: 26px;
  border-radius: 6px;
  border: 2.5px solid #9fd38b;
  border-top-color: transparent;
  border-bottom-color: transparent;
  animation: stink-rise 1.8s ease-in-out infinite;
}

.stink i:nth-child(2) {
  animation-delay: 0.6s;
  height: 32px;
}

.stink i:nth-child(3) {
  animation-delay: 1.2s;
}

@keyframes stink-rise {
  0% {
    transform: translateY(8px) scaleY(0.7);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(-14px) scaleY(1.1) skewX(-12deg);
    opacity: 0;
  }
}

.clean-tag > span {
  background: rgba(255, 255, 255, 0.92);
  color: #6f9b88;
  font-size: 13px;
  font-weight: 560;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(96, 64, 44, 0.12);
  opacity: 0;
  scale: 0.8;
  transition:
    opacity 0.3s,
    scale 0.3s;
}

.clean-tag.on > span {
  opacity: 1;
  scale: 1;
}

.clean-tag.dirty > span {
  color: #fff;
  background: #7cbf6c;
  animation: nudge 1.2s ease-in-out infinite;
}

@keyframes nudge {
  50% {
    scale: 1.08;
  }
}

.scooper > span {
  font-size: 13px;
  font-weight: 560;
  color: #6f9b88;
  animation: rise 1.4s ease-out forwards;
}

.zzz > span {
  font-size: 22px;
  font-weight: 650;
  color: #a7a1cf;
  animation: rise 2.6s ease-out forwards;
}

.heart > span {
  font-size: 24px;
  color: #ff7f95;
  animation: rise 1.6s ease-out forwards;
}

.sparkle > span {
  font-size: 16px;
  color: #ffcd52;
  animation: rise 1.4s ease-out forwards;
}

@keyframes rise {
  0% {
    opacity: 0;
    translate: 0 6px;
    scale: 0.6;
  }
  20% {
    opacity: 1;
    scale: 1;
  }
  100% {
    opacity: 0;
    translate: var(--dx, 0px) -70px;
    scale: 1.2;
  }
}

/* ------------------------------------------------------------------ dev tools */

/* Top right, under the leaderboard link: clear of the button and the ad chips. */
.debug {
  position: fixed;
  right: 10px;
  top: max(54px, calc(env(safe-area-inset-top) + 46px));
  z-index: 15;
  width: 230px;
  background: rgba(45, 38, 36, 0.86);
  color: #f5efe8;
  border-radius: 14px;
  padding: 8px 12px 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  user-select: none;
}

.debug summary {
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  color: #f2b450;
}

.dbg-row {
  display: grid;
  grid-template-columns: 46px 1fr 38px;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.dbg-row input {
  width: 100%;
  accent-color: #f2b450;
}

.dbg-row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dbg-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.dbg-presets button {
  border: 0;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
}

.dbg-presets button:hover {
  background: rgba(255, 255, 255, 0.26);
}

.dbg-note {
  margin: 8px 0 0;
  font-size: 11px;
  opacity: 0.6;
}

/* ------------------------------------------------------------------ menu */

.popover {
  position: fixed;
  z-index: 10;
  top: max(60px, calc(env(safe-area-inset-top) + 52px));
  left: 12px;
  width: min(290px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 16px 12px;
  box-shadow: var(--shadow);
  animation: pop-down 0.2s ease-out;
  user-select: text;
}

@keyframes pop-down {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

.popover small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.field input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px 11px;
  font-size: 17px;
  background: #fff;
  outline: none;
  user-select: text;
}

.field input:focus {
  border-color: #f0a29d;
}

.hint-unique {
  opacity: 0.75;
}

.name-msg {
  min-height: 1.2em;
  margin: 5px 2px 0;
  font-size: 12.5px;
  color: #5f9a57;
}

.name-msg.error {
  color: #c8342d;
}

.mine {
  margin: 14px 0 6px;
}

.mine b {
  font-size: 36px;
  font-weight: 620;
  line-height: 1;
  margin-right: 8px;
}

.mine .scooped {
  margin: 6px 0 0;
}

.mine span {
  color: var(--muted);
  font-size: 14px;
}

.row-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  padding: 11px 2px;
  font-size: 15px;
}

.row-btn b {
  font-weight: 560;
  color: var(--muted);
}

.how {
  border-top: 1px solid var(--line);
  padding: 11px 2px 2px;
  font-size: 15px;
}

.how summary {
  cursor: pointer;
  list-style: none;
}

.how summary::after {
  content: ' ›';
  color: var(--muted);
}

.how[open] summary::after {
  content: ' ⌄';
}

.how p {
  color: #6f5f59;
  font-size: 14px;
  line-height: 1.4;
  margin: 8px 0;
}

.mode {
  margin: 8px 2px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.how a {
  color: var(--ink);
}

.menu-links {
  display: flex;
  gap: 14px;
  margin: 10px 2px 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.menu-links a {
  color: var(--muted);
  text-decoration: none;
}

.menu-links a:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------------ leaderboard page */

.page {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  overflow-y: auto;
  user-select: text;
  animation: page-in 0.25s ease-out;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.page-inner {
  max-width: 540px;
  margin: 0 auto;
  padding: max(26px, calc(env(safe-area-inset-top) + 16px)) 20px 70px;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}

.page h2 {
  font-size: clamp(40px, 9vw, 54px);
  font-weight: 640;
  margin: 18px 0 0;
  line-height: 1;
}

.page .sub {
  color: var(--muted);
  margin: 6px 0 18px;
}

.page h3 {
  margin: 34px 0 10px;
  font-size: 15px;
  font-weight: 560;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tabs {
  display: inline-flex;
  background: #ece3da;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 14px;
}

.tabs button {
  border: 0;
  background: transparent;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 15px;
  color: var(--muted);
}

.tabs button[aria-selected='true'] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(96, 64, 44, 0.1);
}

.ranks,
.cats {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ranks li {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 14px;
  font-size: 18px;
}

.ranks li:nth-child(odd) {
  background: rgba(255, 253, 251, 0.7);
}

.ranks .n {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: #efe7df;
}

.ranks li:nth-child(1) .n {
  background: #ffd76a;
  color: #8a5b00;
}

.ranks li:nth-child(2) .n {
  background: #e4e1e6;
  color: #6c6672;
}

.ranks li:nth-child(3) .n {
  background: #f3c39b;
  color: #8a4c1d;
}

.ranks .who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranks .count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ranks li.you {
  background: #ffeee9;
}

.ranks li.you .who {
  color: var(--red);
  font-weight: 560;
}

.ranks .empty {
  display: block;
  color: var(--muted);
  text-align: center;
  padding: 26px;
}

.you-rank {
  color: var(--muted);
  margin: 10px 12px 0;
  font-size: 15px;
}

.record-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(96, 64, 44, 0.06);
}

.record-card .time {
  font-size: 28px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
}

.record-card small,
.cats small {
  display: block;
  color: var(--muted);
  font-size: 13.5px;
}

.face {
  flex: none;
  width: 42px;
  height: 38px;
  filter: drop-shadow(0 2px 3px rgba(96, 64, 44, 0.16));
}

.record-card .face {
  width: 54px;
  height: 48px;
}

.cats li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}

.cats .grow {
  flex: 1;
  min-width: 0;
}

.cats .dur {
  font-variant-numeric: tabular-nums;
  font-weight: 560;
}

/* ------------------------------------------------------------------ modals */

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(245, 239, 232, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade 0.3s ease-out;
}

.modal.soft {
  background: rgba(245, 239, 232, 0.55);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.ad-card,
.over-card {
  width: min(360px, 100%);
  background: var(--card);
  border-radius: 28px;
  padding: 22px 24px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: pop 0.35s ease-out;
}

.gate-card {
  width: min(340px, 100%);
  background: var(--card);
  border-radius: 28px;
  padding: 22px 24px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: pop 0.35s ease-out;
}

.gate-face .face {
  width: 64px;
  height: 58px;
}

.gate-card h3 {
  margin: 6px 0 6px;
  font-size: 22px;
  font-weight: 620;
}

.gate-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.gate-card input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 19px;
  text-align: center;
  background: #fff;
  outline: none;
  user-select: text;
}

.gate-card input:focus {
  border-color: #f0a29d;
}

.gate-card .name-msg {
  margin: 6px 0 12px;
  min-height: 1.3em;
}

.gate-go {
  border: 0;
  background: var(--red);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  padding: 11px 24px;
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--red-side);
}

.gate-go:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--red-side);
}

.gate-later {
  display: block;
  margin: 10px auto 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
}

.ad-tag {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
}

.ad-art {
  height: 150px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffe4d6, #f8d3e3);
  display: grid;
  place-items: center;
}

.yarn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background:
    repeating-linear-gradient(35deg, transparent 0 9px, rgba(255, 255, 255, 0.45) 9px 12px),
    repeating-linear-gradient(-40deg, transparent 0 11px, rgba(160, 40, 80, 0.15) 11px 13px),
    radial-gradient(circle at 35% 30%, #ff9cbc, #e8628f);
  box-shadow: 0 10px 20px rgba(200, 80, 120, 0.25);
  animation: spin 6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ad-card h3 {
  margin: 16px 0 4px;
  font-size: 22px;
  font-weight: 620;
}

.ad-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.ad-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.ad-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--red);
  border-radius: inherit;
}

.ad-reward {
  min-height: 1.4em;
  margin-top: 14px !important;
  color: var(--ink) !important;
  font-weight: 560;
}

.ad-close {
  border: 0;
  background: var(--red);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--red-side);
}

.ad-close:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--red-side);
}

.over-card small {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--muted);
}

.over-halo {
  width: 64px;
  height: 18px;
  margin: 14px auto 6px;
  border-radius: 50%;
  border: 5px solid #ffd65c;
  box-shadow: 0 0 18px rgba(255, 214, 92, 0.6);
  animation: halo 2.2s ease-in-out infinite;
}

@keyframes halo {
  50% {
    transform: translateY(-5px);
  }
}

.over-name {
  margin: 6px 0 0;
  font-size: 19px;
  color: #6f5f59;
}

.over-name b {
  color: var(--ink);
  font-weight: 600;
}

.over-time {
  margin: 2px 0 6px;
  font-size: 52px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.over-record {
  display: inline-block;
  margin: 0 0 8px;
  background: var(--gold);
  color: #fff;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}

.over-stats {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.over-next {
  margin: 16px 0 0;
  color: #8b736b;
  font-size: 15px;
}

.dots i {
  font-style: normal;
  animation: dot 1.2s infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot {
  50% {
    opacity: 0.2;
  }
}

/* ------------------------------------------------------------------ small screens */

@media (max-width: 560px) {
  .gauges {
    gap: 6px;
    margin-top: 6px;
  }
  .gauge {
    padding: 4px 8px 4px 7px;
    gap: 5px;
  }
  .g-bar {
    width: 64px;
  }
  .gauge small {
    min-width: 0;
    font-size: 12px;
  }
  .hud {
    top: max(54px, calc(env(safe-area-inset-top) + 44px));
  }
  .stat small {
    font-size: 13px;
  }
  .stat b {
    font-size: 25px;
  }
  #left-label {
    font-size: 14px;
  }
  .kibble-icon {
    width: 28px;
    height: 19px;
    box-shadow: 0 5px 0 #8d3d12;
  }
  .paw-icon {
    width: 27px;
    height: 27px;
  }
  .divider {
    height: 40px;
  }
  /* Chips in one wrapping row above the button. */
  .press-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    flex-wrap: wrap;
    row-gap: 2px;
    column-gap: 8px;
    max-width: 100vw;
    padding: 0 10px;
  }
  .press-row::before {
    content: '';
    order: 1;
    flex-basis: 100%;
  }
  .chips {
    display: contents;
  }
  .big {
    order: 2;
    zoom: 0.84;
  }
  .chip {
    font-size: 13px;
    padding: 6px 11px 6px 9px;
  }
}

@media (max-height: 640px) {
  .big {
    zoom: 0.8;
  }
  .stats {
    margin-top: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
