:root {
  color-scheme: light;
  --ink: #365239;
  --soft-ink: #648065;
  --cream: #fff9e9;
  --paper: #fffdf4;
  --leaf: #6fa85a;
  --leaf-dark: #447c42;
  --sun: #f5c95f;
  --coral: #ec8a73;
  --shadow: rgba(68, 93, 54, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.85) 0 3px, transparent 4px),
    radial-gradient(circle at 86% 25%, rgba(255, 255, 255, 0.72) 0 5px, transparent 6px),
    radial-gradient(circle at 22% 80%, rgba(255, 255, 255, 0.64) 0 4px, transparent 5px),
    linear-gradient(155deg, #edf8d9 0%, #d9efc8 52%, #cce7bd 100%);
  background-size: 90px 90px, 140px 140px, 120px 120px, auto;
  user-select: none;
  -webkit-user-select: none;
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  width: 220px;
  height: 220px;
  content: "";
  border-radius: 50%;
  filter: blur(2px);
}

body::before {
  top: -110px;
  right: -60px;
  background: rgba(250, 211, 115, 0.24);
}

body::after {
  bottom: -130px;
  left: -70px;
  background: rgba(104, 166, 89, 0.18);
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  width: min(100%, 680px);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 10px 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: clamp(7px, 2vw, 11px);
}

.title-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
}

.title-lockup h1,
.title-lockup p {
  margin: 0;
}

.eyebrow {
  margin-bottom: 2px !important;
  color: var(--soft-ink);
  font-size: clamp(11px, 2.6vw, 14px);
  font-weight: 700;
  letter-spacing: 0.13em;
}

.title-lockup h1 {
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", sans-serif;
  font-size: clamp(28px, 7vw, 42px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.05em;
}

.title-bunny {
  position: relative;
  display: grid;
  width: 58px;
  height: 51px;
  place-items: center;
  border: 3px solid rgba(99, 76, 59, 0.12);
  border-radius: 48% 48% 43% 43%;
  background: #fffdf8;
  box-shadow: 0 5px 0 rgba(87, 117, 66, 0.08);
}

.ear {
  position: absolute;
  top: -19px;
  width: 17px;
  height: 29px;
  border: 3px solid rgba(99, 76, 59, 0.12);
  border-bottom: 0;
  border-radius: 60% 60% 20% 20%;
  background: linear-gradient(90deg, #fffdf8 22%, #f7c7bb 23% 64%, #fffdf8 65%);
}

.ear-left {
  left: 9px;
  rotate: -10deg;
}

.ear-right {
  right: 9px;
  rotate: 10deg;
}

.bunny-face {
  z-index: 1;
  margin-top: 5px;
  color: #735f54;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.round-button {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  cursor: pointer;
  place-items: center;
  color: var(--leaf-dark);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 253, 244, 0.88);
  box-shadow: 0 5px 0 rgba(74, 111, 57, 0.13), 0 8px 22px var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
  text-decoration: none;
}

.round-button svg {
  width: 29px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.audio-icon {
  display: grid;
  place-items: center;
  font-size: 23px;
  line-height: 1;
  transform: translateY(1px);
}

.audio-button[aria-pressed="false"] {
  color: #7b8876;
  background: rgba(255, 253, 244, 0.78);
}

.round-button:hover {
  transform: translateY(-2px) rotate(-7deg);
  box-shadow: 0 7px 0 rgba(74, 111, 57, 0.13), 0 10px 25px var(--shadow);
}

.round-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(74, 111, 57, 0.13);
}

.round-button:focus-visible,
.difficulty-button:focus-visible,
.picker-close:focus-visible {
  outline: 4px solid rgba(239, 156, 80, 0.62);
  outline-offset: 4px;
}

.maze-card {
  position: relative;
  overflow: hidden;
  padding: clamp(9px, 2.4vw, 16px);
  border: 1px solid rgba(81, 111, 64, 0.12);
  border-radius: clamp(24px, 5vw, 38px);
  background: var(--paper);
  box-shadow: 0 20px 50px var(--shadow), 0 4px 0 rgba(95, 121, 75, 0.09);
}

.paper-corner {
  position: absolute;
  z-index: 3;
  top: 10px;
  width: 54px;
  height: 18px;
  opacity: 0.54;
  background: #efd995;
  transform: rotate(-36deg);
  pointer-events: none;
}

.paper-corner-left {
  left: -17px;
}

.paper-corner-right {
  right: -17px;
  transform: rotate(36deg);
}

#maze {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: clamp(17px, 4vw, 27px);
  background: #86b968;
  cursor: grab;
  touch-action: none;
}

#maze.is-dragging {
  cursor: grabbing;
}

.drag-hint {
  position: absolute;
  z-index: 4;
  bottom: clamp(21px, 5vw, 37px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px 9px 11px;
  color: #735743;
  border: 2px solid rgba(130, 91, 61, 0.08);
  border-radius: 999px;
  background: rgba(255, 252, 235, 0.93);
  box-shadow: 0 7px 22px rgba(72, 74, 46, 0.18);
  font-size: clamp(12px, 3vw, 16px);
  font-weight: 800;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
}

.drag-hint.is-hidden {
  opacity: 0;
  transform: translate(-50%, 12px);
}

.hint-hand {
  display: inline-grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: #ffe4a5;
  font-size: 20px;
  animation: hint-bob 1.1s ease-in-out infinite alternate;
}

.celebration {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  opacity: 0;
  background: rgba(255, 252, 232, 0.76);
  backdrop-filter: blur(4px);
  transform: scale(1.05);
  transition: opacity 260ms ease, transform 400ms cubic-bezier(0.2, 0.9, 0.2, 1);
  pointer-events: none;
}

.celebration.is-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.celebration-sun {
  display: grid;
  width: clamp(62px, 16vw, 92px);
  height: clamp(62px, 16vw, 92px);
  place-items: center;
  color: #e5a72e;
  border-radius: 50%;
  background: #fff1a8;
  box-shadow: 0 0 0 13px rgba(255, 239, 158, 0.48);
  font-size: clamp(36px, 10vw, 56px);
  animation: sunny 1.8s ease-in-out infinite alternate;
}

.celebration p {
  margin: 17px 0 2px;
  color: #446f3f;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", sans-serif;
  font-size: clamp(32px, 8vw, 50px);
  font-weight: 900;
}

.picker-copy {
  margin-bottom: 12px;
  color: #6c8066;
  font-size: clamp(12px, 3vw, 15px);
  font-weight: 800;
}

.difficulty-grid {
  display: grid;
  width: min(86%, 360px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 12px);
}

.difficulty-button {
  position: relative;
  display: grid;
  min-height: clamp(51px, 13vw, 67px);
  align-content: center;
  justify-items: center;
  padding: 7px 9px;
  cursor: pointer;
  color: #3f663d;
  border: 2px solid rgba(70, 105, 58, 0.12);
  border-radius: clamp(14px, 3.4vw, 21px);
  background: #fffdf4;
  box-shadow: 0 4px 0 rgba(63, 102, 61, 0.16), 0 7px 15px rgba(54, 84, 48, 0.12);
  font-weight: 900;
  transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 150ms ease, background 150ms ease;
}

.difficulty-button:nth-child(2) {
  color: #9b6340;
  background: #fff6df;
}

.difficulty-button:nth-child(3) {
  color: #8a5a5c;
  background: #fff0e8;
}

.difficulty-button:nth-child(4) {
  color: #45647a;
  background: #edf7f7;
}

.difficulty-button:hover {
  transform: translateY(-2px) scale(1.02);
}

.difficulty-button:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 0 1px 0 rgba(63, 102, 61, 0.16);
}

.difficulty-button[aria-current="true"]::after {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  content: "";
  border-radius: 50%;
  background: currentColor;
}

.difficulty-size {
  font-size: clamp(17px, 4vw, 22px);
  line-height: 1;
}

.difficulty-name {
  margin-top: 4px;
  opacity: 0.72;
  font-size: clamp(10px, 2.5vw, 12px);
}

.difficulty-picker {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  padding: clamp(15px, 4vw, 28px);
  place-items: center;
  opacity: 0;
  background: rgba(73, 106, 63, 0.38);
  backdrop-filter: blur(5px);
  transition: opacity 220ms ease;
  pointer-events: none;
}

.difficulty-picker.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.picker-sheet {
  position: relative;
  display: grid;
  width: min(100%, 430px);
  padding: clamp(20px, 5vw, 32px);
  justify-items: center;
  border: 2px solid rgba(112, 133, 78, 0.12);
  border-radius: clamp(22px, 5vw, 32px);
  background: #fffaf0;
  box-shadow: 0 18px 45px rgba(49, 77, 42, 0.25), 0 5px 0 rgba(64, 94, 49, 0.12);
  transform: translateY(18px) scale(0.94);
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.difficulty-picker.is-visible .picker-sheet {
  transform: translateY(0) scale(1);
}

.picker-sheet h2,
.picker-sheet p {
  margin: 0;
}

.picker-sheet h2 {
  color: #426941;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", sans-serif;
  font-size: clamp(27px, 7vw, 39px);
}

.picker-sheet > p {
  margin: 3px 0 16px;
  color: #71816d;
  font-size: clamp(12px, 3vw, 14px);
  font-weight: 700;
}

.picker-sheet .difficulty-grid {
  width: 100%;
}

.picker-carrot {
  margin-bottom: 3px;
  font-size: clamp(30px, 8vw, 45px);
  rotate: -9deg;
}

.picker-close {
  position: absolute;
  top: 11px;
  right: 11px;
  display: grid;
  width: 42px;
  height: 42px;
  cursor: pointer;
  place-items: center;
  color: #637961;
  border: 0;
  border-radius: 50%;
  background: #eef3df;
  font-size: 30px;
  line-height: 1;
}

.parent-note {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 13px 0 0;
  color: #5d795d;
  font-size: clamp(12px, 3vw, 14px);
  font-weight: 700;
  text-align: center;
}

@keyframes hint-bob {
  from { transform: translateY(2px) rotate(-8deg); }
  to { transform: translateY(-3px) rotate(5deg); }
}

@keyframes sunny {
  from { transform: rotate(-8deg) scale(0.98); }
  to { transform: rotate(8deg) scale(1.04); }
}

@media (max-height: 720px) and (orientation: landscape) {
  body {
    padding: 10px;
  }

  .game-shell {
    width: min(92vh, 620px);
  }

  .game-header {
    padding-bottom: 8px;
  }

  .title-lockup h1 {
    font-size: 27px;
  }

  .eyebrow,
  .parent-note {
    display: none;
  }

  .title-bunny,
  .round-button {
    width: 43px;
    height: 43px;
  }

  .title-bunny {
    display: none;
  }
}

@media (max-width: 420px) {
  .game-header {
    gap: 8px;
  }

  .title-bunny {
    display: none;
  }

  .header-actions {
    gap: 6px;
  }

  .round-button {
    width: 44px;
    height: 44px;
  }

  .round-button svg {
    width: 25px;
  }

  .audio-icon {
    font-size: 20px;
  }
}

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