/* 메인 테마 */
:root {
  --ink: #5b4a63;
  --ink-soft: #806f87;
  --white: rgba(255, 255, 255, 0.9);
  --pink: #f58db5;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: max(28px, env(safe-area-inset-top)) 20px
    max(28px, env(safe-area-inset-bottom));
  color: var(--ink);
  text-align: center;
  font-family: "Jua", sans-serif;
  background: linear-gradient(
    -45deg,
    #ffd5e5,
    #e5d8ff,
    #ccecff,
    #d7f5df,
    #fff0bf,
    #ffd8e8
  );
  background-size: 400% 400%;
  animation: gradientMove 16s ease infinite;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  filter: blur(6px);
  pointer-events: none;
}

body::before {
  top: -100px;
  left: -90px;
}

body::after {
  right: -100px;
  bottom: -110px;
}

@keyframes gradientMove {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.main {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  margin: 0 auto;
}

[hidden] {
  display: none !important;
}

/* 비밀번호 화면 */
.password-gate {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: calc(100vh - 56px);
  align-items: center;
  justify-content: center;
}

.password-card {
  width: min(100%, 360px);
  padding: 32px 26px 28px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 32px;
  background: var(--white);
  box-shadow: 0 20px 45px rgba(113, 82, 118, 0.2);
  backdrop-filter: blur(12px);
}

.password-card.is-wrong {
  animation: passwordShake 0.38s ease;
}

.password-icon {
  margin-bottom: 12px;
  font-size: 48px;
}

.password-title {
  margin: 0 0 8px;
  font-family: "Gaegu", cursive;
  font-size: clamp(25px, 7.5vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.password-description {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 15px;
}

.password-input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  color: var(--ink);
  border: 2px solid #eadcf0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  font-family: inherit;
  font-size: 28px;
  letter-spacing: 12px;
  text-align: center;
  outline: none;
}

.password-input:focus {
  border-color: #f39abb;
  box-shadow: 0 0 0 4px rgba(243, 154, 187, 0.18);
}

.password-error {
  min-height: 21px;
  margin: 8px 0 10px;
  color: #dd5f8f;
  font-size: 14px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button {
  min-height: 48px;
  color: var(--ink);
  border: 0;
  border-radius: 16px;
  background: linear-gradient(145deg, #f7efff, #ffe8f1);
  font-family: inherit;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(113, 82, 118, 0.1);
  transition: transform 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.keypad button:active {
  transform: scale(0.92);
}

.keypad .keypad-submit {
  color: #fff;
  background: linear-gradient(135deg, #f58db5, #e772a1);
}

@keyframes passwordShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

.eyebrow {
  margin: 12px 0 6px;
  color: var(--ink-soft);
  font-family: "Gaegu", cursive;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-family: "Gaegu", cursive;
  font-size: clamp(46px, 12vw, 72px);
  line-height: 1;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.65);
}

.heart {
  color: var(--pink);
}

.description {
  margin: 16px auto 34px;
  color: var(--ink-soft);
  font-size: clamp(16px, 4vw, 19px);
  line-height: 1.6;
}

.menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
}

.menu-card {
  position: relative;
  display: flex;
  min-height: 180px;
  padding: 24px 20px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 30px;
  background: linear-gradient(145deg, #fff4c9, #ffd7e8);
  box-shadow: 0 14px 30px rgba(113, 82, 118, 0.17);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.menu-card:hover,
.menu-card:focus-visible {
  transform: translateY(-7px) scale(1.02);
  box-shadow: 0 20px 38px rgba(113, 82, 118, 0.23);
  outline: none;
}

.menu-card:active {
  transform: scale(0.97);
}

.menu-card--carrot {
  background: linear-gradient(145deg, #e7f7ca, #ffe0b9);
}

.menu-card__icon {
  margin-bottom: 10px;
  font-size: 52px;
  line-height: 1;
}

.menu-card__title {
  font-size: 25px;
}

.menu-card__desc {
  margin-top: 7px;
  color: var(--ink-soft);
  font-family: "Gaegu", cursive;
  font-size: 18px;
  font-weight: 700;
}

.guide {
  margin-top: 28px;
  color: rgba(91, 74, 99, 0.68);
  font-family: "Gaegu", cursive;
  font-size: 17px;
}

.lock-again {
  margin: -16px 0 24px;
  padding: 10px 16px;
  color: var(--ink-soft);
  border: 1px solid rgba(128, 111, 135, 0.25);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.48);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.lock-again:hover,
.lock-again:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  outline: none;
}

.lock-again:active {
  transform: scale(0.95);
}

/* 모바일 부하를 줄인 당근 비 효과 */
.main-carrot-button {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 20;
  display: flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffe1ee;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(113, 82, 118, 0.18);
  animation: carrotButtonBeat 1.6s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.main-carrot-button:active {
  transform: scale(0.9);
}

@keyframes carrotButtonBeat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
}

.carrot-rain {
  position: fixed;
  top: -64px;
  z-index: 18;
  pointer-events: none;
  contain: layout paint style;
  will-change: transform, opacity;
  animation: carrotFall 3s linear forwards;
}

@keyframes carrotFall {
  0% {
    transform: translate3d(0, -8vh, 0) rotate(0deg);
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  44%,
  86% {
    transform: translate3d(
      var(--carrot-x),
      calc(100vh - 20px - var(--pile-height)),
      0
    ) rotate(var(--carrot-r));
    opacity: 1;
  }
  100% {
    transform: translate3d(
      var(--carrot-x),
      calc(100vh - 20px - var(--pile-height)),
      0
    ) scale(0.65) rotate(var(--carrot-r));
    opacity: 0;
  }
}

.main-toast {
  position: fixed;
  top: calc(78px + env(safe-area-inset-top));
  left: 50%;
  z-index: 30;
  padding: 9px 15px;
  color: #fff;
  border-radius: 99px;
  background: rgba(91, 74, 99, 0.9);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.main-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 460px) {
  .menu {
    grid-template-columns: 1fr;
  }

  .menu-card {
    min-height: 155px;
  }
}

@media (max-width: 350px) {
  .password-card {
    padding-right: 16px;
    padding-left: 16px;
  }

  .password-title {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }

  .menu-card {
    transition: none;
  }

  .main-carrot-button {
    animation: none;
  }
}
