/* 土豆乐园 — original styles */
:root {
  --sky-top: #87ceeb;
  --sky-mid: #b8e0a8;
  --meadow: #7cb342;
  --meadow-deep: #558b2f;
  --soil: #8d6e63;
  --card: #fffef7;
  --ink: #3e2723;
  --accent: #ff8a65;
  --lucky: #ffd54f;
  --shadow: rgba(62, 39, 35, 0.18);
  --radius: 18px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  overflow: hidden;
  background: linear-gradient(
    180deg,
    var(--sky-top) 0%,
    #a8d5e5 28%,
    var(--sky-mid) 55%,
    var(--meadow) 78%,
    var(--meadow-deep) 100%
  );
}

body {
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.meadow-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("meadow.svg");
  background-size: 140px 140px;
  opacity: 0.55;
}

.sun {
  position: fixed;
  top: 4vmin;
  right: 6vmin;
  width: 12vmin;
  height: 12vmin;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff9c4, #ffeb3b 55%, #ffc107);
  box-shadow: 0 0 40px rgba(255, 235, 59, 0.55);
  z-index: 1;
  pointer-events: none;
}

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 254, 247, 0.88);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 8px 16px 8px 10px;
  box-shadow: 0 4px 16px var(--shadow);
}

.brand img {
  width: 36px;
  height: 36px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.7;
}

.hint {
  background: rgba(255, 254, 247, 0.88);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  box-shadow: 0 4px 16px var(--shadow);
  max-width: min(420px, 70vw);
  text-align: center;
}

.field {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 88px 12px 24px;
}

.potato {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  transform-origin: center bottom;
  animation: hop var(--hop-dur, 2.4s) ease-in-out infinite;
  animation-delay: var(--hop-delay, 0s);
  will-change: transform;
  touch-action: manipulation;
}

.potato:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
  border-radius: 12px;
}

.potato .sprite {
  filter: drop-shadow(0 6px 4px var(--shadow));
  transition: transform 0.35s ease;
  transform-style: preserve-3d;
}

.potato.flipped .sprite {
  transform: rotateY(180deg) scale(1.08);
}

.potato .bubble {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  opacity: 0;
  pointer-events: none;
  background: var(--card);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: 200px;
  min-width: 120px;
  box-shadow: 0 8px 24px var(--shadow);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 5;
  text-align: center;
}

.potato .bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -8px;
  border: 8px solid transparent;
  border-top-color: var(--card);
}

.potato.flipped .bubble {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.potato .name-tag {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 254, 247, 0.75);
  padding: 2px 8px;
  border-radius: 999px;
  opacity: 0.85;
}

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

@media (prefers-reduced-motion: reduce) {
  .potato {
    animation: none;
  }
  .potato .sprite,
  .potato .bubble,
  .confetti-piece {
    transition: none !important;
    animation: none !important;
  }
}

/* Win overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(62, 39, 35, 0.35);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  padding: 20px;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  background: var(--card);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  position: relative;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  color: #e65100;
}

.panel .sub {
  margin: 0 0 16px;
  opacity: 0.8;
  font-size: 0.95rem;
}

.panel .countdown {
  font-size: 0.85rem;
  margin-bottom: 18px;
  color: #6d4c41;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

button.action {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button.action:active {
  transform: scale(0.96);
}

button.action.primary {
  background: linear-gradient(135deg, #ff8a65, #ff7043);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 112, 67, 0.45);
}

button.action.secondary {
  background: #efebe9;
  color: var(--ink);
}

button.action:focus-visible {
  outline: 3px solid #ffab91;
  outline-offset: 3px;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.85;
  }
}

.footer-note {
  position: fixed;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: rgba(62, 39, 35, 0.55);
  z-index: 15;
  pointer-events: none;
}

@media (max-width: 520px) {
  .hint {
    display: none;
  }
  .brand p {
    display: none;
  }
  .potato .bubble {
    max-width: 160px;
    font-size: 0.78rem;
  }
}
