:root {
  --paper: #f6f5fb;
  --paper-strong: #ffffff;
  --paper-subtle: #f0edff;
  --paper-muted: #f0edff;
  --ink: #2e2b44;
  --ink-soft: #514d68;
  --dim: #79758d;
  --faint: #9792aa;
  --line: #e5e1f0;
  --line-strong: #cec7e2;
  --gold: #6858c7;
  --gold-deep: #2f296d;
  --gold-fill: #6858c7;
  --gold-wash: #f0edff;
  --jade: #3f8066;
  --jade-wash: #e6f6ef;
  --sky: #527aa7;
  --sky-wash: #e9f2fc;
  --danger: #a55267;
  --danger-wash: #fbedf1;
  --shadow: 0 17px 45px rgba(47, 41, 109, .09);
  --sans: 'Noto Sans SC', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Noto Serif SC', 'Songti SC', serif;
  --display: 'Ma Shan Zheng', 'STKaiti', 'KaiTi', serif;
  color-scheme: light;
}

html[data-theme='dark'] {
  --paper: #20211f;
  --paper-strong: #292a27;
  --paper-subtle: #30312d;
  --paper-muted: #383933;
  --ink: #f1ecdf;
  --ink-soft: #ded8ca;
  --dim: #b8b3a8;
  --faint: #93948b;
  --line: rgba(228, 214, 182, .16);
  --line-strong: rgba(228, 214, 182, .27);
  --gold: #c7a76d;
  --gold-deep: #d0b47f;
  --gold-fill: #9f7c43;
  --gold-wash: #453b2c;
  --jade: #a4c2ad;
  --jade-wash: #304139;
  --sky: #a0bbc7;
  --sky-wash: #303f45;
  --danger: #e2a49c;
  --danger-wash: #483633;
  --shadow: 0 17px 48px rgba(0, 0, 0, .2);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0, color-mix(in srgb, var(--gold) 15%, transparent), transparent 32rem),
    radial-gradient(circle at 96% 34%, color-mix(in srgb, var(--jade) 8%, transparent), transparent 28rem),
    var(--paper);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .22;
  pointer-events: none;
  background-image: url('paper-fibers.svg');
  background-size: 360px;
  mix-blend-mode: multiply;
}

html[data-theme='dark'] body::before { opacity: .06; mix-blend-mode: screen; }

button,
textarea,
input { font: inherit; }

button,
label { -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 13px;
  border-radius: 10px;
  color: var(--paper-strong);
  background: var(--gold-fill);
  font-size: 12px;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

.site-header { position: sticky; z-index: 34; }

.site-brand-name { font-family: var(--display); font-weight: 400; }

.header-history {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold-deep);
  background: var(--paper-strong);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.xiangshu-mobile-history { display: none; }

.site-nav-utility-label { color: var(--faint); font-size: 10px; letter-spacing: 1px; }

.theme-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 34px);
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-subtle);
}

.theme-switch button {
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: var(--dim);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.theme-switch button[aria-pressed='true'] {
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 2px 8px rgba(55, 45, 30, .08);
  font-weight: 700;
}

.page-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(30px, 5vw, 58px) 0 70px;
}

.hero { max-width: 820px; margin-bottom: 27px; }

.eyebrow,
.card-heading p,
.history-drawer header p,
.consent-panel header p {
  margin: 0;
  color: var(--gold-deep);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.eyebrow { display: flex; align-items: center; gap: 8px; }

.eyebrow span { width: 24px; height: 1px; background: var(--gold); }

.hero h1 {
  margin: 9px 0 9px;
  font: 600 clamp(32px, 4.6vw, 48px) / 1.25 var(--serif);
  letter-spacing: .5px;
}

.hero > p:last-of-type {
  max-width: 720px;
  margin: 0;
  color: var(--dim);
  font: 13px / 1.9 var(--serif);
}

.account-notice {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line));
  border-radius: 15px;
  background: var(--gold-wash);
}

.account-notice > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-strong);
  background: var(--gold-fill);
  font: 700 12px / 1 var(--serif);
}

.account-notice p { display: grid; gap: 2px; margin: 0; }
.account-notice b { font-size: 12px; }
.account-notice small { color: var(--dim); font-size: 10.5px; line-height: 1.6; }
.account-notice a { color: var(--gold-deep); font-size: 11px; font-weight: 700; }

.xiangshu-workspace {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 20px;
  align-items: start;
}

.paper-card {
  min-width: 0;
  padding: clamp(18px, 2.4vw, 27px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--paper-strong) 93%, transparent);
  box-shadow: var(--shadow);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 21px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.card-heading h2,
.history-drawer h2,
.consent-panel h2 {
  margin: 5px 0 0;
  font: 600 20px / 1.35 var(--serif);
}

.field {
  min-width: 0;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.field > legend,
.field-title-row label,
.question-title {
  display: block;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .35px;
}

.field i,
.question-title i {
  color: var(--gold-deep);
  font-size: 9px;
  font-style: normal;
  font-weight: 500;
}

.choice-grid { display: grid; gap: 9px; }
.kind-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.choice-grid label,
.focus-options label,
.seg-options label { position: relative; cursor: pointer; }

.choice-grid input,
.focus-options input,
.seg-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.kind-options label > span {
  min-height: 78px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper-subtle);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.kind-options b {
  width: 36px;
  height: 36px;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  align-self: center;
  border-radius: 12px;
  color: var(--gold-deep);
  background: var(--gold-wash);
  font: 700 14px / 1 var(--serif);
}

.kind-options strong { align-self: end; font-size: 13px; }
.kind-options small { align-self: start; color: var(--dim); font-size: 9.5px; }

.kind-options input:checked + span {
  border-color: color-mix(in srgb, var(--gold) 52%, var(--line));
  background: color-mix(in srgb, var(--gold-wash) 68%, var(--paper-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 10%, transparent);
}

.kind-options input:focus-visible + span,
.focus-options input:focus-visible + span,
.seg-options input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--gold) 42%, transparent);
  outline-offset: 2px;
}

.capture-guide {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--sky) 18%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--sky-wash) 58%, var(--paper-strong));
}

.guide-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--sky) 26%, var(--line));
  border-radius: 12px;
  color: var(--sky);
  background: var(--paper-strong);
  font: 700 13px / 1 var(--serif);
}

.capture-guide h3 { margin: 0 0 5px; font: 700 12px / 1.4 var(--serif); }
.capture-guide ul { display: grid; gap: 3px; margin: 0; padding-left: 17px; color: var(--dim); font-size: 10px; line-height: 1.65; }

.field-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.field-title-row label { margin-bottom: 9px; }
.field-title-row > span { color: var(--faint); font-size: 9px; }

.image-dropzone {
  min-height: 205px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 18px;
  border: 1.5px dashed color-mix(in srgb, var(--sky) 35%, var(--line-strong));
  border-radius: 17px;
  background: color-mix(in srgb, var(--paper-subtle) 78%, var(--sky-wash));
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.image-dropzone:hover,
.image-dropzone.dragover,
.image-dropzone.is-dragging {
  border-color: var(--sky);
  background: var(--sky-wash);
}

.image-dropzone:focus-visible {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 18%, transparent);
}

.image-dropzone.is-busy,
.image-dropzone[aria-disabled='true'] { cursor: progress; opacity: .7; pointer-events: none; }

.upload-empty { max-width: 410px; display: grid; justify-items: center; gap: 7px; text-align: center; }

.upload-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border: 1px solid color-mix(in srgb, var(--sky) 18%, var(--line));
  border-radius: 16px;
  color: var(--sky);
  background: var(--paper-strong);
}

.upload-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.upload-empty strong { font-size: 13px; }
.upload-empty small { color: var(--dim); font-size: 10px; line-height: 1.65; }

.upload-preview {
  width: 100%;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.upload-preview img {
  width: 104px;
  height: 120px;
  grid-row: 1 / span 2;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper-strong);
}

.upload-preview > div:not(.preview-actions) { display: grid; gap: 4px; }
.upload-preview strong { font-size: 12px; }
.upload-preview small { color: var(--dim); font-size: 11.5px; line-height: 1.55; }

.preview-actions { display: flex; gap: 7px; }
.preview-actions button,
.result-tools button,
.history-drawer button,
.consent-actions button,
.consent-panel header button {
  min-height: 44px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold-deep);
  background: var(--paper-strong);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

#removeImageButton { color: var(--danger); }

.field-status { margin: 7px 2px 0; color: var(--faint); font-size: 11.5px; line-height: 1.55; }
.field-status.is-ready { color: var(--jade); }
.field-status.is-error { color: var(--danger); }

.hand-fields > legend {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.4;
}

.hand-fields > legend i { line-height: 1.4; }

.hand-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper-subtle);
}
.hand-field-grid > div > span { display: block; margin-bottom: 6px; color: var(--dim); font-size: 10px; font-weight: 700; }

.seg-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-strong); }
.seg-options label > span { min-height: 44px; display: grid; place-items: center; padding: 5px 3px; border-radius: 9px; color: var(--dim); font-size: 11px; white-space: nowrap; }
.seg-options input:checked + span { color: var(--jade); background: var(--jade-wash); font-weight: 700; }

.focus-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.focus-options label > span { min-height: 44px; display: grid; place-items: center; padding: 7px 5px; border: 1px solid var(--line); border-radius: 11px; color: var(--dim); background: var(--paper-subtle); font-size: 11px; text-align: center; }
.focus-options input:checked + span { color: var(--gold-deep); border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); background: var(--gold-wash); font-weight: 700; }

.question-field { display: block; }

.question-field textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  outline: 0;
  color: var(--ink);
  background: var(--paper-strong);
  font-size: 12px;
  line-height: 1.75;
}

.question-field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 12%, transparent); }
.question-field textarea::placeholder { color: var(--faint); }
.question-field > small { display: flex; justify-content: flex-end; margin-top: 6px; color: var(--faint); font-size: 9px; line-height: 1.55; }
.question-field > small b { flex: 0 0 auto; color: var(--dim); }

.form-error {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--danger) 26%, var(--line));
  border-radius: 11px;
  color: var(--danger);
  background: var(--danger-wash);
  font-size: 10.5px;
  line-height: 1.6;
}

.form-actions { display: grid; gap: 8px; }

.primary-action {
  width: 100%;
  min-height: 50px;
  padding: 11px 16px;
  border: 0;
  border-radius: 14px;
  color: #fffdf8;
  background: linear-gradient(125deg, var(--gold-fill), color-mix(in srgb, var(--gold-fill) 78%, var(--jade)));
  box-shadow: 0 9px 22px color-mix(in srgb, var(--gold-fill) 23%, transparent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .8px;
  cursor: pointer;
}

.primary-action:disabled { opacity: .48; filter: saturate(.55); box-shadow: none; cursor: not-allowed; }
.primary-action[aria-busy='true'] { cursor: progress; }


.result-card { position: sticky; top: 18px; min-height: 650px; }
.result-heading { align-items: center; }
.result-tools { display: flex; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.result-tools button:disabled { opacity: .4; cursor: not-allowed; }
#stopButton { color: var(--danger); }

.result-empty {
  min-height: 500px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 25px;
  text-align: center;
}

.result-empty > span {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--line));
  border-radius: 50%;
  color: var(--gold-deep);
  background: var(--gold-wash);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--gold-wash) 55%, transparent);
  font: 400 31px / 1 var(--display);
}

.result-empty h3 { margin: 0 0 8px; font: 600 17px / 1.45 var(--serif); }
.result-empty p { max-width: 420px; margin: 0; color: var(--dim); font-size: 11px; line-height: 1.8; }

.result-status {
  margin: 0 0 14px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--sky);
  background: var(--sky-wash);
  font-size: 10.5px;
  font-weight: 700;
}

.result-status.is-complete { color: var(--jade); background: var(--jade-wash); }
.result-status.is-error { color: var(--danger); background: var(--danger-wash); }

.result-text { color: var(--ink-soft); font: 12.5px / 1.95 var(--serif); overflow-wrap: anywhere; }
.result-text h3 { margin: 1.7em 0 .65em; color: var(--ink); font-size: 17px; line-height: 1.5; }
.result-text h4 { margin: 1.45em 0 .55em; color: var(--ink); font-size: 14px; line-height: 1.5; }
.result-text p { margin: 0 0 1em; }
.result-text ul,
.result-text ol { margin: 0 0 1em; padding-left: 1.6em; }
.result-text li + li { margin-top: .35em; }
.result-text blockquote { margin: 1em 0; padding: 9px 12px; border-left: 3px solid var(--gold); color: var(--dim); background: var(--paper-subtle); }
.result-text code { padding: 1px 4px; border-radius: 5px; background: var(--paper-subtle); font-family: ui-monospace, monospace; font-size: .9em; }

.stream-cursor { display: inline-block; width: 7px; height: 1.1em; margin-left: 4px; vertical-align: -.15em; background: var(--gold); animation: cursorBlink 1s steps(1) infinite; }
@keyframes cursorBlink { 50% { opacity: 0; } }

.incomplete-notice { margin: 16px 0 0; padding: 10px 11px; border: 1px solid color-mix(in srgb, var(--gold) 24%, var(--line)); border-radius: 10px; color: var(--gold-deep); background: var(--gold-wash); font-size: 10px; line-height: 1.6; }
.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  border: 0;
  background: rgba(34, 29, 22, .38);
  backdrop-filter: blur(2px);
}

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 61;
  width: min(440px, 100%);
  height: 100vh;
  height: 100dvh;
  height: var(--tianji-visual-viewport-height, 100dvh);
  overflow-y: auto;
  padding: max(22px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  border-left: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: -22px 0 52px rgba(38, 31, 23, .2);
}

.history-drawer > header { display: flex; align-items: center; justify-content: space-between; gap: 13px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.history-drawer > header button,
.consent-panel header > button { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 23px; font-weight: 400; }
.history-privacy { margin: 13px 0; padding: 9px 10px; border-radius: 10px; color: var(--dim); background: var(--paper-subtle); font-size: 11.5px; line-height: 1.65; }
.history-list { display: grid; gap: 8px; }

.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper-subtle); }
.history-open { min-width: 0; display: grid; gap: 4px; padding: 0; border: 0; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.history-open strong { overflow: hidden; font: 600 12px / 1.5 var(--serif); text-overflow: ellipsis; white-space: nowrap; }
.history-open span { overflow: hidden; color: var(--dim); font-size: 11.5px; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.history-open time { color: var(--faint); font-size: 11.5px; }
.history-delete { align-self: center; color: var(--danger) !important; }
.history-empty { margin: 24px 0; color: var(--faint); font-size: 11px; text-align: center; }
.clear-history { width: 100%; margin-top: 13px; color: var(--danger) !important; }
.clear-history:disabled { opacity: .42; cursor: not-allowed; }

.consent-dialog { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; }
.consent-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(30, 26, 20, .56); backdrop-filter: blur(5px); cursor: default; }
.consent-panel { position: relative; width: min(620px, 100%); max-height: min(760px, calc(100vh - 36px)); max-height: min(760px, calc(100dvh - 36px)); max-height: min(760px, calc(var(--tianji-visual-viewport-height, 100dvh) - 36px)); overflow-y: auto; padding: 21px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--paper-strong); box-shadow: 0 28px 75px rgba(25, 21, 16, .3); }
.consent-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; margin-bottom: 13px; }
.consent-panel > p { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.75; }
.consent-panel > ul { display: grid; gap: 8px; margin: 15px 0; padding: 0; list-style: none; }
.consent-panel > ul li { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 10px; padding: 9px 10px; border-radius: 10px; background: var(--paper-subtle); }
.consent-panel > ul b { color: var(--gold-deep); font-size: 11.5px; }
.consent-panel > ul span { color: var(--dim); font-size: 11.5px; line-height: 1.65; }
.consent-checks { display: grid; gap: 8px; }
.consent-checks label { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.consent-checks input { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--jade); }
.consent-checks span { color: var(--ink-soft); font-size: 11.5px; line-height: 1.6; }
.consent-actions { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 8px; margin-top: 14px; }
.consent-actions button { min-height: 44px; }
.consent-actions #consentConfirmButton { border-color: var(--gold-fill); color: var(--paper-strong); background: var(--gold-fill); }
.consent-actions #consentConfirmButton:disabled { opacity: .45; cursor: not-allowed; }

.toast { position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 100; max-width: min(360px, calc(100% - 36px)); padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink); background: var(--paper-strong); box-shadow: 0 15px 36px rgba(32, 27, 20, .2); font-size: 10.5px; line-height: 1.6; }

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
.history-open:focus-visible { outline: 3px solid color-mix(in srgb, var(--gold) 44%, transparent); outline-offset: 2px; }

@media (max-width: 1080px) {
  .site-nav-link { padding-inline: 8px; font-size: 12px; }
  .site-nav-glyph { display: none; }
}

@media (max-width: 900px) {
  .page-shell { width: min(760px, calc(100% - 28px)); padding-top: 30px; }
  .xiangshu-workspace { grid-template-columns: 1fr; }
  .result-card { position: static; min-height: 0; }
  .result-empty { min-height: 330px; }
}

@media (max-width: 980px) {
  .xiangshu-mobile-history {
    min-width: 76px;
    min-height: 44px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding-inline: 13px;
    white-space: nowrap;
  }
}

@media (max-width: 620px) {
  .page-shell { padding-top: 24px; padding-bottom: 45px; }
  .hero h1 { font-size: 29px; }
  .hero > p:last-of-type { font-size: 12px; }
  .paper-card { padding: 16px 14px; border-radius: 18px; }
  .card-heading { gap: 9px; }
  .card-heading h2 { font-size: 18px; }
  .kind-options { grid-template-columns: 1fr; }
  .kind-options label > span { min-height: 64px; }
  .capture-guide { grid-template-columns: 34px minmax(0, 1fr); padding: 11px; }
  .guide-mark { width: 32px; height: 32px; border-radius: 10px; }
  .field-title-row { align-items: flex-start; flex-direction: column; gap: 0; }
  .image-dropzone { min-height: 190px; padding: 14px; }
  .upload-preview { grid-template-columns: 84px minmax(0, 1fr); }
  .upload-preview img { width: 84px; height: 104px; }
  .hand-field-grid { grid-template-columns: 1fr; }
  .focus-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-notice { grid-template-columns: 36px minmax(0, 1fr); }
  .account-notice > span { width: 34px; height: 34px; }
  .account-notice a { grid-column: 2; justify-self: start; }
  .result-heading { align-items: flex-start; flex-direction: column; }
  .result-tools { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-tools button { min-height: 44px; }
  .result-empty { min-height: 285px; padding-inline: 8px; }
  .consent-dialog { padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
  .consent-panel { padding: 17px 14px; border-radius: 18px; }
  .consent-panel > ul li { grid-template-columns: 1fr; gap: 3px; }
  .consent-actions { grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); }
  .history-drawer { padding-inline: 14px; }
  .toast { right: 14px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 370px) {
  .seg-options label > span { font-size: 9px; }
  .preview-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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