/*
 * PC5A keeps its own page and question styles. The first two stages intentionally
 * consume the existing H5 visual baseline from /assets/style.css; no SPOT-3 quiz
 * script or video state is imported.
 */

:root[data-pc5a-page="flow"] {
  --pc5a-font-family:
    "Noto Serif SC",
    "Source Han Serif SC",
    "Songti SC",
    "STSong",
    serif;
}

/*
 * PC5A imports the first assessment's layout baseline, but its typography is an
 * isolated product contract. Keep every visible node on one complete CJK serif
 * stack so shared page rules cannot reintroduce partial subsets or sans fonts.
 */
html[data-pc5a-page="flow"] body[data-page="index"] {
  --font-sans: var(--pc5a-font-family);
  --font-sans-dynamic: var(--pc5a-font-family);
  --font-serif: var(--pc5a-font-family);
  --font-serif-dynamic: var(--pc5a-font-family);
  font-family: var(--pc5a-font-family) !important;
}

html[data-pc5a-page="flow"] body[data-page="index"] * {
  font-family: var(--pc5a-font-family) !important;
}

body[data-page="index"][data-pc5a-state="home"] #hero-stage,
body[data-page="index"] .home-boot-screen {
  --font-serif: var(--pc5a-font-family);
}

body[data-page="index"][data-pc5a-state="home"] .hero-headline h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.31;
  letter-spacing: 0.04em;
}

body[data-page="index"][data-pc5a-state="home"] .hero-tagline {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0.035em;
}

body[data-page="index"][data-pc5a-state="home"] .hero-description,
body[data-page="index"][data-pc5a-state="home"] .hero-meta p,
body[data-page="index"][data-pc5a-state="home"] .hero-warm-note,
body[data-page="index"][data-pc5a-state="home"] .home-sheet .btn-main,
body[data-page="index"][data-pc5a-state="home"] .sheet-privacy {
  font-family: var(--font-serif);
}

body[data-page="index"][data-pc5a-state="home"] .hero-meta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 20px;
}

body[data-page="index"][data-pc5a-state="home"] .hero-meta p {
  width: 100%;
  gap: 6px;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.015em;
}

body[data-page="index"][data-pc5a-state="home"] .hero-meta-row p:last-child {
  justify-content: flex-end;
}

body[data-page="index"][data-pc5a-state="home"] .hero-meta p img,
body[data-page="index"][data-pc5a-state="home"] .hero-meta .meta-cinema img {
  width: 18px;
  height: 18px;
  opacity: 0.5;
  flex: 0 0 18px;
}

body[data-page="index"][data-pc5a-state="home"] .hero-meta .meta-cinema::before {
  content: none;
}

body[data-page="index"][data-pc5a-state="home"] .home-sheet .btn-main {
  font-size: 15px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.14em;
}

body[data-page="index"][data-pc5a-state="home"] .home-sheet {
  padding-right: 34px;
  padding-left: 34px;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-stage {
  --font-serif: var(--pc5a-font-family);
}

body[data-page="index"][data-pc5a-state="activation"] .activation-stage,
body[data-page="index"][data-pc5a-state="activation"] .activation-stage input,
body[data-page="index"][data-pc5a-state="activation"] .activation-stage button,
body[data-page="index"][data-pc5a-state="activation"] .activation-stage a {
  font-family: var(--font-serif);
}

body[data-page="index"][data-pc5a-state="activation"] .activation-brand-subtitle {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
  letter-spacing: 0.04em;
}

.pc5a-preview-code {
  margin-top: 8px;
  color: rgba(112, 59, 46, 0.78);
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.04em;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-code-input,
body[data-page="index"][data-pc5a-state="activation"] .activation-code-input::placeholder {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-code-input {
  letter-spacing: 0.12em;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-code-input::placeholder {
  letter-spacing: 0.04em;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-status {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 400;
  line-height: 19px;
  letter-spacing: 0.02em;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-consent-row,
body[data-page="index"][data-pc5a-state="activation"] .activation-consent-text,
body[data-page="index"][data-pc5a-state="activation"] .activation-policy-link {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.01em;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-usage-note {
  max-width: 292px;
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.01em;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-submit-btn {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 0.18em;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-submit-label {
  transform: none;
}

body[data-page="index"][data-pc5a-state="activation"] .activation-help-link {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.02em;
}

body[data-page="index"] #pc5a-role-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: var(--archive-stage-control-width);
  gap: 0;
  justify-content: stretch;
}

body[data-page="index"] #pc5a-role-list .archive-role-option {
  width: 100%;
  gap: 3px;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 0.02em;
  transform: none;
}

body[data-page="index"] #pc5a-role-list .radio-dot {
  width: 10px;
  height: 10px;
}

body[data-page="index"] #pc5a-role-list .archive-role-option:disabled {
  color: rgba(26, 23, 20, 0.28);
  cursor: not-allowed;
}

body[data-page="index"] #pc5a-age-segment[data-variant-fixed="true"] {
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.34),
    inset 0 -1px 3px rgba(89, 77, 61, 0.12),
    0 0 0 0.5px rgba(149, 112, 66, 0.28);
}

body[data-page="index"] #pc5a-age-segment[data-variant-fixed="true"] button:not(.active) {
  color: rgba(26, 23, 20, 0.28);
}

body[data-page="index"] #pc5a-age-segment[data-variant-fixed="true"] button.active {
  color: rgba(95, 67, 35, 0.92);
}

body[data-page="index"] .archive-row-stage {
  position: relative;
}

/*
 * The archive-page baseline positions the form and seal with absolute geometry.
 * Keep validation and API feedback in the reserved space between them so a
 * failed tap can never look like an inert button on a real phone.
 */
body[data-page="index"] .pc5a-profile-status {
  position: absolute;
  top: calc(var(--archive-form-top) + var(--archive-form-content-height) + 54px);
  left: 50%;
  width: min(292px, calc(100% - 40px));
  min-height: 20px;
  margin: 0;
  transform: translateX(-50%);
  color: rgba(95, 67, 35, 0.72);
  font-size: 11px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.02em;
  text-align: center;
  transition: opacity 160ms ease, color 160ms ease;
}

body[data-page="index"] .pc5a-profile-status.is-empty {
  opacity: 0;
}

body[data-page="index"] .pc5a-profile-status.is-error {
  color: rgba(155, 48, 36, 0.9);
}

body[data-page="index"] .pc5a-profile-status.is-pending {
  color: rgba(95, 67, 35, 0.8);
}

body[data-page="index"] .pc5a-profile-status.is-success {
  color: rgba(65, 112, 67, 0.86);
}

body[data-page="index"] .archive-seal-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body[data-page="index"] .archive-seal-art {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-height: 760px) {
  body[data-page="index"] .pc5a-profile-status {
    top: calc(var(--archive-form-top) + var(--archive-form-content-height) + 35px);
  }
}

@media (max-height: 680px) {
  body[data-page="index"] .pc5a-profile-status {
    top: calc(var(--archive-form-top) + var(--archive-form-content-height) + 22px);
    font-size: 10px;
    line-height: 18px;
  }
}

body.pc5a-wechat-browser-gate-mode {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

body.pc5a-wechat-browser-gate-mode .index-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
}

.pc5a-wechat-browser-gate {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(36px + env(safe-area-inset-top))
    28px
    calc(36px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.pc5a-wechat-browser-gate-content {
  width: min(100%, 340px);
  color: rgba(31, 27, 23, 0.9);
  font-family: var(--pc5a-font-family);
}

.pc5a-wechat-browser-gate-brand {
  margin: 0 0 22px;
  color: rgba(95, 67, 35, 0.62);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.28em;
}

.pc5a-wechat-browser-gate h1 {
  margin: 0;
  font-size: clamp(22px, 6.2vw, 28px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.08em;
}

.pc5a-wechat-browser-gate-divider {
  display: block;
  width: 54px;
  height: 1px;
  margin: 22px auto;
  background: rgba(95, 67, 35, 0.38);
}

.pc5a-wechat-browser-gate-copy,
.pc5a-wechat-browser-gate-tip {
  margin: 0;
  color: rgba(31, 27, 23, 0.58);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.9;
  letter-spacing: 0.04em;
}

.pc5a-wechat-browser-gate-tip {
  margin-top: 16px;
  color: rgba(95, 67, 35, 0.72);
}

body.pc5a-question-mode {
  --font-sans: var(--pc5a-font-family);
  --font-sans-dynamic: var(--pc5a-font-family);
  --font-serif: var(--pc5a-font-family);
  --font-serif-dynamic: var(--pc5a-font-family);
  --quiz-scene-title-size: 18px;
  --quiz-scene-title-weight: 600;
  --quiz-scene-title-line: 1.6;
  --quiz-subtle-size: clamp(10px, 2.8vw, 13px);
  --quiz-title-width: min(88vw, calc(100vw - 32px), calc(var(--phone-stage-max) - 32px));
  --quiz-option-width: min(85vw, calc(100vw - 32px), calc(var(--phone-stage-max) - 32px));
  --quiz-option-gap: clamp(14px, 1.8vh, 16px);
  --quiz-option-size: 15px;
  --quiz-option-line: 1.55;
  --quiz-option-min-height: clamp(68px, 8.2vh, 76px);
  --quiz-option-radius: 12px;
  --quiz-option-padding-block: clamp(10px, 1.4vh, 12px);
  --quiz-option-padding-inline: clamp(28px, 8.4vw, 33px);
  --quiz-answer-offset: clamp(40px, 4.8vh, 46px);
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--pc5a-font-family);
  overflow: hidden;
}

body.pc5a-question-mode .index-shell {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
}

.pc5a-question-stage {
  width: 100%;
  min-height: 100%;
  height: 100%;
  align-items: stretch;
  overflow: hidden;
}

.pc5a-question-layout {
  width: 100%;
  min-height: 0;
  height: 100%;
  padding:
    calc(30px + env(safe-area-inset-top))
    0
    calc(22px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(14px, 2vh, 18px);
  overflow: hidden;
}

.pc5a-question-meta {
  width: var(--quiz-title-width);
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pc5a-question-meta .question-kicker {
  width: auto;
  max-width: calc(100% - 92px);
  text-align: left;
}

.pc5a-question-count {
  flex: none;
  margin: 0;
  color: rgba(26, 23, 20, 0.42);
  font-family: var(--font-sans-dynamic);
  font-size: 11px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.12em;
}

.pc5a-progress {
  height: 2px;
  width: var(--quiz-title-width);
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(26, 23, 20, 0.1);
}

.pc5a-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: rgba(149, 112, 66, 0.72);
  transition: width 180ms ease;
}

.pc5a-question-panel {
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: clamp(18px, 3.2vh, 28px) 0 8px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  justify-items: center;
  gap: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.pc5a-question-panel::-webkit-scrollbar {
  display: none;
}

.pc5a-question-head {
  width: var(--quiz-title-width);
  max-width: calc(100vw - 32px);
  display: grid;
  justify-items: center;
  gap: clamp(13px, 1.8vh, 16px);
}

.pc5a-question-head .question-title,
.pc5a-question-head .question-sub {
  width: 100%;
}

.pc5a-question-head .question-title {
  text-wrap: balance;
}

.pc5a-question-head .question-sub {
  max-width: 280px;
}

.pc5a-question-help {
  width: min(82vw, 320px);
  margin: -2px 0 0;
  color: rgba(26, 23, 20, 0.5);
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.02em;
  text-align: center;
}

.pc5a-question-divider {
  display: block;
  width: min(78vw, 304px);
  height: 1px;
  margin-top: clamp(18px, 2.4vh, 22px);
  background: rgba(26, 23, 20, 0.32);
}

.pc5a-question-panel .option-list {
  align-content: start;
  grid-auto-rows: max-content;
  margin-top: var(--quiz-answer-offset);
}

.pc5a-transition-fields {
  width: var(--quiz-option-width);
  max-width: calc(100vw - 32px);
  margin: 4px auto 0;
  display: grid;
  gap: 14px;
}

.pc5a-transition-field {
  display: grid;
  gap: 8px;
}

.pc5a-transition-field-label {
  color: rgba(26, 23, 20, 0.64);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

.pc5a-transition-control {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(26, 23, 20, 0.16);
  border-radius: 12px;
  outline: none;
  color: #1a1714;
  background: rgba(255, 255, 255, 0.34);
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.02em;
  resize: vertical;
  transition: border-color 160ms ease, background-color 160ms ease;
}

textarea.pc5a-transition-control {
  min-height: 94px;
}

.pc5a-transition-control::placeholder {
  color: rgba(26, 23, 20, 0.32);
}

.pc5a-transition-control:focus {
  border-color: rgba(149, 112, 66, 0.62);
  background: rgba(255, 255, 255, 0.5);
}

.pc5a-completion-panel {
  min-height: 0;
  width: var(--quiz-title-width);
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  padding-top: clamp(86px, 15vh, 142px);
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 18px;
  text-align: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}

.pc5a-completion-panel::-webkit-scrollbar {
  display: none;
}

.pc5a-completion-panel .question-title,
.pc5a-completion-panel .question-sub {
  width: 100%;
}

.pc5a-completion-note {
  width: min(82vw, 320px);
  margin: 2px 0 0;
  color: rgba(26, 23, 20, 0.5);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.pc5a-question-foot {
  min-height: 58px;
  display: grid;
  justify-items: center;
  align-content: end;
}

.pc5a-question-foot .quiz-actions {
  margin: 0;
  gap: 6px;
}

.pc5a-skip-button {
  min-width: 176px;
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  color: rgba(26, 23, 20, 0.5);
  background: transparent;
  font-family: var(--font-sans-dynamic);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-decoration-color: rgba(26, 23, 20, 0.2);
  text-underline-offset: 4px;
}

.pc5a-skip-button:disabled {
  opacity: 0.45;
}

.pc5a-next-button {
  min-width: 220px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid rgba(26, 23, 20, 0.08);
  border-radius: 18px;
  color: #1a1714;
  background: rgba(242, 238, 230, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
  font-family: var(--font-sans-dynamic);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.12em;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.pc5a-next-button:not(:disabled):active,
.pc5a-next-button.is-submitting {
  color: #fff;
  background: #8f765c;
  border-color: rgba(75, 55, 38, 0.42);
  box-shadow:
    0 5px 14px rgba(75, 55, 38, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(1px) scale(0.98);
}

.pc5a-next-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.pc5a-next-button.is-submitting:disabled {
  cursor: wait;
  opacity: 1;
  box-shadow:
    0 5px 14px rgba(75, 55, 38, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

@media (max-height: 680px) {
  .pc5a-question-layout {
    padding-top: calc(18px + env(safe-area-inset-top));
    gap: 10px;
  }

  .pc5a-question-panel {
    padding-top: 12px;
  }

  .pc5a-question-divider {
    margin-top: 14px;
  }

  .pc5a-question-panel .option-list {
    margin-top: 24px;
  }

  .pc5a-completion-panel {
    padding-top: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pc5a-progress span,
  .pc5a-next-button {
    transition: none;
  }
}

@media (max-width: 360px) {
  body.pc5a-question-mode {
    --quiz-option-width: min(88vw, calc(100vw - 28px));
    --quiz-option-min-height: 64px;
    --quiz-option-padding-inline: 26px;
  }
}
