:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #647087;
  --line: #e2e7f0;
  --blue: #4263eb;
  --blue-dark: #3451cf;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }
::selection { color: #fff; background: var(--blue); }

body { min-width: 320px; margin: 0; }
button, input { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, .drop-zone:focus-within { outline: 3px solid #4263eb55; outline-offset: 3px; }

.page { width: min(1050px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 64px; }
.page-header { margin-bottom: 30px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #26334e; font-size: 14px; font-weight: 750; text-decoration: none; }
.brand-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; color: white; background: var(--blue); box-shadow: 0 5px 12px #4263eb38; font-size: 15px; font-weight: 800; }
h1 { margin: 28px 0 9px; font-size: clamp(30px, 5vw, 42px); letter-spacing: -.045em; line-height: 1.12; }
.intro { max-width: 650px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .92fr); gap: 20px; align-items: start; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 8px 28px #25365b0a; }
.card-body { padding: 22px; }

.drop-zone { display: flex; min-height: 76px; flex-direction: column; align-items: center; justify-content: center; padding: 12px 18px; border: 1.5px dashed #cbd4e4; border-radius: 13px; background: #fafbfe; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--blue); background: #f3f5ff; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }

.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 14px; border: 1px solid transparent; border-radius: 9px; color: white; background: var(--blue); cursor: pointer; font-size: 13px; font-weight: 700; transition: background .15s, transform .15s; }
.button:hover:not(:disabled) { background: var(--blue-dark); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button-secondary { border-color: var(--line); color: #39445b; background: #fff; }
.button-secondary:hover:not(:disabled) { background: #f7f8fb; }
.scan-button { width: 100%; margin-top: 16px; }

.image-preview { margin-top: 16px; }
.image-preview-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.file-name { min-width: 0; flex: 1; overflow: hidden; color: #39445b; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.image-preview img { display: block; width: 100%; max-height: 330px; padding: 10px; border: 1px solid #edf0f5; border-radius: 11px; background: #f8f9fc; object-fit: contain; }
.text-button { padding: 4px; border: 0; color: var(--blue); background: none; cursor: pointer; font-size: 12px; font-weight: 650; }
.text-button:hover { color: var(--blue-dark); text-decoration: underline; }
.remove-image-button { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: #647087; font-size: 21px; line-height: 1; }
.remove-image-button:hover { border-color: #cbd4e4; color: #9c2c32; text-decoration: none; }
.progress-ring { position: relative; display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; color: var(--blue); }
.progress-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 3; }
.progress-ring-track { stroke: #e2e7f0; }
.progress-ring-fill { stroke: var(--blue); stroke-dasharray: 100 100; stroke-dashoffset: 100; stroke-linecap: round; transition: stroke-dashoffset .2s ease; }
.progress-ring span { font-size: 8px; font-weight: 750; }

.status { margin-top: 13px; padding: 11px 12px; border-radius: 9px; color: #44516a; background: #f3f5f9; font-size: 12px; line-height: 1.5; }
.status.error { color: #9c2c32; background: #fff0f0; }
.results-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.results-actions .button { min-height: 36px; padding: 0 11px; font-size: 12px; }
.empty-state { display: grid; min-height: 235px; align-content: center; justify-items: center; padding: 20px; color: #8a94a8; text-align: center; }
.empty-icon { margin-bottom: 9px; color: #aab4c7; font-size: 27px; font-weight: 700; }
.empty-state strong { color: #556179; font-size: 13px; }
.empty-state p { max-width: 250px; margin: 6px 0 0; font-size: 12px; line-height: 1.55; }
.text-results { display: grid; max-height: 450px; gap: 8px; overflow: auto; padding: 1px 3px 4px 1px; }
.text-row { display: flex; min-width: 0; flex-wrap: nowrap; align-items: center; gap: 9px; padding: 8px; border: 1px solid #e8ecf3; border-radius: 10px; }
.text-row input { width: auto; min-width: 0; flex: 1 1 0; height: 36px; padding: 0 9px; border: 1px solid #e0e5ee; border-radius: 7px; color: #202b42; background: #fff; font-size: 14px; }
.text-row input:focus { border-color: var(--blue); outline: 3px solid #4263eb22; }
.style-button, .replace-button, .restore-text-button { display: inline-grid; width: 34px; min-height: 34px; flex: 0 0 34px; place-items: center; padding: 0; font-size: 18px; line-height: 1; }
.style-button { font-size: 15px; font-weight: 800; letter-spacing: -1px; }
.text-row .erase-button { display: inline-grid; width: 34px; min-height: 34px; flex: 0 0 34px; place-items: center; padding: 0; color: #647087; font-size: 22px; line-height: 1; }
.text-row .erase-button:hover:not(:disabled) { color: #9c2c32; }
.style-dialog { width: min(360px, calc(100% - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 14px; color: #172033; box-shadow: 0 18px 60px #17203333; }
.style-dialog::backdrop { background: #17203366; }
.style-dialog form { display: grid; gap: 14px; }
.style-dialog h3 { margin: 0; font-size: 17px; }
.style-dialog form > label { display: grid; gap: 6px; color: #556179; font-size: 12px; font-weight: 650; }
.style-dialog .text-setting { width: 100%; min-height: 38px; padding: 0 9px; border: 1px solid #e0e5ee; border-radius: 7px; color: #202b42; background: #fff; font: inherit; font-size: 14px; }
.text-style-options { display: flex; flex-wrap: wrap; gap: 14px; }
.text-style-checkbox { display: inline-flex; align-items: center; gap: 6px; color: #39445b; font-size: 13px; }
.text-style-checkbox input { width: auto; height: auto; margin: 0; }
.style-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.style-dialog-actions .button { min-height: 36px; }

@media (max-width: 760px) {
  .page { width: min(600px, calc(100% - 28px)); padding-top: 30px; }
  .workspace { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .card-body { padding-right: 16px; padding-left: 16px; }
}
