:root {
  --bg0: #fff3f7;
  --bg1: #fff9ee;
  --ink: #201a23;
  --muted: rgba(32, 26, 35, 0.66);
  --card: rgba(255, 255, 255, 0.74);
  --cardBorder: rgba(32, 26, 35, 0.1);
  --accent: #ff3f86;
  --accent2: #ffb65e;
  --shadow: rgba(26, 16, 24, 0.18);
  --radius: 18px;
  --radius2: 24px;
  --safeB: env(safe-area-inset-bottom, 0px);
  --safeT: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Hiragino Sans", system-ui, -apple-system,
    Segoe UI, sans-serif;
  color: var(--ink);
  background: radial-gradient(1100px 700px at 70% 8%, rgba(255, 63, 134, 0.18), transparent 55%),
    radial-gradient(900px 620px at 10% 18%, rgba(255, 182, 94, 0.18), transparent 58%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: calc(18px + var(--safeT)) 16px calc(18px + var(--safeB));
  max-width: 560px;
  margin: 0 auto;
}

.hero {
  padding: 6px 2px 0;
  display: grid;
  gap: 8px;
}

.hero__tag {
  margin: 0;
  letter-spacing: 0.2em;
  font-size: 12px;
  opacity: 0.85;
}

.hero__title {
  margin: 0;
  font-family: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", serif;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.hero__lead {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.hero__brand {
  font-family: "Baloo 2", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Hiragino Sans",
    sans-serif;
  font-weight: 800;
}

.stage {
  display: grid;
  place-items: center;
  gap: 12px;
}

.boxBtn {
  --boxW: min(250px, 68vw);
  --boxH: calc(var(--boxW) * 1.85);
  --shakeX: clamp(10px, calc(var(--boxW) * 0.06), 18px);
  --shakeY: clamp(7px, calc(var(--boxW) * 0.04), 14px);
  --shakeR: 3deg;
  appearance: none;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: var(--boxW);
  height: var(--boxH);
  display: grid;
  place-items: center;
  border-radius: 18px;
}

.boxBtn:focus-visible {
  outline: 3px solid rgba(255, 126, 170, 0.42);
  outline-offset: 4px;
}

.boxSvg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 24px 44px rgba(26, 16, 24, 0.18));
}

.hint {
  margin: 0;
  text-align: center;
  color: rgba(32, 26, 35, 0.72);
  font-size: 13px;
  line-height: 1.7;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  position: sticky;
  bottom: calc(10px + var(--safeB));
}

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 14px 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease, border-color 120ms ease,
    opacity 120ms ease;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:focus-visible {
  outline: 3px solid rgba(255, 126, 170, 0.42);
  outline-offset: 3px;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(180deg, rgba(255, 142, 184, 0.98), rgba(255, 92, 154, 0.98));
  color: #fff;
  box-shadow: 0 18px 46px rgba(255, 142, 184, 0.22);
}

.btn--primary:hover {
  filter: brightness(1.03);
}

.btn--quiet {
  background: rgba(255, 255, 255, 0.72);
  color: rgba(32, 26, 35, 0.86);
  border: 1px solid rgba(32, 26, 35, 0.1);
}

body.is-modalOpen {
  overflow: hidden;
}

.promoModal[hidden] {
  display: none;
}

.promoModal {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 18px 16px calc(18px + var(--safeB));
  display: grid;
  place-items: center;
}

.promoModal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 16, 24, 0.46);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.promoModal__dialog {
  position: relative;
  width: min(460px, 100%);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(32, 26, 35, 0.12);
  box-shadow: 0 30px 90px rgba(26, 16, 24, 0.28);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.promoModal.is-open .promoModal__dialog {
  animation: promoPop 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.promoModal__close {
  appearance: none;
  border: none;
  background: rgba(32, 26, 35, 0.08);
  color: rgba(32, 26, 35, 0.82);
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  justify-self: end;
}

.promoModal__close:focus-visible {
  outline: 3px solid rgba(255, 126, 170, 0.42);
  outline-offset: 3px;
}

.promoModal__lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(32, 26, 35, 0.78);
  letter-spacing: 0.01em;
}

.promoModal__image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  border: 1px solid rgba(32, 26, 35, 0.08);
}

.promoModal__cta {
  width: 100%;
  text-align: center;
}

.result {
  width: 100%;
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.92);
  padding: 16px;
  display: grid;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.result::before {
  content: "";
  position: absolute;
  inset: -50px -60px;
  background: radial-gradient(900px 420px at 15% 0%, rgba(255, 63, 134, 0.16), transparent 60%),
    radial-gradient(900px 420px at 90% 100%, rgba(43, 212, 182, 0.12), transparent 62%),
    repeating-linear-gradient(
      90deg,
      rgba(32, 26, 35, 0.035),
      rgba(32, 26, 35, 0.035) 1px,
      transparent 1px,
      transparent 10px
    );
  opacity: 0.32;
  pointer-events: none;
}

.result[hidden] {
  display: none;
}

.result__panel {
  position: relative;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.84));
  border: 1px solid rgba(32, 26, 35, 0.08);
  box-shadow: 0 28px 80px rgba(26, 16, 24, 0.16);
  display: grid;
  gap: 18px;
  padding: 22px 18px 18px;
  overflow: hidden;
}

.result__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
      90deg,
      rgba(32, 26, 35, 0.03),
      rgba(32, 26, 35, 0.03) 1px,
      transparent 1px,
      transparent 12px
    ),
    radial-gradient(720px 260px at 25% 10%, rgba(255, 63, 134, 0.1), transparent 60%),
    radial-gradient(720px 260px at 85% 95%, rgba(43, 212, 182, 0.09), transparent 60%);
  opacity: 0.5;
  pointer-events: none;
}

.result__label {
  position: relative;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: rgba(32, 26, 35, 0.58);
}

.result__fortune {
  position: relative;
  margin: 0;
  font-family: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", serif;
  font-size: 64px;
  letter-spacing: 0.16em;
  line-height: 1.02;
  color: rgba(32, 26, 35, 0.86);
}

.result__comment {
  position: relative;
  margin: 0;
  color: rgba(32, 26, 35, 0.72);
  font-size: 18px;
  line-height: 2;
  letter-spacing: 0.01em;
}

.coupon {
  position: relative;
  margin-top: 2px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(
      180deg,
      rgba(255, 63, 134, 0.08),
      rgba(255, 63, 134, 0.03) 46%,
      rgba(43, 212, 182, 0.08)
    ),
    rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(32, 26, 35, 0.08);
  box-shadow: 0 18px 46px rgba(26, 16, 24, 0.1);
}

.coupon::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(32, 26, 35, 0.035),
    rgba(32, 26, 35, 0.035) 1px,
    transparent 1px,
    transparent 10px
  );
  opacity: 0.6;
  pointer-events: none;
}

.coupon__body {
  position: relative;
  padding: 16px 14px 16px;
  display: grid;
  gap: 14px;
}

.coupon__meta {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1.6;
  color: rgba(32, 26, 35, 0.66);
}

.coupon__title {
  margin: 0;
  font-family: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", serif;
  font-size: 34px;
  letter-spacing: 0.06em;
  color: rgba(32, 26, 35, 0.82);
}

.coupon__codeRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.coupon__code {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 15px;
  letter-spacing: 0.12em;
  background: rgba(32, 26, 35, 0.06);
  border: 1px solid rgba(32, 26, 35, 0.12);
  color: rgba(32, 26, 35, 0.85);
  user-select: all;
}

.coupon__copyBtn {
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(32, 26, 35, 0.12);
  color: rgba(32, 26, 35, 0.86);
  min-width: 96px;
}

.coupon__detail {
  margin: 0;
  font-size: 16px;
  line-height: 1.9;
  color: rgba(32, 26, 35, 0.72);
}

.result.is-reveal {
  animation: resultPop 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Motion */
.boxBtn.is-shaking {
  animation: boxShake 1000ms ease-in-out both;
}

@keyframes boxShake {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  12% {
    transform: translate3d(var(--shakeX), calc(0px - var(--shakeY)), 0) rotate(calc(0deg - var(--shakeR)));
  }
  24% {
    transform: translate3d(calc(0px - var(--shakeX)), var(--shakeY), 0) rotate(var(--shakeR));
  }
  38% {
    transform: translate3d(var(--shakeX), var(--shakeY), 0) rotate(calc(0deg - var(--shakeR)));
  }
  52% {
    transform: translate3d(calc(0px - var(--shakeX)), calc(0px - var(--shakeY)), 0) rotate(var(--shakeR));
  }
  68% {
    transform: translate3d(var(--shakeX), calc(0px - var(--shakeY)), 0) rotate(calc(0deg - var(--shakeR)));
  }
  84% {
    transform: translate3d(calc(0px - var(--shakeX)), var(--shakeY), 0) rotate(var(--shakeR));
  }
}

@keyframes resultPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes promoPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .boxBtn.is-shaking,
  .result.is-reveal {
    animation: none !important;
  }

  .promoModal.is-open .promoModal__dialog {
    animation: none !important;
  }

  .btn {
    transition: none;
  }
}

@media (max-width: 420px) {
  .result__fortune {
    font-size: 56px;
  }
  .result__comment,
  .coupon__detail {
    font-size: 15px;
  }
  .coupon__meta {
    font-size: 12px;
  }
  .coupon__title {
    font-size: 24px;
  }
  .coupon__code {
    font-size: 14px;
  }
}
