body[data-tool="image-ocr"] {
  --io-ink: #16121c;
  --io-muted: #7a7388;
  --io-line: rgba(40, 24, 70, 0.1);
  --io-ok: #0f7a4d;
  --io-accent: #7c3aed;
}

body[data-tool="image-ocr"] [hidden] {
  display: none !important;
}

body[data-tool="image-ocr"] .tool-workspace {
  padding: 0 0 2rem !important;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(124, 58, 237, 0.08), transparent 55%),
    radial-gradient(700px 380px at 90% 0%, rgba(14, 165, 233, 0.06), transparent 50%),
    #f6f4f9 !important;
}

body[data-tool="image-ocr"] .io-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

body[data-tool="image-ocr"] .io-intro {
  text-align: center;
  margin: 0 auto 1.5rem;
  max-width: 38rem;
}

body[data-tool="image-ocr"] .io-intro h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  font-weight: 760;
  letter-spacing: -0.04em;
  color: var(--io-ink);
}

body[data-tool="image-ocr"] .io-intro p {
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

body[data-tool="image-ocr"] .io-chip {
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--io-line);
  color: var(--io-accent);
}

body[data-tool="image-ocr"] .io-shell {
  border-radius: 20px;
  border: 1px solid var(--io-line);
  background: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 16px 40px rgba(50, 30, 90, 0.06);
  overflow: hidden;
  min-height: min(620px, calc(100vh - 12rem));
  display: flex;
  flex-direction: column;
}

body[data-tool="image-ocr"] .io-drop {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 2rem;
}

body[data-tool="image-ocr"] .io-shell.has-file .io-drop {
  display: none;
}

body[data-tool="image-ocr"] .io-drop .upload-zone {
  width: 100%;
  max-width: 480px;
  min-height: 220px;
  margin: 0;
  border-radius: 16px;
  border-style: dashed;
  background: rgba(124, 58, 237, 0.03);
}

body[data-tool="image-ocr"] .io-drop .upload-zone::before {
  display: none;
}

body[data-tool="image-ocr"] #fileList {
  display: none !important;
}

body[data-tool="image-ocr"] .io-drop-kicker {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--io-ink);
}

body[data-tool="image-ocr"] .io-drop-sub {
  margin: 0.45rem 0 0;
  font-size: 0.9375rem;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-work {
  display: none;
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(280px, 320px) 1fr;
}

body[data-tool="image-ocr"] .io-shell.has-file .io-work {
  display: grid;
}

body[data-tool="image-ocr"] .io-side {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.25rem 1.15rem 1.3rem;
  border-right: 1px solid var(--io-line);
  background: linear-gradient(165deg, rgba(124, 58, 237, 0.04), transparent 55%);
  overflow-y: auto;
  font-size: 0.9375rem;
}

body[data-tool="image-ocr"] .io-file-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

body[data-tool="image-ocr"] .io-file-bar strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
  color: var(--io-ink);
}

body[data-tool="image-ocr"] .io-file-bar span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8125rem;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-text-btn {
  border: 0;
  background: none;
  padding: 0.15rem 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

body[data-tool="image-ocr"] .io-label {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-langs,
body[data-tool="image-ocr"] .io-psms,
body[data-tool="image-ocr"] .io-scopes {
  display: grid;
  gap: 0.4rem;
}

body[data-tool="image-ocr"] .io-langs,
body[data-tool="image-ocr"] .io-scopes {
  grid-template-columns: 1fr;
}

body[data-tool="image-ocr"] .io-psms {
  grid-template-columns: 1fr;
}

body[data-tool="image-ocr"] .io-lang,
body[data-tool="image-ocr"] .io-psm,
body[data-tool="image-ocr"] .io-scope {
  border: 1px solid var(--io-line);
  background: #fff;
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

body[data-tool="image-ocr"] .io-lang strong,
body[data-tool="image-ocr"] .io-psm strong,
body[data-tool="image-ocr"] .io-scope strong {
  display: block;
  font-size: 0.8125rem;
  color: var(--io-ink);
}

body[data-tool="image-ocr"] .io-lang em,
body[data-tool="image-ocr"] .io-psm em,
body[data-tool="image-ocr"] .io-scope em {
  display: block;
  margin-top: 0.12rem;
  font-style: normal;
  font-size: 0.7rem;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-lang.is-on,
body[data-tool="image-ocr"] .io-psm.is-on,
body[data-tool="image-ocr"] .io-scope.is-on {
  border-color: rgba(124, 58, 237, 0.45);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.12);
}

body[data-tool="image-ocr"] .io-hint {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  color: var(--io-ink);
  cursor: pointer;
  user-select: none;
}

body[data-tool="image-ocr"] .io-check input {
  accent-color: var(--io-accent);
}

body[data-tool="image-ocr"] .io-film {
  display: flex;
  gap: 0.4rem;
}

body[data-tool="image-ocr"] .io-film-btn {
  border: 1px solid var(--io-line);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--io-ink);
  cursor: pointer;
}

body[data-tool="image-ocr"] .io-progress {
  display: grid;
  gap: 0.4rem;
}

body[data-tool="image-ocr"] .io-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  overflow: hidden;
}

body[data-tool="image-ocr"] .io-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  border-radius: inherit;
  transition: width 0.2s ease;
}

body[data-tool="image-ocr"] .io-progress-msg {
  margin: 0;
  font-size: 0.75rem;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-note {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-note a {
  color: var(--io-accent);
  font-weight: 650;
}

body[data-tool="image-ocr"] .io-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #faf9fc;
}

body[data-tool="image-ocr"] .io-main-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem 0.85rem;
}

body[data-tool="image-ocr"] .io-main-bar h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--io-ink);
}

body[data-tool="image-ocr"] .io-main-bar p {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  color: var(--io-muted);
}

body[data-tool="image-ocr"] .io-main-bar p.is-ok {
  color: var(--io-ok);
}

body[data-tool="image-ocr"] .io-main-bar p.is-err {
  color: #dc2626;
}

body[data-tool="image-ocr"] .io-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

body[data-tool="image-ocr"] .io-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  flex: 1;
  min-height: 0;
  padding: 0 1.15rem 1.15rem;
}

body[data-tool="image-ocr"] .io-shot {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--io-line);
  border-radius: 14px;
  overflow: hidden;
}

body[data-tool="image-ocr"] .io-shot figcaption {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--io-muted);
  border-bottom: 1px solid var(--io-line);
}

body[data-tool="image-ocr"] .io-frame {
  position: relative;
  flex: 1;
  min-height: 240px;
  display: grid;
  place-items: center;
  background: #eceaf1;
  overflow: hidden;
}

body[data-tool="image-ocr"] #viewCanvas {
  max-width: 100%;
  max-height: min(460px, 52vh);
  display: block;
  touch-action: none;
  cursor: default;
}

body[data-tool="image-ocr"] .io-result {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--io-line);
  border-radius: 14px;
  overflow: hidden;
}

body[data-tool="image-ocr"] .io-result-label {
  padding: 0.55rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--io-muted);
  border-bottom: 1px solid var(--io-line);
}

body[data-tool="image-ocr"] #outText {
  flex: 1;
  min-height: 220px;
  border: 0;
  resize: none;
  padding: 0.85rem 0.9rem;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--io-ink);
  background: transparent;
}

body[data-tool="image-ocr"] #outText:focus {
  outline: none;
}

body[data-tool="image-ocr"] .io-result-meta {
  margin: 0;
  padding: 0.5rem 0.75rem 0.65rem;
  font-size: 0.72rem;
  color: var(--io-muted);
  border-top: 1px solid var(--io-line);
}

@media (max-width: 900px) {
  body[data-tool="image-ocr"] .io-page {
    padding: 0 1rem;
  }

  body[data-tool="image-ocr"] .io-shell.has-file .io-work {
    grid-template-columns: 1fr;
  }

  body[data-tool="image-ocr"] .io-main {
    order: -1;
  }

  body[data-tool="image-ocr"] .io-side {
    border-right: 0;
    border-top: 1px solid var(--io-line);
  }

  body[data-tool="image-ocr"] .io-split {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] body[data-tool="image-ocr"] {
  --io-ink: #f1edf8;
  --io-muted: #94a3b8;
  --io-line: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] body[data-tool="image-ocr"] .tool-workspace {
  background:
    radial-gradient(ellipse 80% 45% at 10% -10%, rgba(124, 58, 237, 0.22), transparent 55%),
    var(--bg) !important;
}

html[data-theme="dark"] body[data-tool="image-ocr"] .io-shell,
html[data-theme="dark"] body[data-tool="image-ocr"] .io-chip,
html[data-theme="dark"] body[data-tool="image-ocr"] .io-lang,
html[data-theme="dark"] body[data-tool="image-ocr"] .io-psm,
html[data-theme="dark"] body[data-tool="image-ocr"] .io-scope,
html[data-theme="dark"] body[data-tool="image-ocr"] .io-film-btn,
html[data-theme="dark"] body[data-tool="image-ocr"] .io-shot,
html[data-theme="dark"] body[data-tool="image-ocr"] .io-result {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="dark"] body[data-tool="image-ocr"] .io-side,
html[data-theme="dark"] body[data-tool="image-ocr"] .io-main {
  background: var(--bg);
}

html[data-theme="dark"] body[data-tool="image-ocr"] #outText {
  color: var(--text);
}

html[data-theme="dark"] body[data-tool="image-ocr"] .io-frame {
  background: #1b1822;
}
