/* Shared editorial tokens. Legacy aliases remain available to the canvas poster. */
:root,
html[data-style="paper"] {
  --page: #f1ede1;
  --surface: #fbf8ee;
  --ink: #25362f;
  --muted: #6c7165;
  --accent: #9a492f;
  --line: #a8aa98;
  --display: "Songti SC", "STSong", "SimSun", "NSimSun", serif;
  --body: "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 2px;
  --shadow: 5px 5px 0 rgba(37, 54, 47, .12);
  --bg: var(--page);
  --tile: var(--surface);
  --edge: var(--line);
  --tint: #e4e4d5;
  color-scheme: light;
}

html[data-style="night"] {
  --page: #091224;
  --surface: #111d35;
  --ink: #f5f0df;
  --muted: #aab4c7;
  --accent: #efc876;
  --line: #40506d;
  --display: "Songti SC", "STSong", "SimSun", "NSimSun", serif;
  --body: "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .26);
  --bg: var(--page);
  --tile: var(--surface);
  --edge: var(--line);
  --tint: #20304d;
  color-scheme: dark;
}

html[data-style="peach"] {
  --page: #f7ddd5;
  --surface: #fff7e9;
  --ink: #512b35;
  --muted: #87636a;
  --accent: #ad3851;
  --line: #d79d96;
  --display: "Songti SC", "STSong", "SimSun", "NSimSun", serif;
  --body: "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 22px;
  --shadow: 8px 8px 0 #eaa095;
  --bg: var(--page);
  --tile: var(--surface);
  --edge: var(--line);
  --tint: #f6c9bd;
  color-scheme: light;
}

html[data-style="haze"] {
  --page: #e8e5ed;
  --surface: #f8f7fa;
  --ink: #3c3848;
  --muted: #746e80;
  --accent: #716286;
  --line: #d3cddd;
  --display: "Songti SC", "STSong", "SimSun", "NSimSun", serif;
  --body: "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 28px;
  --shadow: 0 14px 36px rgba(67, 57, 82, .08);
  --bg: var(--page);
  --tile: var(--surface);
  --edge: var(--line);
  --tint: #ece7f1;
  color-scheme: light;
}

html[data-style="magazine"] {
  --page: #f4ecd9;
  --surface: #fffaf0;
  --ink: #24221d;
  --muted: #726d61;
  --accent: #ad3f28;
  --line: #b8ad97;
  --display: "Songti SC", "STSong", "SimSun", "NSimSun", serif;
  --body: "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 0px;
  --shadow: none;
  --bg: var(--page);
  --tile: var(--surface);
  --edge: var(--line);
  --tint: #e8dcc3;
  color-scheme: light;
}

html[data-style="celadon"] {
  --page: #eaf0e7;
  --surface: #f8f8ef;
  --ink: #27463e;
  --muted: #708077;
  --accent: #316c5d;
  --line: #a2b5a7;
  --display: "Songti SC", "STSong", "SimSun", "NSimSun", serif;
  --body: "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 3px;
  --shadow: 0 10px 28px rgba(39, 70, 62, .06);
  --bg: var(--page);
  --tile: var(--surface);
  --edge: var(--line);
  --tint: #dfe9df;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 0; background: var(--page); }
body {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.75 var(--body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
header,
main,
footer {
  position: relative;
  z-index: 1;
  width: calc(100% - 32px);
  max-width: 1120px;
  min-width: 0;
  margin-inline: auto;
}
header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
header small {
  max-width: 58%;
  color: var(--muted);
  text-align: right;
  line-height: 1.5;
}
.brand {
  flex: 0 0 auto;
  color: var(--ink);
  font: 900 27px/1 var(--display);
  letter-spacing: -.12em;
  text-decoration: none;
}
.brand span { color: var(--accent); }
small,
.eyebrow,
.number {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 11px;
  letter-spacing: .12em;
}
.eyebrow { color: var(--accent); font-weight: 700; }
.number { color: var(--muted); font-variant-numeric: tabular-nums; }
main:focus { outline: 0; }
main > section { animation: page-in .28s ease-out both; }
footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 40px;
  padding: 18px 0 calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}

h1,
h2,
h3,
p,
blockquote { max-width: 100%; }
h1,
h2,
h3 {
  margin: 12px 0;
  font-family: var(--display);
  line-height: 1.22;
  overflow-wrap: anywhere;
  word-break: break-word;
}
h1 { font-size: clamp(36px, 10vw, 64px); letter-spacing: -.045em; }
h2 { font-size: clamp(25px, 7vw, 38px); }
h3 { font-size: 21px; }
p { overflow-wrap: anywhere; }
.lead { max-width: 650px; color: var(--muted); font-size: 16px; line-height: 1.9; }
.muted { color: var(--muted); font-size: 13px; }
.hero { margin: 34px 0 26px; }
.panel {
  position: relative;
  width: 100%;
  max-width: 780px;
  min-width: 0;
  margin: 24px auto;
}
.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 12px;
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

/* Cover: a magazine frame rather than a generic centered card. */
.cover-frame > .panel:has(form),
.panel.cover-frame {
  isolation: isolate;
  overflow: hidden;
  padding: 54px 24px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.cover-frame > .panel:has(form)::before,
.panel.cover-frame::before {
  content: "PERSONA  /  ISSUE 06";
  display: block;
  margin-bottom: 48px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .22em;
}
.cover-frame > .panel:has(form)::after,
.panel.cover-frame::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.cover-frame > .panel:has(form) > *,
.panel.cover-frame > * { position: relative; z-index: 1; }
.cover-frame > .panel:has(form) h1 { margin: 18px 0 22px; }
.cover-frame > .panel:has(form) .lead { margin-bottom: 26px; }
.cover-frame > .panel:has(form) > .number {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.box,
fieldset {
  min-width: 0;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
form.box { margin: 26px 0 18px; box-shadow: none; }
label { display: block; min-width: 0; margin: 10px 0; font-weight: 650; }
input,
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: min(var(--radius), 8px);
  background: var(--surface);
  color: var(--ink);
  font: 16px/1.5 var(--body);
}
textarea { min-height: 88px; resize: vertical; }
input::placeholder,
textarea::placeholder { color: var(--muted); opacity: .75; }
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 46px;
  max-width: 100%;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: min(var(--radius), 10px);
  background: var(--ink);
  color: var(--surface);
  font: 650 15px/1.5 var(--body);
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}
button.alt,
.btn.alt { background: transparent; color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:not(:disabled):active { transform: translateY(1px); }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.msg { color: var(--accent); font-weight: 650; white-space: pre-line; overflow-wrap: anywhere; }
.msg:empty { display: none; }

/* Question and whole-row answer targets. */
.panel:has(progress) { max-width: 780px; }
.panel:has(progress) > h2 { margin: 22px 0 26px; font-size: clamp(28px, 7.5vw, 40px); }
progress {
  display: block;
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--line);
  color: var(--accent);
  accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.choice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  margin: 12px 0;
  padding: 15px 16px;
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  text-align: left;
}
.choice b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  font: 700 17px/1 var(--display);
}
.choice span { min-width: 0; overflow-wrap: anywhere; }
.choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--tint);
  box-shadow: inset 4px 0 0 var(--accent);
}
.choice[aria-pressed="true"] b { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.choice[aria-pressed="true"]:disabled { opacity: 1; }
.choice:not(:disabled):hover { border-color: var(--accent); }
.panel:has(progress) > .actions { justify-content: space-between; padding-bottom: env(safe-area-inset-bottom); }

/* Result reading column and share rail. */
.panel:has(.result-hero) { max-width: 1104px; }
.result-hero,
.quote-card,
.report-section,
.action-card,
.share-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.result-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 34px 24px;
  box-shadow: var(--shadow);
  animation: page-in .5s ease-out both;
}
.result-hero h1 { position: relative; z-index: 1; margin: 18px 0; font-size: clamp(40px, 10vw, 68px); }
.result-hero h2 { position: relative; z-index: 1; color: var(--muted); font-size: clamp(20px, 5vw, 28px); }
.result-hero .eyebrow { position: relative; z-index: 1; }
.quote-card {
  margin: 18px 0;
  padding: 22px 24px;
  border-left: 4px solid var(--accent);
  font: 22px/1.65 var(--display);
  overflow-wrap: anywhere;
  box-shadow: var(--shadow);
}
.quote-card::before { content: "「"; color: var(--accent); }
.quote-card::after { content: "」"; color: var(--accent); }
.report-section,
.action-card { margin: 18px 0; padding: 24px 22px; }
.report-section > h2,
.action-card > h2 { margin-top: 0; font-size: 27px; }
.report-section p,
.action-card p { line-height: 1.95; }
.evidence-list,
.score-list { margin: 16px 0; padding: 0; list-style: none; }
.evidence-list li {
  padding: 13px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.score-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.score-list li { padding: 12px; background: var(--tint); overflow-wrap: anywhere; }
.share-panel { margin: 22px 0 0; padding: 20px; }
.share-panel .actions { margin-top: 0; }
.share-panel .actions > * { flex: 1 1 160px; }
.poster-preview {
  min-width: 0;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.poster { display: block; width: min(100%, 340px); height: auto; margin: 0 auto 16px; box-shadow: var(--shadow); }
.poster-preview > a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
html[data-style="paper"] .poster { outline: 1px solid var(--line); outline-offset: 4px; }
html[data-style="night"] .poster { border: 1px solid var(--line); border-radius: 10px; }
html[data-style="peach"] .poster { border: 2px solid var(--ink); border-radius: 18px; }
html[data-style="haze"] .poster { border-radius: 26px; }
html[data-style="magazine"] .poster { border: 4px solid var(--ink); }
html[data-style="celadon"] .poster { outline: 3px double var(--line); outline-offset: 5px; }

/* Studio: four panels (templates / editor / appearance / delivery). */
.studio-heading { margin: 28px 0 14px; }
.studio-heading h1 { margin: 8px 0 6px; font-size: clamp(32px, 8vw, 52px); }
.studio-heading .lead { margin-bottom: 0; }
.studio-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 26px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: min(var(--radius), 12px);
  background: var(--surface);
}
.studio-tabs button {
  min-width: 0;
  min-height: 46px;
  padding: 8px 10px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.studio-tabs button[aria-current="page"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}
[data-studio-panel] { min-width: 0; }
[data-studio-panel] > h2:first-child { margin-top: 0; }
[data-studio-panel] > .lead { margin-top: 0; }
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.studio-grid > *,
.studio-aside,
.studio-main { min-width: 0; }
.studio-aside { display: grid; gap: 14px; }
.studio-aside .box { margin: 0; }
.studio-grid h2 { font-size: 25px; }
.studio-draft { margin: 6px 0; font: 700 20px/1.4 var(--display); overflow-wrap: anywhere; }
.studio-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: end; }
.studio-field { min-width: 0; }
.studio-row label { margin: 4px 0; }
.studio-main .box { margin: 18px 0; }
.studio-main details {
  min-width: 0;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: min(var(--radius), 10px);
  background: var(--surface);
}
.studio-main details > label,
.studio-main details > .cols,
.studio-main details > .option-row { margin-inline: 2px; }
summary { min-height: 44px; padding: 9px 4px; font-weight: 700; overflow-wrap: anywhere; cursor: pointer; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.option-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: end; }
.option-row label { margin: 4px 0; }
.option-row > button { width: 100%; margin-bottom: 10px; }
#receipt textarea { min-height: 128px; }
#deliverySelect { max-width: 100%; }
[hidden] { display: none !important; }

/* Studio step editor: published picker, three steps, question directory and current question. */
.editor-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: min(var(--radius), 12px);
  background: var(--surface);
}
.editor-steps button {
  min-width: 0;
  min-height: 46px;
  padding: 8px 6px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.editor-steps button[aria-current="step"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}
.editor-step { min-width: 0; }
.editor-step > .box:first-child { margin-top: 0; }
.profile-card { min-width: 0; }
.profile-card > h3 { margin-top: 0; }
.question-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}
.question-head h2 { margin: 0; }
.question-head .actions { margin: 0; }
.question-head .actions button { min-height: 44px; padding: 6px 12px; }
.question-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.question-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-content: start;
  min-width: 0;
}
.question-nav h3 { grid-column: 1 / -1; margin: 0 0 2px; font-size: 16px; }
.question-nav button {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 8px 10px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.question-nav button[aria-current="true"] {
  border-color: var(--accent);
  background: var(--tint);
  color: var(--ink);
  box-shadow: inset 4px 0 0 var(--accent);
}
.question-nav-add { grid-column: 1 / -1; }
.question-main { min-width: 0; }
.question-main .box { margin: 0; }
.question-card .option-row textarea { min-height: 56px; }
.question-card > label { margin-inline: 2px; }

/* Appearance: CSS thumbnails, phone preview and canvas poster preview. */
#appearance .studio-grid { grid-template-columns: minmax(0, 1fr); }
.appearance-preview,
.appearance-poster { min-width: 0; }
.style-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.style-choice {
  display: grid;
  grid-template-rows: auto auto;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: min(var(--radius), 12px);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}
.style-choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--tint);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.style-choice .style-thumb {
  grid-row: auto;
  width: 100%;
  aspect-ratio: 4 / 3;
}
.style-choice .thumb-series { font-size: 9px; }
.style-choice .thumb-snippet { font-size: 7px; }
.style-choice-name { display: block; padding: 2px 0; text-align: center; }
.phone-preview {
  --pp-page: #f1ede1;
  --pp-surface: #fbf8ee;
  --pp-ink: #25362f;
  --pp-muted: #6c7165;
  --pp-accent: #9a492f;
  --pp-line: #a8aa98;
  --pp-radius: 2px;
  display: grid;
  gap: 10px;
  width: min(100%, 360px);
  min-width: 0;
  margin: 16px auto 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--pp-line);
  border-radius: min(var(--pp-radius), 18px);
  background: var(--pp-page);
  color: var(--pp-ink);
}
.phone-preview[data-style="night"] {
  --pp-page: #091224;
  --pp-surface: #111d35;
  --pp-ink: #f5f0df;
  --pp-muted: #aab4c7;
  --pp-accent: #efc876;
  --pp-line: #40506d;
  --pp-radius: 8px;
}
.phone-preview[data-style="peach"] {
  --pp-page: #f7ddd5;
  --pp-surface: #fff7e9;
  --pp-ink: #512b35;
  --pp-muted: #87636a;
  --pp-accent: #ad3851;
  --pp-line: #d79d96;
  --pp-radius: 18px;
}
.phone-preview[data-style="haze"] {
  --pp-page: #e8e5ed;
  --pp-surface: #f8f7fa;
  --pp-ink: #3c3848;
  --pp-muted: #746e80;
  --pp-accent: #716286;
  --pp-line: #d3cddd;
  --pp-radius: 18px;
}
.phone-preview[data-style="magazine"] {
  --pp-page: #f4ecd9;
  --pp-surface: #fffaf0;
  --pp-ink: #24221d;
  --pp-muted: #726d61;
  --pp-accent: #ad3f28;
  --pp-line: #b8ad97;
  --pp-radius: 0px;
}
.phone-preview[data-style="celadon"] {
  --pp-page: #eaf0e7;
  --pp-surface: #f8f8ef;
  --pp-ink: #27463e;
  --pp-muted: #708077;
  --pp-accent: #316c5d;
  --pp-line: #a2b5a7;
  --pp-radius: 3px;
}
.pp-card {
  min-width: 0;
  padding: 12px;
  overflow-wrap: anywhere;
  border: 1px solid var(--pp-line);
  border-radius: min(var(--pp-radius), 14px);
  background: var(--pp-surface);
}
.pp-cover h3 { margin: 4px 0 6px; font: 700 24px/1.25 var(--display); }
.pp-cover .eyebrow { color: var(--pp-accent); }
.pp-card h4 { margin: 4px 0 6px; font: 700 18px/1.35 var(--display); }
.pp-card p { margin: 4px 0; color: var(--pp-muted); font-size: 12px; line-height: 1.65; }
.pp-options {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.pp-options li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  padding: 7px 8px;
  overflow-wrap: anywhere;
  border: 1px solid var(--pp-line);
  border-radius: min(var(--pp-radius), 8px);
  font-size: 12px;
  line-height: 1.55;
}
.pp-options b { color: var(--pp-accent); }
.pp-quote {
  margin: 8px 0 0;
  padding-left: 8px;
  border-left: 2px solid var(--pp-accent);
  font: 13px/1.6 var(--display);
}
.phone-preview[data-style="paper"] .pp-cover { border-style: double; }
.phone-preview[data-style="night"] .pp-cover,
.phone-preview[data-style="night"] .pp-result { text-align: center; }
.phone-preview[data-style="night"] .pp-options li { border-radius: 999px; }
.phone-preview[data-style="peach"] { box-shadow: 6px 6px 0 #eaa095; }
.phone-preview[data-style="peach"] .pp-card { border-width: 2px; }
.phone-preview[data-style="haze"] .pp-card { border: 0; border-radius: 18px; box-shadow: 0 6px 16px rgba(67, 57, 82, .1); }
.phone-preview[data-style="magazine"] .pp-cover { border: 0; border-top: 6px solid var(--pp-ink); border-radius: 0; }
.phone-preview[data-style="magazine"] .pp-cover h3 { font-size: 30px; }
.phone-preview[data-style="celadon"] .pp-cover,
.phone-preview[data-style="celadon"] .pp-result { border-style: double; border-width: 2px; }
.studio-poster-preview .poster-slot { min-width: 0; margin-top: 12px; }
.studio-poster-preview img {
  display: block;
  width: min(100%, 340px);
  height: auto;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

/* Template library: 8 cover thumbnails drawn with CSS only. */
.template-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 18px 0;
}
.template-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  align-items: start;
}
.template-card > button { grid-column: 2; justify-self: start; width: auto; }
.template-body { min-width: 0; }
.template-body .eyebrow { display: block; line-height: 1.6; }
.template-title { margin: 6px 0 8px; font-size: 22px; }
.template-body .muted { margin: 0 0 8px; line-height: 1.8; }
.template-thumb {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  grid-row: span 2;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 6px 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: min(var(--radius), 10px);
  background: #efe9dc;
}
.thumb-series,
.thumb-name,
.thumb-snippet {
  position: relative;
  z-index: 2;
  max-width: 100%;
  padding: 0 3px;
  color: inherit;
  text-align: center;
  overflow-wrap: anywhere;
}
.thumb-series {
  font: 700 8px/1.3 var(--body);
  letter-spacing: .08em;
  opacity: .88;
}
.thumb-name {
  font: 700 10px/1.35 var(--display);
  letter-spacing: .08em;
}
.thumb-snippet {
  font: 6px/1.35 var(--body);
  opacity: .72;
}
.template-thumb[data-thumb="paper"] {
  color: #25362f;
  background: #f2eddf;
  box-shadow: inset 0 0 0 4px #f2eddf, inset 0 0 0 5px #a8aa98;
}
.template-thumb[data-thumb="paper"]::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 3px double #a8aa98;
}
.template-thumb[data-thumb="paper"]::after {
  content: "ARCHIVE 06";
  position: absolute;
  left: 9px;
  bottom: 7px;
  color: #9a492f;
  font-size: 6px;
  letter-spacing: .14em;
}
.template-thumb[data-thumb="night"] {
  color: #f5f0df;
  background-color: #091224;
  border-color: #40506d;
}
.template-thumb[data-thumb="night"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(239, 200, 118, .85) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(245, 240, 223, .55) 0 1px, transparent 1.6px);
  background-size: 29px 37px, 41px 31px;
  background-position: 3px 7px, 15px 19px;
}
.template-thumb[data-thumb="night"]::after {
  content: "✦";
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #efc876;
  border-radius: 50%;
  color: #efc876;
  font-size: 12px;
}
.template-thumb[data-thumb="peach"] {
  color: #512b35;
  background: #f7ddd5;
  border: 2px solid #512b35;
  border-radius: 14px 3px 14px 3px;
}
.template-thumb[data-thumb="peach"]::before {
  content: "";
  position: absolute;
  right: -14px;
  bottom: -10px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #edaa98;
}
.template-thumb[data-thumb="peach"]::after {
  content: "PEACH!";
  position: absolute;
  left: 7px;
  top: 7px;
  padding: 3px 5px;
  background: #ad3851;
  color: #fff7e9;
  font-size: 6px;
  letter-spacing: .1em;
  transform: rotate(-3deg);
}
.template-thumb[data-thumb="haze"] {
  color: #3c3848;
  background: #e8e5ed;
  border: 0;
  border-radius: 18px;
}
.template-thumb[data-thumb="haze"]::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 12px;
  background: #f8f7fa;
  box-shadow: 0 6px 18px rgba(67, 57, 82, .12);
}
.template-thumb[data-thumb="haze"]::after {
  content: "SOFT";
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ece7f1;
  color: #716286;
  font-size: 6px;
  letter-spacing: .12em;
}
.template-thumb[data-thumb="magazine"] {
  color: #24221d;
  background: #f4ecd9;
  border: 0;
  border-top: 5px solid #24221d;
  border-radius: 0;
}
.template-thumb[data-thumb="magazine"]::after {
  content: "VOL. 06";
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 2px 4px;
  background: #ad3f28;
  color: #fffaf0;
  font-size: 6px;
  letter-spacing: .12em;
}
.template-thumb[data-thumb="celadon"] {
  color: #27463e;
  background-color: #eaf0e7;
  background-image: linear-gradient(155deg, transparent 49.2%, rgba(49, 108, 93, .16) 50%, transparent 50.8%);
  border: 3px double #a2b5a7;
}
.template-thumb[data-thumb="celadon"]::after {
  content: "印";
  position: absolute;
  right: 7px;
  top: 7px;
  padding: 4px;
  border: 1px solid #316c5d;
  background: #316c5d;
  color: #f8f8ef;
  font: 11px/1 var(--display);
}


/* Paper: archival double rules, catalogue marks, vertical breathing room. */
html[data-style="paper"] body::before {
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent 79px, rgba(37, 54, 47, .025) 80px);
}
html[data-style="paper"] .cover-frame > .panel:has(form) {
  padding-block: 64px 40px;
  outline: 1px solid var(--line);
  outline-offset: -9px;
}
html[data-style="paper"] .cover-frame > .panel:has(form)::before { content: "ARCHIVE  No. 06  /  纸上档案"; }
html[data-style="paper"] .cover-frame > .panel:has(form)::after {
  inset: 18px 18px auto auto;
  width: 42px;
  height: 42px;
  border-top: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
}
html[data-style="paper"] .result-hero { border-block: 3px double var(--ink); }
html[data-style="paper"] .result-hero::after {
  content: "ARCHIVE / THIS TIME";
  display: block;
  margin-top: 30px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .2em;
}
html[data-style="paper"] .choice { border-radius: 0; }
html[data-style="paper"] .poster-preview { border-top: 3px double var(--line); }

/* Night: star points, orbit lines and a centered celestial seal. */
html[data-style="night"] body::before {
  background-image:
    radial-gradient(circle at 12% 18%, rgba(239, 200, 118, .7) 0 1px, transparent 1.5px),
    radial-gradient(circle at 82% 10%, rgba(245, 240, 223, .55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 68%, rgba(239, 200, 118, .5) 0 1px, transparent 1.5px),
    radial-gradient(circle at 24% 82%, rgba(245, 240, 223, .45) 0 1px, transparent 1.5px);
  background-size: 173px 197px, 211px 181px, 229px 223px, 197px 239px;
}
html[data-style="night"] .cover-frame > .panel:has(form),
html[data-style="night"] .result-hero { text-align: center; }
html[data-style="night"] .cover-frame > .panel:has(form) { padding-top: 72px; border-color: var(--accent); }
html[data-style="night"] .cover-frame > .panel:has(form)::before { content: "✦  MIDNIGHT ATLAS  ✦"; color: var(--accent); }
html[data-style="night"] .cover-frame > .panel:has(form)::after {
  z-index: 0;
  top: 84px;
  left: 50%;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(239, 200, 118, .28);
  border-radius: 50%;
  transform: translateX(-50%) rotate(-18deg) scaleY(.42);
}
html[data-style="night"] .cover-frame > .panel:has(form) .lead { margin-inline: auto; }
html[data-style="night"] .result-hero::before {
  content: "✦";
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 24px;
}
html[data-style="night"] .result-hero .lead { margin-inline: auto; }
html[data-style="night"] .choice b { border-radius: 50%; }
html[data-style="night"] .poster-preview { border-color: var(--accent); }

/* Peach: offset print blocks, rounded cut-outs and playful magazine labels. */
html[data-style="peach"] header { border-bottom: 3px solid var(--ink); }
html[data-style="peach"] .cover-frame > .panel:has(form) {
  overflow: visible;
  border: 2px solid var(--ink);
  border-radius: 30px 6px 30px 6px;
}
html[data-style="peach"] .cover-frame > .panel:has(form)::before {
  content: "PEACH!  /  蜜桃画报";
  display: inline-block;
  margin: -72px 0 42px -8px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--surface);
  transform: rotate(-3deg);
}
html[data-style="peach"] .cover-frame > .panel:has(form)::after {
  z-index: 0;
  right: -12px;
  bottom: 90px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #edaa98;
}
html[data-style="peach"] .cover-frame > .panel:has(form) .number { border: 0; font-weight: 700; }
html[data-style="peach"] .result-hero { border: 2px solid var(--ink); border-radius: 34px 8px; }
html[data-style="peach"] .result-hero::after {
  content: "YOUR\A MATCH";
  position: absolute;
  right: 16px;
  top: 18px;
  padding: 10px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  font: 700 9px/1.4 var(--body);
  text-align: center;
  white-space: pre;
  transform: rotate(9deg);
}
html[data-style="peach"] .choice { border-width: 2px; box-shadow: 3px 3px 0 var(--tint); }
html[data-style="peach"] .choice[aria-pressed="true"] { box-shadow: 4px 4px 0 var(--accent); }
html[data-style="peach"] .poster-preview { border-top: 2px solid var(--ink); }

/* Haze: soft solid layers, generous radii and capsule metadata, no gradient. */
html[data-style="haze"] .cover-frame > .panel:has(form) { padding: 42px 24px; border: 0; }
html[data-style="haze"] .cover-frame > .panel:has(form)::before {
  content: "SOFT FOCUS  /  柔雾人格";
  display: inline-block;
  margin-bottom: 38px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--accent);
  letter-spacing: .08em;
}
html[data-style="haze"] .cover-frame > .panel:has(form)::after {
  right: 20px;
  top: 20px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 18px 0 0 var(--line), 36px 0 0 var(--line);
}
html[data-style="haze"] .cover-frame > .panel:has(form) .number {
  display: inline-block;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--tint);
}
html[data-style="haze"] .result-hero,
html[data-style="haze"] .quote-card,
html[data-style="haze"] .report-section,
html[data-style="haze"] .action-card,
html[data-style="haze"] .share-panel { border: 0; box-shadow: var(--shadow); }
html[data-style="haze"] .result-hero { padding-block: 42px; text-align: center; }
html[data-style="haze"] .result-hero .eyebrow,
html[data-style="haze"] .result-hero .number { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--tint); }
html[data-style="haze"] .choice { border: 0; border-radius: 20px; box-shadow: 0 5px 16px rgba(67, 57, 82, .05); }
html[data-style="haze"] .choice[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
html[data-style="haze"] .choice b { border-radius: 999px; }
html[data-style="haze"] .score-list li { border-radius: 14px; }

/* Magazine: oversized serif, black editorial bars and reversed headlines. */
html[data-style="magazine"] header { border-bottom: 4px solid var(--ink); }
html[data-style="magazine"] .brand { font-size: 31px; }
html[data-style="magazine"] .cover-frame > .panel:has(form) { border: 0; border-top: 1px solid var(--ink); box-shadow: none; }
html[data-style="magazine"] .cover-frame > .panel:has(form)::before {
  content: "THE PERSONA EDIT  /  VOL. 06";
  margin: -54px -24px 48px;
  padding: 10px 24px;
  background: var(--ink);
  color: var(--surface);
}
html[data-style="magazine"] .cover-frame > .panel:has(form) h1 { font-size: clamp(44px, 12vw, 78px); }
html[data-style="magazine"] .cover-frame > .panel:has(form) .number {
  display: inline-block;
  padding: 8px 12px;
  border: 0;
  background: var(--accent);
  color: var(--surface);
}
html[data-style="magazine"] .result-hero { border: 0; border-top: 8px solid var(--ink); box-shadow: none; }
html[data-style="magazine"] .result-hero h1 {
  display: inline;
  padding: 0 .12em;
  background: var(--ink);
  color: var(--surface);
  line-height: 1.35;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
html[data-style="magazine"] .result-hero h2 { margin-top: 28px; }
html[data-style="magazine"] .quote-card { border: 0; border-block: 1px solid var(--ink); font-size: 26px; }
html[data-style="magazine"] .report-section,
html[data-style="magazine"] .action-card { border: 0; border-top: 1px solid var(--ink); }
html[data-style="magazine"] .choice { border: 0; border-bottom: 1px solid var(--ink); }
html[data-style="magazine"] .choice[aria-pressed="true"] { background: var(--ink); color: var(--surface); box-shadow: none; }
html[data-style="magazine"] .choice[aria-pressed="true"] b { background: var(--surface); color: var(--ink); }
html[data-style="magazine"] .share-panel { border: 4px solid var(--ink); }

/* Celadon: a seal, hairline mountains and deliberate empty space. */
html[data-style="celadon"] .cover-frame > .panel:has(form) {
  padding-block: 62px 46px;
  border: 3px double var(--line);
  background-color: var(--surface);
  background-image:
    linear-gradient(155deg, transparent 49.4%, rgba(49, 108, 93, .13) 50%, transparent 50.6%),
    linear-gradient(25deg, transparent 49.4%, rgba(49, 108, 93, .1) 50%, transparent 50.6%);
  background-position: left bottom, 90px bottom;
  background-size: 230px 100px, 250px 85px;
  background-repeat: no-repeat;
}
html[data-style="celadon"] .cover-frame > .panel:has(form)::before { content: "山水人格志  /  卷六"; color: var(--accent); }
html[data-style="celadon"] .cover-frame > .panel:has(form)::after {
  content: "观\A 心";
  right: 26px;
  top: 24px;
  width: 42px;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--surface);
  font: 17px/1.15 var(--display);
  text-align: center;
  white-space: pre;
}
html[data-style="celadon"] .result-hero { padding-block: 44px; border: 3px double var(--line); }
html[data-style="celadon"] .result-hero::after {
  content: "印\A 心";
  position: absolute;
  right: 20px;
  bottom: 20px;
  padding: 7px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font: 16px/1.1 var(--display);
  white-space: pre;
}
html[data-style="celadon"] .choice { border-radius: 0; border-color: var(--line); }
html[data-style="celadon"] .choice b { border-radius: 2px; }
html[data-style="celadon"] .quote-card { border-left-width: 1px; }
html[data-style="celadon"] .poster-preview { border-top: 3px double var(--line); }

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 760px) {
  header,
  main,
  footer { width: calc(100% - 48px); }
  header { min-height: 82px; }
  header small { font-size: 12px; }
  .hero { margin: 52px 0 32px; }
  .hero h1 { font-size: 64px; }
  .panel { margin-block: 42px; }
  .cover-frame > .panel:has(form),
  .panel.cover-frame { padding: 72px 56px 42px; }
  .cover-frame > .panel:has(form)::before,
  .panel.cover-frame::before { margin-bottom: 64px; }
  .cover-frame > .panel:has(form) h1 { font-size: clamp(48px, 5.5vw, 72px); }
  .lead { font-size: 17px; }
  form.box { padding: 22px 24px; }
  .panel:has(progress) > h2 { font-size: 38px; }
  .choice { min-height: 70px; padding: 17px 20px; }
  .result-hero { padding: 48px 40px; }
  .quote-card { padding: 26px 30px; font-size: 25px; }
  .report-section,
  .action-card { padding: 28px 30px; }
  .panel:has(.result-hero) {
    display: grid;
    grid-template-columns: minmax(0, 720px) 340px;
    justify-content: space-between;
    column-gap: 24px;
    align-items: start;
  }
  .panel:has(.result-hero) > .link { grid-column: 1 / -1; }
  .panel:has(.result-hero) > .result-hero,
  .panel:has(.result-hero) > .quote-card,
  .panel:has(.result-hero) > .report-section,
  .panel:has(.result-hero) > .action-card,
  .panel:has(.result-hero) > .muted { grid-column: 1; }
  .panel:has(.result-hero) > .share-panel {
    grid-column: 2;
    grid-row: 1 / span 8;
    position: sticky;
    top: 24px;
    width: 340px;
    margin: 0;
  }
  .share-panel .actions { display: grid; }
  .share-panel .actions > * { width: 100%; }
  .studio-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .studio-grid { grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
  .studio-aside { position: sticky; top: 20px; }
  .studio-row { grid-template-columns: minmax(0, 1fr) auto; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .option-row { grid-template-columns: minmax(0, 1.4fr) minmax(140px, .8fr) auto; gap: 10px; }
  .option-row > button { width: auto; margin-bottom: 10px; }
  html[data-style="peach"] .cover-frame > .panel:has(form)::before { margin-top: -92px; }
  html[data-style="magazine"] .cover-frame > .panel:has(form)::before { margin: -72px -56px 62px; padding-inline: 56px; }
  html[data-style="magazine"] .cover-frame > .panel:has(form) h1 { font-size: 76px; }
}

@media (min-width: 760px) {
  .editor-steps { grid-template-columns: minmax(0, 1fr); }
  .question-grid { grid-template-columns: 210px minmax(0, 1fr); }
  .question-nav { grid-template-columns: minmax(0, 1fr); }
  .question-nav-add { grid-column: auto; }
  #appearance .studio-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 24px; }
  .style-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Behavioral preferences: a position between two useful approaches, never an ability grade. */
.dimension-row { padding-block: 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.dimension-row:last-child { border-bottom: 0; }
.dimension-labels { display: flex; justify-content: space-between; gap: 24px; font-size: 13px; color: var(--muted); }
.dimension-labels span { max-width: 46%; overflow-wrap: anywhere; }
.dimension-labels span:last-child { text-align: right; }
.preference-track { position: relative; height: 8px; margin: 18px 9px; background: var(--tint); border: 1px solid var(--line); border-radius: 8px; }
.preference-band { position: absolute; top: -1px; height: 8px; background: var(--line); opacity: .5; }
.preference-dot { position: absolute; top: 50%; width: 16px; height: 16px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px var(--accent); }
.report-section details { margin-top: 14px; }
.report-section summary { min-height: 44px; padding-block: 10px; cursor: pointer; color: var(--accent); }
.answer-evidence { margin: 10px 0 18px; padding: 10px 14px; border-left: 2px solid var(--accent); background: var(--tint); }
.dimension-editor fieldset { min-width: 0; margin-block: 16px; border: 1px solid var(--line); }
.dimension-preview { --ink: var(--pp-ink); --muted: var(--pp-muted); --accent: var(--pp-accent); --line: var(--pp-line); --surface: var(--pp-surface); --tint: var(--pp-page); text-align: left; }
.dimension-preview .report-section { margin: 12px 0; padding: 12px; font-size: 13px; }
.dimension-preview h2 { font-size: 18px; }
.dimension-preview h3 { font-size: 15px; }
.dimension-preview p { font-size: 13px; }
.report-download { grid-column: 1; }
@media (min-width: 760px) { .panel:has(.result-hero) > .share-panel { grid-row: 1 / span 20; } }
