:root {
  --bg: #050507;
  --text: #f6f4f7;
  --text-muted: rgba(246, 244, 247, 0.72);
  --text-soft: rgba(246, 244, 247, 0.52);
  --surface: rgba(18, 18, 24, 0.76);
  --surface-border: rgba(255, 255, 255, 0.14);
  --pink: #f8a8c8;
  --pink-glow: rgba(248, 168, 200, 0.34);
  --celeste: #9ed8ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  user-select: none;
}

/* Stages */
.stage {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.stage--active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.stage-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Top Floating Controls */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 8px;
  pointer-events: none;
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  pointer-events: auto;
}

.top-bar > .pill-btn {
  pointer-events: auto;
}

/* Buttons & Pills */
.pill-btn,
.icon-btn {
  appearance: none;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font: inherit;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.25s ease;
}

.pill-btn:active,
.icon-btn:active {
  transform: scale(0.95);
}

.pill-btn {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.pill-btn--ghost:hover {
  background: rgba(34, 34, 44, 0.88);
  border-color: rgba(255, 255, 255, 0.24);
}

.pill-btn--primary {
  background: linear-gradient(135deg, #ffd4e5 0%, #f7a6c6 55%, #b8e3ff 100%);
  color: #140c14;
  border-color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
  padding: 11px 18px;
  font-size: 14px;
  box-shadow: 0 6px 24px var(--pink-glow);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.icon-btn--subtle {
  width: 40px;
  height: 40px;
  font-size: 17px;
  color: var(--text-muted);
}

.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Stage 1: Gift Prompt & Teddy Reveal Card */
.gift-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 52px);
  z-index: 10;
  text-align: center;
  padding: 0 24px;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.gift-hint__eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pink);
  font-weight: 600;
}

.gift-hint__cta {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  animation: pulseSoft 2.1s ease-in-out infinite;
}

@keyframes pulseSoft {
  0%, 100% {
    opacity: 0.68;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.teddy-reveal {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  padding: 0 14px calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.teddy-reveal.is-hidden {
  transform: translateY(16px);
}

.teddy-reveal__card {
  width: 100%;
  max-width: 440px;
  background: rgba(10, 10, 15, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 14px 16px 13px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: center;
  pointer-events: auto;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}

.teddy-reveal__title {
  margin: 0 0 6px;
  font-size: 18.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
}

.teddy-reveal__text {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.46;
  color: var(--text-muted);
}

.teddy-reveal__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Stage 2: Flowers Studio */
.flowers-header {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  left: 0;
  right: 0;
  z-index: 10;
  text-align: center;
  padding: 0 16px;
  pointer-events: none;
}

.flower-title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(246, 244, 247, 0.72);
}

.flower-hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--text-soft);
  transition: opacity 0.6s ease;
}

.flower-hint.is-faded {
  opacity: 0;
}

.flowers-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  padding: 16px 0 calc(env(safe-area-inset-bottom, 0px) + 18px);
  background: linear-gradient(to top, rgba(5, 5, 7, 0.94) 48%, rgba(5, 5, 7, 0));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.flower-note {
  margin: 0;
  padding: 0 20px;
  max-width: 460px;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(246, 244, 247, 0.84);
  font-style: italic;
}

.flower-pills {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 2px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: auto;
  scroll-behavior: smooth;
}

.flower-pills::-webkit-scrollbar {
  display: none;
}

@media (min-width: 680px) {
  .flower-pills {
    justify-content: center;
  }
}

.flower-pill {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 20, 27, 0.84);
  color: rgba(246, 244, 247, 0.8);
  border-radius: 999px;
  padding: 7px 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease, transform 0.15s ease;
}

.flower-pill:active {
  transform: scale(0.95);
}

.flower-pill.is-active {
  background: #ffffff;
  color: #0a0a0e;
  border-color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.24);
}

/* Apology Letter Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 6, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: 82dvh;
  overflow-y: auto;
  background: rgba(16, 16, 23, 0.94);
  border: 1px solid rgba(248, 168, 200, 0.26);
  border-radius: 22px;
  padding: 24px 22px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
}

.modal__kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pink);
}

.modal__title {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  padding-right: 32px;
}

.modal__body {
  font-size: 14.5px;
  line-height: 1.62;
  color: rgba(246, 244, 247, 0.86);
}

.modal__body p {
  margin: 0 0 12px;
}

.modal__body p:last-child {
  margin-bottom: 0;
}

.modal__sign {
  color: #ffd7e6;
  font-weight: 500;
}

@media (max-height: 670px) {
  .teddy-reveal__card {
    padding: 11px 13px 10px;
  }
  .teddy-reveal__title {
    font-size: 16.5px;
    margin-bottom: 4px;
  }
  .teddy-reveal__text {
    font-size: 12px;
    line-height: 1.38;
    margin-bottom: 9px;
  }
  .pill-btn--primary {
    padding: 9px 15px;
    font-size: 13px;
  }
}
