/* Public quiz 8e9691 */
:root {
  --paper: #141414;
  --card: #1c1c1c;
  --ink: #ededed;
  --ink-strong: #f5f5f5;
  --soft: rgba(237, 237, 237, .90);
  --softer: rgba(237, 237, 237, .45);
  --surface: rgba(237, 237, 237, .06);
  --surface-2: rgba(237, 237, 237, .09);
  --line: rgba(237, 237, 237, .14);
  --line-strong: rgba(237, 237, 237, .28);
}

:root[data-theme="light"] {
  --paper: #ffffff;
  --card: #ffffff;
  --ink: #141414;
  --ink-strong: #0a0a0a;
  --soft: rgba(20, 20, 20, .90);
  --softer: rgba(20, 20, 20, .45);
  --surface: rgba(20, 20, 20, .035);
  --surface-2: rgba(20, 20, 20, .055);
  --line: rgba(20, 20, 20, .10);
  --line-strong: rgba(20, 20, 20, .22);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--soft);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

#scene {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.site-header {
  position: relative;
  z-index: 10;
  width: min(100% - 40px, 920px);
  height: calc(76px + env(safe-area-inset-top));
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: inherit;
  text-decoration: none;
}

.brand {
  display: block;
  width: 122px;
  height: 32px;
  margin-right: -18px;
}

.logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.logo-light { display: none; }
:root[data-theme="light"] .logo-dark { display: none; }
:root[data-theme="light"] .logo-light { display: block; }

.product-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding-left: 9px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 520px);
  min-height: calc(100svh - 76px);
  margin: 0 auto;
  padding: 36px 24px calc(44px + env(safe-area-inset-bottom));
}

.screen {
  display: none;
  min-height: calc(100svh - 156px - env(safe-area-inset-top));
}

.screen.is-active {
  display: block;
  animation: screenIn .42s ease;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.start-screen {
  padding-top: clamp(12px, 3vh, 28px);
  text-align: center;
}

.start-heading {
  text-align: left;
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--softer);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.8px;
}

h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(30px, 8.5vw, 50px);
  line-height: 1.08;
  letter-spacing: -3px;
  white-space: nowrap;
}

.start-copy {
  margin: 18px 0 30px;
  color: var(--softer);
  font-size: 15px;
  line-height: 1.65;
}

.start-card {
  overflow: hidden;
  margin: 30px 0 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 90%, transparent);
  text-align: left;
  backdrop-filter: blur(12px);
}

.start-card-top {
  padding: 15px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: var(--softer);
  font-size: 11px;
}

.start-card-stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.start-card-stats i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: .65;
}

.result-catalog {
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.result-catalog > span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--soft);
  font-size: 11px;
  white-space: nowrap;
}

.primary-btn,
.secondary-btn,
.popnota-btn,
.text-btn {
  width: 100%;
  border: 0;
  cursor: pointer;
}

.primary-btn {
  min-height: 58px;
  padding: 0 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--ink);
  border-radius: 17px;
  color: var(--paper);
  background: var(--ink);
  font-size: 16px;
  font-weight: 700;
  transition: opacity .16s ease, transform .16s ease;
}

.primary-btn:active {
  opacity: .78;
  transform: scale(.99);
}

.btn-arrow {
  font-size: 18px;
  font-weight: 400;
}

.fine-print,
.keyboard-tip {
  margin: 13px 0 0;
  color: var(--softer);
  text-align: center;
  font-size: 10px;
}

.quiz-screen { padding-top: 12px; }

.quiz-meta {
  display: flex;
  align-items: center;
  gap: 15px;
}

.back-btn {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  font-size: 18px;
}

.progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-track {
  flex: 1;
  height: 2px;
  overflow: hidden;
  background: var(--line);
}

.progress-track span {
  display: block;
  width: 8.333%;
  height: 100%;
  background: var(--ink);
  transition: width .35s ease;
}

.progress-count {
  min-width: 42px;
  color: var(--softer);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.progress-count b {
  color: var(--soft);
  font-size: 14px;
  font-weight: 600;
}

.question-wrap {
  padding-top: clamp(52px, 10vh, 94px);
}

.question-wrap.is-leaving { animation: questionOut .16s ease forwards; }
.question-wrap.is-entering { animation: questionIn .30s ease; }

@keyframes questionOut {
  to { opacity: 0; transform: translateX(-8px); }
}

@keyframes questionIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.question-kicker {
  margin: 0 0 11px;
  color: var(--softer);
  font-size: 11px;
}

.question-wrap h2 {
  min-height: 100px;
  margin: 0 0 28px;
  color: var(--ink-strong);
  font-size: clamp(26px, 7.4vw, 34px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -1px;
}

.answers {
  display: grid;
  gap: 10px;
}

.answer-btn {
  position: relative;
  width: 100%;
  min-height: 59px;
  padding: 14px 49px 14px 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--soft);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.answer-btn::after {
  content: attr(data-key);
  position: absolute;
  top: 50%;
  right: 16px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--softer);
  transform: translateY(-50%);
  font-size: 10px;
}

.answer-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.answer-btn.is-selected {
  color: var(--paper);
  border-color: var(--ink);
  background: var(--ink);
}

.answer-btn.is-selected::after {
  color: var(--ink);
  border-color: var(--paper);
  background: var(--paper);
}

.result-screen {
  padding-top: 5px;
  padding-bottom: 34px;
}

.result-intro {
  margin: 0 2px 13px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
}

.result-intro p {
  margin: 0;
  color: var(--soft);
  font-size: 12px;
  font-weight: 600;
}

.result-intro span {
  color: var(--softer);
  font-size: 9px;
  letter-spacing: .6px;
}

.result-card {
  position: relative;
  overflow: hidden;
  padding: 23px 21px 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .06);
  backdrop-filter: blur(16px);
}

.result-code {
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--softer);
  font-size: 9px;
}

.result-overline {
  margin: 27px 0 7px;
  color: var(--softer);
  font-size: 11px;
}

.result-card h2 {
  max-width: 95%;
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(35px, 10vw, 48px);
  line-height: 1.08;
  letter-spacing: -2.3px;
}

.result-one-liner {
  margin: 14px 0 18px;
  color: var(--soft);
  font-size: 15px;
  line-height: 1.55;
}

.trait-list {
  padding: 15px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.trait-list span {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--soft);
  background: var(--surface);
  font-size: 10px;
}

.analysis-copy { padding: 17px 0 2px; }

.analysis-copy p {
  margin: 0 0 10px;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.75;
}

.analysis-copy p:last-child { margin-bottom: 0; }

.result-footer {
  margin-top: 23px;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--softer);
  font-size: 9px;
}

.mini-brand {
  position: relative;
  width: 79px;
  height: 20px;
}

.mini-logo {
  position: absolute;
  left: 0;
  top: 50%;
  width: 79px;
  height: auto;
  transform: translateY(-50%);
}

.share-hint {
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--softer);
  font-size: 10px;
}

.restart-result-btn {
  margin-top: 8px;
}

.share-hint i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
}

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

.related-section {
  margin: 15px 0 5px;
}

.related-section h3 {
  margin: 0 2px 14px;
  color: var(--softer);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .2px;
}

.related-list {
  display: grid;
  gap: 10px;
}

.related-post {
  min-width: 0;
  padding: 16px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 19px;
  color: var(--soft);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.related-post:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  transform: translateY(-1px);
}

.related-post:active { transform: scale(.992); }

.related-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.related-author {
  min-width: 0;
  margin-top: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--softer);
  font-size: 11px;
}

.related-author img {
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.related-author span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-author i {
  margin-left: auto;
  font-style: normal;
  font-size: 13px;
}

.related-loading {
  height: 112px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background:
    linear-gradient(90deg, transparent, var(--surface-2), transparent) -180px 0 / 180px 100% no-repeat,
    var(--surface);
  animation: relatedShimmer 1.1s ease-in-out infinite;
}

.share-primary-btn {
  justify-content: center;
}

.start-back-btn {
  margin-top: 10px;
}

@keyframes relatedShimmer {
  to { background-position: calc(100% + 180px) 0, 0 0; }
}

.secondary-btn,
.popnota-btn {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  color: var(--soft);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.popnota-btn {
  gap: 8px;
  color: var(--paper);
  border-color: var(--ink);
  background: var(--ink);
}

.text-btn {
  padding: 14px;
  color: var(--softer);
  background: none;
  font-size: 11px;
}

.progress-reset {
  margin-top: 4px;
}

.progress-reset[hidden] {
  display: none;
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: calc(100% - 42px);
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper);
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: .22s ease;
  font-size: 11px;
  white-space: nowrap;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 600px) {
  .site-header {
    width: min(100% - 28px, 920px);
    height: calc(68px + env(safe-area-inset-top));
  }
  .brand {
    width: 112px;
    height: 29px;
    margin-right: -17px;
  }
  .product-badge {
    min-height: 16px;
    padding-left: 8px;
    font-size: 12px;
  }
  .app-shell {
    min-height: calc(100svh - 68px);
    padding-top: 32px;
  }
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 44px;
    }
}

@media (max-height: 720px) {
  .start-screen { padding-top: 10px; }
  h1 { font-size: 43px; }
  .start-copy { margin: 13px 0 18px; }
  .question-wrap { padding-top: 30px; }
  .question-wrap h2 { min-height: 78px; margin-bottom: 19px; font-size: 26px; }
  .answer-btn { min-height: 52px; padding-top: 11px; padding-bottom: 11px; }
}

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

/* ── 在 App 的 WebView 里（?embed=app）──────────────────────────────────────
   App 自己已经有导航栏和返回手势，网页这边再放一遍 logo 页头、"返回全部测试"、
   "去 Popnota 看看" 就是重复入口（而且会把人踢出 App 去开浏览器）。全部收起来，
   只留测试本身。见 popnota-server/src/explore.ts 发的 ?embed=app。 */
:root[data-embed="app"] .site-header,
:root[data-embed="app"] .site-footer,
:root[data-embed="app"] .start-back-btn,
:root[data-embed="app"] .popnota-btn {
  display: none !important;
}
:root[data-embed="app"] .app-shell {
  min-height: 100svh;
  padding-top: calc(28px + env(safe-area-inset-top));
}

/* 能直接调系统分享面板的设备（手机/平板/App 内 WebView）不显示「保存鉴定结果」：
   面板里就有「存储图像」，而 <a download> 在 WKWebView 里根本不工作。PC 走另一支，
   两个按钮都留（那边没有系统分享面板，没有保存就只能截图）。见 app.js applyShareCapability。 */
:root[data-share="native"] #saveBtn {
  display: none;
}
