:root {
  color-scheme: light;
  --design-width: 1500;
  --design-height: 2668;
  --ink: #4a2b12;
  --cream: #fff3d4;
  --orange: #f18427;
  --green: #29943d;
  --red: #c74331;
  --shadow: 0 18px 44px rgba(33, 20, 10, 0.28);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #2b2b2b;
  user-select: none;
}

button {
  padding: 0;
  border: 0;
  font: inherit;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: #303030;
}

.game-canvas {
  position: relative;
  width: min(100vw, calc(100svh * 1500 / 2668));
  height: min(100svh, calc(100vw * 2668 / 1500));
  aspect-ratio: 1500 / 2668;
  overflow: hidden;
  background: #8bc657;
  box-shadow: var(--shadow);
}

.scene,
.animal,
.hud,
.grid-layer,
.target-ring,
.feedback-bubble,
.control-row,
.image-button,
.overlay {
  position: absolute;
}

.scene {
  left: 0;
  width: 100%;
  pointer-events: none;
}

.bg-farm {
  top: 0;
  height: 100%;
  z-index: 0;
}

.board-frame {
  left: 0;
  top: calc(839 / 2668 * 100%);
  z-index: 3;
}

.exit-button {
  left: calc(72 / 1500 * 100%);
  top: calc(72 / 2668 * 100%);
  z-index: 12;
  width: calc(399 / 1500 * 100%);
}

.exit-button img,
.image-button img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.animal {
  z-index: 2;
  pointer-events: none;
  transform-origin: center bottom;
  isolation: isolate;
}

.animal-base,
.animal-tail {
  position: absolute;
  display: block;
  height: auto;
  pointer-events: none;
}

.animal-base {
  left: 0;
  top: 0;
  width: 100%;
  z-index: 2;
  animation: breathe 2.4s ease-in-out infinite;
  transform-origin: center bottom;
}

.animal-tail {
  z-index: 1;
  animation: tail-idle 1.8s ease-in-out infinite;
}

.animal.is-calling .animal-base {
  animation: animal-call 520ms ease-out;
}

.animal.is-calling .animal-tail {
  animation: tail-active 520ms ease-in-out;
}

.animal-cow {
  left: calc(65 / 1500 * 100%);
  top: calc(291 / 2668 * 100%);
  width: calc(494 / 1500 * 100%);
  height: calc(527 / 2668 * 100%);
}

.cow-tail {
  left: calc(-58 / 494 * 100%);
  top: calc(231 / 527 * 100%);
  width: calc(131 / 494 * 100%);
  transform-origin: 75% 34%;
}

.animal-dog {
  left: calc(636 / 1500 * 100%);
  top: calc(398 / 2668 * 100%);
  width: calc(346 / 1500 * 100%);
  height: calc(441 / 2668 * 100%);
}

.dog-tail {
  left: calc(292 / 346 * 100%);
  top: calc(261 / 441 * 100%);
  width: calc(82 / 346 * 100%);
  transform-origin: 10% 71%;
}

.animal-cat {
  left: calc(1009 / 1500 * 100%);
  top: calc(449 / 2668 * 100%);
  width: calc(296 / 1500 * 100%);
  height: calc(397 / 2668 * 100%);
}

.cat-tail {
  left: calc(260 / 296 * 100%);
  top: calc(182 / 397 * 100%);
  width: calc(107 / 296 * 100%);
  transform-origin: 44% 91%;
}

.hud {
  left: calc(515 / 1500 * 100%);
  top: calc(54 / 2668 * 100%);
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: calc(900 / 1500 * 100%);
}

.game-canvas.is-menu .hud,
.game-canvas.is-menu .control-row {
  opacity: 0;
  pointer-events: none;
}

.hud-card {
  min-height: 44px;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 2px solid rgba(118, 66, 22, 0.24);
  border-radius: 7px;
  background: rgba(255, 244, 211, 0.9);
  box-shadow: 0 4px 10px rgba(84, 52, 24, 0.12);
}

.hud-card span {
  font-size: clamp(10px, 2.4vw, 15px);
  font-weight: 900;
}

.hud-card strong {
  font-size: clamp(15px, 4vw, 24px);
  line-height: 1;
}

.grid-layer {
  left: calc(142 / 1500 * 100%);
  top: calc(972 / 2668 * 100%);
  z-index: 5;
  width: calc(1224 / 1500 * 100%);
  height: calc(1224 / 2668 * 100%);
}

.fruit-cell {
  position: absolute;
  width: calc(306 / 1224 * 100%);
  height: calc(306 / 1224 * 100%);
  display: grid;
  place-items: center;
  transition: transform 160ms ease, filter 160ms ease;
}

.fruit-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.fruit-cell.refreshing {
  animation: fruit-pop 260ms ease-out;
}

.target-ring {
  z-index: 6;
  border: 5px solid rgba(255, 136, 28, 0.86);
  border-radius: 18px;
  box-shadow: 0 0 0 6px rgba(255, 249, 220, 0.56);
  pointer-events: none;
  animation: target-confirm 520ms ease-out forwards;
}

.feedback-bubble {
  left: 50%;
  top: calc(900 / 2668 * 100%);
  z-index: 18;
  min-width: 120px;
  padding: 8px 16px;
  border-radius: 999px;
  color: white;
  font-size: clamp(15px, 4.2vw, 28px);
  font-weight: 1000;
  text-align: center;
  background: rgba(43, 139, 55, 0.95);
  transform: translateX(-50%);
  box-shadow: 0 8px 24px rgba(50, 30, 12, 0.24);
}

.feedback-bubble.is-wrong {
  background: rgba(194, 61, 45, 0.95);
}

.control-row {
  left: 0;
  right: 0;
  bottom: calc(53 / 2668 * 100%);
  z-index: 8;
  height: calc(339 / 2668 * 100%);
}

.control-button {
  top: 0;
  z-index: 1;
  width: calc(284 / 1500 * 100%);
  touch-action: manipulation;
}

.control-button[data-action="pack"] {
  left: calc(67 / 1500 * 100%);
  width: calc(339 / 1500 * 100%);
}

.control-button[data-action="grass"] {
  left: calc(590 / 1500 * 100%);
}

.control-button[data-action="bone"] {
  left: calc(876 / 1500 * 100%);
}

.control-button[data-action="fish"] {
  left: calc(1162 / 1500 * 100%);
}

.control-button .state-pressed {
  display: none;
}

.control-button:active,
.control-button.is-pressed {
  transform: translateY(2px);
}

.control-button:active .state-normal,
.control-button.is-pressed .state-normal {
  display: none;
}

.control-button:active .state-pressed,
.control-button.is-pressed .state-pressed {
  display: block;
}

.overlay {
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 22, 12, 0.42);
}

.start-overlay {
  z-index: 35;
  padding: 0;
  background: #78cdf5;
}

.start-scene {
  position: absolute;
  inset: 0;
}

.start-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.start-loading {
  --loading-progress: 8%;
  position: absolute;
  left: 50%;
  top: calc(2068 / 2668 * 100%);
  z-index: 3;
  width: calc(720 / 1500 * 100%);
  transform: translateX(-50%);
  color: #fff6df;
  text-align: center;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

.start-loading-copy {
  display: block;
  margin-bottom: calc(18 / 2668 * 100svh);
  color: #fff6df;
  font-size: clamp(24px, min(6vw, 3.5svh), 54px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  -webkit-text-stroke: clamp(2px, min(0.8vw, 0.48svh), 7px) #ad4f20;
  paint-order: stroke fill;
  text-shadow:
    0 3px 0 #7d3517,
    0 6px 10px rgba(74, 31, 10, 0.38);
}

.start-loading-track {
  position: relative;
  height: clamp(30px, min(7vw, 4svh), 58px);
  overflow: hidden;
  border: clamp(3px, min(0.85vw, 0.5svh), 7px) solid #ad4f20;
  border-radius: 999px;
  background: rgba(255, 247, 215, 0.9);
  box-shadow:
    0 4px 0 rgba(116, 50, 18, 0.22),
    0 10px 18px rgba(63, 31, 12, 0.22);
}

.start-loading-track::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 12%;
  height: 28%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

.start-loading-fill {
  position: absolute;
  inset: clamp(4px, min(0.6vw, 0.34svh), 8px) auto clamp(4px, min(0.6vw, 0.34svh), 8px) clamp(4px, min(0.6vw, 0.34svh), 8px);
  width: var(--loading-progress);
  max-width: calc(100% - clamp(8px, min(1.2vw, 0.68svh), 16px));
  border-radius: 999px;
  background: linear-gradient(90deg, #b24e1d 0%, #c65d24 52%, #da8230 100%);
  box-shadow: inset 0 2px 0 rgba(255, 221, 149, 0.22);
  transition: width 180ms ease-out;
}

.start-scene.is-loading .start-menu-button {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.985);
}

.start-scene.is-ready .start-loading {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

.start-scene.is-ready .start-menu-button {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 220ms ease, transform 120ms ease, filter 120ms ease;
}

.start-menu-button {
  position: absolute;
  z-index: 2;
  touch-action: manipulation;
  transition: transform 120ms ease, filter 120ms ease;
}

.start-menu-button img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.start-menu-button:active {
  transform: translateY(2px) scale(0.985);
  filter: brightness(0.96);
}

.start-play-button {
  left: calc(492 / 1500 * 100%);
  top: calc(2149 / 2668 * 100%);
  width: calc(516 / 1500 * 100%);
}

.start-rules-button {
  left: calc(492 / 1500 * 100%);
  top: calc(2375 / 2668 * 100%);
  width: calc(516 / 1500 * 100%);
}

.start-settings-button {
  left: calc(101 / 1500 * 100%);
  top: calc(2380 / 2668 * 100%);
  width: calc(181 / 1500 * 100%);
}

.start-leaderboard-button {
  left: calc(1216 / 1500 * 100%);
  top: calc(2380 / 2668 * 100%);
  width: calc(181 / 1500 * 100%);
}

.start-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(24 / 2668 * 100%);
  z-index: 2;
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(12px, min(3.4vw, 2svh), 28px);
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 2px 8px rgba(36, 22, 12, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  .start-loading,
  .start-loading-fill,
  .start-scene.is-ready .start-menu-button {
    transition: none;
  }
}

.access-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 7%;
  background: rgba(33, 24, 14, 0.34);
  backdrop-filter: blur(5px);
}

.access-lock-overlay.hidden {
  display: none;
}

.access-lock-card {
  width: min(82%, 520px);
  display: grid;
  justify-items: center;
  padding: clamp(22px, min(5vw, 3svh), 42px);
  border: 3px solid rgba(132, 80, 34, 0.18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 252, 243, 0.96), rgba(255, 241, 207, 0.94));
  box-shadow: 0 22px 54px rgba(44, 25, 11, 0.3);
  text-align: center;
}

.access-lock-icon {
  width: clamp(84px, min(22vw, 13svh), 156px);
  height: auto;
  margin-bottom: clamp(10px, min(3vw, 2svh), 18px);
  filter: drop-shadow(0 10px 16px rgba(95, 51, 9, 0.25));
}

.access-lock-card h1 {
  margin: 0;
  color: #4a2b12;
  font-size: clamp(20px, min(5.2vw, 3.7svh), 42px);
  line-height: 1.2;
}

.access-lock-card p {
  margin: clamp(10px, min(2.4vw, 1.7svh), 18px) 0 0;
  color: #6f4220;
  font-size: clamp(14px, min(3.4vw, 2.35svh), 25px);
  font-weight: 750;
  line-height: 1.45;
}

.access-lock-action {
  margin-top: clamp(16px, min(4vw, 2.8svh), 28px);
  min-width: clamp(128px, 34vw, 220px);
  padding: clamp(10px, min(2.6vw, 1.9svh), 17px) clamp(18px, min(5vw, 3svh), 32px);
  border: 3px solid rgba(115, 67, 24, 0.16);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #ff9f2d 0%, #f18119 100%);
  box-shadow: 0 9px 0 rgba(139, 75, 17, 0.5), 0 16px 26px rgba(90, 52, 20, 0.22);
  font-size: clamp(15px, min(4vw, 2.75svh), 28px);
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.start-leaderboard-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 7.4%;
  background: rgba(38, 25, 17, 0.42);
  backdrop-filter: blur(2px);
}

.start-leaderboard-modal.is-hidden {
  display: none;
}

.start-leaderboard-panel {
  position: relative;
  width: min(100%, 520px);
  padding: 22px 20px 18px;
  overflow: hidden;
  border: 3px solid rgba(132, 80, 34, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 252, 243, 0.98) 0%, rgba(255, 241, 207, 0.96) 100%);
  box-shadow: 0 22px 48px rgba(59, 34, 16, 0.28);
}

.start-leaderboard-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 218, 115, 0.38), transparent 25%),
    radial-gradient(circle at 92% 4%, rgba(77, 159, 67, 0.18), transparent 28%);
  pointer-events: none;
}

.start-leaderboard-close {
  position: absolute;
  right: 14px;
  top: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(120, 73, 34, 0.18);
  border-radius: 999px;
  color: #6f4220;
  background: rgba(255, 255, 255, 0.74);
  font-size: 24px;
  font-weight: 1000;
  line-height: 1;
}

.start-leaderboard-title {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 3px;
  margin-bottom: 8px;
  text-align: center;
}

.start-leaderboard-title span {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  color: #2f7b39;
  background: rgba(217, 245, 198, 0.82);
  font-size: clamp(11px, 3vw, 14px);
  font-weight: 1000;
}

.start-leaderboard-title h2 {
  margin: 0;
  color: #2c2118;
  font-size: clamp(28px, 7.2vw, 40px);
  line-height: 1.05;
}

#startLeaderboardCount {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 12px;
  color: #6b604f;
  font-size: clamp(12px, 3.3vw, 16px);
  font-weight: 900;
  text-align: center;
}

.rules-overlay {
  z-index: 42;
  padding: 0;
}

.settings-overlay {
  z-index: 43;
  padding: 0;
}

.rules-card {
  position: absolute;
  left: calc(68 / 1500 * 100%);
  top: 50%;
  z-index: 1;
  width: calc(1390 / 1500 * 100%);
  aspect-ratio: 1390 / 1849;
  color: #5a2f12;
  transform: translateY(-50%);
}

.rules-card-bg,
.rules-box-bg {
  position: absolute;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.rules-card-bg {
  inset: 0;
}

.rules-title-badge,
.rules-box,
.rules-actions {
  position: absolute;
  z-index: 2;
}

.rules-title-badge {
  left: calc(160 / 1390 * 100%);
  top: calc(126 / 1849 * 100%);
  width: calc(530 / 1390 * 100%);
  height: auto;
  pointer-events: none;
}

.rules-box {
  left: calc(130 / 1390 * 100%);
  width: calc(1090 / 1390 * 100%);
  height: calc(532 / 1849 * 100%);
}

.rules-pack-box {
  top: calc(324 / 1849 * 100%);
}

.rules-feed-box {
  top: calc(880 / 1849 * 100%);
}

.rules-box > *:not(.rules-box-bg) {
  position: absolute;
  z-index: 1;
}

.rules-apple-grid {
  left: calc(160 / 1090 * 100%);
  top: calc(48 / 532 * 100%);
  width: calc(350 / 1090 * 100%);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(18 / 300 * 100%);
}

.rules-apple-grid span {
  display: grid;
  place-items: center;
  border: 3px solid rgba(128, 75, 25, 0.42);
  border-radius: 10px;
  background: rgba(255, 232, 178, 0.92);
  box-shadow: inset 0 0 0 2px rgba(184, 122, 48, 0.2);
  animation: rules-apple-pop 2.4s ease-in-out infinite;
}

.rules-apple-grid span:nth-child(2) {
  animation-delay: 120ms;
}

.rules-apple-grid span:nth-child(3) {
  animation-delay: 240ms;
}

.rules-apple-grid span:nth-child(4) {
  animation-delay: 360ms;
}

.rules-apple-grid img {
  display: block;
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.rules-pack-icon {
  left: calc(660 / 1090 * 100%);
  top: calc(76 / 532 * 100%);
  width: calc(230 / 1090 * 100%);
  height: auto;
  animation: rules-target-pulse 2.4s ease-in-out infinite;
}

.rules-hand {
  width: calc(117 / 1090 * 100%);
  height: auto;
  pointer-events: none;
  transform-origin: 18% 18%;
}

.rules-pack-hand {
  left: calc(820 / 1090 * 100%);
  top: calc(246 / 532 * 100%);
  animation: rules-hand-tap-pack 2.4s ease-in-out infinite;
}

.rules-box-text,
.rules-sound-text {
  margin: 0;
  color: #5a2f12;
  font-weight: 1000;
  line-height: 1.28;
}

.rules-box-text {
  left: calc(38 / 1090 * 100%);
  right: calc(38 / 1090 * 100%);
  font-size: clamp(12px, min(2.05vw, 1.48svh), 27px);
  line-height: 1.22;
}

.rules-pack-text {
  top: calc(382 / 532 * 100%);
}

.rules-sound-text {
  display: none;
}

.rules-animals-demo {
  left: calc(74 / 1090 * 100%);
  top: calc(84 / 532 * 100%);
  width: calc(640 / 1090 * 100%);
  height: auto;
  animation: rules-animal-breathe 2.4s ease-in-out infinite;
}

.rules-grass-icon {
  left: calc(780 / 1090 * 100%);
  top: calc(82 / 532 * 100%);
  width: calc(190 / 1090 * 100%);
  height: auto;
  animation: rules-target-pulse 2.4s ease-in-out infinite;
}

.rules-grass-hand {
  left: calc(900 / 1090 * 100%);
  top: calc(220 / 532 * 100%);
  animation: rules-hand-tap-grass 2.4s ease-in-out infinite;
}

.rules-feed-text {
  top: calc(350 / 532 * 100%);
}

.rules-actions {
  left: calc(140 / 1390 * 100%);
  top: calc(1466 / 1849 * 100%);
  width: calc(1110 / 1390 * 100%);
  height: calc(237 / 1849 * 100%);
}

.rules-nav-button {
  position: absolute;
  top: 0;
  width: calc(497 / 1110 * 100%);
  height: 100%;
  display: grid;
  place-items: center;
  color: #5a2f12;
  font-size: clamp(18px, min(4.9vw, 3.55svh), 57px);
  font-weight: 1000;
  line-height: 1;
  white-space: nowrap;
  background: center / contain no-repeat url("./assets/ui/btn_setting_option_normal.png");
}

.rules-nav-button span {
  transform: translateY(-2%);
}

.rules-start-button {
  right: 0;
  color: white;
  background-image: url("./assets/ui/btn_setting_option_selected.png");
}

.rules-back-button {
  left: 0;
}

.rules-nav-button:active {
  transform: translateY(2px) scale(0.99);
  filter: brightness(0.98);
}

.settings-card {
  position: absolute;
  left: calc(68 / 1500 * 100%);
  top: 50%;
  z-index: 1;
  width: calc(1390 / 1500 * 100%);
  aspect-ratio: 1390 / 1849;
  color: #5a2f12;
  transform: translateY(-50%);
}

.settings-card-bg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.settings-title,
.settings-label,
.switch-button,
.settings-divider,
.interval-options,
.interval-option,
.setting-done-button {
  position: absolute;
  z-index: 2;
}

.settings-title {
  left: 0;
  top: calc(165 / 1849 * 100%);
  width: 100%;
  margin: 0;
  color: #673817;
  font-size: clamp(28px, 4.8vw, 58px);
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.settings-label {
  color: #5a2f12;
  font-size: clamp(18px, 3vw, 34px);
  font-weight: 1000;
  line-height: 1;
  white-space: nowrap;
}

.settings-label-bgm {
  left: calc(133 / 1390 * 100%);
  top: calc(465 / 1849 * 100%);
}

.settings-label-refresh {
  left: calc(133 / 1390 * 100%);
  top: calc(730 / 1849 * 100%);
}

.settings-divider {
  left: calc(130 / 1390 * 100%);
  top: calc(642 / 1849 * 100%);
  width: calc(1125 / 1390 * 100%);
  height: 2px;
  background: rgba(206, 154, 79, 0.28);
}

.switch-button {
  left: calc(861 / 1390 * 100%);
  top: calc(430 / 1849 * 100%);
  width: calc(345 / 1390 * 100%);
  height: calc(187 / 1849 * 100%);
  background: center / contain no-repeat url("./assets/ui/btn_bgm_off.png");
}

.switch-button.is-on {
  background-image: url("./assets/ui/btn_bgm_on.png");
}

.switch-button:active {
  transform: translateY(2px) scale(0.98);
  filter: brightness(0.96);
}

.interval-options {
  inset: 0;
  pointer-events: none;
}

.interval-option {
  width: calc(497 / 1390 * 100%);
  height: calc(237 / 1849 * 100%);
  display: grid;
  place-items: center;
  color: #5a2f12;
  font-size: clamp(17px, 3.2vw, 34px);
  font-weight: 1000;
  line-height: 1;
  white-space: nowrap;
  background: center / contain no-repeat url("./assets/ui/btn_setting_option_normal.png");
  pointer-events: auto;
}

.interval-option.is-selected {
  color: white;
  background-image: url("./assets/ui/btn_setting_option_selected.png");
}

.interval-option:active {
  transform: translateY(2px) scale(0.99);
  filter: brightness(0.98);
}

.interval-1750 {
  left: calc(137 / 1390 * 100%);
  top: calc(876 / 1849 * 100%);
}

.interval-2000 {
  left: calc(690 / 1390 * 100%);
  top: calc(876 / 1849 * 100%);
}

.interval-2250 {
  left: calc(137 / 1390 * 100%);
  top: calc(1151 / 1849 * 100%);
}

.interval-2500 {
  left: calc(690 / 1390 * 100%);
  top: calc(1151 / 1849 * 100%);
}

.setting-done-button {
  left: calc(295 / 1390 * 100%);
  top: calc(1452 / 1849 * 100%);
  width: calc(775 / 1390 * 100%);
  height: calc(237 / 1849 * 100%);
  display: grid;
  place-items: center;
  color: white;
  font-size: clamp(24px, 4.3vw, 46px);
  font-weight: 1000;
  line-height: 1;
  white-space: nowrap;
}

.setting-done-button img,
.setting-done-button span {
  grid-area: 1 / 1;
}

.setting-done-button img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.setting-done-button span {
  z-index: 1;
}

.setting-done-button .done-pressed {
  display: none;
}

.setting-done-button:active {
  transform: translateY(2px);
}

.setting-done-button:active .done-normal {
  display: none;
}

.setting-done-button:active .done-pressed {
  display: block;
}

.dialog {
  width: min(74%, 430px);
  padding: 20px 18px;
  border: 4px solid #85501f;
  border-radius: 10px;
  color: #573115;
  text-align: center;
  background: rgba(255, 242, 205, 0.97);
  box-shadow: 0 18px 46px rgba(28, 19, 10, 0.34);
}

.result-dialog {
  width: min(86%, 520px);
  max-height: min(88%, 720px);
  overflow: auto;
}

.dialog h1,
.dialog h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 6.8vw, 42px);
  line-height: 1.1;
}

.dialog p {
  margin: 0 0 20px;
  font-size: clamp(13px, 3.5vw, 20px);
  font-weight: 800;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.text-button {
  min-width: 160px;
  padding: 10px 20px;
  border: 3px solid #7d4518;
  border-radius: 8px;
  color: white;
  font-size: clamp(16px, 4.5vw, 24px);
  font-weight: 1000;
  background: #ee7e24;
  box-shadow: inset 0 -4px 0 rgba(108, 51, 13, 0.25);
}

.text-button.secondary {
  color: #5a3214;
  background: #ffefc6;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 14px;
}

.result-grid div {
  padding: 12px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.result-grid dt {
  font-size: clamp(13px, 3.5vw, 18px);
  font-weight: 900;
}

.result-grid dd {
  margin: 4px 0 0;
  font-size: clamp(24px, 7vw, 38px);
  font-weight: 1000;
}

.leaderboard-form {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  text-align: left;
}

.leaderboard-form label {
  color: #4b554c;
  font-size: clamp(13px, 3.5vw, 16px);
  font-weight: 900;
}

.nickname-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(82px, 30%);
  gap: 8px;
}

.nickname-row input {
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  border: 2px solid rgba(88, 53, 24, 0.2);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  font: inherit;
  font-size: clamp(16px, 4.2vw, 20px);
  font-weight: 900;
  outline: none;
}

.nickname-row input:focus {
  border-color: rgba(41, 148, 61, 0.72);
  box-shadow: 0 0 0 3px rgba(41, 148, 61, 0.14);
}

.nickname-button {
  min-width: 0;
  min-height: 48px;
  padding: 0 10px;
  font-size: clamp(15px, 4vw, 19px);
}

.dialog .leaderboard-note {
  min-height: 1.25em;
  margin: 0;
  color: #5c665d;
  font-size: clamp(12px, 3.2vw, 15px);
  font-weight: 800;
  line-height: 1.25;
}

.leaderboard-panel {
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 2px rgba(88, 53, 24, 0.1);
}

.leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.leaderboard-head h3 {
  margin: 0;
  font-size: clamp(19px, 5vw, 25px);
  line-height: 1;
}

.leaderboard-head span {
  color: #617062;
  font-size: clamp(12px, 3.2vw, 15px);
  font-weight: 900;
  white-space: nowrap;
}

.leaderboard-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 42px;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 253, 245, 0.72);
  color: #253026;
  font-size: clamp(12px, 3.2vw, 15px);
  font-weight: 850;
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: white;
  background: var(--green);
  font-weight: 1000;
}

.leaderboard-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.leaderboard-meta {
  color: #687268;
  font-size: clamp(10px, 2.8vw, 13px);
  white-space: nowrap;
}

.leaderboard-score {
  color: #226f2c;
  font-size: clamp(14px, 3.8vw, 18px);
  text-align: right;
}

.leaderboard-empty {
  display: grid;
  gap: 3px;
  padding: 14px 12px;
  border-radius: 8px;
  color: #667066;
  background: rgba(255, 253, 245, 0.72);
  text-align: left;
}

.leaderboard-empty strong {
  color: #293128;
  font-size: clamp(14px, 3.7vw, 17px);
  font-weight: 1000;
}

.leaderboard-empty span {
  color: #687268;
  font-size: clamp(12px, 3.2vw, 15px);
  font-weight: 850;
  line-height: 1.35;
}

.start-leaderboard-list {
  position: relative;
  z-index: 1;
  gap: 8px;
}

.start-leaderboard-list .leaderboard-item {
  grid-template-columns: 34px minmax(0, 1fr) minmax(58px, auto);
  min-height: 46px;
  padding: 8px 10px;
  border: 2px solid rgba(122, 77, 38, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 5px 12px rgba(95, 58, 25, 0.08);
  font-size: clamp(13px, 3.6vw, 17px);
}

.start-leaderboard-list .leaderboard-rank {
  width: 30px;
  height: 30px;
  box-shadow: inset 0 -2px 0 rgba(63, 35, 14, 0.16);
  background: #9d7047;
}

.start-leaderboard-list .leaderboard-meta {
  display: none;
}

.start-leaderboard-list .leaderboard-score {
  color: #2f7b39;
  font-size: clamp(16px, 4.4vw, 22px);
  font-weight: 1000;
}

.start-leaderboard-list .leaderboard-item:nth-child(1) {
  border-color: rgba(229, 168, 50, 0.42);
  background: linear-gradient(135deg, rgba(255, 247, 212, 0.96), rgba(255, 226, 143, 0.82));
}

.start-leaderboard-list .leaderboard-item:nth-child(2) {
  border-color: rgba(160, 163, 170, 0.34);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(224, 229, 232, 0.78));
}

.start-leaderboard-list .leaderboard-item:nth-child(3) {
  border-color: rgba(184, 110, 58, 0.34);
  background: linear-gradient(135deg, rgba(255, 242, 225, 0.94), rgba(232, 173, 116, 0.76));
}

.start-leaderboard-list .leaderboard-item:nth-child(1) .leaderboard-rank {
  background: #d8a524;
}

.start-leaderboard-list .leaderboard-item:nth-child(2) .leaderboard-rank {
  background: #9098a3;
}

.start-leaderboard-list .leaderboard-item:nth-child(3) .leaderboard-rank {
  background: #b66e3a;
}

.start-leaderboard-list .leaderboard-empty {
  padding: 16px 14px;
  border: 2px dashed rgba(151, 100, 52, 0.28);
  background: rgba(255, 255, 255, 0.64);
  text-align: center;
}

.leaderboard-more {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  font-size: clamp(14px, 3.8vw, 18px);
}

.leaderboard-more.hidden {
  display: none;
}

.text-button:disabled {
  cursor: default;
  filter: grayscale(0.2);
  opacity: 0.72;
}

.hidden {
  display: none !important;
}

@keyframes breathe {
  0%,
  100% {
    transform: translateY(0) scaleY(1);
  }
  50% {
    transform: translateY(1.4%) scaleY(0.985);
  }
}

@keyframes animal-call {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  35% {
    transform: translateY(-2.8%) rotate(-1.2deg);
  }
  68% {
    transform: translateY(1.2%) rotate(0.8deg);
  }
}

@keyframes tail-idle {
  0%,
  100% {
    transform: rotate(-2deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

@keyframes tail-active {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(12deg);
  }
  50% {
    transform: rotate(-10deg);
  }
  75% {
    transform: rotate(8deg);
  }
}

@keyframes fruit-pop {
  0% {
    transform: scale(0.92);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(1);
    filter: none;
  }
}

@keyframes target-confirm {
  0% {
    opacity: 1;
    transform: scale(0.92);
  }
  100% {
    opacity: 0;
    transform: scale(1.05);
  }
}

@keyframes demo-grid-pulse {
  0%,
  100% {
    box-shadow: 0 4px 12px rgba(96, 54, 18, 0.16);
  }
  38%,
  58% {
    box-shadow: 0 0 0 5px rgba(255, 145, 36, 0.32), 0 4px 12px rgba(96, 54, 18, 0.16);
  }
}

@keyframes demo-apple-pop {
  0%,
  18%,
  100% {
    transform: scale(1);
  }
  32% {
    transform: scale(1.08);
  }
}

@keyframes demo-arrow-nudge {
  0%,
  45%,
  100% {
    transform: translateX(0);
    opacity: 0.65;
  }
  58%,
  70% {
    transform: translateX(4px);
    opacity: 1;
  }
}

@keyframes demo-pack-click {
  0%,
  60%,
  100% {
    transform: translateY(0) scale(1);
    filter: none;
  }
  72% {
    transform: translateY(2px) scale(0.96);
    filter: brightness(0.95);
  }
  84% {
    transform: translateY(0) scale(1.04);
    filter: brightness(1.05);
  }
}

@keyframes rules-apple-pop {
  0%,
  18%,
  100% {
    transform: scale(1);
    filter: none;
  }
  34%,
  54% {
    transform: scale(1.06);
    filter: brightness(1.08);
  }
}

@keyframes rules-target-pulse {
  0%,
  54%,
  100% {
    transform: scale(1);
    filter: none;
  }
  68% {
    transform: scale(1.04);
    filter: brightness(1.08);
  }
}

@keyframes rules-hand-tap-pack {
  0%,
  52%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  66% {
    transform: translate(-8%, -8%) scale(0.94);
  }
  78% {
    transform: translate(0, 0) scale(1.03);
  }
}

@keyframes rules-hand-tap-grass {
  0%,
  52%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  66% {
    transform: translate(-9%, -9%) scale(0.94);
  }
  78% {
    transform: translate(0, 0) scale(1.03);
  }
}

@keyframes rules-sound-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.82;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

@keyframes rules-animal-breathe {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2%);
  }
}

@media (max-width: 420px) {
  .hud {
    gap: 4px;
  }

  .hud-card {
    min-height: 38px;
  }

  .dialog.rules-dialog {
    width: min(86%, 360px);
    padding: 16px 14px;
  }

  .dialog.settings-dialog {
    width: min(84%, 350px);
    padding: 16px 14px;
  }

  .rules-demo {
    gap: 8px;
  }

  .demo-grid {
    grid-template-columns: repeat(2, 44px);
    grid-template-rows: repeat(2, 44px);
  }

  .demo-grid img {
    width: 44px;
    height: 44px;
  }

  .demo-pack {
    flex-basis: 72px;
    width: 72px;
  }
}
