/* tools.runemic.com: only what runemic.com's site.css doesn't have. Class names start with t / tool so they never clash
   with site.css (which the console, Scan and Split share). */
.tool { padding-block: 40px 64px; }
.tool__head { max-width: 760px; margin-bottom: 28px; }
.tool__head h1 { font-size: clamp(2rem, 4.4vw, 3rem); letter-spacing: -0.03em; margin: 0 0 12px; }
.tool__more { max-width: 820px; margin-top: 28px; }
.tool__more h2 { font-size: 1.35rem; margin: 28px 0 14px; }

.tdrop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 48px 20px; border: 1.5px dashed color-mix(in srgb, var(--ink) 28%, transparent); border-radius: 14px; background: var(--surface, transparent); cursor: pointer; transition: border-color .15s, background .15s; }
.tdrop:hover, .tdrop:focus-visible, .tdrop.is-over { border-color: var(--ink); outline: none; }
.tdrop p { margin: 0; }
.tdrop__icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2, #f4f4f5); margin-bottom: 6px; }
.tdrop__icon svg { width: 22px; height: 22px; }
.tdrop__title { font-weight: 600; font-size: 1.1rem; }
.tlink { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.is-busy .tdrop { opacity: .55; pointer-events: none; }
.tstatus { min-height: 1.5em; margin: 12px 0 0; color: var(--ink-2); }
.tstatus[data-kind="error"] { color: var(--danger, #dc2626); }
.tstatus[data-kind="ok"] { color: var(--ok, #16a34a); }
.tstatus a { color: inherit; font-weight: 600; }

.result__bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.result__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.result__tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.result__tabs button { font: inherit; font-size: .875rem; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; }
.result__tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.result__body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.result__img { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.result__img img { display: block; width: 100%; height: auto; }
.result__table { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.sheet { border-collapse: collapse; width: 100%; font-size: .875rem; }
.sheet th, .sheet td { border: 1px solid var(--line); padding: 6px 10px; text-align: start; vertical-align: top; white-space: pre-wrap; }
.sheet th { background: var(--surface-2, #f4f4f5); font-weight: 600; position: sticky; top: 0; }
.sheet td.num { text-align: end; font-variant-numeric: tabular-nums; }
.plain { white-space: pre-wrap; padding: 12px; margin: 0; font-size: .875rem; }
.result__table > .muted { padding: 12px 12px 0; margin: 0; }
@media (max-width: 760px) { .result__body { grid-template-columns: 1fr; } .result__img { max-height: 220px; } }

.tsteps { padding-inline-start: 1.2em; color: var(--ink-2); display: grid; gap: 6px; }
.tools-foot { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding-block: 24px; }
@media (hover: none) { .tdrop__paste { display: none; } } /* no pasting hint on phones */

/* while reading: a scan line moves down the image, a placeholder table shimmers, the steps tick off */
.result__img { position: relative; }
.tscan { display: none; position: absolute; inset-inline: 0; top: -15%; height: 15%; background: linear-gradient(to bottom, transparent, rgba(26, 122, 127, .22), transparent); border-bottom: 2px solid rgba(26, 122, 127, .7); pointer-events: none; }
.is-reading .tscan { display: block; animation: tscan 1.8s ease-in-out infinite; }
@keyframes tscan { from { top: -15%; } to { top: 100%; } }
.tskel { display: grid; gap: 1px; background: var(--line); }
.tskel__row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 1px; }
.tskel__row span { height: 34px; background: var(--bg); position: relative; overflow: hidden; }
.tskel__row span::after { content: ""; position: absolute; inset: 12px 10px; border-radius: 4px; background: var(--surface-2, #f1f1f3); }
.tskel__row:first-child span { background: var(--surface-2, #f4f4f5); }
.is-reading .tskel__row span::after { animation: tshimmer 1.4s ease-in-out infinite; }
@keyframes tshimmer { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.tprogress { display: none; list-style: none; padding: 0; margin: 0 0 12px; gap: 6px 18px; flex-wrap: wrap; font-size: .875rem; color: var(--muted); }
.is-reading .tprogress { display: flex; }
.tprogress li::before { content: "○ "; }
.tprogress li.is-done { color: var(--ink-2); }
.tprogress li.is-done::before { content: "✓ "; color: var(--ok, #16a34a); }
.tprogress li.is-now { color: var(--ink); font-weight: 600; }
.tprogress li.is-now::before { content: "● "; color: #1a7a7f; }
.tprogress .tprogress__time { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.tprogress .tprogress__time::before { content: none; }
@media (prefers-reduced-motion: reduce) { .is-reading .tscan, .is-reading .tskel__row span::after { animation: none; } .is-reading .tscan { top: 40%; } }
.is-reading .result__actions { visibility: hidden; } /* nothing to download yet */

/* the grid of tools: coloured icon, name, one line on what it does; "Soon" cards aren't links */
.tchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.tchip { font: inherit; font-size: .9375rem; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.tchip:hover { border-color: var(--ink); }
.tchip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.tcard { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.tcard:hover { border-color: var(--ink); box-shadow: 0 6px 20px rgba(0,0,0,.06); transform: translateY(-1px); }
.tcard[hidden] { display: none; }
.tcard h3 { font-size: 1.15rem; margin: 6px 0 0; letter-spacing: -0.01em; }
.tcard p { margin: 0; color: var(--ink-2); font-size: .9375rem; line-height: 1.5; }
.tcard__icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; box-shadow: 6px 6px 0 -1px color-mix(in srgb, currentColor 0%, var(--surface-2, #eceff1)); }
.tcard__icon svg { width: 24px; height: 24px; }
.tcard__tag { position: absolute; top: 18px; inset-inline-end: 18px; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2, #f4f4f5); color: var(--muted); }
.tcard__tag--out::after { content: " ↗"; }
.tcard--soon { cursor: default; }
.tcard--soon .tcard__icon { opacity: .55; }
.tcard--soon h3, .tcard--soon p { opacity: .7; }
.tool__grid { margin-top: 56px; }
.tool__grid h2 { font-size: 1.35rem; margin: 0 0 16px; }
@media (max-width: 560px) { /* phones: two smaller cards per row */
  .tgrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tcard { padding: 14px; gap: 6px; }
  .tcard h3 { font-size: 1rem; margin-top: 2px; }
  .tcard p { font-size: .8125rem; line-height: 1.45; }
  .tcard__icon { width: 38px; height: 38px; border-radius: 10px; }
  .tcard__tag { position: static; align-self: flex-start; order: 5; font-size: .6875rem; }
}

/* text results: the Markdown preview, editable source, the text placeholder while reading */
.tdoc { padding: 0; }
.tmd { padding: 16px 20px; font-size: .9375rem; line-height: 1.6; }
.tmd h1, .tmd h2, .tmd h3 { margin: 14px 0 8px; line-height: 1.3; } .tmd h1 { font-size: 1.4rem; } .tmd h2 { font-size: 1.2rem; } .tmd h3 { font-size: 1.05rem; }
.tmd p, .tmd ul, .tmd ol, .tmd blockquote, .tmd pre { margin: 0 0 10px; }
.tmd table { border-collapse: collapse; margin: 0 0 12px; font-size: .875rem; }
.tmd th, .tmd td { border: 1px solid var(--line); padding: 5px 9px; text-align: start; }
.tmd blockquote { border-inline-start: 3px solid var(--line); padding-inline-start: 12px; color: var(--ink-2); }
.tmd pre { background: var(--surface-2, #f4f4f5); padding: 10px; border-radius: 8px; overflow: auto; }
.tsource { width: 100%; min-height: 360px; border: 0; padding: 16px 20px; font: .875rem/1.6 var(--mono, ui-monospace, monospace); background: var(--bg); color: var(--ink); resize: vertical; display: block; }
.tsource:focus { outline: none; }
.tsource--tall { min-height: 480px; border: 1px solid var(--line); border-radius: 12px; }
.tskel--text { display: grid; gap: 12px; padding: 18px 20px; background: none; }
.tskel--text span { height: 12px; border-radius: 4px; background: var(--surface-2, #f1f1f3); }
.is-reading .tskel--text span { animation: tshimmer 1.4s ease-in-out infinite; }
.tprogress .tprogress__extra { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tprogress .tprogress__extra::before { content: none; }
.tprogress .tprogress__extra:empty { display: none; }

/* Image to LaTeX: one card per formula, drawn above its editable code */
.tformulas { display: grid; gap: 12px; align-content: start; }
.tformula { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg); display: grid; gap: 10px; }
.tformula__view { overflow-x: auto; font-size: 1.15rem; min-height: 1.6em; }
.tformula__view.is-bad { color: var(--danger, #dc2626); font-size: .875rem; }
.tformula__row { display: flex; gap: 8px; align-items: flex-start; }
.tformula__code { flex: 1; min-width: 0; font: .875rem/1.5 var(--mono, ui-monospace, monospace); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface-2, #fafafa); color: var(--ink); resize: vertical; }
.tformulas > .muted { margin: 0; }

/* PDF to text: the pages, each marked with how it was read, beside the growing text */
.result__body--pdf { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); }
.tpages { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; max-height: 480px; overflow: auto; }
.tpage { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: .8125rem; }
.tpage:last-child { border-bottom: 0; }
.tpage__state { color: var(--muted); }
.tpage[data-state="ok"] .tpage__state { color: var(--ok, #16a34a); }
.tpage[data-state="now"] { background: var(--surface-2, #f4f4f5); }
.tpage[data-state="now"] .tpage__state { color: #1a7a7f; font-weight: 600; }
.tpage[data-state="bad"] .tpage__state { color: var(--danger, #dc2626); }
@media (max-width: 760px) { .result__body--pdf { grid-template-columns: 1fr; } .tpages { max-height: 180px; } }
/* Translate an image (/translate-image) */
.trtop { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.trmodes { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2, rgba(0,0,0,.05)); }
.trmodes button { font: inherit; font-size: .92rem; padding: 6px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; }
.trmodes button[aria-selected="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.trlangs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; flex: 1 1 420px; max-width: 640px; }
.trlangs select { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); min-width: 0; width: 100%; }
.trswap:disabled { opacity: .35; cursor: default; }
.trpanes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); }
.trpane { display: flex; flex-direction: column; min-width: 0; min-height: 360px; }
.trpane--out { background: var(--surface-2, rgba(0,0,0,.03)); border-left: 1px solid var(--line); }
.trpane .tdrop { margin: 14px; flex: 1; }
.trapp[data-mode="text"] .tdrop, .trapp[data-mode="text"] .trthumb { display: none; }
.trapp[data-mode="image"] .tdrop:not([hidden]) ~ .trsrc, .trapp[data-mode="image"] .tdrop:not([hidden]) ~ .trpane__foot { display: none; }
.trthumb { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.trthumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.trthumb .tlink { margin-inline-start: auto; flex: none; }
.trsrc { flex: 1; min-height: 240px; resize: vertical; border: 0; padding: 16px; font: inherit; font-size: 1.05rem; line-height: 1.6; background: transparent; color: var(--ink); outline: none; }
.trsrc[dir="rtl"] { text-align: right; }
.trpane__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px 0; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.trout { flex: 1; padding: 12px 16px; font-size: 1.05rem; line-height: 1.6; overflow: auto; max-height: 70vh; overflow-wrap: anywhere; }
.trout[dir="rtl"] { text-align: right; }
.trplaceholder { color: var(--ink-3, #999); margin: 0; }
.trpane__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; }
.trpane__btns { display: flex; gap: 6px; }
#chars.is-over { color: var(--danger, #b42318); }
.trworking { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; }
.trworking__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand, #0f766e); animation: trpulse 1s ease-in-out infinite; }
@keyframes trpulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .trworking__dot { animation: none; } }
@media (max-width: 760px) {
  .trpanes { grid-template-columns: 1fr; }
  .trpane--out { border-left: 0; border-top: 1px solid var(--line); }
  .trpane { min-height: 0; }
  .trsrc { min-height: 160px; }
  .trout { min-height: 120px; }
  .trlangs { flex-basis: 100%; }
}
@media (max-width: 420px) { .trlangs select { padding: 8px 8px; font-size: .92rem; } .trlangs { gap: 4px; } }
/* header: signed in on the tools */
/* the header's Sign in waits for the platform's answer, so a signed-in reload doesn't flash it (account.js) */
.tsignin:not(.is-ready) { visibility: hidden; }
.tacct { position: relative; }
.tacct__btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .88rem; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); cursor: pointer; max-width: 100%; }
.tacct__btn img { border-radius: 50%; flex: none; }
.tacct__who { font-weight: 600; max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tacct__credits { color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tacct__menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 50; display: grid; gap: 8px; min-width: 220px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.tacct__menu p { margin: 0; }
.tacct__menu .tlink { justify-self: start; }
@media (max-width: 520px) { .tacct__who { display: none; } }
/* Translate an image: the image is shown large while it is read, then shrinks to a thumbnail */
.trthumb__img { position: relative; overflow: hidden; margin: 0; flex: none; border-radius: 8px; }
.trthumb__img img { display: block; }
.trthumb.is-reading { flex-direction: column; align-items: stretch; }
.trthumb.is-reading .trthumb__img { background: var(--surface-2, #f4f4f5); border: 1px solid var(--line); }
.trthumb.is-reading .trthumb__img img { width: 100%; height: auto; max-height: 300px; object-fit: contain; border: 0; border-radius: 0; }
.trthumb.is-reading #change { display: none; }
.trthumb.is-reading #thumb-note { font-weight: 600; color: var(--ink-2); }
.trprogress { display: grid; gap: 10px; padding: 6px 0; }
.trprogress__step { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--ink-3, #999); font-size: 1rem; }
.trprogress__step::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; flex: none; }
.trprogress__step.is-now { color: var(--ink); font-weight: 600; }
.trprogress__step.is-now::before { border-color: var(--brand, #0f766e); background: var(--brand, #0f766e); animation: trpulse 1s ease-in-out infinite; }
.trprogress__step.is-done { color: var(--ink-2); }
.trprogress__step.is-done::before { background: currentColor; }
.trprogress__secs { margin-inline-start: auto; font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .trprogress__step.is-now::before { animation: none; } }
/* Image to text: the text box fills the result */
.ttext { display: block; width: 100%; min-height: 360px; font-family: inherit; font-size: 1.02rem; line-height: 1.65; }
.ttext[dir="rtl"] { text-align: right; }
