:root {
  color-scheme: light;
  --ink: #193f48;
  --paper: #fffdf8;
  --rose: #ff6b8a;
  --sun: #ffd15c;
  --mint: #58d6a8;
  --sky: #55bfff;
  --violet: #8e79ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  color: var(--ink);
  background: #fff4d6;
  font-family:
    ui-rounded, "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui,
    sans-serif;
}

button {
  font: inherit;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: max(84px, env(safe-area-inset-top)) 18px max(54px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.46) 0 2px, transparent 2px 58px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0 2px, transparent 2px 58px),
    linear-gradient(135deg, #fff0a8 0%, #ffd2dc 29%, #b8ecff 67%, #d3f8cb 100%);
}

.sky-confetti {
  position: absolute;
  inset: 0;
  opacity: 0.9;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 22%, var(--rose) 0 8px, transparent 9px),
    radial-gradient(circle at 86% 18%, var(--sun) 0 10px, transparent 11px),
    radial-gradient(circle at 78% 80%, var(--mint) 0 9px, transparent 10px),
    radial-gradient(circle at 20% 82%, var(--sky) 0 7px, transparent 8px),
    radial-gradient(circle at 54% 12%, var(--violet) 0 6px, transparent 7px);
  animation: drift 8s ease-in-out infinite alternate;
}

.show {
  position: relative;
  width: min(82vw, 520px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.picture-button {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 5px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  color: inherit;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.96) 0 38%, rgba(255, 255, 255, 0.4) 39% 60%, transparent 61%),
    linear-gradient(160deg, rgba(255, 253, 248, 0.88), rgba(255, 255, 255, 0.54));
  box-shadow: 0 28px 54px rgba(26, 68, 74, 0.22);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.picture-button:active {
  transform: scale(0.985);
}

.picture-button img {
  width: min(76%, 390px);
  height: min(76%, 390px);
  object-fit: contain;
  filter: drop-shadow(0 16px 0 rgba(255, 255, 255, 0.62)) drop-shadow(0 20px 28px rgba(31, 80, 86, 0.18));
  user-select: none;
  z-index: 2;
}

.effect-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  min-width: 72px;
  padding: 8px 10px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(25, 63, 72, 0.86);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
  z-index: 3;
}

.curtain {
  position: absolute;
  top: 4%;
  bottom: 4%;
  width: 21%;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.34), transparent 38%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 10px, transparent 10px 22px),
    var(--rose);
  box-shadow: 0 16px 30px rgba(80, 34, 58, 0.16);
  pointer-events: none;
  z-index: 4;
}

.curtain-left {
  left: -9%;
  transform: rotate(-4deg);
}

.curtain-right {
  right: -9%;
  transform: rotate(4deg);
}

.hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.title-block {
  display: grid;
  gap: 3px;
  max-width: min(60vw, 25rem);
}

.title-block p,
.title-block h1,
.credit {
  margin: 0;
}

.title-block p {
  color: rgba(25, 63, 72, 0.6);
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1;
}

.title-block h1 {
  color: rgba(25, 63, 72, 0.86);
  font-size: clamp(1.24rem, 4vw, 2.18rem);
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.72);
}

.toolbar {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.toolbar button {
  display: grid;
  place-items: center;
  width: clamp(44px, 11vw, 58px);
  height: clamp(44px, 11vw, 58px);
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.68);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(37, 82, 85, 0.16);
  cursor: pointer;
}

.toolbar button:active {
  transform: scale(0.94);
}

.toolbar span {
  display: block;
  font-size: clamp(1.28rem, 5vw, 2rem);
  font-weight: 900;
  line-height: 1;
}

.credit {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  color: rgba(25, 63, 72, 0.64);
  font-size: 0.78rem;
  font-weight: 800;
  pointer-events: auto;
}

.credit a {
  color: inherit;
}

.pop {
  animation: pop 520ms cubic-bezier(0.2, 1.22, 0.32, 1) both;
}

.fade {
  animation: fade 560ms ease-out both;
}

.zoom {
  animation: zoom 560ms cubic-bezier(0.17, 1.4, 0.42, 1) both;
}

.spin {
  animation: spin 620ms cubic-bezier(0.16, 1.2, 0.4, 1) both;
}

.slide {
  animation: slide 540ms cubic-bezier(0.2, 1.05, 0.42, 1) both;
}

.flip {
  animation: flip 620ms cubic-bezier(0.2, 1.1, 0.4, 1) both;
}

.squash {
  animation: squash 520ms cubic-bezier(0.2, 1.32, 0.42, 1) both;
}

@keyframes drift {
  from {
    transform: translateY(-10px);
  }
  to {
    transform: translateY(10px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.35) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes zoom {
  from {
    opacity: 0;
    transform: scale(0.1);
  }
  70% {
    transform: scale(1.12);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  from {
    opacity: 0;
    transform: rotate(-220deg) scale(0.25);
  }
  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

@keyframes slide {
  from {
    opacity: 0;
    transform: translateX(64vw) rotate(8deg);
  }
  to {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

@keyframes flip {
  from {
    opacity: 0;
    transform: perspective(800px) rotateY(90deg) scale(0.8);
  }
  to {
    opacity: 1;
    transform: perspective(800px) rotateY(0) scale(1);
  }
}

@keyframes squash {
  from {
    opacity: 0;
    transform: scale(1.35, 0.16);
  }
  55% {
    transform: scale(0.86, 1.16);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 560px) {
  .stage {
    padding-top: max(82px, env(safe-area-inset-top));
  }

  .show {
    width: min(91vw, 470px);
  }

  .picture-button {
    border-width: 4px;
  }

  .picture-button img {
    width: 78%;
    height: 78%;
  }

  .title-block {
    max-width: 10.5rem;
  }

  .title-block p {
    font-size: 0.72rem;
  }

  .title-block h1 {
    font-size: 1.22rem;
  }

  .toolbar {
    gap: 6px;
  }

  .toolbar button {
    width: 40px;
    height: 40px;
    border-width: 2px;
  }

  .toolbar span {
    font-size: 1.28rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sky-confetti,
  .pop,
  .fade,
  .zoom,
  .spin,
  .slide,
  .flip,
  .squash {
    animation-duration: 1ms;
  }
}
