#ocrcalc { --oc-radius: 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; padding: clamp(16px, 4vw, 28px); margin: 8px 0; box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -18px rgba(44, 31, 224, .18); }
#ocrcalc *, #ocrcalc *::before, #ocrcalc *::after { box-sizing: border-box; }
#ocrcalc p { margin: 0; }
#ocrcalc button { font-family: var(--body); }
#ocrcalc [hidden] { display: none !important; }

/* labels, fields */
#ocrcalc .oc-label { display: block; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
#ocrcalc .oc-label em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--accent); margin-left: 6px; }
#ocrcalc .oc-field { display: block; min-width: 0; margin: 0; }
#ocrcalc input[type=number], #ocrcalc input[type=text], #ocrcalc select, #ocrcalc textarea { width: 100%; padding: 10px 12px; font-family: var(--mono); font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
#ocrcalc textarea { resize: vertical; line-height: 1.5; display: block; }
#ocrcalc textarea[readonly] { background: #fff; cursor: default; }
#ocrcalc input:focus, #ocrcalc select:focus, #ocrcalc textarea:focus,
#ocrcalc button:focus-visible, #ocrcalc summary:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(44, 31, 224, .16); }

/* controls */
#ocrcalc .oc-controls { display: grid; gap: 20px; }

#ocrcalc .oc-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#ocrcalc .oc-tab { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; text-align: left; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .14s, background .14s, transform .14s; }
#ocrcalc .oc-tab:hover { border-color: #c4c8f0; transform: translateY(-1px); }
#ocrcalc .oc-tab.active { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
#ocrcalc .oc-thumb { flex: none; width: 36px; height: 46px; display: grid; place-items: center; overflow: hidden; border-radius: 6px; background: #fff; border: 1px solid var(--line); color: var(--accent); }
#ocrcalc .oc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; border: 0; border-radius: 0; }
#ocrcalc .oc-tab-text { display: grid; min-width: 0; line-height: 1.25; }
#ocrcalc .oc-tab-text b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
#ocrcalc .oc-tab-text i { font-style: normal; font-size: 12px; color: var(--muted); }
#ocrcalc .oc-tab-own { border-style: dashed; border-color: #b9bdf0; background: #fafaff; }
#ocrcalc .oc-tab-own .oc-thumb { background: var(--accent-soft); border-color: transparent; border-radius: 50%; width: 36px; height: 36px; }
#ocrcalc .oc-tab-own.active { border-style: solid; }

#ocrcalc .oc-volume-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#ocrcalc .oc-volume-row input[type=number] { width: 150px; font-size: 15px; font-weight: 500; }
#ocrcalc .oc-quick { display: flex; gap: 6px; }
#ocrcalc .oc-pill { padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: all .12s; }
#ocrcalc .oc-pill:hover { color: var(--text); border-color: #c4c8f0; }
#ocrcalc .oc-pill.active { color: var(--accent); background: var(--accent-soft); border-color: #d7d9f3; }
#ocrcalc .oc-slider { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; margin: 16px 0 2px; border-radius: 999px; background: var(--line); cursor: pointer; }
#ocrcalc .oc-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .35); }
#ocrcalc .oc-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .35); }

/* body: result first for samples, inputs first for "your own" */
#ocrcalc .oc-body { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
#ocrcalc .oc-preset { order: 1; }
#ocrcalc .oc-stage { order: 2; }
#ocrcalc .oc-custom { order: 3; }
#ocrcalc[data-mode="custom"] .oc-stage { order: 1; }
#ocrcalc[data-mode="custom"] .oc-custom { order: 2; }

/* headline */
#ocrcalc .oc-headline { padding: 20px 22px; border-radius: var(--oc-radius); background: linear-gradient(135deg, #14162B, #2a2570); color: #EAECFB; }
#ocrcalc .oc-lead { font-size: 14.5px; color: #B7BCE6; line-height: 1.4; }
#ocrcalc .oc-lead b { color: #fff; font-weight: 600; }
#ocrcalc .oc-range { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 8px; }
#ocrcalc .oc-range strong { font-family: var(--display); font-size: clamp(28px, 6.4vw, 40px); line-height: 1.1; letter-spacing: -.025em; color: #fff; font-variant-numeric: tabular-nums; }
#ocrcalc .oc-range span { color: #8F95D0; font-size: 15px; }
#ocrcalc .oc-range small { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #8F95D0; }
#ocrcalc .oc-note { font-size: 13.5px; line-height: 1.5; color: #B7BCE6; }
#ocrcalc .oc-note b { color: #fff; font-weight: 600; }

/* ranked rows */
#ocrcalc .oc-rows { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
#ocrcalc .oc-rows:empty { display: none; }
#ocrcalc .oc-row { margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; transition: border-color .14s; }
#ocrcalc .oc-row::marker { content: none; }
#ocrcalc .oc-row:hover { border-color: #c4c8f0; }
#ocrcalc .oc-row.best { border-color: #cfd2f6; background: #fbfbff; }
#ocrcalc .oc-row-head { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name month doc" "track track track"; gap: 8px 18px; align-items: center; width: 100%; padding: 12px 14px 12px 16px; text-align: left; color: inherit; background: none; border: 0; cursor: pointer; }
#ocrcalc .oc-row-head::after { content: ""; position: absolute; right: 14px; top: 16px; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .16s; opacity: 0; }
#ocrcalc .oc-row-head[aria-expanded="true"]::after { transform: rotate(-135deg); top: 20px; }
#ocrcalc .oc-name { grid-area: name; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
#ocrcalc .oc-name b { font-size: 15px; font-weight: 600; color: var(--text); }
#ocrcalc .oc-name i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--muted); }
#ocrcalc .oc-name i::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--pc, var(--muted)); vertical-align: 0; }
#ocrcalc .oc-badge { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 999px; color: var(--muted); background: #eef1f7; }
#ocrcalc .oc-badge.best { color: #0b7a55; background: #dcf6ea; }
#ocrcalc .oc-v { text-align: right; font-variant-numeric: tabular-nums; }
#ocrcalc .oc-v b { display: block; font-family: var(--display); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
#ocrcalc .oc-v i { display: block; font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#ocrcalc .oc-v-month { grid-area: month; min-width: 84px; }
#ocrcalc .oc-v-month b { font-size: 19px; color: var(--accent); }
#ocrcalc .oc-v-doc { grid-area: doc; min-width: 78px; padding-right: 16px; }
#ocrcalc .oc-v-doc b { font-size: 14px; color: var(--text); }
#ocrcalc .oc-track { grid-area: track; display: block; height: 6px; border-radius: 999px; background: #eef1f7; overflow: hidden; }
#ocrcalc .oc-fill { display: block; height: 100%; border-radius: 999px; background: var(--pc, var(--accent)); transition: width .3s ease; }
#ocrcalc .oc-row:hover .oc-row-head::after, #ocrcalc .oc-row-head:focus-visible::after, #ocrcalc .oc-row-head[aria-expanded="true"]::after { opacity: .8; }
#ocrcalc .oc-math { padding: 10px 16px 14px; border-top: 1px dashed var(--line); background: #fafbfe; }
#ocrcalc .oc-hint { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

#ocrcalc [data-provider="openai"] { --pc: #10a37f; }
#ocrcalc [data-provider="google"] { --pc: #4285f4; }
#ocrcalc [data-provider="anthropic"] { --pc: #d97757; }
#ocrcalc [data-provider="qwen"] { --pc: #7c4dff; }

/* the arithmetic, inline */
#ocrcalc .oc-math, #ocrcalc .oc-eq { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
#ocrcalc .term i { font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; padding: 1px 5px; border-radius: 4px; }
#ocrcalc .term b { font-weight: 500; }
#ocrcalc .term.input i { background: #eef0ff; color: #3b2fe0; }
#ocrcalc .term.output i { background: #fff1e6; color: #c2410c; }
#ocrcalc .term.input .t { color: #3b2fe0; }
#ocrcalc .term.input .p { color: #3b82f6; }
#ocrcalc .term.input .c { color: #1e3a8a; font-weight: 600; }
#ocrcalc .term.output .t { color: #c2410c; }
#ocrcalc .term.output .p { color: #d97706; }
#ocrcalc .term.output .c { color: #7c2d12; font-weight: 600; }
#ocrcalc .plus { color: #b6b9cc; }

/* what is being priced */
#ocrcalc .oc-stage { border: 1px solid var(--line); border-radius: var(--oc-radius); background: var(--bg); }
#ocrcalc .oc-stage > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; border-radius: var(--oc-radius); }
#ocrcalc .oc-stage > summary::-webkit-details-marker { display: none; }
#ocrcalc .oc-stage-title { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
#ocrcalc .oc-stage-title::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .16s; }
#ocrcalc .oc-stage[open] .oc-stage-title::before { transform: rotate(45deg); }
#ocrcalc .oc-stage-meta { font-size: 12.5px; color: var(--muted); text-align: right; }
#ocrcalc[data-mode="custom"] .oc-stage > summary { cursor: default; pointer-events: none; }
#ocrcalc[data-mode="custom"] .oc-stage-title::before { display: none; }
#ocrcalc .oc-stage-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: 16px; padding: 4px 16px 16px; align-items: start; }
#ocrcalc .oc-doc { min-width: 0; }
#ocrcalc .oc-frame { position: relative; height: 300px; overflow: auto; display: flex; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
#ocrcalc .oc-frame img { display: block; width: 100%; height: auto; align-self: flex-start; border: 0; border-radius: 0; }
#ocrcalc .oc-frame img[hidden] { display: none; }
#ocrcalc .oc-io { display: grid; gap: 12px; min-width: 0; }
#ocrcalc .oc-block { display: block; margin: 0; }
#ocrcalc .oc-caption { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* upload drop zone / preview */
#ocrcalc .oc-drop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; margin: 0; cursor: pointer; color: var(--muted); border: 1.5px dashed #b9bdf0; border-radius: 12px; background: #fafaff; transition: border-color .12s, background .12s; }
#ocrcalc .oc-drop:hover, #ocrcalc .oc-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
#ocrcalc .oc-drop-hint { display: grid; justify-items: center; gap: 4px; color: var(--accent); }
#ocrcalc .oc-drop-hint b { font-size: 14px; color: var(--text); word-break: break-all; }
#ocrcalc .oc-drop-hint small { font-size: 12px; color: var(--muted); }
#ocrcalc .oc-drop.has-file { border-style: solid; border-color: transparent; padding: 0; background: #fff; align-items: stretch; }
#ocrcalc .oc-drop.has-file .oc-drop-hint { display: none; }
#ocrcalc .oc-preview { display: none; width: 100%; overflow: auto; }
#ocrcalc .oc-drop.has-file .oc-preview { display: block; }
#ocrcalc .oc-preview img { display: block; width: 100%; height: auto; border: 0; border-radius: 0; }
#ocrcalc .oc-preview object { display: block; width: 100%; height: 100%; min-height: 296px; border: 0; }
#ocrcalc .oc-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* your own document */
#ocrcalc .oc-live { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid #cdeedd; background: #f1fbf6; border-radius: 12px; font-size: 13px; line-height: 1.5; color: #3d5a4b; }
#ocrcalc .oc-live b { color: #0f5132; }
#ocrcalc .oc-livedot { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: #16a34a; animation: ocpulse 1.8s infinite; }
@keyframes ocpulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); } }
#ocrcalc .oc-models { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
#ocrcalc .oc-models-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
#ocrcalc .oc-models .oc-label { margin: 0; }
#ocrcalc .oc-model-tools { display: flex; gap: 12px; }
#ocrcalc .oc-model-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 18px; }
#ocrcalc .oc-pick-group { display: grid; gap: 6px; align-content: start; }
#ocrcalc .oc-pick-provider { font-size: 12.5px; font-weight: 600; color: var(--text); }
#ocrcalc .oc-pick-provider::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--pc, var(--muted)); vertical-align: 1px; }
#ocrcalc .oc-pick { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13.5px; line-height: 1.3; cursor: pointer; }
#ocrcalc .oc-pick input { width: 16px; height: 16px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
#ocrcalc .oc-models .oc-hint { margin-top: 10px; }
#ocrcalc .oc-run { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
#ocrcalc .oc-row-head.static { cursor: default; }
#ocrcalc .oc-row-head.static::after { content: none; }
#ocrcalc .oc-btn { padding: 11px 22px; font-weight: 600; font-size: 14px; border-radius: 10px; border: 1px solid var(--text); background: var(--text); color: #fff; cursor: pointer; transition: opacity .12s, background .12s; }
#ocrcalc .oc-btn:hover { opacity: .88; }
#ocrcalc .oc-btn[disabled] { opacity: .55; cursor: progress; }
#ocrcalc .oc-btn.ghost { background: #fff; color: var(--accent); border-color: #b9bdf0; }
#ocrcalc .oc-btn.ghost:hover { background: var(--accent-soft); opacity: 1; }
#ocrcalc .oc-status { font-size: 13px; color: var(--muted); margin-top: 10px; min-height: 1.2em; }
#ocrcalc .oc-status.err { color: #b3261e; }
#ocrcalc .oc-result { margin-top: 6px; }
#ocrcalc .oc-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px 20px; border-radius: var(--oc-radius); background: linear-gradient(135deg, #14162B, #2a2570); }
#ocrcalc .oc-hero .oc-label { color: #8F95D0; margin-bottom: 4px; }
#ocrcalc .oc-hero strong { display: block; font-family: var(--display); letter-spacing: -.02em; font-size: clamp(26px, 6vw, 36px); color: #fff; font-variant-numeric: tabular-nums; }
#ocrcalc .oc-siblings-label { margin: 16px 0 0; }

/* footer */
#ocrcalc .oc-foot { margin-top: 18px; display: grid; gap: 8px; }
#ocrcalc .oc-small { font-size: 12.5px; color: var(--muted); }
#ocrcalc .oc-link { padding: 0; border: 0; background: none; font-size: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
#ocrcalc .oc-copied { margin-left: 8px; font-family: var(--mono); color: #0E9F6E; }
#ocrcalc .oc-copy { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
#ocrcalc #ocr-copy-status { font-family: var(--mono); font-size: 13px; color: #0E9F6E; }
#ocrcalc #ocr-embed-snippet { width: 100%; min-height: 180px; margin-top: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--ink, #14162B); color: var(--ink-text, #EAECFB); }

/* quick-check dialog */
#ocrcalc .oc-modal { border: none; border-radius: 16px; padding: 28px 26px 22px; width: min(92vw, 380px); box-shadow: 0 24px 70px rgba(15, 18, 40, .35); text-align: center; color: var(--text); }
#ocrcalc .oc-modal::backdrop { background: rgba(15, 18, 40, .55); backdrop-filter: blur(3px); }
#ocrcalc .oc-modal form { margin: 0; }
#ocrcalc .oc-modal h3 { margin: 10px 0 4px; font-size: 20px; }
#ocrcalc .oc-modal-icon { width: 44px; height: 44px; margin: 0 auto; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 22px; font-weight: 700; }
#ocrcalc .oc-modal-sub { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
#ocrcalc .oc-modal-q { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: .04em; padding: 14px; margin-bottom: 12px; border-radius: 10px; background: repeating-linear-gradient(135deg, #f3f4fb, #f3f4fb 8px, #eceefa 8px, #eceefa 16px); border: 1px solid var(--line); user-select: none; }
#ocrcalc .oc-modal input { text-align: center; font-size: 16px; }
#ocrcalc .oc-modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

/* iframe embed: samples only; "your own document" lives in the article */
#ocrcalc[data-embed] { margin: 0; }
#ocrcalc[data-embed] .oc-tab-own, #ocrcalc[data-embed] .oc-custom, #ocrcalc[data-embed] #ocr-copy-link { display: none; }
#ocrcalc[data-embed] .oc-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 720px) {
  #ocrcalc .oc-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #ocrcalc[data-embed] .oc-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #ocrcalc .oc-stage-grid { grid-template-columns: 1fr; }
  #ocrcalc .oc-frame { height: 240px; }
  #ocrcalc .oc-stage-meta { display: none; }
}
@media (max-width: 520px) {
  #ocrcalc .oc-row-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name month" "track doc"; gap: 8px 14px; padding-right: 14px; }
  #ocrcalc .oc-v-doc { min-width: 0; padding-right: 0; }
  #ocrcalc .oc-v-doc b { display: inline; font-size: 12.5px; color: var(--muted); font-weight: 500; }
  #ocrcalc .oc-v-doc i { display: inline; margin-left: 4px; }
  #ocrcalc .oc-row-head::after { display: none; }
  #ocrcalc .oc-volume-row input[type=number] { width: 100%; }
  #ocrcalc .oc-quick { width: 100%; }
  #ocrcalc .oc-pill { flex: 1; }
  #ocrcalc .oc-run .oc-btn { width: 100%; }
  #ocrcalc .oc-hero { gap: 10px; padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  #ocrcalc *, #ocrcalc *::before { transition: none !important; animation: none !important; }
}
