:root {
  color-scheme: light;
  --ink: #5a2f42;
  --berry: #c9366f;
  --pink: #ff8fbd;
  --cream: #fff9e8;
  --gold: #ffbf3f;
  --orange: #f26a22;
  --blue: #6bc7e9;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.95) 0 3%, transparent 16%),
    radial-gradient(circle at 82% 9%, rgba(255,255,255,.75) 0 2%, transparent 14%),
    linear-gradient(180deg, #fff1b7 0%, #ffe2bd 46%, #ffcde1 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  background-image: radial-gradient(rgba(255,255,255,.9) 1px, transparent 1px);
  background-size: 17px 17px;
  mask-image: linear-gradient(to bottom, #000, transparent 64%);
}

.oracle {
  width: min(1180px, calc(100% - 28px));
  min-height: calc(100dvh - 66px);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px) 0 4px;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 12px;
}

.answer-panel {
  position: relative;
  z-index: 20;
  min-height: clamp(92px, 12vw, 124px);
  padding: 22px clamp(42px, 8vw, 98px);
  display: grid;
  place-items: center;
  border: 4px solid #fff;
  border-radius: 28px 28px 48px 48px;
  background: linear-gradient(155deg, rgba(255,255,255,.96), rgba(255,247,213,.95));
  box-shadow:
    0 11px 0 rgba(191, 81, 103, .16),
    0 18px 40px rgba(125, 62, 86, .18),
    inset 0 0 0 2px rgba(248, 175, 87, .34);
  transition: transform .3s ease, filter .3s ease;
}

.answer-panel::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -20px;
  width: 34px;
  height: 34px;
  background: #fff9df;
  border-right: 4px solid #fff;
  border-bottom: 4px solid #fff;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 7px 7px 0 rgba(191, 81, 103, .08);
}

#answer {
  margin: 0;
  text-align: center;
  font-size: clamp(1.18rem, 2.5vw, 1.9rem);
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: .035em;
  text-wrap: balance;
}

.answer-sparkle {
  position: absolute;
  left: 24px;
  top: 20px;
  color: var(--gold);
  font-size: 1.55rem;
  animation: twinkle 2.2s ease-in-out infinite;
}

.answer-sparkle--right {
  left: auto;
  right: 24px;
  top: auto;
  bottom: 18px;
  animation-delay: -1.1s;
}

.stage {
  position: relative;
  height: var(--stage-height, min(56vw, 630px));
  min-height: 210px;
  max-height: 650px;
  isolation: isolate;
  overflow: hidden;
}

.stage::before {
  content: "";
  position: absolute;
  z-index: -3;
  inset: 6% 8% 5%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,.78), rgba(255,255,255,0) 68%);
}

.sky-glow {
  position: absolute;
  z-index: -2;
  left: 50%;
  top: 3%;
  width: min(44vw, 470px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255,250,194,.95), rgba(255,197,88,.28) 42%, transparent 70%);
  filter: blur(3px);
  transition: .5s ease;
}

.star-field {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 12%;
  width: 40%;
  height: 48%;
  transform: translateX(-50%);
  opacity: 0;
  background-image:
    radial-gradient(circle, #fff 0 2px, transparent 3px),
    radial-gradient(circle, #ffd34f 0 3px, transparent 4px),
    radial-gradient(circle, #fff 0 1px, transparent 2px);
  background-size: 68px 78px, 109px 94px, 43px 51px;
  background-position: 7px 12px, 44px 3px, 20px 36px;
  transition: opacity .3s ease;
}

.character {
  position: absolute;
  bottom: 1.5%;
  width: auto;
  max-width: none;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 14px 9px rgba(104, 54, 66, .17));
  transform-origin: 50% 100%;
}

.mar {
  z-index: 2;
  left: clamp(0px, 3vw, 38px);
  height: 96%;
}
.baina {
  z-index: 2;
  right: clamp(0px, 3vw, 38px);
  height: 95%;
}
.daughter {
  z-index: 4;
  left: 50%;
  bottom: 1%;
  width: auto;
  height: 63%;
  transform: translateX(-50%);
}
.bunny {
  z-index: 5;
  left: 61.5%;
  bottom: 1%;
  width: auto;
  height: 20%;
}

.carrot-wrap {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 3%;
  width: auto;
  height: 35%;
  aspect-ratio: 156 / 305;
  transform: translateX(-50%);
}

.carrot-button {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  filter: drop-shadow(0 14px 12px rgba(133, 57, 26, .25));
  animation: hover 3s ease-in-out infinite;
}

.carrot-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter .2s ease;
}

.carrot-button:hover img,
.carrot-button:focus-visible img {
  filter: brightness(1.08) saturate(1.15);
}

.carrot-button:focus-visible {
  outline: 4px solid rgba(64, 149, 205, .75);
  outline-offset: 8px;
  border-radius: 45%;
}

.tap-hint {
  position: absolute;
  top: 48%;
  left: 50%;
  width: max-content;
  padding: 8px 13px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 999px;
  color: #fff;
  background: rgba(189, 54, 94, .9);
  box-shadow: 0 5px 12px rgba(102, 32, 56, .2);
  font-size: clamp(.75rem, 1.3vw, .92rem);
  font-weight: 800;
  letter-spacing: .05em;
  transform: translate(-50%, -50%) rotate(-5deg);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.carrot-button:hover .tap-hint {
  transform: translate(-50%, -56%) rotate(2deg) scale(1.05);
}

.oracle-rings,
.oracle-rings i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.oracle-rings { z-index: 1; opacity: 0; }
.oracle-rings i { border: 3px solid rgba(255, 181, 43, .62); }

.ground-shadow {
  position: absolute;
  z-index: -1;
  left: 9%;
  right: 9%;
  bottom: 0;
  height: 10%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(149, 72, 99, .25), transparent 70%);
  filter: blur(8px);
}

.status {
  z-index: 20;
  margin: -5px auto 0;
  padding: 9px 18px;
  border-radius: 999px;
  color: rgba(90,47,66,.82);
  background: rgba(255,255,255,.46);
  font-size: clamp(.88rem, 1.6vw, 1rem);
  font-weight: 650;
  text-align: center;
}

footer {
  min-height: 66px;
  margin-top: auto;
  padding: 18px 16px 24px;
  text-align: center;
}

footer a {
  color: rgba(90, 47, 66, .7);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-decoration: none;
}

footer a:hover { color: var(--berry); text-decoration: underline; text-underline-offset: 4px; }

.is-consulting .answer-panel { animation: panel-breathe 1.6s ease both; }
.is-consulting .sky-glow { transform: translateX(-50%) scale(1.22); filter: blur(2px) brightness(1.2); }
.is-consulting .star-field { opacity: 1; animation: stars-spin 1.35s ease-in-out both; }
.is-consulting .tap-hint { opacity: 0; }
.is-consulting .carrot-button { animation: carrot-consult 1.55s cubic-bezier(.36,.07,.19,.97) both; }
.is-consulting .oracle-rings { opacity: 1; }
.is-consulting .oracle-rings i:nth-child(1) { animation: ring 1s ease-out .15s both; }
.is-consulting .oracle-rings i:nth-child(2) { animation: ring 1s ease-out .4s both; }
.is-consulting .oracle-rings i:nth-child(3) { animation: ring 1s ease-out .65s both; }
.is-consulting .mar { animation: cheer-left 1.5s ease both; }
.is-consulting .baina { animation: cheer-right 1.5s ease both; }
.is-consulting .daughter { animation: daughter-cheer 1.3s ease .1s both; }
.is-consulting .bunny { animation: bunny-hop .72s ease .18s 2 both; }
.has-answer .answer-panel { animation: answer-arrives .65s cubic-bezier(.17,.84,.44,1.2) both; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes hover { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes twinkle { 0%,100% { opacity: .35; transform: scale(.7) rotate(0); } 50% { opacity: 1; transform: scale(1.2) rotate(90deg); } }
@keyframes ring { 0% { transform: scale(.4); opacity: 0; } 35% { opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } }
@keyframes carrot-consult {
  0% { transform: translateY(0) rotate(0) scale(1); }
  15% { transform: translateY(-14px) rotate(-10deg) scale(1.08); }
  30% { transform: translateY(-9px) rotate(10deg) scale(1.08); }
  46% { transform: translateY(-24px) rotate(-8deg) scale(1.14); }
  62% { transform: translateY(-20px) rotate(8deg) scale(1.16); filter: drop-shadow(0 0 20px #ffd755); }
  82% { transform: translateY(-36px) rotate(0) scale(1.2); filter: drop-shadow(0 0 30px #fff27b); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}
@keyframes panel-breathe { 0%,100% { filter: none; } 50% { filter: brightness(1.05); transform: translateY(-2px); } }
@keyframes stars-spin { 0% { transform: translateX(-50%) scale(.45) rotate(-15deg); opacity: 0; } 45% { opacity: 1; } 100% { transform: translateX(-50%) scale(1.15) rotate(12deg); opacity: 0; } }
@keyframes cheer-left { 0%,100% { transform: rotate(0); } 35% { transform: rotate(-1.5deg) translateY(-6px); } 62% { transform: rotate(.8deg); } }
@keyframes cheer-right { 0%,100% { transform: rotate(0); } 35% { transform: rotate(1.5deg) translateY(-6px); } 62% { transform: rotate(-.8deg); } }
@keyframes daughter-cheer { 0%,100% { transform: translateX(-50%) scale(1); } 35% { transform: translateX(-50%) translateY(-18px) scale(1.03); } 58% { transform: translateX(-50%) translateY(0) scale(.98,1.02); } }
@keyframes bunny-hop { 0%,100% { transform: translateY(0) rotate(0); } 45% { transform: translateY(-24px) rotate(-5deg); } }
@keyframes answer-arrives { 0% { transform: scale(.96); filter: brightness(1.25); } 60% { transform: scale(1.018); } 100% { transform: scale(1); filter: none; } }

@media (max-width: 680px) {
  .oracle { width: min(100% - 16px, 1180px); padding-top: 12px; min-height: calc(100vh - 55px); }
  .answer-panel { min-height: 112px; padding: 18px 30px; border-radius: 22px 22px 34px 34px; }
  .answer-sparkle { left: 12px; top: 10px; }
  .answer-sparkle--right { left: auto; right: 12px; top: auto; bottom: 10px; }
  .mar { left: -3%; height: 89%; }
  .baina { right: -4%; height: 88%; }
  .daughter { height: 57%; }
  .bunny { left: 62%; height: 18%; }
  .carrot-wrap { top: 4%; height: 31%; }
  .tap-hint { font-size: .68rem; padding: 6px 9px; }
  .status { margin-top: -8px; }
  footer { min-height: 55px; padding: 14px 12px 18px; }
}

@media (max-width: 430px) {
  #answer { font-size: 1.05rem; }
  .mar { left: -8%; height: 86%; }
  .baina { right: -10%; height: 85%; }
  .daughter { height: 54%; }
  .bunny { left: 63%; height: 17%; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .oracle { padding-top: 10px; gap: 6px; }
  .answer-panel { min-height: 72px; padding-block: 12px; }
  .status { margin-top: -4px; padding-block: 6px; }
  .mar, .baina { height: 94%; }
  footer { min-height: 42px; padding-block: 8px 12px; }
}

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