@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@700;800;900&display=swap");

.game-root,
.game-root * {
  box-sizing: border-box;
}

.game-root {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #e8efe5;
  color: #4c5d4c;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.garden-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #e8efe5;
  font-family: "Nunito", ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
}

.garden-shell [hidden] {
  display: none !important;
}

.garden-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

.garden-canvas canvas {
  display: block;
  image-rendering: auto;
  cursor: url("/static/img/cursors/cursor_cat.54234ab9b215.png") 0 0, auto !important;
}

.garden-hud {
  position: absolute;
  top: max(14px, calc(env(safe-area-inset-top) + 8px));
  left: 50%;
  z-index: 5;
  width: min(720px, calc(100% - 340px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.garden-title {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #5d6947;
  font-size: clamp(22px, 2.8vw, 38px);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72), 0 5px 14px rgba(49, 76, 49, 0.16);
}

.garden-message {
  max-width: min(650px, 100%);
  margin: 7px auto 0;
  padding: 0 10px;
  color: #fffdf1;
  font-size: clamp(14px, 1.7vw, 19px);
  font-weight: 900;
  line-height: 1.18;
  text-shadow: 0 2px 9px rgba(45, 65, 42, 0.72);
}

.garden-status,
.garden-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.garden-sequence {
  position: absolute;
  top: max(66px, calc(env(safe-area-inset-top) + 62px));
  left: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.garden-sequence-line {
  position: absolute;
  top: 50%;
  right: 25px;
  left: 25px;
  z-index: -1;
  height: 3px;
  border-radius: 3px;
  background: rgba(105, 126, 88, 0.3);
  transform: translateY(-50%);
}

.garden-stage {
  position: relative;
  display: grid;
  width: 49px;
  height: 41px;
  flex: 0 0 49px;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(125, 145, 108, 0.32);
  border-radius: 12px;
  background: rgba(255, 253, 246, 0.9);
  box-shadow: 0 4px 10px rgba(54, 83, 49, 0.12);
  opacity: 0.48;
  filter: saturate(0.65);
  transition: border-color 220ms ease, filter 220ms ease, opacity 220ms ease, transform 220ms ease;
}

.garden-stage-image {
  width: 90%;
  height: 86%;
  object-fit: contain;
}

.garden-stage [data-garden-stage-window] {
  width: 72%;
  height: 82%;
}

.garden-stage-check {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid #fffdf2;
  border-radius: 50%;
  background: #6f9c62;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 14px;
  text-align: center;
}

.garden-stage.is-current {
  border-color: #e28a4e;
  background: #fff8e9;
  box-shadow: 0 6px 15px rgba(197, 105, 52, 0.22);
  opacity: 1;
  filter: none;
  transform: scale(1.08);
}

.garden-stage.is-done {
  border-color: #8db17d;
  background: #f3f8ed;
  opacity: 1;
  filter: none;
}

.garden-stage.is-done .garden-stage-check {
  display: block;
}

.garden-tools {
  position: absolute;
  top: max(66px, calc(env(safe-area-inset-top) + 62px));
  right: max(18px, calc(env(safe-area-inset-right) + 18px));
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: auto;
}

.garden-tool,
.garden-audio-button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  padding: 5px 10px;
  background: rgba(255, 252, 241, 0.78);
  color: #5f704f;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: url("/static/img/cursors/cursor_hand.7271d4ef0443.png") 12 4, pointer;
}

.garden-tool:hover,
.garden-tool:focus-visible,
.garden-audio-button:hover,
.garden-audio-button:focus-visible {
  background: rgba(255, 252, 241, 0.96);
}

.garden-current-card {
  position: absolute;
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 22px));
  left: max(22px, calc(env(safe-area-inset-left) + 22px));
  z-index: 6;
  display: grid;
  width: 132px;
  height: 132px;
  min-height: 0;
  align-items: center;
  justify-items: center;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  padding: 8px;
  background: rgba(255, 252, 241, 0.93);
  box-shadow: 0 18px 38px rgba(53, 78, 44, 0.2);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.garden-current-mouth {
  display: grid;
  width: 106px;
  height: 106px;
  flex: 0 0 106px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f5eed7;
}

.garden-current-image {
  grid-area: 1 / 1;
  width: 92%;
  height: 92%;
  object-fit: contain;
}

.garden-timer-area {
  position: absolute;
  right: max(24px, calc(env(safe-area-inset-right) + 24px));
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 22px));
  z-index: 8;
  width: 132px;
  height: 132px;
}

.garden-timer-ring {
  --garden-timer-progress: 0%;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#e08a4f var(--garden-timer-progress), rgba(255, 253, 246, 0.88) 0);
  box-shadow: 0 16px 36px rgba(76, 82, 48, 0.24);
  transition: background 120ms linear;
}

.garden-timer-button {
  display: grid;
  width: calc(100% - 13px);
  height: calc(100% - 13px);
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  padding: 8px;
  background: #c77855;
  color: #fffdf4;
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 5px rgba(83, 50, 35, 0.28);
  cursor: url("/static/img/cursors/cursor_hand.7271d4ef0443.png") 12 4, pointer;
  transition: background-color 180ms ease, transform 180ms ease;
}

.garden-timer-button:hover:not(:disabled),
.garden-timer-button:focus-visible:not(:disabled) {
  background: #b9684b;
  transform: scale(1.025);
}

.garden-timer-button:disabled {
  cursor: url("/static/img/cursors/cursor_cat.54234ab9b215.png") 0 0, default;
  opacity: 0.72;
}

.garden-timer-button.is-running {
  background: #a86f5a;
  font-size: 36px;
  opacity: 1;
}

.garden-timer-button.is-retry {
  font-size: 17px;
}

.garden-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 68px 18px 24px;
  background: rgba(67, 87, 64, 0.24);
  backdrop-filter: blur(5px);
}

.garden-overlay[hidden] {
  display: none;
}

.garden-card {
  width: min(560px, calc(100vw - 34px));
  max-height: min(740px, calc(100% - 24px));
  overflow: auto;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  padding: 21px 22px 20px;
  background: rgba(255, 252, 241, 0.97);
  color: #56644d;
  box-shadow: 0 24px 64px rgba(47, 69, 42, 0.27);
  text-align: center;
}

.garden-card h2 {
  margin: 0;
  color: #68784d;
  font-size: clamp(25px, 4vw, 34px);
  font-weight: 900;
  line-height: 1.05;
}

.garden-card p {
  margin: 12px auto 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.28;
}

.garden-card-lead {
  color: #c1714f;
  font-size: 18px !important;
  font-weight: 900 !important;
}

.garden-mouth-pair {
  display: flex;
  max-width: 330px;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  margin: 13px auto 0;
}

.garden-mouth-guide-card {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  border-radius: 16px;
  padding: 7px 6px;
  background: rgba(245, 238, 215, 0.8);
  color: #687252;
  font-size: 13px;
  font-weight: 900;
}

.garden-mouth-guide-card .garden-mouth-image {
  display: block;
  width: 100%;
  height: 88px;
  object-fit: contain;
}

.garden-adult-note {
  color: #637153;
}

.garden-warning {
  color: #b7765e;
  font-size: 13px !important;
}

.garden-instruction-audio {
  margin-top: 13px;
  border: 0;
  border-radius: 18px;
  padding: 9px 14px;
  background: #e5efdc;
  color: #5d704d;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: url("/static/img/cursors/cursor_hand.7271d4ef0443.png") 12 4, pointer;
}

.garden-instruction-audio:hover,
.garden-instruction-audio:focus-visible {
  background: #d7e8cf;
}

.garden-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.garden-button,
.garden-link {
  display: inline-flex;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.94);
  border-radius: 28px;
  padding: 0 20px;
  background: #c77855;
  color: #fffdf4;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 2px 5px rgba(83, 50, 35, 0.28);
  cursor: url("/static/img/cursors/cursor_hand.7271d4ef0443.png") 12 4, pointer;
}

.garden-actions .garden-button {
  flex: 1 1 auto;
}

.garden-actions .garden-link {
  flex: 0 1 auto;
  background: #e9c98a;
  color: #6c5736;
  text-shadow: none;
}

.garden-button:disabled {
  cursor: url("/static/img/cursors/cursor_cat.54234ab9b215.png") 0 0, default;
  opacity: 0.62;
}

.garden-error {
  position: absolute;
  inset: 50% 20px auto;
  z-index: 30;
  transform: translateY(-50%);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 252, 241, 0.96);
  color: #a3614c;
  font-weight: 900;
  text-align: center;
}

@media (max-width: 1100px) and (orientation: portrait) {
  .garden-hud {
    top: max(16px, calc(env(safe-area-inset-top) + 10px));
    left: 48%;
    width: min(450px, calc(100% - 210px));
  }

  .garden-title {
    padding: 0;
    font-size: clamp(16px, 4.2vw, 24px);
    line-height: 1.02;
  }

  .garden-message {
    margin-top: 0;
    font-size: 1px;
  }

  .garden-sequence {
    top: max(94px, calc(env(safe-area-inset-top) + 90px));
    gap: 4px;
    padding: 6px 7px;
  }

  .garden-stage {
    width: clamp(31px, 8.7vw, 37px);
    height: clamp(28px, 7.8vw, 33px);
    flex-basis: clamp(31px, 8.7vw, 37px);
    border-width: 2px;
    border-radius: 9px;
  }

  .garden-stage-check {
    width: 15px;
    height: 15px;
    border-width: 1px;
    font-size: 9px;
    line-height: 13px;
  }

  .garden-tools {
    top: max(153px, calc(env(safe-area-inset-top) + 149px));
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  .garden-tool,
  .garden-audio-button {
    min-height: 29px;
    padding: 3px 9px;
    font-size: 11px;
  }

  .garden-current-card {
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 14px));
    left: max(13px, calc(env(safe-area-inset-left) + 13px));
    width: 110px;
    height: 110px;
    min-height: 0;
    border-radius: 50%;
    padding: 7px;
  }

  .garden-current-mouth {
    width: 92px;
    height: 92px;
    flex-basis: 92px;
  }

  .garden-timer-area {
    right: max(13px, calc(env(safe-area-inset-right) + 13px));
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 14px));
    width: 112px;
    height: 112px;
  }

  .garden-timer-button {
    font-size: 17px;
  }

  .garden-timer-button.is-running {
    font-size: 32px;
  }
}

@media (orientation: landscape) and (max-width: 1100px) and (max-height: 620px) {
  .garden-overlay {
    padding: 7px 16px;
  }

  .garden-hud {
    top: max(14px, calc(env(safe-area-inset-top) + 8px));
    width: min(390px, calc(100% - 330px));
  }

  .garden-title {
    padding: 0;
    font-size: clamp(18px, 3vw, 26px);
  }

  .garden-message {
    margin-top: 3px;
    font-size: 12px;
  }

  .garden-sequence {
    top: max(66px, calc(env(safe-area-inset-top) + 62px));
    gap: 4px;
    padding: 5px 7px;
  }

  .garden-stage {
    width: 36px;
    height: 30px;
    flex-basis: 36px;
    border-width: 2px;
    border-radius: 9px;
  }

  .garden-stage-check {
    width: 13px;
    height: 13px;
    border-width: 1px;
    font-size: 8px;
    line-height: 11px;
  }

  .garden-tools {
    top: max(66px, calc(env(safe-area-inset-top) + 62px));
    right: max(12px, calc(env(safe-area-inset-right) + 12px));
  }

  .garden-tool,
  .garden-audio-button {
    min-height: 30px;
    padding: 3px 8px;
    font-size: 10px;
  }

  .garden-current-card {
    bottom: max(11px, calc(env(safe-area-inset-bottom) + 11px));
    left: max(13px, calc(env(safe-area-inset-left) + 13px));
    width: 94px;
    height: 94px;
    min-height: 0;
    border-width: 2px;
    border-radius: 50%;
    padding: 5px;
  }

  .garden-current-mouth {
    width: 76px;
    height: 76px;
    flex-basis: 76px;
  }

  .garden-timer-area {
    right: max(13px, calc(env(safe-area-inset-right) + 13px));
    bottom: max(11px, calc(env(safe-area-inset-bottom) + 11px));
    width: 94px;
    height: 94px;
  }

  .garden-timer-button {
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    border-width: 2px;
    font-size: 15px;
  }

  .garden-timer-button.is-running {
    font-size: 28px;
  }

  .garden-timer-button.is-retry {
    font-size: 13px;
  }

  .garden-card {
    max-height: calc(100% - 12px);
    padding: 11px 15px;
  }

  .garden-card h2 {
    font-size: 23px;
  }

  .garden-card p {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.18;
  }

  .garden-card-lead,
  .garden-warning {
    font-size: 12px !important;
  }

  .garden-mouth-pair {
    max-width: 270px;
    gap: 7px;
    margin-top: 7px;
  }

  .garden-mouth-guide-card {
    padding: 4px;
    font-size: 10px;
  }

  .garden-mouth-guide-card .garden-mouth-image {
    height: 48px;
  }

  .garden-instruction-audio {
    margin-top: 7px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .garden-actions {
    margin-top: 8px;
  }

  .garden-button,
  .garden-link {
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
  }
}

@media (max-width: 480px) and (orientation: portrait) {
  .garden-card {
    padding: 16px 13px 15px;
  }

  .garden-card h2 {
    font-size: 24px;
  }

  .garden-card p {
    margin-top: 8px;
    font-size: 13px;
  }

  .garden-card-lead {
    font-size: 15px !important;
  }

  .garden-mouth-pair {
    margin-top: 9px;
  }

  .garden-mouth-guide-card .garden-mouth-image {
    height: 70px;
  }

  .garden-actions {
    flex-direction: column;
  }

  .garden-actions .garden-button,
  .garden-actions .garden-link {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .garden-stage,
  .garden-timer-ring,
  .garden-timer-button {
    transition: none;
  }
}
