:root {
  --rose: #e6007e;
  --rose-deep: #c4006d;
  --aqua: #aee6e7;
  --ink: #181418;
  --muted: #615761;
  --black: #171717;
  --line: #06c755;
  --border: rgba(230, 0, 126, .58);
  --glass: rgba(255, 255, 255, .24);
  --shadow: 0 28px 90px rgba(37, 14, 31, .22);
  --max: 1480px;
}

* { box-sizing: border-box; }

html {
  background: #eed8e2;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(255,255,255,.55), transparent 22%),
    radial-gradient(circle at 90% 10%, rgba(194,170,255,.22), transparent 20%),
    linear-gradient(180deg, #f3d7e5 0%, #eadde7 35%, #d8e8eb 68%, #b7e7e8 100%);
}

button { font: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid rgba(230, 0, 126, .3); outline-offset: 3px; }
img { display: block; width: 100%; height: auto; }

.page {
  position: relative;
  width: min(var(--max), calc(100vw - 48px));
  height: clamp(700px, calc(100dvh - 36px), 920px);
  margin: 18px auto;
  overflow: hidden;
  border-radius: 30px;
  background:
    radial-gradient(circle at 88% 8%, rgba(175,150,235,.18), transparent 15%),
    radial-gradient(circle at 8% 87%, rgba(65,220,225,.17), transparent 20%),
    linear-gradient(180deg, #f2d5e3 0%, #eadde7 30%, #d8e8eb 64%, #b5e6e7 100%);
  box-shadow: var(--shadow);
}

.ambient {
  position: absolute;
  border-radius: 50%;
  filter: blur(20px);
  pointer-events: none;
  opacity: .24;
}

.ambient-one { width: 200px; height: 200px; top: 80px; right: -60px; background: #9077c6; }
.ambient-two { width: 160px; height: 160px; bottom: 70px; left: -45px; background: #62d9dc; }

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 128px;
  padding: 22px 28px 8px;
  text-align: center;
}

.brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #141214;
  font-size: clamp(32px, 2.6vw, 44px);
  font-weight: 900;
  font-style: italic;
  line-height: 1;
}

.heartbeat { position: relative; width: 84px; height: 24px; opacity: .38; }
.heartbeat::before {
  position: absolute;
  top: 11px;
  right: 0;
  left: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #4a3f48 12%, #4a3f48 30%, transparent 31%);
  content: "";
}
.heartbeat::after {
  position: absolute;
  top: 4px;
  left: 33px;
  width: 20px;
  height: 15px;
  border-bottom: 2px solid #4a3f48;
  border-left: 2px solid #4a3f48;
  content: "";
  transform: skewX(-22deg) rotate(-42deg);
}
.heartbeat.right { transform: scaleX(-1); }

.subtitle { margin: 12px 0 0; color: #3d343c; font-size: clamp(16px, 1.2vw, 20px); font-weight: 600; }
.progress-wrap { display: flex; justify-content: center; gap: 8px; width: min(520px, 70%); margin-top: 13px; }
.progress-dot { width: 8px; height: 8px; border-radius: 999px; background: rgba(24,20,24,.17); transition: .18s ease; }
.progress-dot.is-done { background: rgba(230,0,126,.42); }
.progress-dot.is-active { width: 26px; background: var(--rose); }

.screen { position: relative; z-index: 4; height: calc(100% - 128px); padding: 0 46px 104px; }
.card-stack { position: relative; width: min(1180px, 100%); height: 100%; margin: 0 auto; }
.outline {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 94%;
  height: calc(100% - 26px);
  border: 3px solid var(--border);
  border-radius: 34px;
  pointer-events: none;
  transform: translateX(-50%);
}
.outline.one { opacity: .68; transform: translateX(-50%) rotate(2.2deg); }
.outline.two { opacity: .68; transform: translateX(-50%) rotate(-2.2deg); }

.question-card {
  position: absolute;
  inset: 28px 42px 14px;
  overflow: hidden;
  border: 3px solid var(--border);
  border-radius: 28px;
  background: var(--glass);
}
.accent {
  position: absolute;
  top: 18px;
  left: 22px;
  color: var(--rose);
  font-size: clamp(15px, 1.25vw, 21px);
  font-weight: 900;
  font-style: italic;
  line-height: 1.05;
  white-space: pre-line;
}
.view { width: 100%; height: 100%; }
.question-inner { display: flex; flex-direction: column; justify-content: center; width: 100%; height: 100%; padding: 84px 54px 28px; }
.question-inner.media { justify-content: flex-start; padding: 66px 40px 24px; }
.question {
  width: min(980px, 100%);
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(25px, 2vw, 35px);
  font-weight: 900;
  line-height: 1.48;
  text-align: center;
  text-wrap: balance;
}
.subcopy { width: min(760px, 100%); margin: 16px auto 0; color: var(--muted); font-size: clamp(15px, 1.2vw, 18px); font-weight: 600; line-height: 1.75; text-align: center; }
.question.compact { width: 100%; margin: 0 0 20px; font-size: clamp(21px, 1.6vw, 28px); text-align: left; }

.media-grid { display: grid; flex: 1 1 auto; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; width: 100%; min-height: 0; }
.media-choice { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0; border: 3px solid transparent; border-radius: 18px; background: transparent; cursor: pointer; }
.media-choice.selected { border-color: var(--rose); box-shadow: 0 0 0 2px rgba(255,255,255,.5), 0 8px 22px rgba(230,0,126,.17); }
.media-choice .image { flex: 1 1 auto; min-height: 0; overflow: hidden; border-radius: 15px; background: rgba(255,255,255,.36); }
.media-choice img { width: 100%; height: 100%; object-fit: cover; }
.media-choice .name { margin: 8px 0 0; color: #171417; font-size: clamp(16px, 1.2vw, 21px); font-weight: 900; text-align: center; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: min(780px, 100%); margin: auto; }
.choice-card { min-height: 94px; border: 2px solid rgba(230,0,126,.16); border-radius: 18px; background: rgba(255,255,255,.36); color: #1e1a1e; font-size: clamp(18px,1.4vw,23px); font-weight: 900; cursor: pointer; }
.choice-card.selected { border-color: var(--rose); background: rgba(230,0,126,.08); }

.actions { position: absolute; bottom: 28px; left: 50%; z-index: 20; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 24px; width: min(760px, calc(100% - 110px)); height: 64px; transform: translateX(-50%); }
.action { height: 100%; border: 0; border-radius: 999px; background: var(--black); box-shadow: 0 10px 26px rgba(0,0,0,.16); color: #fff; font-size: clamp(18px,1.3vw,23px); font-weight: 900; cursor: pointer; }
.action:active { transform: scale(.985); }
.action:disabled { opacity: .42; cursor: not-allowed; }
.action.single { grid-column: 1 / -1; justify-self: center; width: min(520px,100%); }

.quick-line-button { position: absolute; top: 16px; right: 18px; z-index: 12; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 15px; border: 0; border-radius: 999px; background: var(--line); box-shadow: 0 8px 22px rgba(6,199,85,.24); color: #fff; font-size: 13px; font-weight: 900; cursor: pointer; transition: transform .15s ease, filter .15s ease; }
.quick-line-button:hover { filter: brightness(1.03); }
.quick-line-button:active { transform: scale(.985); }
.quick-line-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.18); }

.loader { width: 60px; height: 60px; margin: 40px auto 16px; border: 5px solid rgba(255,255,255,.6); border-top-color: var(--rose); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin: 0; font-size: 21px; font-weight: 900; text-align: center; }
.loading-bar { width: min(620px,76%); height: 10px; margin: 22px auto 0; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.58); }
.loading-bar span { display: block; width: 0; height: 100%; background: linear-gradient(90deg,var(--rose),#ff6bb7); transition: width .15s ease; }

.result { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 62px 28px 26px; text-align: center; }
.result-kicker { color: var(--rose); font-size: 14px; font-weight: 900; letter-spacing: .14em; }
.result h2 { margin: 8px 0 0; font-size: clamp(34px,2.7vw,46px); font-weight: 900; line-height: 1.18; }
.result p { width: min(720px,100%); margin: 12px auto 0; color: var(--muted); font-size: clamp(16px,1.2vw,19px); font-weight: 600; line-height: 1.7; }
.result-badges { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; width: min(660px,100%); margin: 20px auto 0; }
.result-badge { display: flex; align-items: center; justify-content: center; min-height: 58px; padding: 10px 12px; border: 1px solid rgba(24,20,24,.08); border-radius: 16px; background: rgba(255,255,255,.35); color: #302730; font-size: 14px; font-weight: 900; }
.line-button { width: min(500px,100%); min-height: 68px; margin-top: 22px; border: 0; border-radius: 999px; background: var(--line); box-shadow: 0 13px 32px rgba(6,199,85,.27); color: #fff; font-size: clamp(19px,1.5vw,24px); font-weight: 900; cursor: pointer; }
.result-note { margin-top: 10px !important; color: #5c535d !important; font-size: 13px !important; }
.after-line-copy { width: min(700px,100%); margin-top: 15px; padding: 14px 18px; border-radius: 14px; background: rgba(255,255,255,.28); color: #4f4650; font-size: 13px; line-height: 1.6; text-align: left; }
.after-line-copy strong { display: block; margin-bottom: 4px; color: #211b21; }
.after-line-copy ul { margin: 6px 0 0; padding-left: 1.2rem; }
.legal-note { width: min(700px,100%); margin-top: 12px; color: #6f6570; font-size: 12px; line-height: 1.55; }

.startup-error { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; gap: 14px; background: #f1d8e5; text-align: center; }
.startup-error[hidden] { display: none; }
.startup-error button { padding: 10px 20px; border: 0; border-radius: 999px; background: #171717; color: #fff; cursor: pointer; }

@media (max-width: 1023px) and (min-width: 768px) {
  .page { width: calc(100vw - 28px); height: clamp(720px,calc(100dvh - 24px),900px); margin: 12px auto; }
  .screen { padding: 0 28px 98px; }
  .question-card { inset: 24px 28px 12px; }
  .question-inner { padding-right: 34px; padding-left: 34px; }
  .question-inner.media { padding-right: 26px; padding-left: 26px; }
  .media-grid { grid-template-rows: repeat(2,minmax(0,1fr)); grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 18px; }
  .actions { bottom: 24px; width: min(660px,calc(100% - 70px)); height: 60px; }
}

@media (max-width: 767px) {
  body { min-height: 100dvh; overflow: hidden; background: #f1d8e5; }
  .page { width: 100vw; height: 100dvh; min-height: 0; margin: 0; border-radius: 0; box-shadow: none; }
  .topbar { justify-content: flex-start; height: 104px; padding: 12px 14px 4px; }
  .brand-line { gap: 8px; font-size: clamp(27px,7.2vw,33px); }
  .heartbeat { width: 46px; height: 20px; }
  .heartbeat::before { top: 9px; }
  .heartbeat::after { top: 3px; left: 18px; width: 17px; height: 13px; }
  .subtitle { max-width: calc(100vw - 24px); margin-top: 7px; overflow: hidden; font-size: clamp(13px,3.7vw,16px); line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; }
  .progress-wrap { width: min(330px,86%); margin-top: 8px; gap: 5px; }
  .progress-dot { width: 6px; height: 6px; }
  .progress-dot.is-active { width: 19px; }
  .screen { height: calc(100% - 104px); padding: 0 8px calc(78px + env(safe-area-inset-bottom)); }
  .card-stack { width: 100%; height: 100%; }
  .outline { top: 8px; width: 89%; height: calc(100% - 18px); border-width: 2px; border-radius: 27px; }
  .outline.one { transform: translateX(-50%) rotate(3deg); }
  .outline.two { transform: translateX(-50%) rotate(-3deg); }
  .question-card { inset: 17px 17px 6px; border-width: 2px; border-radius: 22px; }
  .accent { top: 12px; left: 13px; font-size: clamp(13px,3.8vw,17px); }
  .quick-line-button { top: 10px; right: 11px; min-height: 34px; padding: 0 11px; font-size: 11.5px; }
  .quick-line-dot { width: 7px; height: 7px; box-shadow: 0 0 0 2px rgba(255,255,255,.18); }
  .question-inner { align-items: center; justify-content: center; padding: 62px 17px 18px; }
  .question-inner.media { align-items: stretch; justify-content: flex-start; padding: 58px 13px 10px; }
  .question { width: 100%; margin: 0; font-size: clamp(21px,5.7vw,27px); line-height: 1.42; text-align: center; }
  .subcopy { width: min(310px,100%); margin-top: 16px; font-size: clamp(14px,3.8vw,16px); line-height: 1.75; text-align: center; }
  .question.compact { margin-bottom: 9px; padding-right: 96px; font-size: clamp(17px,4.6vw,21px); line-height: 1.35; text-align: left; }
  .media-grid { grid-template-rows: repeat(2,minmax(0,1fr)); grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 10px; }
  .media-choice { border-width: 2px; border-radius: 13px; }
  .media-choice .image { border-radius: 10px; }
  .media-choice .name { margin-top: 4px; font-size: clamp(13px,3.7vw,17px); }
  .choice-grid { grid-template-columns: 1fr; gap: 10px; margin: auto 0; }
  .choice-card { min-height: 62px; font-size: 17px; }
  .actions { right: 16px; bottom: calc(12px + env(safe-area-inset-bottom)); left: 16px; width: auto; height: 56px; gap: 12px; transform: none; }
  .action { font-size: clamp(16px,4.7vw,21px); }
  .result { justify-content: flex-start; overflow-y: auto; padding: 49px 14px 18px; }
  .result-kicker { font-size: 11px; }
  .result h2 { margin-top: 4px; font-size: clamp(27px,7.5vw,36px); }
  .result p { margin-top: 7px; font-size: clamp(13px,3.7vw,16px); line-height: 1.55; }
  .line-button { min-height: 58px; margin-top: 13px; font-size: clamp(17px,4.8vw,21px); }
  .result-note { margin-top: 8px !important; font-size: 12px !important; }
  .result-badges { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; width: 100%; margin-top: 13px; }
  .result-badge { min-height: 48px; padding: 7px 5px; border-radius: 13px; font-size: 11px; line-height: 1.25; }
  .after-line-copy { width: 100%; margin-top: 13px; padding: 12px 13px; font-size: 12px; line-height: 1.65; }
  .legal-note { width: 100%; margin-top: 10px; padding-bottom: 6px; font-size: 10.5px; line-height: 1.5; }
}

@media (max-width: 380px) {
  .topbar { height: 94px; padding-top: 9px; }
  .brand-line { font-size: 24px; }
  .subtitle { margin-top: 5px; font-size: 12px; }
  .screen { height: calc(100% - 94px); padding-bottom: 66px; }
  .question-card { inset: 13px 13px 5px; }
  .question-inner { padding: 54px 13px 14px; }
  .question-inner.media { padding: 47px 10px 8px; }
  .question.compact { padding-right: 84px; }
  .quick-line-button { top: 8px; right: 9px; min-height: 31px; padding: 0 9px; font-size: 10.5px; }
  .actions { right: 12px; bottom: calc(7px + env(safe-area-inset-bottom)); left: 12px; height: 50px; }
}

@media (max-height: 700px) and (max-width: 767px) {
  .topbar { height: 80px; padding-top: 6px; }
  .brand-line { font-size: 23px; }
  .subtitle { margin-top: 3px; font-size: 11.5px; }
  .progress-wrap { margin-top: 4px; }
  .screen { height: calc(100% - 80px); padding-bottom: 58px; }
  .question-card { inset: 9px 14px 4px; }
  .question-inner { padding-top: 46px; }
  .question-inner.media { padding-top: 42px; }
  .actions { bottom: 6px; height: 44px; }
}

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