@font-face {
  font-family: "ExAndBreakfast";
  src: url("fonts/exandBreakfast.ttf") format("truetype");
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "ExAndBreakfast", "Helvetica Neue", "Hiragino Sans", sans-serif;
}

.sky {
  position: relative;
  width: 100%;
  height: 100%;
  background: #F9F5E7;
  overflow: hidden;
}

/* --- Branch (initial state) --- */
.branch {
  position: absolute;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 8px 18px rgba(180, 90, 120, 0.12));
  opacity: 1;
  transition: opacity 1200ms ease;
}

.branch.gone { opacity: 0; }

.branch.b1 {
  bottom: 0;
  left: 50%;
  width: 600px;
  margin-left: -300px;
  z-index: 4;
}

/* --- Petal storm (many petal.png flying around) --- */
.petal-storm {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.storm-petal {
  position: absolute;
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
  opacity: 0;
}

/* --- Wish petal (where you write) --- */
.wish-petal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38vw;
  max-width: 520px;
  min-width: 320px;
  aspect-ratio: 1 / 0.85;
  transform: translate(-50%, -50%) scale(0.6) rotate(-10deg);
  opacity: 0;
  transition: opacity 1000ms ease, transform 1400ms cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: drop-shadow(0 14px 28px rgba(180, 90, 120, 0.25));
  z-index: 8;
  pointer-events: none;
}

.blow-prompt {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-family: inherit;
  font-size: clamp(18px, 2.4vw, 28px);
  color: #b85a78;
  letter-spacing: 0.5px;
  z-index: 9;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  white-space: nowrap;
}

.blow-prompt.show {
  opacity: 1;
  animation: pulse 2.4s ease-in-out infinite;
}

.blow-prompt[hidden] { display: none; }

.palm-message {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-family: inherit;
  font-size: clamp(18px, 2.4vw, 28px);
  color: #b85a78;
  letter-spacing: 0.5px;
  z-index: 9;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  white-space: nowrap;
}

.palm-message.show { opacity: 1; }
.palm-message[hidden] { display: none; }

.wish-countdown {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-family: inherit;
  font-size: clamp(18px, 2.4vw, 28px);
  color: #b85a78;
  letter-spacing: 0.5px;
  z-index: 9;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  white-space: nowrap;
}

.wish-countdown.show { opacity: 1; }

.wish-countdown[hidden] { display: none; }

.credit {
  position: absolute;
  right: 16px;
  bottom: 12px;
  z-index: 11;
  font-family: inherit;
  font-size: 10px;
  line-height: 1.4;
  color: #b85a78;
  opacity: 0.7;
  text-align: right;
  letter-spacing: 0.2px;
  pointer-events: auto;
}

.credit a {
  color: inherit;
  text-decoration: none;
}

.credit a:hover { opacity: 0.7; }

.topnav {
  position: absolute;
  top: 18px;
  right: 24px;
  z-index: 11;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.topnav.show { opacity: 1; }
.topnav[hidden] { display: none; }

.topnav-btn {
  background: transparent;
  border: none;
  color: #000;
  font-family: inherit;
  font-size: clamp(13px, 1.4vw, 15px);
  letter-spacing: 0.4px;
  cursor: pointer;
  padding: 8px 12px;
  transition: opacity 0.2s ease;
}

.topnav-btn:hover { opacity: 0.6; }

.manage-hint {
  position: absolute;
  left: 50%;
  bottom: 24%;
  transform: translateX(-50%);
  font-family: inherit;
  font-size: clamp(12px, 1.3vw, 15px);
  color: #8a3553;
  letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 9;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  white-space: nowrap;
}

.manage-hint.show { opacity: 1; }
.manage-hint[hidden] { display: none; }

.wish-petal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
  pointer-events: auto;
}

.wish-petal-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* --- Voice mode inside the wish petal --- */
.wish-voice {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.wish-actions {
  display: flex;
  gap: 11px;
  align-items: center;
}

.save-btn {
  background: transparent;
  border: none;
  color: #000;
  font-family: inherit;
  font-size: clamp(14px, 1.6vw, 18px);
  letter-spacing: 0.5px;
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.save-btn:hover { opacity: 0.7; }

.record-btn {
  background: transparent;
  border: none;
  color: #000;
  font-family: inherit;
  letter-spacing: 0.5px;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.1;
}

.record-btn[hidden] {
  display: none;
}

.record-label {
  font-size: clamp(16px, 1.9vw, 22px);
}

.record-hint {
  font-size: clamp(11px, 1.2vw, 14px);
  opacity: 0.65;
}

.redo-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  cursor: pointer;
  line-height: 0;
  transition: opacity 0.2s ease;
}

.redo-icon {
  width: clamp(38px, 4.3vw, 53px);
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}

.record-btn.recording {
  background: transparent;
  color: #000;
  animation: recording-pulse 1.4s ease-in-out infinite;
}

@keyframes recording-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.play-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  line-height: 0;
  position: relative;
  top: 26px;
}

.play-btn:hover {
  opacity: 0.7;
}

.play-icon {
  width: clamp(38px, 4.3vw, 53px);
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}

/* --- Ground (saved petals) --- */
.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 180px;
  pointer-events: none;
  z-index: 5;
}

.ground-petal {
  position: absolute;
  bottom: 12px;
  width: 70px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, 0) rotate(var(--rot, 0deg));
  transform-origin: center;
  transition: transform 0.25s ease;
}

.ground-petal:hover {
  transform: translate(-50%, -6px) rotate(var(--rot, 0deg));
}

.ground-petal img {
  width: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(180, 90, 120, 0.25));
}

/* --- Onboarding overlay --- */
.onboard {
  position: absolute;
  inset: 0;
  z-index: 30;
  cursor: pointer;
}

.onboard.gone {
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms ease;
}

.onboard-step {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #b85a78;
  opacity: 0;
  transition: opacity 700ms ease;
  pointer-events: none;
}

.onboard-step.show {
  opacity: 1;
}

.onboard-emoji {
  font-size: 56px;
  margin-bottom: 14px;
}

.onboard-title {
  font-size: 28px;
  letter-spacing: 1px;
}

.onboard-story {
  line-height: 1.4;
}

.story-phrase {
  display: inline-block;
  opacity: 0;
  transition: opacity 500ms ease;
}

.story-phrase.show {
  opacity: 1;
}

/* Step 2 (tap to begin) blinks in a slightly different shade */
.onboard-step[data-step="2"].show .onboard-title {
  color: #000;
  animation: blink 1.4s ease-in-out infinite;
}

/* Step 3 (blow gently) gets a soft pulse */
.onboard-step[data-step="3"].show .onboard-title {
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
