:root {
  color-scheme: only light;
  --paper: #fffdf8;
  --ground: #f6f2e9;
  --ground-deep: #e9e5da;
  --ink: #302d27;
  --ink-soft: #686358;
  --fountain: #59694b;
  --fountain-dark: #4c5c3f;
  --rule: #d8d2c6;
  --rule-soft: #e5dfd4;
  --stamp: #9b353d;
  --success: #2f6b58;
  --warning: #8a5c19;
  --shadow: 0 2px 12px rgba(0, 0, 0, .035);
  --body-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --display-font: var(--body-font);
  --utility-font: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  min-width: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body-font);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--ground);
  line-height: 1.55;
}

button,
input,
textarea { font: inherit; }

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

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: 12px;
  padding: 10px 14px;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid rgba(0, 113, 227, .5);
  outline-offset: 3px;
}

::selection { background: #d6e8ff; color: var(--ink); }
input, textarea { caret-color: var(--fountain); }
input[type="range"] { accent-color: var(--fountain); }

.site-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1168px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display-font);
  font-size: 23px;
  font-weight: 700;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-family: var(--display-font); font-size: 19px; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: var(--ink-soft); font-size: 12px; }

.header-path {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6a7f99;
  font-family: var(--utility-font);
  font-size: 11px;
  letter-spacing: .08em;
}

.header-path i { width: 24px; height: 1px; background: #a9b9ca; }

main { padding: 0 16px calc(72px + env(safe-area-inset-bottom)); }

.center-stage,
.login-stage {
  display: grid;
  min-height: calc(100vh - 138px);
  min-height: calc(100svh - 138px);
  place-items: center;
  padding: 20px 0 48px;
}

.boot-card {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-soft);
}

.spinner,
.button-loader {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(27, 90, 160, .20);
  border-top-color: var(--fountain);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-paper {
  position: relative;
  display: grid;
  width: min(100%, 900px);
  overflow: hidden;
  border: 1px solid var(--rule-soft);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.paper-index {
  padding: 18px 24px;
  border-bottom: 1px solid var(--rule);
  color: #71839a;
  font-family: var(--utility-font);
  font-size: 11px;
  letter-spacing: .14em;
}

.login-copy { padding: 38px 26px 22px; }

.kicker {
  margin: 0 0 12px;
  color: var(--fountain);
  font-family: var(--utility-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.login-copy h1,
.workspace-head h1,
.list-head h1 {
  margin: 0;
  font-family: var(--display-font);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: .02em;
}

.login-copy h1 { max-width: 12em; font-size: clamp(30px, 6vw, 44px); }

.login-copy > p:last-child,
.workspace-head > div > p:last-child,
.list-head > div > p:last-child {
  max-width: 40em;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.code-form {
  align-self: center;
  margin: 8px 26px 30px;
  padding: 24px;
  border: 1px solid #cbd7e4;
  border-radius: 12px;
  background: rgba(246, 249, 252, .88);
}

.code-form label {
  display: block;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.code-control { display: grid; gap: 12px; }
.password-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.code-control input {
  width: 100%;
  min-height: 54px;
  padding: 8px 16px;
  border: 1px solid #9cafc3;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-family: var(--utility-font);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: .35em;
  text-align: center;
}

.code-control input::placeholder { color: #a8b5c4; }
.code-control input[aria-invalid="true"] { border-color: var(--stamp); box-shadow: 0 0 0 3px rgba(155, 53, 61, .10); }
.code-control label { margin: 0; }
.code-control select,
.code-control input:not(#access-code) { min-width: 0; min-height: 48px; padding: 10px 12px; border: 1px solid #9cafc3; border-radius: 8px; background: white; color: var(--ink); font: inherit; letter-spacing: normal; text-align: left; }
#activation-fields label { margin-bottom: 9px; }

.field-help,
.form-error { margin: 12px 0 0; font-size: 12px; }
.field-help { color: var(--ink-soft); }
.form-error { color: var(--stamp); font-weight: 650; }

.login-retention {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  border-top: 1px solid var(--rule);
  background: rgba(236, 243, 249, .76);
}

.login-retention > span {
  flex: none;
  color: var(--stamp);
  font-family: var(--display-font);
  font-size: 28px;
  font-weight: 700;
}

.login-retention p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.login-retention strong { color: var(--ink); }

.button,
.text-button,
.inline-button,
.back-button,
.dialog-close {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 18px;
  font-weight: 650;
  text-decoration: none;
}

.button:not(:disabled):active { transform: translateY(1px); }
.button.primary { background: var(--fountain-dark); color: white; }
.button.primary:hover:not(:disabled), .generate-button:hover:not(:disabled) { background: #0077ed; }
.button.secondary { border: 1px solid var(--rule); background: white; color: var(--ink); }
.button.secondary:hover:not(:disabled), .button.quiet:hover:not(:disabled) { border-color: #b8b8be; background: #f5f5f7; }
.button.quiet { border: 1px solid var(--rule-soft); background: #f5f5f7; color: var(--ink); }
.button.danger { border: 1px solid #d8b4b8; background: #fff9f9; color: var(--stamp); }
.button.small { min-height: 44px; padding: 7px 12px; font-size: 13px; }

.app-shell { width: min(100%, 1120px); margin: 8px auto 0; }

.session-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px 10px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--paper);
}

.session-bar > div { min-width: 0; }
.session-label { margin-right: 8px; color: var(--ink-soft); font-size: 12px; }
.masked-code { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.session-quota { display: flex; align-items: baseline; gap: 4px; color: var(--ink-soft); font-size: 12px; }
.session-quota strong { color: var(--ink); font-family: var(--display-font); font-size: 18px; }
.text-button { padding: 8px 10px; background: transparent; color: var(--ink-soft); font-weight: 550; }
.text-button:hover:not(:disabled) { background: var(--ground); }

.payment-panel { margin-top: 24px; padding: 8px 20px; box-shadow: none; }
.account-help { margin-top: 8px; padding: 0 20px; color: var(--ink-soft); }
.account-help > summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-size: 13px; }
.generation-workspace { min-width: 0; }
.generation-workspace > .step-heading { margin: 8px 4px 24px; }
.generation-columns { display: grid; align-items: start; gap: 24px; min-width: 0; }
.image-workspace, .font-picker { min-width: 0; border-radius: 16px; background: var(--paper); }
.image-workspace { padding: 20px; }
.group-title { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.image-workspace .image-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.image-list:empty { display: none; }
.font-picker { margin: 0; border: 0; }
.font-browser { padding: 0 20px 20px; }
.font-browser > .font-search-label:first-child { margin-top: 0; }
.font-settings { margin: 0; border-top: 1px solid var(--rule-soft); }
.font-settings > .font-download-actions,
.font-settings > .glyph-setting,
.font-settings > .heart-table-width-control { margin: 0; padding: 16px 20px; }
.font-settings > * + * { border-top: 1px solid var(--rule-soft); }
.font-settings .button { justify-content: flex-start; width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--fountain); text-align: left; overflow-wrap: anywhere; }
.font-settings .field-help { margin: 4px 0 0; }
.font-picker > .glyph-sample { margin: 0; padding: 16px 20px; border-top: 1px solid var(--rule-soft); }
.font-picker > .glyph-sample > summary { padding: 0; }
.generation-toolbar { margin-top: 24px; padding: 20px 20px calc(16px + env(safe-area-inset-bottom)); border-radius: 16px; background: var(--paper); }
.generation-actions { display: grid; align-items: center; gap: 16px; min-width: 0; }
.generation-prompt strong { display: block; font-size: 17px; font-weight: 600; }
.generation-prompt p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.generation-toolbar .generate-button { margin: 0; }
.generation-toolbar > .billing-help { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--rule-soft); }
.generation-toolbar .field-help { max-width: 75ch; }
.summary-hint { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.ui-demo-notice { max-width: 1120px; margin: 0 auto; padding: 8px 16px; color: var(--ink-soft); font-size: 12px; }
.upload-checks {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}
.upload-checks span,
.image-quality {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #bfd0df;
  border-radius: 999px;
  background: #f5f9fc;
  color: #34577e;
  font-size: 12px;
  font-weight: 650;
}
.image-quality { margin-top: 8px; }
.image-quality::before { content: "✓"; margin-right: 5px; color: #2d7458; }
.image-quality.is-warning { border-color: #dfc58c; background: #fffaf0; color: #795b18; }
.image-quality.is-warning::before { content: "!"; color: #a36c00; }
.image-item.has-warning { border-color: #dfc58c; box-shadow: 0 0 0 2px rgba(187, 130, 10, .08); }
.payment-panel > summary, .payment-example > summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: var(--ink-soft); font-weight: 550; }
.payment-notice { color: var(--stamp); }
.payment-plans { width: 100%; border-collapse: collapse; font-size: 14px; }
.payment-plans caption { padding: 8px 0; text-align: left; font-weight: 700; }
.payment-plans th, .payment-plans td { padding: 10px 6px; border-bottom: 1px solid var(--rule); text-align: left; }
.payment-plans td:nth-child(2) { white-space: nowrap; }
.payment-label { display: block; margin: 14px 0 6px; font-weight: 650; font-size: 14px; }
.payment-input { min-width: 0; width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #9cafc3; border-radius: 8px; background: white; color: var(--ink); font: inherit; }
.payment-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.payment-actions > .payment-input { flex: 1 1 220px; }
.payment-codes { display: grid; gap: 20px; margin: 22px 0; }
.payment-codes a { min-width: 0; display: grid; align-content: start; gap: 10px; color: var(--fountain-dark); text-align: center; text-underline-offset: 3px; }
.payment-codes img { display: block; width: 100%; max-width: 350px; height: auto; margin: 0 auto; }
.payment-codes span { font-size: 13px; }

.view-tabs,
.font-filter,
.detail-font-filter {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  padding: 3px;
  border-radius: 10px;
  background: var(--ground-deep);
}

.view-tabs { width: min(100%, 400px); margin: 20px 0 28px; }
.font-filter, .detail-font-filter { margin-top: 14px; }

.view-tab,
.font-filter > .button,
.detail-font-filter > .button {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4a4a4e;
  font-size: 14px;
  font-weight: 550;
}

.view-tab.is-active,
.font-filter .button.is-active,
.detail-font-filter .button.is-active { border: 0; background: white; color: var(--ink); box-shadow: 0 2px 5px rgba(0, 0, 0, .12); }
.view-tab span:not(:empty) { margin-left: 5px; padding: 2px 6px; border-radius: 8px; background: var(--ground-deep); font-size: 11px; font-variant-numeric: tabular-nums; }

.workspace { display: grid; gap: 16px; }
.admin-view { overflow-wrap: anywhere; }
.admin-view h1, .admin-view h2, .admin-view h3 { margin: 0 0 10px; }
.admin-view h2 { font-size: 20px; }
.admin-view h3 { font-size: 16px; }
.admin-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.admin-metrics dt { color: var(--ink-soft); font-size: 12px; }
.admin-metrics dd { margin: 4px 0 0; font-size: 18px; font-weight: 650; }
.admin-entry { padding: 18px 0; border-top: 1px solid var(--rule); }
.admin-feedback-message { white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-view .pagination { gap: 8px; }

.workspace-head,
.list-head,
.workflow-card,
.result-panel,
.state-card,
.record-card,
.record-detail {
  border: 0;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: none;
}

.workspace-head {
  position: relative;
  min-height: 215px;
  overflow: hidden;
  padding: 30px 25px 110px;
}

.ruled-paper {
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 43px, rgba(57, 98, 145, .08) 44px, transparent 45px),
    var(--paper);
}

.workspace-head h1 { max-width: 13em; font-size: clamp(28px, 7vw, 45px); }
.ink-signature {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(390px, 82%);
  gap: 1px;
  color: rgba(20, 63, 118, .42);
  font-family: "Kaiti SC", "STKaiti", var(--display-font);
  font-size: 15px;
  line-height: 1.55;
  transform: rotate(-1.2deg);
}

.ink-signature span:nth-child(2) { padding-left: 28px; }
.ink-signature span:nth-child(3) { padding-left: 8px; }

.workflow-card { padding: 24px 20px; }
.payment-panel.workflow-card { padding: 8px 20px; }
.workflow-card.compact { padding-bottom: 22px; }
.step-heading { display: flex; align-items: flex-start; gap: 16px; }
.step-heading h2 { margin: 0; font-size: 2rem; line-height: 1.3; letter-spacing: -.025em; }
.step-heading p { margin: 5px 0 0; color: var(--ink-soft); font-size: 13px; }
.font-summary { min-height: 44px; padding: 20px; cursor: pointer; }
.font-summary h2 { display: inline; margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.font-summary .selection-note { margin: 4px 0 0; padding: 0; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 400; }
.font-summary .selection-note.is-selected { background: transparent; }

.inline-state,
.selection-note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f3f7fb;
  color: #647990;
  font-size: 13px;
}

.inline-state.is-error { border: 1px solid var(--stamp); color: var(--stamp); }
.selection-note.is-selected { background: #eef6fd; color: var(--fountain-dark); font-weight: 650; }
#font-selection-note {
  overflow-wrap: anywhere;
}

.font-favorite-toggle { position: absolute; top: 8px; right: 8px; display: grid; width: 44px; height: 44px; place-items: center; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 22px; cursor: pointer; line-height: 1; }
.font-favorites-empty { color: var(--ink-soft); margin: 16px 0 4px; }
.font-grid,
.detail-font-grid {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 12px;
}
.font-grid { margin-top: 16px; scrollbar-width: thin; scrollbar-color: #c5c5cb transparent; }
.workflow-card,
.record-detail { min-width: 0; }
.font-grid[hidden] { display: none; }
.font-grid:focus-visible,
.detail-font-grid:focus-visible { outline: 2px solid var(--fountain); outline-offset: 2px; }

.font-option {
  position: relative;
  display: grid;
  flex: 0 0 min(280px, calc(100% - 24px));
  scroll-snap-align: start;
  grid-template-columns: 22px 1fr;
  gap: 11px;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: white;
  cursor: pointer;
}

.font-option:hover { border-color: #aaaab0; }
.font-option.is-selected { border-color: var(--fountain); background: white; box-shadow: inset 0 0 0 1px var(--fountain); }
.font-option.is-unavailable { cursor: not-allowed; opacity: .52; }
.font-option input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--fountain); }
.font-option-copy { min-width: 0; padding-right: 42px; }
.font-sample { margin: 20px 0 0; }
.font-sample a { display: block; min-height: 80px; overflow: hidden; border-radius: 8px; background: #f8f8fa; }
.font-sample img { display: block; width: 100%; height: auto; }
.font-sample figcaption { margin-top: 8px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.font-sample .field-help:empty { display: none; }
.font-option-title { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.font-option-title strong { color: #5b6470; font-size: 14px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.font-option-title span { color: var(--ink-soft); font-family: var(--utility-font); font-size: 12px; text-transform: uppercase; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-top: 16px; }
.pagination span { color: var(--ink-soft); font-family: var(--utility-font); font-size: 12px; text-align: center; }

.upload-zone {
  display: grid;
  place-items: center;
  margin-top: 16px;
  padding: 28px 16px;
  border: 1px solid var(--rule-soft);
  border-radius: 14px;
  background: #fafafa;
  text-align: center;
  transition: border-color .18s ease, background-color .18s ease;
}

.upload-zone.is-dragging { border-color: var(--fountain); background: #edf5fc; }
.upload-icon { margin-bottom: 14px; color: #8e8e93; }
.upload-zone strong { font-size: 16px; }
.upload-zone > p { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; }
.upload-zone #privacy-state:not(.is-error) { display: none; }
#image-state:not(.is-error) { margin-top: 12px; padding: 0; background: transparent; }
.upload-symbol { display: flex; align-items: flex-end; gap: 4px; height: 28px; margin-bottom: 12px; }
.upload-symbol span { width: 5px; border-radius: 2px; background: var(--fountain); transform: rotate(-5deg); }
.upload-symbol span:nth-child(1) { height: 17px; }
.upload-symbol span:nth-child(2) { height: 27px; }
.upload-symbol span:nth-child(3) { height: 21px; }
.upload-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 18px; }

.image-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.image-item {
  position: relative;
  overflow: hidden;
  border: 1px solid #cdd8e4;
  border-radius: 10px;
  background: white;
}

.image-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e8eef4; }
.image-page {
  position: absolute;
  top: 8px;
  left: 8px;
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  padding: 0 7px;
  border-radius: 15px;
  background: rgba(13, 39, 75, .86);
  color: white;
  font-family: var(--utility-font);
  font-size: 11px;
}

.image-meta { padding: 9px 10px 5px; color: var(--ink-soft); font-size: 11px; }
.image-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3px; padding: 5px; }
.image-actions button { min-height: 44px; border: 0; border-radius: 6px; background: #f1f5f9; color: #416184; font-size: 12px; }
.image-actions button:last-child { color: var(--stamp); }

.consent-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 10px;
  margin-top: 20px;
  color: #3e5877;
  font-size: 13px;
}

.consent-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--fountain); }
.consent-row label { cursor: pointer; }
.inline-button { min-height: 44px; margin-top: 4px; padding: 5px 0; background: transparent; color: var(--fountain); text-decoration: underline; text-underline-offset: 3px; }

.review-warning {
  margin: 12px 0 18px;
  padding: 11px 13px;
  border: 1px solid #c59851;
  background: #fffaf1;
  color: #6c552d;
  font-size: 12px;
}

.generate-button {
  width: 100%;
  min-height: 54px;
  background: var(--fountain-dark);
  color: white;
  font-size: 16px;
  margin-top: 12px;
}

.generate-button .button-loader { display: none; width: 18px; height: 18px; border-color: rgba(255,255,255,.28); border-top-color: white; }
.generate-button.is-working .button-loader { display: inline-block; }

.job-progress { margin-top: 18px; padding: 15px; border-radius: 9px; background: #f2f7fb; }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.progress-copy span { font-family: var(--utility-font); color: var(--fountain); }
.job-progress progress {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  margin-top: 10px;
  border: 0;
  border-radius: 5px;
  appearance: none;
  background: #d8e4ef;
}
.job-progress progress::-webkit-progress-bar { border-radius: 5px; background: #d8e4ef; }
.job-progress progress::-webkit-progress-value { border-radius: 5px; background: var(--fountain); }
.job-progress progress::-moz-progress-bar { border-radius: 5px; background: var(--fountain); }
.job-progress p { margin: 9px 0 0; color: var(--ink-soft); font-size: 12px; }

.result-panel {
  display: grid;
  gap: 16px;
  padding: 24px 20px;
  border-color: var(--rule);
  background: var(--paper);
  box-shadow: none;
}

.result-copy h2 { margin: 0; font-size: 23px; }
.result-copy > p:last-child { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; }
.result-actions { display: grid; gap: 8px; }
.result-actions > .button, .pdf-actions > .button { min-height: 52px; }
.more-actions > summary,
.glyph-sample > summary,
.versions > summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: var(--ink); font-size: 14px; font-weight: 550; }
.billing-help > summary { color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.secondary-actions { display: grid; gap: 8px; margin-top: 8px; }
.secondary-actions .pdf-share-status,
.pdf-actions > .pdf-share-status { grid-column: 1 / -1; }
.record-options { grid-column: 1 / -1; }
.pdf-share-status { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }

.list-head { display: grid; gap: 18px; align-items: end; padding: 25px 22px; }
.list-head h1 { font-size: 32px; }
.state-card { padding: 28px 20px; color: var(--ink-soft); text-align: center; }
.state-card.is-error { color: var(--stamp); }
.records-list { display: grid; gap: 12px; }

.record-card { padding: 18px; }
.record-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.record-card h2 { margin: 0; font-size: 17px; }
.record-card-time { margin: 4px 0 0; color: #77899d; font-family: var(--utility-font); font-size: 10px; }
.record-font-name { color: var(--ink); font-weight: 700; }
.status-chip,
.version-chip {
  flex: none;
  padding: 5px 9px;
  border-radius: 14px;
  background: #e8f0f8;
  color: #315a86;
  font-size: 11px;
  font-weight: 650;
}

.status-chip.completed { background: #e5f2ec; color: var(--success); }
.status-chip.failed,
.status-chip.edit_failed { background: #faeaea; color: var(--stamp); }
.record-message { margin: 13px 0 0; color: var(--ink-soft); font-size: 12px; }
.record-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 11px; color: #6f8197; font-size: 11px; }
.record-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }

.record-detail { padding: 20px; }
.back-button { padding: 7px 4px; background: transparent; color: var(--fountain-dark); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 15px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.detail-head h2 { margin: 0; font-size: 26px; }
.detail-head > div > p:last-child { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; }
.detail-notice { margin-top: 15px; padding: 12px 14px; border: 1px solid var(--warning); background: #fff9ef; color: #71582d; font-size: 12px; }
.detail-notice.is-error { border-color: var(--stamp); background: #fff5f5; color: var(--stamp); }

.review-panel,
.source-images-panel { margin-top: 18px; padding: 18px; border: 1px solid #d6e0ea; border-radius: 14px; background: #fff; }
.review-count,
.source-readonly { color: #6f8197; font-size: 11px; }
.review-list { display: grid; gap: 9px; margin: 14px 0 0; padding: 0; list-style: none; }
.review-item { padding: 11px 13px; border: 1px solid #b26a22; background: #fff8eb; }
.review-item strong { display: block; color: #6f4518; font-size: 13px; }
.review-item span { display: block; margin-top: 4px; color: #735f49; font-size: 11px; line-height: 1.55; }
.review-clear { padding: 12px; border: 1px solid #328064; background: #eef8f4; color: #315f50; font-size: 12px; }
.source-image-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.source-image-link { display: block; overflow: hidden; border: 1px solid #ccd8e4; border-radius: 10px; background: #f5f8fb; }
.source-image-link img { display: block; width: 100%; height: auto; }

.editor-paper { margin-top: 18px; }
.patient-head h3 { margin: 0; font-size: 17px; }
.patient-head p { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; }
.patient-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}
.patient-field { display: grid; gap: 5px; min-width: 0; }
.patient-field.wide { grid-column: 1 / -1; }
.patient-field span { color: #5e728a; font-size: 11px; font-weight: 650; }
.patient-field input {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid #c5d2df;
  border-radius: 7px;
  background: #fbfcfd;
  color: var(--ink);
}
.patient-field input:disabled { background: #f1f4f7; color: #5f7185; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.patient-fields + .editor-head { margin-top: 22px; }
.editor-head h3,
.versions h3,
.detail-result h3 { margin: 0; font-size: 17px; }
.editor-guide { margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; }
.glyph-sample { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--rule); }
.glyph-sample h3 { margin: 0; font-size: 17px; }
.glyph-sample > summary h3, .versions > summary h3 { display: inline; }
.glyph-actions, .font-download-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.glyph-file { display: block; width: 100%; min-height: 44px; margin: 8px 0; font: inherit; }
.glyph-upload-progress { display: block; width: 100%; margin-top: 14px; }
.glyph-sample .inline-state { margin-top: 12px; }
.font-search-label { display: block; margin-top: 16px; color: var(--ink-soft); font-size: 13px; }
.font-search { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 7px; background: white; color: var(--ink); font: inherit; }
.font-download-actions [aria-disabled="true"] { opacity: .5; pointer-events: none; }
.font-option-copy strong { display: block; font-size: 14px; font-weight: 600; }
.font-option-copy small { display: block; color: var(--ink-soft); }
.section-list { display: grid; gap: 12px; margin-top: 16px; }
.section-field { overflow: hidden; border: 1px solid #ccd8e4; border-radius: 9px; background: #fbfcfd; }
.section-field input,
.section-field textarea {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.section-field input { min-height: 46px; padding: 10px 13px; border-bottom: 1px solid #dce4ec; font-weight: 700; }
.section-field textarea { min-height: 126px; resize: vertical; padding: 12px 13px; line-height: 1.7; }
.section-field.is-locked { border-color: #9b6b22; box-shadow: 0 0 0 1px rgba(155, 107, 34, .12); }
.section-lock-note { margin: 0; padding: 8px 13px; border-top: 1px solid #e2e8ef; color: #66798d; background: #f8fafc; font-size: 11px; line-height: 1.55; }
.section-field.is-locked .section-lock-note { color: #754c12; background: #fff8e8; }
.section-field input:disabled,
.section-field textarea:disabled { background: #f1f4f7; color: #5f7185; }
.section-controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 5px; border-top: 1px solid #e2e8ef; background: white; }
.section-controls.has-lock { grid-template-columns: repeat(4, 1fr); }
.section-controls button { min-height: 44px; border: 0; border-radius: 5px; background: #f1f5f9; color: #416184; font-size: 12px; }
.section-controls button[data-action="remove"] { color: var(--stamp); }
.section-controls button[data-action="toggle-lock"].is-active { background: #fff0cf; color: #754c12; font-weight: 750; }

.detail-actions,
.detail-result > div { display: grid; gap: 8px; margin-top: 18px; }
.detail-font-choice {
  display: grid;
  grid-column: 1 / -1;
  gap: 5px;
  color: #5e728a;
  font-size: 11px;
  font-weight: 650;
}
.detail-font-choice select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #c5d2df;
  border-radius: 7px;
  background: #fbfcfd;
  color: var(--ink);
}
.heart-table-width-control { display: grid; gap: 8px; width: 100%; margin-top: 12px; }
.heart-table-width-control label { display: flex; justify-content: space-between; gap: 12px; }
.heart-table-width-control input { width: 100%; min-height: 44px; margin: 0; accent-color: var(--fountain); }
.heart-table-width-control p { margin: 0; }
.detail-font-grid {
  margin-top: 8px;
}
.detail-font-card {
  display: grid;
  flex: 0 0 min(280px, calc(100% - 24px));
  scroll-snap-align: start;
  gap: 5px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #c5d2df;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}
.detail-font-card.is-selected {
  border-color: var(--fountain-dark);
  box-shadow: 0 0 0 2px rgba(47,107,88,.18);
}
.detail-font-pagination { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--ink-soft); font-size: 12px; }
.detail-font-choose { width: 100%; min-height: 60px; padding: 8px; border: 0; background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: 14px; }
.detail-result { margin-top: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.versions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--rule); }
.versions-list { display: grid; gap: 8px; margin-top: 12px; }
.version-row { display: grid; gap: 10px; padding: 13px; border: 1px solid #d4dee8; border-radius: 8px; }
.version-row.is-current { border-color: #8fb2a6; background: #f6fbf9; }
.version-name { font-size: 13px; font-weight: 700; }
.version-meta { margin-top: 3px; color: #73859a; font-family: var(--utility-font); font-size: 10px; }
.version-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.version-actions .button { min-height: 44px; padding: 6px 10px; font-size: 11px; }

.privacy-dialog {
  width: min(calc(100% - 28px), 620px);
  max-height: min(84vh, 760px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(10, 29, 55, .28);
}

.privacy-dialog::backdrop { background: rgba(12, 29, 52, .56); backdrop-filter: blur(2px); }
.dialog-sheet { padding: 22px; }
.font-glyph-dialog { width: min(900px, calc(100vw - 24px)); max-width: 900px; max-height: calc(100dvh - 24px); overflow-y: auto; }
.font-glyph-search { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 10px; }
.font-glyph-search input { width: 76px; min-height: 44px; text-align: center; font-size: 22px; }
.font-glyph-shortcuts { display: flex; flex-wrap: wrap; gap: 5px; }
.font-glyph-shortcuts button { min-width: 38px; min-height: 44px; padding: 6px; }
.font-glyph-choices { min-width: 0; margin: 16px 0 10px; padding: 12px; border: 1px solid var(--rule); border-radius: 8px; }
.font-glyph-variants { display: flex; flex-wrap: wrap; gap: 12px; }
.font-glyph-variant { display: grid; justify-items: center; gap: 8px; padding: 10px; border: 1px solid var(--rule); border-radius: 8px; cursor: pointer; }
.font-glyph-variant:has(input:checked) { border-color: var(--fountain); background: #f2f7fb; }
.font-glyph-variant img { display: block; width: 112px; height: 112px; object-fit: contain; background: white; }
.font-glyph-variant input { width: 22px; height: 22px; accent-color: var(--fountain); }
.font-glyph-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.font-glyph-comparison figure { min-width: 0; margin: 0; }
.font-glyph-comparison img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); background: white; }
.font-glyph-comparison figcaption { margin: 8px 0; }
.font-glyph-comparison .button { margin-top: 8px; }
.font-glyph-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
@media (max-width: 560px) {
  .font-glyph-dialog .dialog-sheet { padding: 16px; }
  .font-glyph-comparison { grid-template-columns: minmax(0, 1fr); }
  .font-glyph-variant img { width: 88px; height: 88px; }
}
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.dialog-head h2 { margin: 0; font-size: 24px; }
.dialog-close { width: 44px; padding: 0; background: #edf2f7; color: var(--ink); font-size: 24px; }
.privacy-content { max-height: 52vh; overflow: auto; margin-top: 18px; padding: 16px; border: 1px solid var(--rule-soft); border-radius: 8px; background: #f8fafc; color: #465f7d; font-size: 13px; }
.privacy-content h3 { margin: 18px 0 6px; color: var(--ink); font-size: 15px; }
.privacy-content h3:first-child { margin-top: 0; }
.privacy-content p { margin: 7px 0; }
.dialog-done { width: 100%; margin-top: 16px; }

.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 8px;
  background: rgba(13, 35, 67, .94);
  color: white;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 10px 35px rgba(11, 29, 53, .28);
  transform: translateX(-50%);
}

@media (min-width: 600px) {
  main { padding-right: 24px; padding-left: 24px; }
  .login-paper { grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr); }
  .paper-index { grid-column: 1 / -1; }
  .login-copy { padding: 54px 44px 52px; }
  .code-form { margin: 48px 34px; }
  .login-retention { grid-column: 1 / -1; }
  .workspace-head { padding: 38px 36px; }
  .workspace-head > div:first-child { max-width: 55%; }
  .workflow-card { padding: 28px; }
  .image-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-panel { grid-template-columns: 1fr auto; align-items: center; padding: 28px; }
  .result-actions { min-width: 180px; }
  .list-head { grid-template-columns: 1fr auto; padding: 30px; }
  .record-card { padding: 21px 23px; }
  .record-card-actions { justify-content: flex-end; }
  .detail-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-result > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .version-row { grid-template-columns: 1fr auto; align-items: center; }
}

@media (min-width: 900px) {
  .site-header { padding-right: 24px; padding-left: 24px; }
  .app-shell { margin-top: 18px; }
  .session-bar { padding-right: 20px; padding-left: 22px; }
  .workspace-head { min-height: 245px; }
  .workflow-card,
  .record-detail { padding: 34px 38px; }
  .font-grid { gap: 14px; }
  .image-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
  .generation-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .generation-actions { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); }
  .image-workspace .upload-zone { min-height: 320px; }
}

@media (max-width: 560px) {
  .generation-columns { gap: 16px; }
  .image-workspace, .font-summary { padding: 16px; }
  .font-browser { padding: 0 16px 16px; }
  .font-settings > .font-download-actions,
  .font-settings > .glyph-setting,
  .font-settings > .heart-table-width-control,
  .font-picker > .glyph-sample { padding: 16px; }
  .generation-toolbar { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
}

@media (min-resolution: 2dppx) {
  .font-settings,
  .font-settings > * + *,
  .font-picker > .glyph-sample,
  .generation-toolbar > .billing-help { border-top-width: .5px; }
}

@media (max-width: 420px) {
  .header-path { display: none; }
  .patient-fields { grid-template-columns: 1fr; }
  .patient-field.wide { grid-column: auto; }
  .session-bar { grid-template-columns: 1fr auto; }
  .session-quota { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .session-bar > .text-button { grid-column: 2; grid-row: 1 / span 2; }
  .result-actions { grid-template-columns: 1fr; }
}

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

@media print {
  .site-header,
  .session-bar,
  .view-tabs,
  .button,
  .text-button,
  .inline-button { display: none !important; }
  body { background: white; }
  main { padding: 0; }
  .workflow-card,
  .record-detail { border: 0; box-shadow: none; }
}

/* Keep the file action available while the native PDF pane scrolls. */
.pdf-view { max-width: 1240px; margin: 0 auto; padding: 0 16px 24px; }
.pdf-toolbar { position: sticky; top: 0; z-index: 10; padding: 16px; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px 12px 0 0; }
.pdf-toolbar h1 { margin: 0 0 12px; font-size: 22px; }
.pdf-toolbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pdf-toolbar-actions a { text-decoration: none; }
.pdf-toolbar .field-help { margin: 12px 0 0; }
.pdf-frame { display: block; width: 100%; height: 75vh; height: 75svh; min-height: 400px; border: 1px solid var(--rule); border-top: 0; background: white; }
@media (max-width: 560px) {
  .pdf-view { padding: 0 8px 16px; }
  .pdf-toolbar { padding: 12px; }
  .pdf-toolbar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pdf-toolbar-actions .button, .pdf-toolbar-actions .text-button { width: 100%; min-width: 0; white-space: nowrap; text-align: center; }
}


.glyph-review { margin-top: 18px; padding: 14px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; color: #172b3a; }
.glyph-review h4 { margin: 0; }
.glyph-review-row { margin-top: 14px; border-top: 1px solid #dce4ec; padding-top: 10px; }
.glyph-review-row summary { min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.glyph-review-glyphs { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.glyph-review-glyphs figure { flex: 0 0 64px; margin: 0; text-align: center; }
.glyph-review-glyphs img { display: block; width: 64px; height: 64px; background: #fff; }
.glyph-review-glyphs figcaption { font-size: 14px; line-height: 24px; }
.glyph-review-adjust { margin-top: 8px; }
.glyph-review-scroll { position: sticky; top: max(8px, env(safe-area-inset-top)); z-index: 2; overflow-x: auto; margin-top: 8px; border: 1px solid #dce4ec; border-radius: 4px; background: #fff; }
.glyph-review-picture { position: relative; width: var(--glyph-row-width, 1536px); padding-top: 28px; background: #fff; color-scheme: only light; }
.glyph-review-image { display: block; width: 100%; height: 128px; max-width: none; background: #fff; }
@media (max-height: 480px) {
  .glyph-review-picture { width: calc(var(--glyph-row-width, 1536px) * .625); }
  .glyph-review-image { height: 80px; }
}
.glyph-review-cut { position: absolute; top: 28px; bottom: 0; border-left: 1px dashed #bd5d31; pointer-events: none; }
.glyph-review-char { position: absolute; top: 2px; transform: translateX(-50%); font: 600 16px/24px monospace; color: #15344e; }
.glyph-review-boundaries { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; margin-top: 12px; }
.glyph-review-boundary { display: grid; gap: 3px; min-width: 0; font-size: 13px; }
.glyph-review-boundary input { width: 100%; min-height: 44px; accent-color: #287160; }
.glyph-review-boundary-note { color: #607486; font-size: 12px; }

/* Mobile B: paper specimen, compact source strip, persistent primary action. */
:focus-visible { outline-color: var(--fountain); }
::selection { background: #dce4d2; color: var(--ink); }
html { scroll-padding-bottom: 140px; scrollbar-color: #b3b9a8 var(--ground); }
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: 1; }
.button.primary:hover:not(:disabled), .generate-button:hover:not(:disabled) { background: #3e4e33; }
.button.secondary, .button.quiet { background: transparent; color: var(--fountain-dark); border-color: var(--rule); }
.button.secondary:hover:not(:disabled), .button.quiet:hover:not(:disabled) { background: var(--ground-deep); border-color: var(--fountain); }
.site-header, .app-shell { max-width: 760px; }
.site-header { min-height: 70px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: 14px; }
.brand-mark, .brand small { display: none; }
.brand strong { font-size: 27px; letter-spacing: -.025em; }
.app-shell { margin-top: 0; }
main { padding-bottom: 24px; }
body:has(#generator-view:not([hidden])) { padding-bottom: calc(114px + env(safe-area-inset-bottom)); }
header.site-header { border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.view-tabs { display: none; width: auto; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; gap: 8px; }
body:has(#app-view:not([hidden])) .view-tabs { display: flex; }
.view-tab { flex: 0 1 auto; min-width: 64px; border-radius: 0; color: var(--ink-soft); font-size: 16px; }
.view-tab.is-active { display: none; }
.generation-workspace > .step-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.generation-columns { grid-template-columns: minmax(0, 1fr); gap: 24px; }
.image-workspace, .font-picker { padding: 0; border-radius: 0; background: transparent; }
.image-workspace { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.group-title { font-size: 18px; }
.image-workspace .upload-zone { grid-column: 1 / -1; min-height: 0; margin: 0; padding: 22px 14px; border-color: var(--rule); border-radius: 12px; background: var(--paper); }
.upload-zone .upload-icon { width: 32px; height: 32px; color: var(--fountain); }
.upload-zone p { color: var(--ink-soft); }
.upload-actions { margin-top: 14px; }
.image-workspace:has(.image-item) .upload-zone { grid-column: 2; grid-row: 1; padding: 0; border: 0; background: transparent; }
.image-workspace:has(.image-item) .upload-zone > :not(.upload-actions):not(input) { display: none; }
.image-workspace:has(.image-item) .upload-actions { margin: 0; gap: 6px; }
.image-workspace:has(.image-item) .upload-actions .button { min-height: 44px; padding: 7px 10px; font-size: 14px; background: transparent; border: 1px solid var(--rule); color: var(--fountain-dark); }
.image-workspace .image-list { display: flex; grid-column: 1 / -1; gap: 12px; margin: 0; padding: 0 0 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scroll-snap-type: x proximity; }
.image-workspace .image-list:empty { display: none; }
.image-item { flex: 0 0 144px; min-width: 0; scroll-snap-align: start; border-color: var(--rule); border-radius: 10px; background: var(--paper); }
.image-item img { height: 96px; object-fit: contain; background: #ece8df; }
.image-page { background: var(--fountain-dark); }
.image-meta { padding: 6px; font-size: 11px; color: var(--ink-soft); }
.image-actions { gap: 0; padding: 0; border-color: var(--rule); background: transparent; }
.image-actions button { min-width: 44px; min-height: 44px; padding: 5px 2px; background: transparent; color: var(--fountain-dark); font-size: 12px; }
#image-state { grid-column: 1 / -1; margin: 0; padding: 0; background: transparent; color: var(--ink-soft); font-size: 13px; }
.image-workspace:has(.image-item) .image-list { grid-row: 2; }
.image-workspace:has(.image-item) #image-state { grid-row: 3; }
#image-state.is-error { padding: 10px; color: var(--stamp); }
.paper-font-search { border: 1px solid var(--rule); border-radius: 12px; }
.font-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 60px; padding: 12px 16px; list-style: none; }
.font-summary::-webkit-details-marker { display: none; }
.font-summary svg { flex: 0 0 20px; color: var(--fountain); transition: transform .18s ease; }
.paper-font-search[open] .font-summary svg { transform: rotate(90deg); }
.font-summary .selection-note, .font-summary .selection-note.is-selected { margin: 0; background: transparent; color: var(--ink); font-size: 15px; font-weight: 600; }
.paper-search-body { padding: 0 14px 14px; }
.paper-search-body .font-search-label { margin-top: 0; }
.font-search { background: var(--paper); font-size: 16px; }
.font-filter .button { font-size: 15px; }
.font-filter .button.is-active { color: var(--fountain-dark); background: var(--paper); box-shadow: none; }
#font-state { margin-top: 12px; background: var(--paper); color: var(--ink-soft); }
.font-sample { margin: 18px 0 14px; padding: 16px 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); }
.paper-sample-title { margin: 0 0 14px; font-size: 16px; }
.font-sample a { display: flex; align-items: center; min-height: 112px; border-radius: 0; background: repeating-linear-gradient(transparent 0 37px, #e8e1d4 37px 38px), #faf6ed; }
.font-sample img { display: block; width: 100%; height: auto; object-fit: contain; mix-blend-mode: multiply; }
.paper-sample-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.paper-sample-scroll > a { min-width: 720px; }
.paper-sample-help { margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; }
.font-sample figcaption { margin-top: 10px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.paper-font-strip { min-width: 0; }
.font-grid { gap: 10px; align-items: flex-start; margin-top: 0; padding: 2px 2px 8px; scrollbar-color: #a7b098 transparent; }
.font-option { flex-basis: 124px; min-height: 104px; height: 104px; grid-template-columns: 22px minmax(0, 1fr); align-content: end; gap: 8px; padding: 44px 10px 12px; border-color: var(--rule); background: transparent; }
.font-option.is-selected { border-color: var(--fountain); background: #f1f1e7; box-shadow: inset 0 0 0 1px var(--fountain); }
.font-option-copy { padding-right: 0; align-self: center; overflow-wrap: anywhere; }
.font-option-copy strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 14px; font-weight: 600; }
.font-favorite-toggle { top: 0; right: 0; color: var(--fountain); }
.font-option input { width: 20px; height: 20px; }
.pagination { margin-top: 4px; color: var(--ink-soft); }
.pagination .button { background: transparent; font-size: 13px; }
.font-picker > .glyph-sample { margin: 18px 0 0; padding: 0; border: 1px solid var(--rule); border-radius: 12px; }
.font-picker > .glyph-sample > summary { min-height: 66px; padding: 12px 16px; cursor: pointer; color: var(--ink); }
.font-picker > .glyph-sample > :not(summary) { margin-left: 14px; margin-right: 14px; }
.glyph-sample > :last-child { margin-bottom: 14px; }
.glyph-sample h3 { font-size: 17px; }
.summary-hint { font-size: 12px; }
.paper-more { margin-top: 10px; }
.paper-more > summary, .paper-account > summary { min-height: 48px; padding: 12px 0; color: var(--ink-soft); font-size: 14px; cursor: pointer; }
.font-settings { border-top: 0; }
.font-settings > .font-download-actions, .font-settings > .glyph-setting, .font-settings > .heart-table-width-control { padding: 12px 0; }
.paper-account { margin-top: 20px; border-top: 1px solid var(--rule); }
.session-bar { padding: 12px 0; background: transparent; border-radius: 0; }
.generation-toolbar { margin-top: 16px; padding: 0; background: transparent; border-radius: 0; }
.generation-actions { position: fixed; z-index: 20; bottom: 0; left: 50%; display: block; width: min(100%, 792px); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--ground); transform: translateX(-50%); border-top: 1px solid var(--rule); }
.generation-prompt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.generation-actions .generate-button { width: 100%; min-height: 54px; border-radius: 14px; background: var(--fountain-dark); font-size: 16px; }
.generation-toolbar > .billing-help { margin-top: 0; border: 0; }
.billing-help > summary { min-height: 44px; color: var(--ink-soft); font-size: 12px; }
.payment-panel { margin-top: 8px; border-top: 1px solid var(--rule); border-radius: 0; background: transparent; }
.inline-state { background: #eeeade; color: var(--ink-soft); }
.ui-demo-notice { max-width: 792px; padding: 6px 16px; border-bottom: 1px solid var(--rule); font-size: 11px; background: #ece7da; color: var(--ink-soft); }
.toast { bottom: calc(104px + env(safe-area-inset-bottom)); background: #302d27; }
.job-progress { margin-bottom: 20px; }
@media (min-width: 600px) {
  .site-header { padding-right: 0; padding-left: 0; }
  .image-item { flex-basis: 168px; }
  .image-item img { height: 150px; }
  .font-sample a { min-height: 190px; }
}
