:root {
  color-scheme: light;
  --navy: #17317f;
  --blue: #209eda;
  --red: #e01520;
  --gold: #c99b69;
  --ivory: #f5efe8;
  --paper: #fffdf9;
  --ink: #10265f;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 84% 7%, rgba(201, 155, 105, 0.24), transparent 25rem),
    radial-gradient(circle at 16% 25%, rgba(32, 158, 218, 0.19), transparent 26rem),
    linear-gradient(180deg, #fbf7f0 0%, #edf7fc 56%, #d8edf8 100%);
}

button { font: inherit; -webkit-tap-highlight-color: transparent; }

#h5-app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.h5-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-bottom: 28px;
}

.h5-brand img { width: 100%; height: auto; max-height: 64px; object-fit: contain; object-position: center; }

.panel {
  min-height: calc(100vh - 145px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  background: rgba(255, 253, 249, 0.82);
  box-shadow: 0 22px 65px rgba(23, 49, 127, 0.14);
  backdrop-filter: blur(16px);
  text-align: center;
}

.panel[hidden], .result[hidden] { display: none; }

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.17em;
}

h1, h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-weight: 500; }
h1 { font-size: clamp(38px, 10vw, 58px); line-height: 1.05; }
h2 { font-size: clamp(29px, 7.5vw, 42px); line-height: 1.15; }

.panel > p:not(.eyebrow) { margin: 22px 0 0; font-size: 18px; line-height: 1.65; }
.en { color: #54658f; font-size: 0.88em !important; letter-spacing: 0.015em; }

.primary, .secondary, .text-button, .option {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.primary, .secondary {
  min-height: 58px;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.primary { margin-top: 32px; background: var(--navy); color: white; box-shadow: 0 14px 30px rgba(23, 49, 127, 0.22); }
.primary:disabled, .secondary:disabled { opacity: 0.38; cursor: default; box-shadow: none; }
.secondary { background: white; color: var(--navy); border: 1px solid rgba(23, 49, 127, 0.18); }

#h5-question { margin: 0 0 24px; text-align: center; text-wrap: balance; }

#h5-options { display: grid; gap: 12px; }
.option {
  min-height: 70px;
  padding: 13px 17px;
  border-radius: 18px;
  border: 1px solid rgba(23, 49, 127, 0.17);
  display: grid;
  gap: 4px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: center;
  font-size: 17px;
  font-weight: 700;
}
.option small { color: #667597; font-weight: 500; }
.option[aria-checked="true"] { border-color: var(--gold); background: #fffaf1; box-shadow: 0 9px 24px rgba(23, 49, 127, 0.12); }

.result-heading { padding: 14px 8px 22px; text-align: center; }
#result-heading { max-width: 15ch; margin: 0 auto; font-size: clamp(28px, 8vw, 40px); line-height: 1.08; text-wrap: balance; }
.result-heading p { margin: 10px 0 0; line-height: 1.5; color: #54658f; }
#result-mode { color: var(--gold); font-size: 12px; font-weight: 850; letter-spacing: 0.11em; }
#result-persona { color: var(--navy); font-family: Georgia, "Songti SC", serif; font-size: 24px; font-weight: 650; }
#result-answers { font-size: 14px; }
#result-reasons { color: #7b5b3d; font-size: 14px; font-weight: 720; }
#result-copy { font-size: 15px; }
#result-journey-code,
#result-memory-date { margin: 7px 0 0; color: #405787; font-size: 12px; font-weight: 760; letter-spacing: .06em; }

#memory-poster {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  border-radius: 18px;
  background: #cfe6f5;
  box-shadow: 0 22px 60px rgba(17, 38, 95, 0.23);
  -webkit-touch-callout: default;
  user-select: auto;
}

#memory-poster[hidden], #retry-poster[hidden] { display: none; }
#poster-region[aria-busy="true"] { min-height: 100px; }
.result-actions button { overflow-wrap: anywhere; }

.result-actions { display: grid; gap: 12px; margin-top: 22px; }
.result-actions .primary { margin-top: 0; }
.text-button { padding: 12px; background: transparent; color: var(--navy); font-weight: 700; }
.privacy { margin: 17px 0 0; color: #647393; font-size: 12px; line-height: 1.6; text-align: center; }
#h5-status { min-height: 1.5em; margin: 14px 0 0; color: var(--navy); font-size: 13px; text-align: center; }

button:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }

@media (max-height: 760px) {
  #h5-app { padding-top: 14px; }
  .h5-brand { margin-bottom: 14px; }
  .panel { min-height: auto; padding: 24px 20px; }
  .option { min-height: 60px; }
}

/* Shared three-question revision. */
[hidden], #h5-next { display: none !important; }
#h5-back { min-height: 44px; margin-top: 10px; }
.quiz-progress { font-size: 11px !important; letter-spacing: .1em; margin-top: 16px !important; }
.option:disabled { opacity: 1; cursor: default; }
.h5-brand { margin-bottom: 20px; padding: 12px; background: #fffdf9; border-radius: 14px; }
.h5-brand img { max-height: 52px; }
.share-hint { font-size: 14px; color: #405787; text-align: center; line-height: 1.5; }
.instagram-guide a { display: inline-block; padding: 10px 0; color: #17317f; font-weight: 800; text-underline-offset: 3px; overflow-wrap: anywhere; }
.instagram-guide a:focus-visible { outline: 3px solid #bfa079; outline-offset: 3px; }

.poster-actions { display:grid; gap:12px; }
@media (max-width:700px) {
  body[data-h5-view="result"] #h5-app { padding-bottom:calc(116px + env(safe-area-inset-bottom)); }
  .poster-actions { position:fixed; z-index:20; left:50%; bottom:0; transform:translateX(-50%); width:min(100%,520px); display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:12px 16px max(12px,env(safe-area-inset-bottom)); background:#fffdf9; border-top:1px solid #c4cfdf; box-shadow:0 -6px 24px #17317f14; }
  .poster-actions :is(.primary,.secondary) { min-height:52px; padding:10px 12px; margin:0; font-size:12px; letter-spacing:.03em; }
  body[data-h5-view="result"] #h5-status { padding-bottom:0; }
}

.memory-share { box-sizing:border-box; width:min(94vw,620px); max-width:620px; max-height:92vh; max-height:92dvh; padding:0; border:0; border-radius:22px; background:#fffdf9; color:#17317f; font:16px/1.5 Arial,sans-serif; overflow:auto; overscroll-behavior:contain; box-shadow:0 20px 80px #071c4b66; }
.memory-share::backdrop { background:#071c4bc9; }
.memory-share *, .memory-share *::before, .memory-share *::after { box-sizing:border-box; }
.memory-share [hidden] { display:none!important; }
.memory-share-header { position:sticky; top:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px; background:#fffdf9; border-bottom:1px solid #d8e0ed; }
.memory-share-header h2 { margin:0; color:#17317f; font:800 16px/1.3 Arial,sans-serif; letter-spacing:.04em; }
.memory-share button.memory-share-close { flex:0 0 44px; width:44px; height:44px; min-height:44px; margin:0; padding:0; border:1px solid #b4c2d9; border-radius:50%; color:#17317f; background:white; font:28px/1 Arial,sans-serif; }
.memory-share-body { padding:0 20px 22px; }
.memory-share p { margin:14px 0; font:14px/1.5 Arial,sans-serif; color:#314d7b; letter-spacing:0; }
.memory-share .memory-share-image { display:block; width:100%; max-width:100%; height:auto; aspect-ratio:4 / 5; max-height:none; margin:16px auto; object-fit:contain; border-radius:12px; -webkit-touch-callout:default; user-select:auto; }
.memory-share label { display:block; margin:18px 0 8px; font:bold 13px/1.4 Arial,sans-serif; letter-spacing:.03em; }
.memory-share textarea { display:block; width:100%; resize:vertical; min-height:145px; padding:12px; border:1px solid #9cadc9; border-radius:12px; background:white; color:#17317f; font:16px/1.5 Arial,sans-serif; user-select:text; }
.memory-share-row { display:flex; gap:10px; flex-wrap:wrap; margin-top:10px; }
.memory-share button, .memory-share a[data-download-image] { cursor:pointer; display:block; min-height:44px; margin:0; padding:11px 14px; border:1px solid #9cadc9; border-radius:12px; background:#edf2fa; color:#17317f; font:700 12px/1.5 Arial,sans-serif; letter-spacing:.02em; text-align:center; text-decoration:none; white-space:normal; }
.memory-share-row button { flex:1 1 110px; }
.memory-share button.memory-share-primary { width:100%; background:#17317f; border-color:#17317f; color:white; font-size:14px; min-height:48px; margin:16px 0 8px; }
.memory-share button:disabled { opacity:.55; cursor:wait; }
.memory-share .memory-share-tip { font-size:13px; }
.memory-share [data-share-status] { color:#17317f; font-weight:700; min-height:1.5em; }
.memory-share-fallback { align-items:center; justify-content:space-between; }
.memory-share a[data-instagram-profile] { color:#17317f; font:700 11px/1.5 Arial,sans-serif; max-width:200px; padding:12px 0; text-underline-offset:3px; }
.memory-share :focus-visible { outline:3px solid #c28d45; outline-offset:3px; }
#aperture #recommendation-countdown { flex:0 0 auto; margin:12px 0 0; font:700 clamp(11px,2.5cqw,17px)/1.4 Arial,sans-serif; color:#fff4df; letter-spacing:.06em; text-align:center; }
#aperture #booking-share { display:block; width:100%; min-height:44px; padding:12px 16px; margin:12px 0 0; border:1px solid #17317f; border-radius:999px; background:#e8eef9; color:#17317f; font-size:clamp(11px,2.8cqw,20px); }
#aperture #booking-share-status { margin:4px 0 0; font:12px/1.4 Arial,sans-serif; color:#425d89; text-align:center; }
#aperture #booking-share-status:empty { display:none; }
@media(max-height:650px) {
  #aperture #recommendation-countdown { margin-top:8px; font-size:11px; }
  #aperture #recommendation-screen .recommendation-brand { margin-bottom:6px; }
  #aperture #recommendation-definition { margin-top:6px; }
  #aperture #recommendation-answers { margin-top:7px; gap:4px; }
  #aperture #recommendation-screen :is(.answer-chip,.reason-chip) { padding-top:4px; padding-bottom:4px; }
  #aperture #recommendation-why, #aperture #recommendation-city { margin-top:8px; }
  #aperture #recommendation-route { margin-top:6px; }
  #aperture #booking-share { margin-top:8px; }
  #aperture #booking-panel .instagram-guide { margin-top:8px; }
}
@media(max-height:650px) {
  body[data-channel="online"] #aperture #booking-screen { top:12px; bottom:max(72px,calc(env(safe-area-inset-bottom) + 60px)); }
  #aperture #booking-persona { margin-top:8px; }
  #aperture #booking-country { margin-top:8px; }
  #aperture #booking-button { min-height:48px; margin-top:12px; padding-top:12px; padding-bottom:12px; }
  #aperture #booking-helper { margin-top:8px; }
  #aperture #booking-panel .card-label { margin-top:10px; }
  #aperture #try-again { min-height:44px; padding-top:8px; padding-bottom:8px; }
}

/* Headings receive focus for screen-reader orientation, never a visual box. */
:is(h1,h2,h3,h4,p)[tabindex="-1"]:focus { outline:none !important; }
html[data-input-mode="pointer"] :is(button,a,[role="radio"]):focus { outline:none !important; }
html[data-input-mode="keyboard"] :is(button,a,[role="radio"]):focus { outline:3px solid #c28d45; outline-offset:3px; }

.booking-dates input { display:block; width:100%; min-width:0; min-height:48px; border:1px solid #9cadc9; border-radius:10px; padding:10px; color:#17317f; background:#fff; font:16px Arial,sans-serif; box-sizing:border-box; }
.booking-dates [data-flight-route] { font-size:18px; font-weight:700; }
.memory-share [data-link-fallback] { overflow-wrap:anywhere; user-select:text; }

/* The dialog owns its scroll area; primary actions stay visible above safe-area. */
.memory-share { overflow:hidden; }
.memory-share[open] { display:flex; flex-direction:column; }
.memory-share-header { position:relative; flex:0 0 auto; }
.memory-share-body { overflow:auto; flex:1 1 auto; min-height:0; overscroll-behavior:contain; padding:0 18px 18px; }
.memory-share-footer { flex:0 0 auto; padding:10px 18px max(12px,env(safe-area-inset-bottom)); border-top:1px solid #d8e0ed; background:#fffdf9; }
.memory-share-footer .memory-share-row { flex-wrap:nowrap; margin:0; }
.memory-share-footer .memory-share-row > * { flex:1 1 0; width:auto; min-width:0; margin:0; min-height:48px; }
.memory-share-footer [data-share-status] { margin:0 0 8px; min-height:0; font-size:12px; }
.memory-share-footer [data-share-status]:empty { display:none; }
.memory-share .memory-share-meta { color:#17317f; font-weight:700; font-size:12px; line-height:1.55; overflow-wrap:anywhere; }
.memory-share .memory-share-image { width:min(100%,400px); }
.memory-share [data-new-caption] { margin-top:8px; width:100%; }
.memory-share-more summary { min-height:44px; padding:12px 0; font:700 12px/1.5 Arial,sans-serif; cursor:pointer; }
.memory-share a[data-download-fallback] { min-height:44px; padding:12px; font:700 12px/1.5 Arial,sans-serif; color:#17317f; }
#aperture #continue-journey { margin:12px auto 0; min-height:44px; padding:10px 24px; border:1px solid #fffdf9; border-radius:999px; background:#fffdf9; color:#17317f; font:800 12px/1.5 Arial,sans-serif; letter-spacing:.04em; }
#aperture .recommendation-actions { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:8px 16px; margin-top:12px; }
#aperture .recommendation-actions #recommendation-countdown { margin:0; font-variant-numeric:tabular-nums; }
#aperture .recommendation-actions #continue-journey { margin:0; min-width:80px; flex:0 0 auto; }
#aperture #continue-journey:focus-visible { outline:3px solid #fff4df; outline-offset:4px; }
#aperture #continue-journey:disabled { opacity:.65; }
body[data-channel="offline"] #aperture .recommendation-actions #continue-journey { min-height:52px; min-width:104px; padding:12px 28px; font-size:clamp(14px,2.8cqw,20px); }
#aperture .mobile-memory-link { display:none; }
@media(max-width:700px) {
  #aperture .mobile-memory-link { display:block; width:100%; min-height:44px; margin:8px 0; padding:10px 12px; border:1px solid #fffdf9; border-radius:999px; background:#fffdf9; color:#17317f; text-align:center; text-decoration:none; font:800 11px/1.5 Arial,sans-serif; }
}
@media(max-height:650px) {
  #aperture #continue-journey { margin-top:8px; }
}
