/* Quiet paper surfaces; original puppy art supplies the playful part. */
:root {
  --surface-0: #f6f5f1;
  --surface-1: #fcfcfb;
  --surface-2: #ffffff;
  --ink: #2c2c2a;
  --text-secondary: #5f5e5a;
  --muted: #73716a;
  --line: #ddddd5;
  --line-strong: #bdbbb2;
  --brand: #b45135;
  --brand-hover: #9b412a;
  --clay: #d97757;
  --clay-soft: #f7ece6;
  --ghost-hover: rgba(21, 21, 21, .05);
  --secondary-fill: #eae9e4;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: Georgia, "Times New Roman", "Songti SC", STSong, SimSun, serif;
  font-family: var(--font-sans);
  font-synthesis: none;
  color: var(--ink);
  background: var(--surface-0);
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { border: 0; background: none; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
button, a, input { transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
svg { display: block; width: 100%; height: auto; }
button svg { pointer-events: none; }
main:focus { outline: none; }
#main { min-height: calc(100dvh - 174px); }
.mark { display: inline-block; flex: 0 0 18px; width: 18px; }

/* A small, useful masthead rather than a second hero. */
.header { max-width: 1208px; height: 96px; margin: auto; padding: 0 48px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 0; text-align: left; font-size: 18px; font-weight: 650; letter-spacing: .02em; border-radius: var(--radius-xs); }
.brand > span:first-child { width: 32px; height: 36px; color: var(--brand); }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: .02em; }
nav { display: flex; align-items: center; gap: 6px; }
nav button { min-height: 40px; padding: 9px 13px; color: var(--text-secondary); font-size: 13px; border-radius: var(--radius-sm); }
nav button span { margin-left: 4px; color: var(--muted); }
nav button:hover { background: var(--ghost-hover); color: var(--ink); }
.footer { max-width: 1112px; margin: 0 auto; padding: 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.8; }
.footer button { padding: 4px 6px; border-radius: var(--radius-xs); color: var(--text-secondary); font-size: 11px; }
.footer button:hover { background: var(--ghost-hover); }
.author { display: inline-block; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line-strong); color: var(--ink); font-size: 12px; font-weight: 650; }

/* Home: editorial text at left, a single original illustration at right. */
.home { max-width: 1112px; margin: 0 auto; padding: 44px 0 38px; }
.hero { display: grid; grid-template-columns: 1.08fr 1fr; align-items: center; gap: 12px; min-height: 454px; }
.hero-copy { position: relative; z-index: 1; min-width: 0; }
.intro-note { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; line-height: 1.7; }
.intro-note i { width: 6px; height: 6px; border-radius: 50%; background: var(--clay); }
.hero h1 { margin: 22px 0 18px; font-family: var(--font-serif); font-size: clamp(42px, 4.25vw, 54px); font-weight: 500; letter-spacing: -.035em; line-height: 1.42; }
.hero-copy > p { color: var(--text-secondary); font-size: 15px; line-height: 1.95; }
.hero-cta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 12px 21px; border: 0; border-radius: var(--radius-sm); font-size: 14px; font-weight: 550; line-height: 1.5; text-decoration: none; }
.primary { background: var(--brand); color: #fff; }
.primary:hover:not(:disabled) { background: var(--brand-hover); }
.primary:active:not(:disabled) { background: #8d3926; }
.primary:disabled { background: #dedbd5; color: #7a776f; }
.primary .mark { width: 18px; }
.secondary { color: var(--ink); background: var(--secondary-fill); }
.secondary:hover:not(:disabled) { background: #dfded8; }
.secondary:active:not(:disabled) { background: #d5d3cb; }
.text-button { padding: 11px 12px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 13px; }
.text-button:hover { background: var(--ghost-hover); color: var(--ink); }
.hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 19px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.hero-meta b { color: var(--text-secondary); font-weight: 550; font-variant-numeric: tabular-nums; }
.hero-meta i { height: 10px; border-left: 1px solid var(--line-strong); }
.hero-art { position: relative; min-width: 0; padding: 0 0 0 8px; }
.art-caption { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: -8px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.art-caption span { width: 20px; height: 1px; background: var(--line-strong); }
.intro-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; margin-top: 36px; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.intro-strip > div { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.strip-icon { width: 30px; flex: 0 0 30px; color: var(--brand); font-size: 22px; line-height: 1; text-align: center; }
.intro-strip strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 13px; font-weight: 550; }
.home-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.home-bottom button { padding: 6px; margin-left: -6px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 11px; }
.home-bottom button:hover { background: var(--ghost-hover); }
.mini-agents { display: flex; align-items: center; gap: 3px; }
.mini-agent { width: 28px; height: 28px; overflow: hidden; border-radius: 50%; background: #eae8df; }
.mini-agent svg { transform: scale(1.35) translateY(2px); }
.mini-agents > span:last-child { margin-left: 8px; }
.loading, .noscript { padding: 80px 20px; color: var(--text-secondary); text-align: center; font-size: 14px; }

/* One question, one row per choice. No card around the cards. */
.page-shell { max-width: 656px; margin: 22px auto 50px; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.back { min-height: 40px; padding: 9px 10px; margin-left: -10px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 13px; }
.back:hover:not(:disabled) { background: var(--ghost-hover); color: var(--ink); }
.back:disabled { opacity: .38; }
.progress-label { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.progress-label b { color: var(--ink); font-size: 15px; font-weight: 550; }
.progress { height: 3px; overflow: hidden; border-radius: var(--radius-xs); background: #e4e2da; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--clay); transition: width .24s ease; }
.quiz-card { position: relative; margin-top: 23px; padding: 0 0 12px; }
.quiz-illustration { width: 86px; height: 86px; margin: 0 auto 8px; }
.scene { margin-bottom: 11px; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.question-title { max-width: 600px; margin: auto; outline: none; font-family: var(--font-serif); font-size: 27px; font-weight: 550; letter-spacing: -.015em; line-height: 1.65; text-align: center; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }
.option { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 15px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-1); font-size: 14px; line-height: 1.65; text-align: left; }
.option:hover { border-color: var(--line-strong); background: var(--surface-2); }
.option > span:nth-child(2) { flex: 1; min-width: 0; }
.option .letter { display: grid; place-items: center; flex: 0 0 26px; width: 26px; height: 26px; border-radius: var(--radius-xs); color: var(--text-secondary); background: var(--ghost-hover); font-size: 11px; font-weight: 550; }
.option.selected { border-color: #bc735a; background: var(--clay-soft); }
.option.selected .letter { color: #fff; background: var(--brand); }
.option .check { flex: 0 0 18px; width: 18px; margin-left: auto; color: var(--brand); font-size: 17px; text-align: center; }
.quiz-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 23px; }
.quiz-bottom .primary { min-width: 150px; }
.quiz-note { margin-top: 20px; color: var(--muted); font-size: 11px; line-height: 1.95; text-align: center; }
.question-fade { animation: question-in .2s ease; }
@keyframes question-in { from { opacity: .45; } to { opacity: 1; } }

/* A quiet field guide: illustrations stay, decorative frames step back. */
.gallery { max-width: 1000px; margin: 22px auto 48px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 18px 0 28px; }
.page-heading h1 { font-family: var(--font-serif); font-size: 35px; font-weight: 500; letter-spacing: -.02em; line-height: 1.45; }
.page-heading p { margin-top: 10px; color: var(--text-secondary); font-size: 13px; line-height: 1.85; }
.gallery-count { padding-bottom: 4px; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: nowrap; font-variant-numeric: tabular-nums; }
.agent-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.agent-tile { min-width: 0; padding: 12px 12px 17px; border: 1px solid transparent; border-radius: var(--radius-md); text-align: left; }
.agent-tile:hover { border-color: var(--line); background: var(--surface-1); }
.agent-tile .agent-picture { margin-bottom: 14px; padding: 5px 14px 0; border-radius: var(--radius-sm); background: #eeece5; background: color-mix(in srgb, var(--agent-bg) 34%, var(--surface-0)); }
.agent-tile h2 { display: flex; align-items: center; justify-content: space-between; gap: 7px; font-size: 17px; font-weight: 600; line-height: 1.6; }
.agent-tile h2 span { color: var(--muted); font-size: 14px; font-weight: 400; }
.agent-tile p { margin-top: 5px; color: var(--text-secondary); font-size: 11px; line-height: 1.8; }
.agent-tile small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.8; }

/* The result has one closed frame; supporting content uses surface contrast. */
.result-page { max-width: 760px; margin: 22px auto 48px; }
.result-intro { margin: 12px 0 22px; color: var(--text-secondary); font-size: 12px; line-height: 1.8; text-align: center; }
.identity-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface-2); }
.identity-top { display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 20px; padding: 28px 36px 4px; background: #eeece5; background: color-mix(in srgb, var(--agent-bg) 23%, var(--surface-0)); }
.identity-top .agent-picture { width: 100%; max-width: 240px; justify-self: center; }
.identity-top .identity-copy { min-width: 0; padding-bottom: 22px; }
.card-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; color: var(--text-secondary); font-size: 11px; line-height: 1.7; }
.card-kicker:before { content: ""; width: 15px; border-top: 1px solid var(--clay); }
.identity-copy h1 { font-family: var(--font-serif); color: var(--ink); font-size: 43px; font-weight: 500; letter-spacing: -.02em; line-height: 1.4; }
.identity-copy .english { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.identity-copy h2 { margin-top: 14px; font-size: 16px; font-weight: 550; line-height: 1.6; }
.agent-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.agent-tags span { padding: 5px 8px; border-radius: var(--radius-xs); background: rgba(255, 255, 255, .65); color: var(--text-secondary); font-size: 10px; line-height: 1.5; }
.identity-body { padding: 28px 36px; }
.agent-quote { margin-bottom: 15px; font-family: var(--font-serif); font-size: 20px; font-weight: 550; line-height: 1.8; }
.agent-description { color: var(--text-secondary); font-size: 13px; line-height: 2; }
.agent-skills { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--line); }
.agent-skills dl, .agent-skills dd { margin: 0; }
.agent-skills dt { margin-bottom: 7px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.agent-skills dd { font-size: 13px; line-height: 1.8; }
.identity-stamp { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 25px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.stamp { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.stamp .mark { width: 16px; flex-basis: 16px; color: var(--brand); }
.result-actions { display: flex; justify-content: center; gap: 12px; margin-top: 27px; }
.result-subactions { display: flex; justify-content: center; gap: 8px; margin: 11px 0 25px; }
.result-subactions button { padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 12px; }
.result-subactions button:hover { background: var(--ghost-hover); }
.more-result { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.detail-panel { min-width: 0; padding: 24px; border-radius: var(--radius-md); background: var(--surface-1); }
.detail-panel h2 { font-size: 14px; font-weight: 600; line-height: 1.6; }
.panel-note { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.trait-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 31px; align-items: center; gap: 9px; margin-top: 15px; color: var(--text-secondary); font-size: 11px; }
.trait-track { height: 4px; overflow: hidden; border-radius: var(--radius-xs); background: #e8e6df; }
.trait-track i { display: block; height: 100%; border-radius: inherit; background: var(--clay); }
.trait-row b { font-size: 10px; font-weight: 450; text-align: right; font-variant-numeric: tabular-nums; }
.buddy-row { display: flex; align-items: center; gap: 13px; margin: 10px 0; }
.buddy-art { width: 88px; flex-shrink: 0; border-radius: var(--radius-md); background: var(--surface-0); }
.buddy-row strong { font-size: 17px; font-weight: 550; }
.buddy-row span { display: block; margin-top: 6px; color: var(--text-secondary); font-size: 11px; line-height: 1.7; }
.detail-panel > p:last-child { color: var(--text-secondary); font-size: 12px; line-height: 1.9; }
.small-disclaimer { margin-top: 25px; color: var(--muted); font-size: 11px; line-height: 1.95; text-align: center; }
.shared-cta { padding: 25px 0; text-align: center; }
.shared-cta p { margin-bottom: 16px; color: var(--text-secondary); font-size: 13px; line-height: 1.8; }

/* Dialogs are the only elevated surfaces. Secondary actions have no outline. */
dialog { width: min(470px, calc(100% - 32px)); max-height: 88dvh; overflow: auto; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--ink); box-shadow: 0 18px 64px rgba(21, 21, 21, .13); }
dialog::backdrop { background: rgba(32, 32, 31, .32); backdrop-filter: blur(3px); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.dialog-top h2 { font-size: 18px; font-weight: 600; line-height: 1.6; }
.close { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 23px; font-weight: 350; line-height: 1; }
.close:hover { background: var(--ghost-hover); color: var(--ink); }
.dialog-body, .modal-description { color: var(--text-secondary); font-size: 13px; line-height: 2; }
.dialog-body strong { color: var(--ink); font-weight: 600; }
.dialog-body p + p { margin-top: 13px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.dialog-actions .primary, .dialog-actions .secondary { min-height: 42px; padding: 10px 16px; font-size: 13px; }
.modal-dog { width: 180px; margin: 0 auto 10px; border-radius: var(--radius-md); background: var(--surface-0); }
.modal-quote { margin: 16px 0; font-family: var(--font-serif); font-size: 19px; font-weight: 550; line-height: 1.7; text-align: center; }
.modal-tags { justify-content: center; }
.modal-tags span { background: var(--surface-0); }
.save-preview { display: block; width: 100%; max-height: 55dvh; object-fit: contain; border-radius: var(--radius-sm); background: var(--surface-0); }
.save-help { margin-top: 14px; color: var(--text-secondary); font-size: 11px; line-height: 1.9; text-align: center; }
.download-link { display: flex; width: 100%; margin-top: 16px; }
.share-input { width: 100%; margin-top: 14px; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-0); color: var(--ink); font-size: 12px; }
.toast { position: fixed; z-index: 10; bottom: max(28px, env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: var(--radius-sm); background: #383835; color: #fff; font-size: 12px; line-height: 1.7; text-align: center; overflow-wrap: anywhere; pointer-events: none; opacity: 0; transform: translate(-50%, 8px); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.skip-link { position: fixed; z-index: 20; top: -80px; left: 16px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); }
.skip-link:focus { top: 16px; }

/* The same surface/spacing system scales down; no duplicate style layers. */
@media (min-width: 1440px) {
  .home { padding-top: 58px; }
  .hero { min-height: 470px; }
}

@media (max-width: 1208px) {
  .home, .footer { margin-left: 48px; margin-right: 48px; }
  .gallery { margin-left: 48px; margin-right: 48px; }
}

@media (max-width: 860px) {
  .header { height: 88px; padding: 0 28px; }
  .home, .footer { margin-left: 28px; margin-right: 28px; }
  .home { padding-top: 30px; }
  .hero { min-height: 368px; grid-template-columns: 1.1fr 1fr; gap: 4px; }
  .hero h1 { font-size: 39px; }
  .hero-copy > p { font-size: 13px; }
  .hero-art { padding: 0; }
  .hero-cta { margin-top: 23px; }
  .hero-cta .primary { padding: 12px 17px; font-size: 13px; }
  .hero-meta { gap: 8px; font-size: 10px; }
  .intro-strip { gap: 18px; margin-top: 30px; }
  .intro-strip > div { align-items: flex-start; gap: 8px; font-size: 10px; }
  .intro-strip strong { font-size: 12px; }
  .strip-icon { flex-basis: 22px; width: 22px; font-size: 20px; }
  .home-bottom > span { max-width: 230px; text-align: right; }
  .page-shell, .result-page { margin-left: 28px; margin-right: 28px; }
  .gallery { margin-left: 28px; margin-right: 28px; }
  .agent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .agent-tile .agent-picture { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 600px) {
  #main { min-height: calc(100dvh - 178px); }
  .header { height: 78px; padding: 0 22px; gap: 12px; }
  .brand { gap: 8px; font-size: 16px; }
  .brand > span:first-child { width: 28px; height: 32px; }
  .brand small { margin-top: 3px; font-size: 9px; }
  nav { gap: 0; }
  nav button { min-height: 42px; padding: 9px 7px; font-size: 12px; }
  .about-button { display: none; }
  .home { margin: 0 24px; padding: 28px 0 30px; }
  .hero { display: flex; flex-direction: column; gap: 0; min-height: 0; }
  .hero-copy { width: 100%; text-align: center; }
  .hero h1 { margin: 0 0 17px; font-size: 39px; line-height: 1.44; letter-spacing: -.035em; }
  .hero-copy > p { font-size: 13px; line-height: 1.95; }
  .hero-cta { justify-content: center; gap: 7px; margin-top: 23px; }
  .hero-cta .primary { min-height: 48px; padding: 12px 20px; font-size: 14px; }
  .hero-art { width: 100%; max-width: 350px; margin: 18px auto 0; }
  .intro-note, .hero-meta, .art-caption, .intro-strip, .home-bottom { display: none; }
  .footer { margin: 0 22px; padding: 18px 0; flex-direction: column; gap: 7px; text-align: center; font-size: 10px; }
  .footer button { font-size: 10px; }
  .author { margin-left: 9px; padding-left: 9px; font-size: 11px; }
  .page-shell { margin: 7px 22px 34px; }
  .page-top { margin-bottom: 10px; }
  .back { font-size: 12px; }
  .progress-label { font-size: 11px; }
  .progress-label b { font-size: 14px; }
  .quiz-card { margin-top: 22px; padding-bottom: 8px; }
  .quiz-illustration { width: 77px; height: 77px; margin-bottom: 7px; }
  .scene { margin-bottom: 9px; font-size: 11px; }
  .question-title { font-size: 23px; line-height: 1.65; }
  .options { gap: 10px; margin-top: 22px; }
  .option { min-height: 63px; gap: 11px; padding: 13px 14px; font-size: 13px; }
  .option .letter { flex-basis: 25px; width: 25px; height: 25px; }
  .option .check { flex-basis: 15px; width: 15px; font-size: 15px; }
  .quiz-bottom { margin-top: 21px; gap: 12px; }
  .quiz-bottom .primary { min-width: 135px; min-height: 44px; padding: 10px 15px; font-size: 13px; }
  .quiz-note { margin-top: 20px; font-size: 10px; }
  .gallery { margin: 8px 18px 34px; }
  .page-heading { gap: 12px; margin: 14px 4px 20px; }
  .page-heading h1 { font-size: 30px; }
  .page-heading p { font-size: 11px; }
  .gallery-count { font-size: 10px; }
  .agent-grid { gap: 10px; }
  .agent-tile { padding: 8px 8px 14px; }
  .agent-tile .agent-picture { margin-bottom: 11px; padding: 0 5px; }
  .agent-tile h2 { gap: 3px; font-size: 15px; }
  .agent-tile h2 span { font-size: 12px; }
  .agent-tile p { font-size: 10px; }
  .agent-tile small { margin-top: 6px; font-size: 9px; }
  .result-page { margin: 8px 18px 34px; }
  .result-intro { margin: 11px 0 18px; font-size: 11px; }
  .identity-card { border-radius: var(--radius-lg); }
  .identity-top { grid-template-columns: 1.05fr 1fr; gap: 0; padding: 22px 22px 1px; }
  .identity-top .identity-copy { padding-bottom: 18px; }
  .identity-top .agent-picture { width: 110%; max-width: 210px; margin-right: -6px; }
  .card-kicker { gap: 6px; margin-bottom: 11px; font-size: 9px; }
  .card-kicker:before { width: 11px; }
  .identity-copy h1 { font-size: 34px; }
  .identity-copy .english { font-size: 9px; }
  .identity-copy h2 { margin-top: 12px; font-size: 13px; }
  .agent-tags { gap: 5px; margin-top: 12px; }
  .agent-tags span { padding: 5px 7px; font-size: 9px; }
  .identity-body { padding: 23px 22px; }
  .agent-quote { margin-bottom: 13px; font-size: 18px; }
  .agent-description { font-size: 12px; line-height: 1.95; }
  .agent-skills { gap: 16px; margin-top: 20px; padding-top: 18px; }
  .agent-skills dt { font-size: 10px; }
  .agent-skills dd { font-size: 11px; }
  .identity-stamp { align-items: flex-start; gap: 10px; margin-top: 22px; font-size: 9px; }
  .identity-stamp > span:last-child { max-width: 94px; text-align: right; }
  .stamp { gap: 5px; }
  .stamp .mark { width: 14px; flex-basis: 14px; }
  .result-actions { gap: 9px; margin-top: 23px; }
  .result-actions .primary, .result-actions .secondary { flex: 1; min-height: 46px; padding: 11px 12px; font-size: 12px; }
  .result-subactions { gap: 4px; margin: 10px 0 21px; }
  .result-subactions button { font-size: 11px; }
  .more-result { grid-template-columns: 1fr; gap: 14px; margin-top: 20px; }
  .detail-panel { padding: 22px; }
  .detail-panel h2 { font-size: 14px; }
  .buddy-art { width: 80px; }
  .small-disclaimer { margin-top: 20px; font-size: 10px; }
  dialog { padding: 22px; }
  .dialog-top h2 { font-size: 17px; }
  .modal-quote { font-size: 18px; }
}

@media (max-width: 360px) {
  .header { padding: 0 17px; gap: 8px; }
  .brand { font-size: 15px; gap: 7px; }
  .brand > span:first-child { width: 25px; height: 29px; }
  nav button { padding-left: 5px; padding-right: 5px; font-size: 11px; }
  .home { margin: 0 18px; padding-top: 24px; }
  .hero h1 { font-size: 34px; }
  .hero-copy > p { font-size: 12px; }
  .hero-cta .primary { padding-left: 17px; padding-right: 17px; font-size: 13px; }
  .page-shell { margin-left: 18px; margin-right: 18px; }
  .question-title { font-size: 21px; }
  .option { gap: 9px; padding: 12px 11px; font-size: 12px; }
  .gallery { margin-left: 13px; margin-right: 13px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .agent-grid { gap: 6px; }
  .agent-tile { padding-left: 7px; padding-right: 7px; }
  .agent-tile h2 { font-size: 13px; }
  .result-page { margin-left: 14px; margin-right: 14px; }
  .identity-top { padding-left: 17px; padding-right: 17px; }
  .identity-copy h1 { font-size: 30px; }
  .agent-tags span { padding: 4px 6px; }
  .identity-body { padding: 21px 18px; }
  .agent-quote { font-size: 16px; }
  .result-actions .primary, .result-actions .secondary { gap: 7px; padding-left: 9px; padding-right: 9px; }
  .footer { margin-left: 17px; margin-right: 17px; }
  dialog { padding: 19px; }
}

@media (max-width: 320px) {
  .hero h1 { font-size: 31px; }
  .hero-art { margin-top: 15px; }
  .hero-cta { gap: 5px; }
  .text-button { padding-left: 9px; padding-right: 9px; font-size: 12px; }
  .identity-top { grid-template-columns: 1.1fr 1fr; padding-left: 14px; padding-right: 14px; }
  .identity-copy h1 { font-size: 28px; }
  .identity-copy h2 { font-size: 12px; }
  .identity-stamp { flex-wrap: wrap; }
  .identity-stamp > span:last-child { max-width: none; text-align: left; }
  .dialog-actions .primary, .dialog-actions .secondary { padding-left: 12px; padding-right: 12px; font-size: 12px; }
}

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

/* Local records and update controls reuse the existing quiet surface hierarchy. */
[hidden] { display: none !important; }
#boot-state { margin: 0 auto 24px; padding: 0 22px; text-align: center; font-size: 12px; color: var(--muted); }
.storage-note { color: var(--text-secondary); font-size: 12px; line-height: 1.9; margin: 0 4px 24px; }
.saved-records { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.saved-record { display: flex; align-items: center; gap: 18px; text-align: left; width: 100%; padding: 18px; border-radius: var(--radius-md); background: var(--surface-1); }
.saved-record:hover { background: var(--surface-2); }
.record-art { width: 74px; flex: 0 0 74px; }
.saved-record strong { display: block; font-size: 17px; font-weight: 600; }
.saved-record small,.saved-record time { display: block; margin-top: 7px; font-size: 11px; color: var(--text-secondary); }
.saved-record time { color: var(--muted); }
.record-open { margin-left: auto; font-size: 14px; color: var(--muted); }
.empty-records { grid-column: 1/-1; padding: 44px 20px; color: var(--text-secondary); text-align: center; font-size: 13px; line-height: 2; }
.empty-records .primary { margin-top: 24px; }
.backup-import { display: block; margin: 22px 0 16px; font-weight: 600; color: var(--ink); }
.backup-import input { display: block; margin-top: 9px; width: 100%; max-width: 100%; font-size: 12px; font-weight: 400; }
.update-banner { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; padding: 13px 17px; display: flex; gap: 14px; align-items: center; background: var(--surface-2); color: var(--ink); box-shadow: 0 0 0 1px var(--line),0 6px 22px #00000012; border-radius: var(--radius-md); z-index: 8; font-size: 12px; }
.update-banner button { padding: 7px 10px; color: var(--brand); border-radius: var(--radius-xs); white-space: nowrap; }
.offline-status { display: block; text-align: center; color: var(--muted); font-size: 10px; padding: 0 16px max(12px,env(safe-area-inset-bottom)); }
.offline-status:empty { display: none; }
@media(max-width:600px) { .saved-records { grid-template-columns: 1fr; } .saved-record { padding: 14px; gap: 13px; } .record-art { width: 64px; flex-basis: 64px; } .update-banner { gap: 5px; padding: 11px 12px; font-size: 10px; } .update-banner span { max-width: 170px; line-height: 1.7; } }

/* ---- 英雄档案：官方立绘 + 更接近战术档案的排版 ---- */
:root {
  --surface-0: #f4f2ec;
  --surface-1: #fbfaf6;
  --surface-2: #ffffff;
  --ink: #1b1c20;
  --text-secondary: #55565c;
  --muted: #6f7076;
  --line: #e2ded2;
  --line-strong: #bdb7a7;
  --brand: #cc3a34;
  --brand-hover: #b32f2a;
  --clay: #e0503c;
  --clay-soft: #fbeeea;
  --ghost-hover: rgba(27, 28, 32, .05);
  --secondary-fill: #e9e6dd;
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
.portrait { display: block; width: 100%; height: 100%; object-fit: contain; object-position: bottom center; }
.mark { display: inline-block; flex: 0 0 18px; width: 18px; height: 18px; }
.primary .mark, .dialog-actions .mark { width: 16px; height: 16px; flex-basis: 16px; }
.brand > span:first-child svg { width: 100%; height: 100%; }

/* 首页：三张错开的档案卡，最上面一张还没揭晓 */
.hero-art { display: grid; place-items: center; padding: 0; }
.stack { position: relative; width: 100%; height: 420px; }
.stack-card { position: absolute; left: 50%; bottom: 8px; width: 218px; height: 336px; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); box-shadow: 0 16px 36px rgba(30, 26, 20, .1); }
.stack-card .portrait { object-position: bottom center; }
.stack-card.back { transform: translateX(-50%) rotate(-9deg) translate(-62px, -12px); opacity: .92; }
.stack-card.mid { transform: translateX(-50%) rotate(7deg) translate(62px, -4px); opacity: .96; }
.stack-card.front { z-index: 2; transform: translateX(-50%) rotate(-1.5deg); }
.stack-question { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); font-family: var(--font-serif); font-size: 26px; line-height: 1; }
.art-caption { margin-top: 14px; }
.hero-credit { margin-top: 12px; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.mini-agent { width: 30px; height: 30px; overflow: hidden; border-radius: 50%; background: #eae8df; }
.mini-agent .portrait { object-fit: cover; object-position: 50% 6%; }
.mini-agents > span:last-child { margin-left: 8px; }

/* 答题页的小头像 */
.quiz-illustration { display: grid; place-items: end center; overflow: hidden; border-radius: 50%; background: var(--surface-1); }
.quiz-illustration .portrait { object-fit: cover; object-position: 50% 8%; }

/* 图鉴：30 位英雄 */
.agent-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.agent-tile .agent-picture { display: grid; place-items: end center; height: 168px; overflow: hidden; padding: 8px 12px 0; }
.agent-tile .agent-picture .portrait { object-position: bottom center; }
.agent-tile h2 { font-size: 15px; }

/* 结果页：立绘、六维与匹配 */
.identity-top .agent-picture { display: grid; place-items: end center; height: 300px; overflow: hidden; }
.identity-top .agent-picture .portrait { max-height: 300px; }
.modal-agent { display: grid; place-items: end center; height: 210px; overflow: hidden; margin-bottom: 10px; border-radius: var(--radius-md); }
.modal-meta { margin-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.9; }
.record-art { display: grid; place-items: end center; height: 74px; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-0); }
.record-art .portrait { object-position: bottom center; }
.buddy-art { display: grid; place-items: end center; height: 88px; overflow: hidden; }
.trait-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 30px; margin-top: 14px; }
.detail-panel.wide { grid-column: 1 / -1; }
.panel-quote { margin-top: 14px; color: var(--text-secondary); font-size: 13px; line-height: 2; }
.identity-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 20px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.identity-meta span { padding: 4px 9px; border: 1px solid var(--line); border-radius: var(--radius-xs); }

/* 署名：小而克制，不抢内容 */
.byline { display: inline-block; margin-left: 10px; color: var(--muted); font-size: 10px; letter-spacing: .04em; white-space: nowrap; }
.footer .author { border-left-color: var(--line); }

@media (max-width: 1000px) {
  .agent-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stack { height: 380px; }
  .stack-card { width: 196px; height: 302px; }
  .identity-top .agent-picture { height: 270px; }
}
@media (max-width: 860px) {
  .agent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .stack { height: 330px; }
  .stack-card { width: 168px; height: 258px; }
  .stack-card.back { transform: translateX(-50%) rotate(-8deg) translate(-48px, -10px); }
  .stack-card.mid { transform: translateX(-50%) rotate(6deg) translate(48px, -4px); }
  .identity-top .agent-picture { height: 240px; }
  .trait-list { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .agent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .agent-tile .agent-picture { height: 150px; padding: 6px 6px 0; }
  .stack { height: 300px; }
  .stack-card { width: 150px; height: 232px; }
  .identity-top .agent-picture { height: 210px; }
  .quiz-illustration { width: 70px; height: 70px; }
}

/* 侧边卡露出的是一条窄边，改用封面裁切让脸部进入可见区域 */
.stack-card.back .portrait, .stack-card.mid .portrait { object-fit: cover; object-position: 50% 8%; }
@media (max-width: 600px) {
  /* 手机上立绘独占一行，信息在下方，避免和标签挤在一起 */
  .identity-top { grid-template-columns: 1fr; gap: 0; padding: 20px 20px 4px; }
  .identity-top .agent-picture { order: -1; width: 100%; max-width: none; height: 230px; margin: 0 0 8px; }
  .identity-top .identity-copy { padding-bottom: 18px; }
}

/* 后面的档案标签卡 */
.stack-card.back, .stack-card.mid { background: var(--agent-bg); }
.stack-label { position: absolute; top: 26px; left: 50%; transform: translateX(-50%); color: #6f7076; font-family: var(--font-serif); font-size: 19px; letter-spacing: .34em; writing-mode: vertical-rl; opacity: .75; }
.stack-card.back .stack-label { top: 34px; }

@media (max-width: 600px) {
  /* 手机上保留「24 道 / 约 4 分钟 / 不用登录」，它是最直接的预期管理 */
  .hero-meta { display: flex; }
}
