/* Contract: warm paper / ink / teal; system type; 4px rhythm; 12px controls, 20px panels.
   State-only motion, visible focus, no decorative codes or external assets. */
:root {
  --paper: #f6f5f0;
  --surface: #fffefa;
  --ink: #243831;
  --muted: #65746c;
  --line: #e0e5dc;
  --teal: #19715e;
  --teal-hover: #125b4b;
  --teal-tint: #eaf3ed;
  --error: #a23d32;
  --error-tint: #fff0eb;
  --focus: #248b77;
  --radius-control: 12px;
  --radius-panel: 20px;
  --ease-spring: cubic-bezier(.2, .85, .25, 1.12);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
p, h1, h2, h3 { margin: 0; }
svg { display: block; flex-shrink: 0; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button:disabled { cursor: not-allowed; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; clip-path: inset(50%); white-space: nowrap; overflow: hidden; }
.skip-link { position: fixed; z-index: 5; top: 12px; left: 16px; padding: 12px 20px; border-radius: 8px; background: var(--ink); color: white; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.app-shell { max-width: 1168px; margin: 0 auto; padding: 0 40px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 96px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-size: 19px; font-weight: 650; letter-spacing: .5px; flex-shrink: 0; }
.brand-light { font-weight: 400; margin-left: 3px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fffefa; background: var(--teal); }
.brand-mark svg { width: 32px; height: 32px; }
.health-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.service-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #8c9991; }
.service-status[data-state="ready"] .status-dot { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-tint); }
.service-status[data-state="unavailable"] .status-dot { background: #b47739; }
.intro { padding: 44px 0 32px; }
.eyebrow { font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 2px; color: var(--teal); margin-bottom: 12px; }
h1 { font-size: clamp(25px, 3vw, 34px); line-height: 1.4; letter-spacing: -.5px; font-weight: 600; }
.intro-copy { color: var(--muted); margin-top: 12px; line-height: 1.8; }
.intro-copy span { display: inline-block; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-panel); padding: 28px; box-shadow: 0 4px 24px #24383103; }
.panel-heading, .heading-group { display: flex; align-items: center; }
.panel-heading { gap: 12px; justify-content: space-between; margin-bottom: 28px; }
.heading-group { gap: 12px; min-width: 0; }
.step { font: 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--teal); border: 1px solid #d6e3d9; background: #f3f7f1; padding: 7px 6px; border-radius: 6px; }
h2 { font-size: 17px; font-weight: 600; }
.panel-caption { font-size: 11px; color: var(--muted); white-space: nowrap; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.field-group { margin-bottom: 28px; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.required-label { font-size: 10px; font-weight: 400; color: var(--muted); }
.url-control { position: relative; }
.url-control svg { position: absolute; top: 17px; left: 16px; width: 18px; height: 18px; color: #7f9084; pointer-events: none; }
input[type="url"] { width: 100%; min-width: 0; border: 1px solid #d6ddd3; background: #fffefa; color: var(--ink); border-radius: var(--radius-control); padding: 14px 14px 14px 44px; height: 52px; font-size: 14px; transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out); }
input::placeholder { color: #8b968f; }
input[type="url"]:hover { border-color: #9aac9e; }
input[type="url"]:focus-visible { outline-offset: 2px; border-color: var(--teal); }
input[aria-invalid="true"] { border-color: var(--error); }
input:disabled { color: var(--muted); background: #f5f5ef; cursor: not-allowed; }
.field-hint { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.field-error { margin-top: 8px; font-size: 12px; color: var(--error); overflow-wrap: anywhere; }
.upload-zone { border: 1px dashed #c9d5c8; border-radius: var(--radius-control); background: #f8faf5; padding: 24px 16px; min-height: 208px; display: grid; align-content: center; transition: border-color 120ms var(--ease-out), background-color 120ms var(--ease-out); }
.upload-zone.is-dragging { border-color: var(--teal); border-style: solid; background: var(--teal-tint); box-shadow: 0 0 0 3px #19715e14; }
.upload-zone.has-error { border-color: var(--error); }
.upload-zone.is-disabled { opacity: .65; }
.upload-empty { text-align: center; }
.upload-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #eaf0e6; color: #5c7864; margin: 0 auto 12px; }
.upload-icon svg { width: 24px; height: 24px; }
.upload-title { font-size: 13px; font-weight: 500; }
.upload-subtitle { margin-top: 4px; font-size: 11px; color: var(--muted); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 12px; min-height: 44px; border: 1px solid transparent; border-radius: var(--radius-control); font-size: 13px; font-weight: 500; line-height: 1.4; text-decoration: none; transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out), transform 100ms var(--ease-out); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button-secondary { padding: 8px 16px; background: var(--surface); border-color: #d9e1d5; }
.button-secondary:hover { background: #edf3e9; border-color: #b3c7b5; }
.choose-button { min-height: 36px; margin-top: 16px; font-size: 12px; border-radius: 8px; gap: 20px; }
.button-primary { width: 100%; min-height: 52px; padding: 12px 20px; color: #fff; background: var(--teal); justify-content: space-between; font-size: 14px; }
.button-primary:hover:not(:disabled) { background: var(--teal-hover); }
.button-primary > :last-child { font-size: 20px; line-height: 1; }
.button-primary:disabled { background: #a4b6a9; color: #fff; }
.text-button { padding: 6px 2px; border: 0; background: transparent; color: var(--teal); font-size: 12px; border-radius: 4px; text-underline-offset: 4px; }
.text-button:hover:not(:disabled) { text-decoration: underline; }
.text-button:disabled { color: var(--muted); }
.health-retry { font-size: 11px; }
.logo-preview { display: grid; grid-template-columns: 80px minmax(0, 1fr) 20px; gap: 16px; align-items: center; }
.logo-thumbnail { width: 80px; height: 80px; display: grid; place-items: center; background: white; border: 1px solid var(--line); border-radius: 12px; }
.logo-thumbnail img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.logo-details { min-width: 0; }
.file-name { font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.logo-details .field-hint { margin-top: 4px; }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.file-actions > span { color: #b9c3b9; }
.remove-button { color: var(--muted); }
.file-check { display: grid; place-items: center; font-size: 12px; width: 20px; height: 20px; border-radius: 50%; background: #dfecde; color: var(--teal); }
.capacity-note { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 24px; font-size: 11px; line-height: 1.9; color: #526957; }
.capacity-note svg { width: 16px; height: 16px; margin-top: 2px; }
.capacity-note p span { color: var(--muted); }
.submit-note { text-align: center; font-size: 10px; color: var(--muted); margin-top: 12px; }
.form-feedback { background: var(--error-tint); border: 1px solid #f0d4ca; border-radius: 12px; padding: 12px 16px; color: var(--error); font-size: 12px; margin-top: 16px; overflow-wrap: anywhere; }
.form-feedback strong { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.output-panel { background: #fcfdf8; }
.result-tag { font-size: 10px; color: #778379; padding: 4px 8px; background: #f0f2eb; border-radius: 6px; flex-shrink: 0; }
.result-tag[data-state="success"] { color: var(--teal); background: var(--teal-tint); }
.result-tag[data-state="error"] { color: var(--error); background: var(--error-tint); }
.preview-stage { display: grid; place-items: center; min-width: 0; aspect-ratio: 1; width: 100%; border: 1px solid #e5eadf; border-radius: 12px; background: #fff; }
.empty-state, .loading-state { min-width: 0; width: 100%; padding: 28px 12px; text-align: center; }
.empty-art { position: relative; width: 100px; height: 88px; margin: 0 auto 24px; }
.art-sheet { display: grid; place-items: center; position: absolute; width: 68px; height: 76px; border-radius: 12px; border: 1px solid #d7e4d3; }
.art-sheet-back { background: #edf3e7; left: 8px; top: 0; transform: rotate(-12deg); }
.art-sheet-front { background: #f8fbf3; right: 8px; top: 8px; transform: rotate(8deg); }
.art-sheet-front svg { width: 40px; height: 40px; color: #7a947c; }
.empty-state h3, .loading-state h3 { font-size: 14px; font-weight: 500; }
.empty-state p, .loading-state p { font-size: 12px; line-height: 1.9; margin-top: 12px; color: var(--muted); }
.empty-spec { display: inline-flex; gap: 12px; align-items: center; margin-top: 24px; font: 10px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; color: #899388; letter-spacing: .5px; }
.empty-spec > span { color: #bdc7b7; }
.result-image { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; border-radius: 12px; }
.result-details { margin-top: 16px; }
.verification-row { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; justify-content: space-between; font-size: 10px; }
.verified-label { color: var(--teal); }
.verified-label > span { display: inline-grid; place-items: center; width: 16px; height: 16px; background: var(--teal-tint); border-radius: 50%; margin-right: 4px; }
.result-dimensions { color: var(--muted); }
.payload-block { background: #f0f4ec; border-radius: 8px; padding: 12px; margin-top: 16px; }
.payload-block h3 { font-size: 10px; font-weight: 400; color: var(--muted); margin-bottom: 4px; }
.payload-block p { font: 12px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }
.button-download { width: 100%; margin-top: 16px; border-color: #c6d8c7; color: var(--teal); background: #f2f7ed; }
.button-download svg { width: 18px; height: 18px; }
.button-download:hover { border-color: #8eaf93; background: #e4efde; }
.scan-note { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.scan-note-label { display: inline-block; font-size: 10px; font-weight: 500; color: #8a6d38; padding: 2px 6px; background: #f4f0df; border-radius: 4px; margin-bottom: 8px; }
.scan-note p { font-size: 11px; line-height: 1.9; color: var(--muted); }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin: 32px 0 24px; color: #6d7b70; font-size: 10px; }
.footer-tech { letter-spacing: .5px; }
.footer-tech > span { margin: 0 8px; color: #b5beb1; }
.loading-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.loading-dots i { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: working 1.2s cubic-bezier(.45, 0, .55, 1) infinite alternate; }
.loading-dots i:nth-child(2) { animation-delay: 120ms; }
.loading-dots i:nth-child(3) { animation-delay: 240ms; }
.result-details:not([hidden]), .result-image:not([hidden]) { animation: reveal 320ms var(--ease-spring) both; }
.result-details:not([hidden]) { animation-delay: 40ms; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes working { from { opacity: .3; transform: translateY(2px); } to { opacity: 1; transform: translateY(-2px); } }
.noscript-note { position: fixed; bottom: 16px; left: 16px; right: 16px; padding: 16px; color: var(--error); background: var(--error-tint); border: 1px solid var(--error); border-radius: 12px; }
@media (max-width: 800px) {
  .app-shell { padding: 0 24px; }
  .panel { padding: 24px; }
  .workspace { gap: 20px; }
  .logo-preview { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
  .logo-thumbnail { width: 64px; height: 64px; }
  .file-check { display: none; }
}
@media (max-width: 680px) {
  .app-shell { max-width: 560px; padding: 0 20px; }
  .site-header { min-height: 80px; }
  .brand { font-size: 17px; gap: 8px; }
  .brand-mark { width: 36px; height: 36px; }
  .health-wrap { gap: 0 8px; max-width: 140px; }
  .service-status { font-size: 10px; gap: 6px; }
  .health-retry { padding: 2px; font-size: 10px; }
  .intro { padding: 32px 0 24px; }
  .intro-copy { font-size: 12px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .panel { padding: 24px; border-radius: 16px; }
  .panel-heading { margin-bottom: 24px; }
  .field-group { margin-bottom: 24px; }
  .field-hint { font-size: 10px; }
  .site-footer { margin-top: 24px; font-size: 9px; }
}
@media (max-width: 360px) {
  .app-shell { padding: 0 16px; }
  .panel { padding: 20px; }
  .panel-caption { display: none; }
  .empty-state { padding: 24px 8px; }
  .empty-art { margin-bottom: 16px; }
  .empty-state h3 { font-size: 12px; }
  .empty-state p { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
