:root {
  --ink: #1f1a38;
  --deep: #35206d;
  --pink: #ff6fb7;
  --hot-pink: #ff3f9f;
  --blue: #4477ff;
  --cyan: #61dfff;
  --yellow: #ffe05c;
  --mint: #76f3c8;
  --cream: #fff7df;
  --white: #ffffff;
  --shadow: 5px 5px 0 #1f1a38;
  --soft-shadow: 0 16px 36px rgba(31, 26, 56, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #ffeef8;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
  letter-spacing: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.28) 0 2px, transparent 2px 8px),
    linear-gradient(90deg, rgba(255, 111, 183, 0.16) 1px, transparent 1px),
    linear-gradient(0deg, rgba(68, 119, 255, 0.12) 1px, transparent 1px),
    conic-gradient(from 45deg, #fff 0 25%, #eff8ff 0 50%, #fff7fd 0 75%, #fff4c9 0);
  background-size: auto, 34px 34px, 34px 34px, 68px 68px;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(135deg, rgba(255, 111, 183, 0.55), transparent 42%),
    linear-gradient(315deg, rgba(97, 223, 255, 0.5), transparent 42%),
    linear-gradient(180deg, rgba(255, 224, 92, 0.35), transparent 55%);
}

button {
  font: inherit;
}

a {
  color: inherit;
}

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

.page-shell {
  position: relative;
  width: min(100%, 960px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 14px 14px calc(22px + env(safe-area-inset-bottom));
}

.page-shell::before,
.page-shell::after {
  position: fixed;
  z-index: -1;
  color: rgba(31, 26, 56, 0.35);
  font-weight: 900;
  pointer-events: none;
  text-shadow: 2px 2px 0 var(--white);
}

.page-shell::before {
  top: 82px;
  left: 14px;
  content: "☆ + ◇";
  transform: rotate(-9deg);
}

.page-shell::after {
  right: 20px;
  bottom: 86px;
  content: "◇ ☆ +";
  transform: rotate(8deg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 44px 1fr 44px 44px;
  align-items: center;
  gap: 8px;
  padding: env(safe-area-inset-top) 0 10px;
}

.brand-chip {
  min-width: 0;
  padding: 10px 12px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--cyan));
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 950;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.music-button {
  background: var(--yellow);
}

.music-button.is-playing {
  background: var(--mint);
  color: var(--deep);
}

.app {
  display: grid;
  min-height: calc(100dvh - 74px);
}

.screen {
  display: none;
}

.screen.is-active {
  display: grid;
}

.intro-screen {
  align-content: center;
  gap: 18px;
  min-height: calc(100dvh - 102px);
  padding: 4px 0 22px;
}

.intro-copy {
  display: grid;
  gap: 10px;
}

.result-kicker {
  display: none;
}

.title-art {
  display: block;
  width: min(100%, 520px);
  margin: -8px auto -2px;
  filter:
    drop-shadow(4px 5px 0 rgba(31, 26, 56, 0.28))
    drop-shadow(0 10px 20px rgba(255, 63, 159, 0.22));
  animation: title-float 3.4s ease-in-out infinite;
  transform-origin: 50% 52%;
  will-change: transform;
}

.primary-button,
.secondary-button,
.option-button {
  min-height: 56px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  font-weight: 950;
}

.primary-button {
  width: 100%;
  padding: 16px;
  background: var(--yellow);
  font-size: 1.08rem;
}

.start-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter:
    drop-shadow(5px 7px 0 rgba(31, 26, 56, 0.24))
    drop-shadow(0 12px 22px rgba(68, 119, 255, 0.22));
}

.start-image-button img {
  display: block;
  width: min(100%, 520px);
  height: auto;
  margin: 0 auto;
}

.start-image-button:active {
  transform: translateY(2px) scale(0.985);
}

.intro-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 126px));
  justify-content: center;
  gap: 8px;
  align-items: center;
  width: min(100%, 300px);
  margin: 0 auto;
}

.intro-game-link,
.intro-thread-link {
  display: inline-grid;
  min-height: 36px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 rgba(31, 26, 56, 0.88);
  background:
    radial-gradient(circle at 18% 22%, #ffffff 0 0.16rem, transparent 0.18rem),
    linear-gradient(90deg, #ffe05c, #ff8fce 52%, #61dfff);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.intro-game-link {
  padding: 8px 9px;
}

.intro-thread-link {
  padding: 8px 9px;
}

.secondary-button {
  width: 100%;
  padding: 16px;
  background: var(--white);
  font-size: 1.02rem;
}

.quiz-screen {
  align-content: center;
  gap: 16px;
  padding: 8px 0 22px;
}

.quiz-head {
  display: grid;
  gap: 10px;
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 950;
}

.question-meta span {
  display: inline-grid;
  min-height: 34px;
  align-items: center;
  padding: 6px 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 3px 3px 0 var(--ink);
}

.question-meta span:first-child {
  background: var(--yellow);
}

.progress-track {
  height: 18px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 3px 3px 0 var(--ink);
}

.progress-fill {
  display: block;
  width: 5%;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--yellow), var(--cyan));
  transition: width 180ms ease;
}

.question-panel {
  display: grid;
  gap: 18px;
  padding: 18px 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow), var(--soft-shadow);
}

.question-panel h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.42;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.options {
  display: grid;
  gap: 12px;
}

.option-button {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 78px;
  padding: 12px;
  background: var(--white);
  text-align: left;
}

.option-button:nth-child(1) {
  background: linear-gradient(90deg, #fff, #fff6d8);
}

.option-button:nth-child(2) {
  background: linear-gradient(90deg, #fff, #e9fbff);
}

.option-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--hot-pink);
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 950;
  text-shadow: 1px 1px 0 var(--ink);
}

.option-button:nth-child(2) .option-mark {
  background: var(--blue);
}

.option-text {
  min-width: 0;
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.48;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.result-screen {
  align-content: center;
  gap: 16px;
  padding: 8px 0 22px;
}

.result-visual {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow), var(--soft-shadow);
}

.result-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.result-copy {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 16px 14px 18px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.result-copy h2 {
  margin: 0;
  color: var(--yellow);
  font-size: 2.05rem;
  font-weight: 950;
  line-height: 1.1;
  text-shadow:
    2px 0 0 var(--ink),
    -2px 0 0 var(--ink),
    0 2px 0 var(--ink),
    0 -2px 0 var(--ink),
    4px 4px 0 var(--pink);
}

.result-badge-image {
  display: block;
  position: relative;
  z-index: 1;
  width: min(82%, 280px);
  max-height: 112px;
  object-fit: contain;
  justify-self: center;
  pointer-events: none;
  transform: none;
  transform-origin: center;
  filter: drop-shadow(3px 4px 0 rgba(31, 26, 56, 0.24));
}

.result-quote {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: 100%;
  margin: 2px auto 0;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: linear-gradient(90deg, #fff6d8, #ffe4f4, #e6fbff);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--deep);
  font-size: 0.98rem;
  font-weight: 950;
  line-height: 1.35;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.result-copy p:last-child {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 1rem;
  font-weight: 780;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.result-actions {
  display: grid;
  gap: 12px;
}

.match-scroll-button {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 30%, #fff 0 0.28rem, transparent 0.31rem),
    radial-gradient(circle at 88% 68%, #fff 0 0.24rem, transparent 0.27rem),
    linear-gradient(90deg, #ffe05c, #ff7bc2 48%, #61dfff);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 950;
  line-height: 1.25;
  word-break: keep-all;
}

.all-myday-section {
  position: relative;
  display: none;
  gap: 14px;
  margin-top: 8px;
  padding: 18px 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow), var(--soft-shadow);
  scroll-margin-top: 78px;
}

.all-myday-section.is-open {
  display: grid;
}

.all-myday-section img {
  display: block;
  width: min(100%, 420px);
  height: auto;
  justify-self: center;
  filter:
    drop-shadow(4px 5px 0 rgba(31, 26, 56, 0.22))
    drop-shadow(0 10px 22px rgba(97, 223, 255, 0.2));
}

.all-myday-copy {
  display: grid;
  gap: 10px;
}

.all-myday-copy h3 {
  margin: 0;
  color: var(--yellow);
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1.16;
  text-align: center;
  text-shadow:
    2px 0 0 var(--ink),
    -2px 0 0 var(--ink),
    0 2px 0 var(--ink),
    0 -2px 0 var(--ink),
    3px 3px 0 var(--pink);
  word-break: keep-all;
}

.all-myday-copy p {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 780;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.fly-credit {
  justify-self: end;
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--hot-pink);
  font-size: 0.92rem;
  font-weight: 950;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.birthday-note {
  margin: 2px 0 0;
  color: var(--hot-pink);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1.45;
  text-align: center;
  word-break: keep-all;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 50;
  display: none;
  max-width: 460px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  box-shadow: 4px 4px 0 var(--pink);
  color: var(--white);
  font-weight: 850;
  text-align: center;
}

.toast.is-visible {
  display: block;
}

.particle-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  pointer-events: none;
}

.click-particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  color: var(--particle-color);
  font-size: var(--particle-size);
  font-weight: 950;
  line-height: 1;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.65);
  text-shadow:
    1px 1px 0 #ffffff,
    2px 2px 0 rgba(31, 26, 56, 0.34);
  animation: particle-fly 760ms cubic-bezier(0.17, 0.82, 0.31, 1) forwards;
}

.clover-particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--clover-size);
  height: var(--clover-size);
  aspect-ratio: 1;
  opacity: 0;
  object-fit: contain;
  transform: translate(-50%, -50%) scale(0.64) rotate(var(--rot));
  filter:
    drop-shadow(2px 3px 0 rgba(31, 26, 56, 0.22))
    drop-shadow(0 6px 12px rgba(118, 243, 200, 0.35));
  animation: clover-float var(--duration) ease-out var(--delay) forwards;
}

@keyframes particle-fly {
  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
      rotate(var(--rot))
      scale(0.28);
  }

}

@keyframes clover-float {
  0% {
    opacity: 0.98;
  }

  70% {
    opacity: 0.96;
  }

  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
      scale(1.05)
      rotate(calc(var(--rot) + var(--spin)));
  }
}

@keyframes title-float {
  0%,
  100% {
    transform: translateY(0) rotate(-0.7deg);
  }

  50% {
    transform: translateY(-12px) rotate(0.7deg);
  }
}

@media (max-width: 360px) {
  .page-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .title-art {
    width: min(100%, 440px);
  }

  .question-panel h2 {
    font-size: 1.16rem;
  }

  .option-text {
    font-size: 0.92rem;
  }
}

@media (min-width: 720px) {
  .page-shell {
    padding: 22px 24px 32px;
  }

  .topbar {
    grid-template-columns: 52px 1fr 52px 52px;
  }

  .icon-button {
    width: 52px;
    height: 52px;
  }

  .intro-screen {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    align-content: center;
    gap: 20px;
  }

  .intro-copy,
  .intro-screen .start-image-button {
    grid-column: auto;
  }

  .title-art {
    width: min(100%, 620px);
  }

  .quiz-screen {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
  }

  .question-panel {
    padding: 24px;
  }

  .question-panel h2 {
    font-size: 1.7rem;
  }

  .option-button {
    min-height: 88px;
    padding: 16px;
  }

  .option-text {
    font-size: 1.05rem;
  }

  .result-screen {
    grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1fr);
    align-items: center;
    gap: 22px;
  }

  .result-actions {
    grid-column: 2;
    grid-template-columns: 1fr 1fr;
  }

  .match-scroll-button {
    grid-column: 2;
  }

  .all-myday-section {
    grid-column: 1 / -1;
    align-items: center;
    padding: 22px;
  }

  .all-myday-section.is-open {
    grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1fr);
  }

  .all-myday-copy h3 {
    text-align: left;
  }
}

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

  .clover-particle {
    animation-duration: var(--duration) !important;
    animation-iteration-count: 1 !important;
  }
}
