:root {
  color-scheme: light;
  --ink: #211b19;
  --muted: #746964;
  --paper: #f5f1e9;
  --surface: #fffdf9;
  --line: #ded5ca;
  --orange: #f36b24;
  --orange-dark: #c94711;
  --green: #16794d;
  --yellow: #a96100;
  --red: #b82f2f;
  --shadow: 0 22px 55px rgba(63, 42, 28, .11);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 0%, rgba(243, 107, 36, .13), transparent 28rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, select, input { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
.studioShell { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 80px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 30px; }
.eyebrow, .cardLabel { margin: 0 0 9px; color: var(--orange-dark); font-size: 12px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(38px, 5vw, 74px); line-height: .96; letter-spacing: -.055em; }
h1 span { color: var(--orange); }
.subtitle { margin: 15px 0 0; color: var(--muted); font-size: 20px; }
.privacyNote { width: min(420px, 42%); margin: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 253, 249, .68); color: var(--muted); line-height: 1.5; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; }
.inputColumn, .pipelineCard, .statusPanel, .exportPanel, .diagnostics { border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.inputColumn { padding: 26px; }
.sectionSelector { display: grid; grid-template-columns: minmax(190px, .75fr) minmax(0, 1.25fr); gap: 8px 16px; align-items: center; margin-bottom: 20px; }
.sectionSelector > label { grid-column: 1 / -1; font-weight: 800; }
.sectionSelector select { min-height: 48px; border-color: var(--orange); font-weight: 750; }
.sectionSelector p { margin: 0; padding: 9px 13px; border-radius: 12px; background: #fff4ea; line-height: 1.3; }
.sectionSelector p span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.sectionSelector p strong { color: var(--orange-dark); font-size: 13px; }
.optionsRow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.optionsRow label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; }
.dropzone { display: grid; place-items: center; min-height: 220px; padding: 30px; border: 2px dashed #cbbbaf; border-radius: 20px; background: #faf7f1; text-align: center; cursor: pointer; transition: .18s ease; }
.dropzone:hover, .dropzone.dragging { border-color: var(--orange); background: #fff7f0; transform: translateY(-1px); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropIcon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 13px; border-radius: 50%; color: #fff; background: var(--orange); font-size: 34px; font-weight: 300; }
.dropzone strong { font-size: 18px; }
.dropzone small { margin-top: 7px; color: var(--muted); }
.fileInfo, .exportInfo { margin: 18px 0; }
.fileInfo div, .exportInfo div { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0; border-bottom: 1px solid #eee7df; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 750; text-align: right; overflow-wrap: anywhere; }
.primaryButton, .downloadButton { width: 100%; min-height: 54px; border: 0; border-radius: 14px; color: #fff; background: var(--orange); font-weight: 850; cursor: pointer; box-shadow: 0 10px 22px rgba(243, 107, 36, .23); }
button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.progress { min-height: 24px; margin: 14px 0 0; color: var(--muted); line-height: 1.45; }
.pipelineCard { padding: 26px; }
.pipelineCard ol { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: route; }
.pipelineCard li { position: relative; min-height: 54px; padding: 3px 0 20px 50px; color: var(--muted); line-height: 1.3; counter-increment: route; }
.pipelineCard li::before { content: counter(route); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--orange-dark); background: #ffeadc; font-weight: 850; }
.pipelineCard li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; background: #eadfd5; }

.resultSection { margin-top: 42px; }
.sectionHeading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
h2 { margin: 0; font-size: clamp(30px, 4vw, 52px); letter-spacing: -.04em; }
.previewSwitch { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.previewSwitch button { padding: 8px 11px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 13px; font-weight: 750; }
.previewSwitch button.active { color: #fff; background: var(--ink); }
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
figure { margin: 0; }
figcaption { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 850; letter-spacing: .11em; }
.imageFrame { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: #fff; }
.imageFrame img, .imageFrame canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.previewBackground.checker { background-color: #fff; background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%); background-position: 0 0, 0 12px, 12px -12px, -12px 0; background-size: 24px 24px; }
.previewBackground.white { background: #fff; }
.previewBackground.dark { background: #242426; }
.previewBackground.warm { background: #f2f1ee; }
.decisionBanner { margin: 18px 0; padding: 16px 19px; border-radius: 15px; font-weight: 750; line-height: 1.45; }
.decisionBanner.ok { color: var(--green); background: #e9f7f0; border: 1px solid #bfe5d1; }
.decisionBanner.warning { color: #744500; background: #fff2d6; border: 1px solid #efd291; }
.decisionBanner.failed { color: var(--red); background: #fdeaea; border: 1px solid #efc1c1; }
.resultGrid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; }
.statusPanel, .exportPanel { padding: 24px; box-shadow: none; }
h3 { margin: 0 0 18px; font-size: 20px; }
.qualityList { display: grid; gap: 9px; }
.qualityItem { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 5px 18px; align-items: center; padding: 12px 13px; border-radius: 12px; background: #f8f5f0; }
.qualityItem strong { justify-self: end; font-size: 12px; letter-spacing: .04em; }
.qualityItem small { grid-column: 1 / -1; color: var(--muted); line-height: 1.35; }
.qualityItem .ok { color: var(--green); }.qualityItem .warning, .qualityItem .repaired, .qualityItem .skipped { color: var(--yellow); }.qualityItem .failed, .qualityItem .rejected, .qualityItem .low_confidence { color: var(--red); }.qualityItem .n_a { color: var(--muted); }
.approvalCheck { display: flex; gap: 11px; align-items: flex-start; margin: 18px 0; color: var(--muted); line-height: 1.4; }
.approvalCheck input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--orange); }
.exportHint { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.diagnostics { margin-top: 18px; padding: 0 24px 24px; box-shadow: none; }
.diagnostics summary { padding: 22px 0; cursor: pointer; font-size: 18px; font-weight: 850; }
.stageGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.stageCard { min-width: 0; }
.stageCard h4 { min-height: 30px; margin: 0 0 8px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.stageVisual { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background-color: #fff; background-image: linear-gradient(45deg, #e4e4e4 25%, transparent 25%), linear-gradient(-45deg, #e4e4e4 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e4e4e4 75%), linear-gradient(-45deg, transparent 75%, #e4e4e4 75%); background-position: 0 0, 0 9px, 9px -9px, -9px 0; background-size: 18px 18px; }
.stageVisual img, .stageVisual canvas { width: 100%; height: 100%; display: block; object-fit: contain; }

@media (max-width: 900px) {
  .studioShell { width: min(100% - 26px, 720px); padding-top: 28px; }
  .hero { align-items: start; flex-direction: column; gap: 20px; }
  .privacyNote { width: 100%; }
  .workspace, .resultGrid { grid-template-columns: 1fr; }
  .pipelineCard { order: -1; }
  .pipelineCard ol { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .pipelineCard li { min-height: 42px; padding-bottom: 6px; }
  .pipelineCard li::after { display: none; }
  .comparison { grid-template-columns: 1fr; }
  .sectionHeading { align-items: start; flex-direction: column; }
}

@media (max-width: 560px) {
  .optionsRow { grid-template-columns: 1fr; }
  .sectionSelector { grid-template-columns: 1fr; }
  .pipelineCard ol { grid-template-columns: 1fr; }
  .previewSwitch { width: 100%; }
  .previewSwitch button { flex: 1 1 40%; }
}
