:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--page); color: var(--text); }
body { margin: 0; min-width: 320px; background: var(--page); color: var(--text); transition: background .2s ease, color .2s ease; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, .drop-zone:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 48%, transparent); outline-offset: 2px; }
.app-shell { max-width: 1510px; margin: 0 auto; padding: 0 34px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 12px; }
.brand-mark svg { width: 25px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font: 700 17px/1.1 Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: -.4px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 1.45px; }
.topbar-actions { display: flex; align-items: center; gap: 24px; }
.privacy-note { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.privacy-dot { width: 7px; height: 7px; border-radius: 100%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.theme-toggle { height: 38px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-soft); }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.moon-icon { display: none; }
:root[data-theme="dark"] .sun-icon { display: none; }
:root[data-theme="dark"] .moon-icon { display: block; }
.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: 42px 0 30px; }
.eyebrow, .panel-kicker { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: 1.65px; }
h1, h2, h3, p { margin-top: 0; }
.hero-row h1 { margin: 9px 0 7px; font: 700 clamp(30px, 3.5vw, 43px)/1.08 Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: -1.9px; }
.hero-row h1 span { color: var(--accent); }
.hero-copy { max-width: 600px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.hero-chip { flex: 0 0 auto; margin-bottom: 3px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 30px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 600; box-shadow: var(--shadow-soft); }
.chip-orb { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.workspace-grid { display: grid; grid-template-columns: minmax(290px, 340px) minmax(0, 1fr); align-items: start; gap: 22px; padding-bottom: 42px; }
.panel { border: 1px solid var(--border); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
.control-panel { padding: 21px; }
.panel-heading, .preview-toolbar, .preview-card-head, .preview-card-foot, .section-head, .field-label { display: flex; align-items: center; justify-content: space-between; }
.panel-heading { margin-bottom: 18px; }
.panel-heading h2, .preview-toolbar h2 { margin: 4px 0 0; font: 700 19px/1.2 Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: -.55px; }
.step-pill { border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .7px; }
.drop-zone { min-height: 154px; padding: 18px 12px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--surface-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; transition: .18s ease; }
.drop-zone:hover, .drop-zone.drag-active { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { width: 36px; height: 36px; margin-bottom: 10px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.upload-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone > strong { font-size: 12px; font-weight: 700; }
.drop-sub { margin-top: 4px; color: var(--muted); font-size: 11px; }
.browse-link { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.file-meta { margin-top: 11px; color: var(--subtle); font-size: 9px; }
.loaded-file { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.file-thumb { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 800; }
.file-description { flex: 1; min-width: 0; }
.file-description strong, .file-description small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-description strong { font-size: 11px; }
.file-description small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.icon-button { width: 27px; height: 27px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.icon-button:hover { background: var(--red-soft); color: var(--red); }
.divider { height: 1px; margin: 19px 0; background: var(--border); }
.section-head { margin-bottom: 10px; color: var(--text); font-size: 11px; font-weight: 800; }
.live-tag, .section-index { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: 1px; }
.live-tag { padding: 4px 6px; border-radius: 5px; background: var(--surface-soft); }
.mode-options { display: grid; gap: 8px; }
.mode-card { position: relative; min-height: 62px; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; transition: border .15s ease, background .15s ease; }
.mode-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 13%, transparent); }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-soft); color: var(--muted); }
.mode-card.selected .mode-icon { background: var(--surface); color: var(--accent); }
.mode-card:has(input[value="photo"]).selected { border-color: color-mix(in srgb, var(--accent) 82%, #28a86b); }
.mode-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mode-copy { display: block; min-width: 0; }
.mode-copy strong, .mode-copy small { display: block; }
.mode-copy strong { font-size: 11px; }
.mode-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.recommended { position: absolute; top: 7px; right: 8px; color: var(--accent); font-size: 7px; font-weight: 900; letter-spacing: .65px; }
.field-hint { margin: 8px 1px 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.field-group { margin: 15px 0 0; }
.field-label { margin-bottom: 8px; gap: 12px; }
.field-label label { font-size: 10px; font-weight: 700; }
.field-label output { color: var(--accent); font-size: 9px; font-weight: 800; font-variant-numeric: tabular-nums; }
.select-control { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--text); font-size: 11px; }
input[type="range"] { display: block; width: 100%; height: 4px; margin: 11px 0 7px; accent-color: var(--accent); cursor: pointer; }
.range-ends { display: flex; justify-content: space-between; color: var(--subtle); font-size: 8px; }
.field-group.is-disabled { opacity: .4; }
.field-group input:disabled, .field-group select:disabled { cursor: not-allowed; }
.note-card { display: flex; gap: 8px; margin-top: 16px; padding: 10px; border-radius: 9px; background: var(--surface-soft); color: var(--muted); }
.note-symbol { width: 16px; height: 16px; flex: 0 0 16px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 800; }
.note-card p { margin: 0; font-size: 9px; line-height: 1.55; }
.primary-button, .download-button { width: 100%; min-height: 43px; margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 9px; font-size: 11px; font-weight: 800; cursor: pointer; transition: background .15s ease, transform .15s ease; }
.primary-button { background: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 25%, transparent); }
.primary-button:hover:not(:disabled) { background: var(--accent-strong); transform: translateY(-1px); }
.primary-button:disabled, .download-button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.primary-button svg, .download-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.download-button { margin-top: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.download-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.local-note { margin: 12px 0 0; color: var(--muted); text-align: center; font-size: 9px; }
.lock-icon { margin-right: 4px; color: var(--green); }
.preview-area { min-width: 0; }
.preview-toolbar { margin: 2px 1px 14px; }
.preview-actions { display: flex; align-items: center; gap: 10px; }
.format-pill { padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .7px; }
.format-pill span { margin: 0 3px; color: var(--accent); }
.reset-button { border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; }
.reset-button:disabled { opacity: .35; cursor: not-allowed; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.preview-card { padding: 14px; min-width: 0; }
.preview-card-head { min-height: 31px; margin-bottom: 11px; }
.preview-card-head > div { display: flex; align-items: center; gap: 8px; }
.preview-label { color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: .5px; }
.preview-card h3 { margin: 0; font: 700 13px Inter, ui-sans-serif, system-ui, sans-serif; }
.preview-badge { max-width: 50%; padding: 5px 7px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 8px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-badge.is-ready { background: var(--green-soft); color: var(--green); }
.preview-stage { position: relative; height: clamp(240px, 32vw, 430px); min-height: 240px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background-color: var(--stage); }
.checkerboard { background-image: linear-gradient(45deg, var(--checker-a) 25%, transparent 25%), linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--checker-a) 75%), linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; background-color: var(--checker-b); }
.preview-stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
#resultPreview { max-width: 100%; max-height: 100%; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 20px; text-align: center; color: var(--muted); }
.empty-art { width: 43px; height: 43px; margin-bottom: 4px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--subtle); font-size: 23px; }
.vector-empty { color: var(--accent); }
.empty-state strong { font-size: 11px; }
.empty-state small { font-size: 9px; }
.preview-card-foot { margin-top: 10px; color: var(--muted); font-size: 9px; }
.foot-state { color: var(--subtle); font-size: 8px; font-weight: 900; letter-spacing: .8px; }
.result-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; margin-top: 16px; padding: 16px 18px; }
.summary-status { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.status-indicator { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--subtle); box-shadow: 0 0 0 4px var(--surface-soft); }
.status-indicator.is-working { background: #e6a33a; box-shadow: 0 0 0 4px color-mix(in srgb, #e6a33a 14%, transparent); animation: pulse 1s infinite; }
.status-indicator.is-success { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-indicator.is-error { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
@keyframes pulse { 50% { opacity: .35; } }
.summary-status strong, .summary-status small { display: block; }
.summary-status strong { font-size: 11px; }
.summary-status small { max-width: 330px; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.summary-metrics { display: grid; grid-template-columns: repeat(6, minmax(58px, 1fr)); gap: 12px; }
.metric { min-width: 58px; padding-left: 10px; border-left: 1px solid var(--border); }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 8px; }
.metric strong { margin-top: 5px; font: 700 15px Inter, ui-sans-serif, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.quality-note { display: flex; gap: 9px; margin-top: 13px; padding: 0 2px; color: var(--muted); }
.quality-icon { color: var(--accent); font-size: 14px; }
.quality-note p { margin: 0; font-size: 9px; line-height: 1.6; }
.quality-note strong { color: var(--text); }
.app-footer { display: flex; justify-content: space-between; padding: 17px 0 22px; border-top: 1px solid var(--border); color: var(--subtle); font-size: 8px; font-weight: 800; letter-spacing: .9px; }
.app-footer span:last-child { font-weight: 500; letter-spacing: 0; }

@media (max-width: 1050px) {
  .workspace-grid { grid-template-columns: minmax(270px, 315px) minmax(0, 1fr); gap: 15px; }
  .app-shell { padding: 0 22px; }
  .control-panel { padding: 17px; }
  .preview-grid { gap: 10px; }
  .preview-card { padding: 11px; }
  .summary-metrics { gap: 9px; }
  .metric { padding-left: 9px; }
}
@media (max-width: 780px) {
  .app-shell { padding: 0 15px; }
  .topbar { height: 69px; }
  .privacy-note { display: none; }
  .hero-row { align-items: start; flex-direction: column; padding: 30px 0 22px; gap: 14px; }
  .hero-chip { margin: 0; }
  .workspace-grid { grid-template-columns: 1fr; }
  .control-panel { order: 1; }
  .preview-area { order: 2; }
  .preview-stage { height: clamp(230px, 58vw, 380px); }
}
@media (max-width: 560px) {
  .preview-grid { grid-template-columns: 1fr; }
  .preview-stage { height: 300px; }
  .result-summary { align-items: stretch; flex-direction: column; gap: 15px; }
  .summary-metrics { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
  .metric:first-child { border-left: 0; padding-left: 0; }
  .metric strong { font-size: 13px; }
  .app-footer { gap: 10px; flex-direction: column; }
  .app-footer span:last-child { font-size: 9px; }
}


.progress-track { flex: 1 0 100%; height: 3px; width: 100%; overflow: hidden; border-radius: 999px; background: var(--border); margin-top: 13px; }
.progress-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .18s ease; }
.cancel-button { border-color: color-mix(in srgb, var(--danger, #d9534f) 30%, var(--border)); }
.cancel-button[hidden] { display: none; }
@media (max-width: 640px) { .summary-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

[hidden]{display:none!important}
.check-row{display:flex;gap:.5rem;align-items:center;font-size:.85rem}select#curveMode,select#tileSize,select#underlayMode{width:100%;padding:.5rem;border-radius:8px}
