/* Browser demo shell and surfaces follow desktop/ui/app.css. */
.try-shell { min-height: 100vh; }
.try-shell .sidebar { top: var(--site-header-height, 64px); height: calc(100vh - var(--site-header-height, 64px)); }
.try-shell .app { max-width: 1180px; }
.try-brand { display: none; color: var(--fg); text-decoration: none; }
.try-menu { display: flex; flex-direction: column; gap: 4px; }
.try-menu-heading { margin: 14px 10px 4px; color: var(--fg-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.try-menu > .try-menu-heading:first-child { margin-top: 0; }
.try-shell .sidebar-foot { gap: 2px; }
.try-shell .sidebar-foot .tab { min-height: 38px; font-size: 14px; text-decoration: none; }
.try-shell .sidebar-foot .tab[hidden] { display: none; }
.try-shell .sidebar-foot .tab[aria-current="page"] { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.try-body[hidden] { display: none; }
.try-ocr-typeset .try-ocr-math.is-editable { display: inline-block; border-radius: 5px; cursor: pointer; outline: 1px solid transparent; transition: background .12s ease, outline-color .12s ease; }
.try-ocr-typeset .try-ocr-math.is-editable:hover { background: var(--brand-tint); outline-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.try-ocr-typeset .try-ocr-math.is-display { display: block; }
.try-ocr-typeset .try-ocr-math.is-editable:focus-visible { outline: 2px solid var(--brand); }
.try-ocr-tip { margin: 6px 0 0; color: var(--fg-muted); font-size: 12.5px; }
.try-ocr-tip[hidden] { display: none; }
.try-modes { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.try-mode { min-height: 38px; width: 100%; padding: 8px 10px; border-radius: var(--radius-lg); font: inherit; font-size: 14px; font-weight: 500; text-align: left; color: var(--fg-secondary); }
.try-mode:hover { background: var(--bg-hover); color: var(--fg); }
.try-mode[aria-selected="true"] { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
/* A conversion going on (or finished) under another tool: a dot on its entry, so it can be found again (try.ts, setPdfBusy). */
.try-mode.is-busy::after, .try-mode.is-done::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--accent); }
.try-mode.is-busy::after { animation: tc-pulse 1.2s ease-in-out infinite; }
.try-mode.is-done::after { background: var(--ok-fg); }
@keyframes tc-pulse { 50% { opacity: .3; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .try-mode.is-busy::after { animation: none; } }
/* Page heading: full width, wraps cleanly on every screen. */
.try-shell .page-head { display: flex; flex-direction: column; gap: 6px; padding: 0 0 16px; border-bottom: 1px solid var(--border-subtle); }
.try-shell .page-head h1 { font-size: clamp(22px, 2.2vw + 12px, 30px); line-height: 1.2; overflow-wrap: anywhere; }
.try-shell .page-head .page-sub { margin: 0; max-width: none; font-size: clamp(14px, .4vw + 12.5px, 16px); line-height: 1.55; }
.try-body { padding: 0; background: transparent; }
.try-body > .section-inner { max-width: none; padding: 0; }
.try-panel[hidden] { display: none !important; }
.try-workflows { display: flex; flex-wrap: nowrap; gap: 6px; margin: 0 0 16px; padding: 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg); overflow-x: auto; }
.try-workflow { flex: none; min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--fg-secondary); font: inherit; font-size: 13px; font-weight: 550; white-space: nowrap; cursor: pointer; }
.try-workflow:hover { background: var(--bg-hover); color: var(--fg); }
.try-workflow[aria-selected="true"] { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); font-weight: 650; }
.try-workflow-panel[hidden] { display: none !important; }
.try-pdf-frame { display: block; width: 100%; min-height: 780px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg); }
.try-grid, .try-ocr-grid { gap: 16px; }
.try-ocr-grid { grid-template-columns: minmax(0, 1fr); }
.try-card { gap: 12px; padding: 20px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .04); }
.try-result { position: static; }
.try-card-title { margin: 0; color: var(--fg-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.try-latex, .try-code, .try-ocr-result textarea { font-family: "Cascadia Mono", Consolas, monospace; color: var(--fg); background: var(--bg-subtle); border-color: var(--border); border-radius: var(--radius); }
.try-paper { border-color: var(--border-subtle); border-radius: var(--radius); }
.try-work { margin-top: 16px; }
.try-work .section-inner { max-width: none; padding: 0; }
.try-work > .section-inner { display: flex; flex-direction: column; gap: 10px; }
.try-ocr-upload-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.try-ocr-workspace { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.try-ocr-workspace[hidden] { display: none; }
.try-ocr-exportbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg); }
.try-ocr-export-spacer { flex: 1 1 auto; }
.try-ocr-export-label { color: var(--fg-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.try-ocr-exportbar .try-select { width: auto; min-width: 205px; }
.try-ocr-review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; min-width: 0; }
.try-ocr-pane { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 560px; padding: 16px; border: 1px solid var(--border-subtle); border-radius: 20px; background: var(--bg); }
.try-ocr-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.try-ocr-pane-head h2 { margin: 0; color: var(--fg); font-size: 13px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.try-ocr-pane-head > span { overflow: hidden; color: var(--fg-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.try-ocr-original-view { display: grid; flex: 1 1 auto; place-items: center; min-height: 460px; overflow: auto; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-subtle); }
.try-ocr-original-view img { display: block; width: 100%; max-height: 680px; object-fit: contain; }
.try-ocr-original-view img[hidden] { display: none; }
.try-ocr-original-view p { color: var(--fg-muted); font-size: 14px; }
.try-ocr-editor-label { display: flex; justify-content: space-between; gap: 10px; color: var(--fg-secondary); font-size: 13px; font-weight: 650; }
.try-ocr-editor-label span { color: var(--fg-muted); font-size: 12px; font-weight: 400; }
.try-ocr-editor-label[hidden], .try-ocr-converted-pane textarea[hidden] { display: none; }
.try-ocr-view-switch { display: flex; gap: 4px; padding: 4px; width: fit-content; border-radius: 10px; background: var(--bg-subtle); }
.try-ocr-view-switch button { padding: 6px 11px; border: 0; border-radius: 7px; background: transparent; color: var(--fg-secondary); font: inherit; font-size: 12px; cursor: pointer; }
.try-ocr-view-switch button[aria-selected="true"] { background: var(--bg); color: var(--brand); font-weight: 650; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.try-ocr-typeset { flex: 1 1 auto; min-height: 460px; padding: 22px; overflow: auto; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg); color: var(--fg); font: 15px/1.8 "Cambria Math", Cambria, Georgia, serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.try-ocr-typeset[hidden] { display: none; }
.try-ocr-typeset math { font-size: 1.1em; }
.try-ocr-result textarea, .try-ocr-converted-pane textarea { flex: 1 1 auto; width: 100%; min-height: 460px; resize: vertical; padding: 18px; background: var(--bg); font-size: 14px; line-height: 1.7; }
.try-ocr-pdf-preview { display: flex; gap: 8px; max-width: 100%; padding-bottom: 2px; overflow-x: auto; }
.try-ocr-pdf-preview[hidden] { display: none; }
.try-ocr-pdf-page { flex: 0 0 74px; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 5px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); cursor: pointer; }
.try-ocr-pdf-page.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-tint); }
.try-ocr-pdf-page img { display: block; width: 100%; height: 74px; object-fit: contain; background: var(--bg-subtle); }
.try-ocr-page-number { color: var(--fg-muted); font-size: 11px; text-align: center; }
.phone-upload-shell { display: flex; flex-direction: column; gap: 20px; width: min(100% - 28px, 520px); margin: 28px auto; color: var(--fg); font-family: "Inter Variable", Inter, system-ui, sans-serif; }
.phone-upload-brand { display: none; align-items: center; gap: 9px; width: fit-content; color: var(--fg); text-decoration: none; font-weight: 650; }
.phone-upload-brand img { border-radius: 7px; }
.phone-upload-card { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 22px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg); }
.phone-upload-card h1 { margin: 0; font-size: clamp(24px, 7vw, 32px); line-height: 1.15; }
.phone-upload-card .eyebrow { margin: 0; }
.phone-upload-copy { margin: 0; color: var(--fg-secondary); line-height: 1.6; }
.phone-upload-card .field { margin-top: 2px; }
.phone-upload-card .btn { min-height: 42px; }
.phone-upload-card .try-status { width: 100%; }
.phone-upload-expiry { margin: 0; color: var(--fg-muted); font-size: 12px; }

@media (max-width: 760px) {
  .try-shell .sidebar { top: 0; height: auto; gap: 10px; }
  /* The tools are a menu here: the button names the open one (mobile-menu.ts). */
  .try-shell .sidebar { position: relative; padding: 12px 16px; }
  .try-shell .sidebar:not(.is-menu-open) .try-menu, .try-shell .sidebar:not(.is-menu-open) .sidebar-foot { display: none; }
  .try-shell .sidebar.is-menu-open .try-menu, .try-shell .sidebar.is-menu-open .sidebar-foot { display: flex; flex-direction: column; gap: 2px; }
  .try-shell .sidebar.is-menu-open .try-menu { margin-top: 8px; padding: 6px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg); box-shadow: 0 12px 28px rgba(15, 23, 42, .12); }
  .try-shell .sidebar.is-menu-open .sidebar-foot { margin-top: 8px; padding: 6px; border-top: 1px solid var(--border-subtle); }
  .try-shell .try-modes { flex-direction: column; flex-wrap: nowrap; }
  .try-shell .try-mode, .try-shell .sidebar-foot .tab { width: 100%; min-height: 44px; justify-content: flex-start; white-space: normal; }
  .try-workflows { margin-right: -16px; padding-right: 16px; }
  .try-pdf-frame { min-height: 860px; }
  .try-shell .app { min-height: auto; padding: 18px 16px; }
  .try-ocr-review-grid { grid-template-columns: minmax(0, 1fr); }
  .try-ocr-pane { min-height: auto; padding: 12px; }
  .try-ocr-original-view { min-height: 320px; }
  .try-ocr-typeset, .try-ocr-result textarea, .try-ocr-converted-pane textarea { min-height: 340px; }
  .try-ocr-editor-label { flex-direction: column; gap: 3px; }
  .try-ocr-exportbar .try-select { flex: 1 1 100%; width: 100%; }
}

/* Convert files: one upload for every file, routed by what was dropped (try.ts). */
.try-upload { display: flex; flex-direction: column; gap: 14px; }
.try-upload[hidden], .try-route[hidden] { display: none; }
.try-upload-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.try-output { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--bg); }
.try-output-label { padding: 0 8px 0 10px; color: var(--fg-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.try-output-option { min-width: 84px; padding: 7px 16px; border: 0; border-radius: 999px; background: transparent; color: var(--fg-secondary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.try-output-option:hover { color: var(--fg); background: var(--bg-hover); }
.try-output-option[aria-checked="true"] { background: var(--brand); color: #fff; }
.try-reader[hidden] { display: none; }
.try-engine { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--bg); color: var(--fg-secondary); font-size: 13px; font-weight: 550; }
.try-engine::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.try-engine[data-engine="own"]::before { background: var(--ok-fg); }
.try-engine[hidden] { display: none; }
.try-drop { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 44px 24px 34px; border: 2px dashed var(--border); border-radius: 20px; background: linear-gradient(180deg, var(--brand-tint), var(--bg) 70%); text-align: center; transition: border-color .15s, background-color .15s; }
.try-drop.is-over { border-color: var(--brand); background: var(--brand-tint); }
.try-drop-plus { display: grid; place-items: center; width: 84px; height: 84px; border: 0; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 10px 28px color-mix(in srgb, var(--brand) 35%, transparent); cursor: pointer; transition: transform .15s, background-color .15s; }
.try-drop-plus:hover { background: var(--brand-hover); transform: scale(1.04); }
.try-drop-plus:focus-visible, .try-output-option:focus-visible { outline: 3px solid var(--brand-tint); outline-offset: 2px; }
.try-drop-title { margin: 6px 0 0; color: var(--fg); font-size: clamp(22px, 3vw, 30px); font-weight: 750; letter-spacing: -.01em; }
.try-drop-or { margin: 0; color: var(--fg-muted); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.try-drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.try-drop-btn { min-width: 190px; min-height: 48px; border-radius: 999px; font-weight: 650; letter-spacing: .02em; }
.try-drop-formats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.try-drop-formats li { padding: 3px 10px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--bg); color: var(--fg-secondary); font-size: 12px; font-weight: 650; }
.try-drop-help { max-width: 520px; margin: 0; color: var(--fg-muted); font-size: 13.5px; line-height: 1.5; }
.try-upload-alt { margin: 0; color: var(--fg-muted); font-size: 13.5px; text-align: center; }
.try-link { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.try-link:hover { text-decoration: underline; }
.try-route { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; margin-bottom: 14px; }
.try-route-new { flex: none; border-radius: 999px !important; }
.try-route-title { min-width: 0; overflow: hidden; color: var(--fg-secondary); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.try-doc-download-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.try-ocr-pane-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.try-ocr-pane-actions [hidden] { display: none; }
.try-ocr-setup[hidden] { display: none; }
.try-good { margin-top: 22px; padding: 20px 22px; border: 1px solid var(--border-subtle); border-radius: 16px; background: var(--bg); }
.try-good h2 { margin: 0 0 12px; color: var(--fg); font-size: 17px; }
.try-good-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 26px; }
.try-good-grid > div { color: var(--fg-secondary); font-size: 14px; line-height: 1.55; }
.try-good-grid strong { color: var(--fg); }

@media (max-width: 760px) {
  .try-drop { padding: 30px 16px 24px; }
  .try-drop-btn { min-width: 0; flex: 1 1 140px; }
  .try-good-grid { grid-template-columns: minmax(0, 1fr); }
  .try-upload-top { flex-direction: column; align-items: stretch; }
  .try-output { justify-content: space-between; }
}

/* The phone upload dialog (try.html #try-ocr-qr-panel). */
.try-qr-dialog { width: min(100% - 32px, 460px); max-height: calc(100vh - 32px); padding: 34px 32px 24px; border: 0; border-radius: 22px; background: var(--bg); color: var(--fg); box-shadow: 0 24px 64px rgba(15, 23, 42, .28); text-align: center; overflow: auto; }
.try-qr-dialog[open] { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.try-qr-dialog::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.try-qr-x { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--fg-muted); cursor: pointer; }
.try-qr-x:hover { background: var(--bg-hover); color: var(--fg); }
.try-qr-badge { padding: 5px 16px; border: 1px solid var(--border); border-radius: 999px; color: var(--brand); font-size: 12px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.try-qr-title { margin: 2px 0 0; font-size: clamp(20px, 4.5vw, 25px); font-weight: 750; line-height: 1.2; }
.try-qr-lead { margin: 0; color: var(--fg-secondary); font-size: 14.5px; }
.try-qr-card { padding: 16px; border: 1px solid var(--border-subtle); border-radius: 18px; background: #fff; box-shadow: 0 6px 20px rgba(15, 23, 42, .06); }
.try-ocr-qr-code { display: block; width: 216px; height: 216px; max-width: 60vw; max-height: 60vw; }
.try-qr-state { display: inline-flex; align-items: center; gap: 10px; padding: 9px 18px; border: 1px solid var(--brand); border-radius: 999px; background: var(--brand-tint); color: var(--fg); font-size: 14px; font-weight: 600; }
.try-qr-state[data-tone="ended"] { border-color: var(--border); background: var(--bg-subtle); color: var(--fg-muted); }
.try-qr-spinner { width: 16px; height: 16px; border: 2px solid var(--brand-tint); border-top-color: var(--brand); border-radius: 50%; animation: try-qr-spin .8s linear infinite; }
.try-qr-state[data-tone="ended"] .try-qr-spinner { display: none; }
.try-qr-timer { color: var(--fg-muted); font-variant-numeric: tabular-nums; font-weight: 500; }
@keyframes try-qr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .try-qr-spinner { animation-duration: 2.4s; } }
.try-qr-or { margin: 6px 0 0; color: var(--fg-muted); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.try-qr-url { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 6px 6px 16px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-subtle); }
.try-qr-url-text { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--fg-secondary); font-size: 13.5px; text-align: left; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.try-qr-copy { flex: none; padding: 9px 18px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--fg); font: inherit; font-size: 13px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.try-qr-copy:hover { border-color: var(--brand); color: var(--brand); }
.try-qr-help { margin: 0; color: var(--fg-muted); font-size: 12.5px; line-height: 1.5; }
.try-qr-end { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--fg-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.try-qr-end:hover:not(:disabled) { color: var(--fg); background: var(--bg-hover); }
.try-qr-end:disabled { cursor: default; }
@media (max-width: 480px) { .try-qr-dialog { padding: 30px 18px 18px; } }

/* Equation export: one primary action, then two labelled segmented groups. */
.try-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.try-act-main { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; text-align: left; border-radius: var(--radius-lg); }
.try-act-main .try-act-icon { flex: none; width: 26px; height: 26px; }
.try-act-main-text { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; line-height: 1.2; }
.try-act-main-text b { font-size: 15px; font-weight: 650; }
.try-act-main-text small { font-size: 12px; font-weight: 450; opacity: .82; }
.try-kbd { flex: none; padding: 2px 7px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 6px; background: rgba(255, 255, 255, .12); font: 600 11px/1.5 "Inter", system-ui, sans-serif; letter-spacing: .02em; }
@media (hover: none) { .try-kbd { display: none; } }
.try-act-group { display: flex; flex-direction: column; gap: 6px; }
.try-act-label { font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); }
.try-act-seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); overflow: hidden; }
.try-act { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 40px; padding: 8px 10px; border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--fg); font: inherit; font-size: 13.5px; font-weight: 550; white-space: nowrap; cursor: pointer; transition: background .12s ease, color .12s ease; }
.try-act:first-child { border-left: 0; }
.try-act[hidden] { display: none; }
.try-act span { overflow: hidden; text-overflow: ellipsis; }
.try-act .try-act-icon { flex: none; color: var(--fg-muted); transition: color .12s ease; }
.try-act:hover:not(:disabled) { background: var(--brand-tint); color: var(--brand); }
.try-act:hover:not(:disabled) .try-act-icon { color: var(--brand); }
.try-act:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.try-act:disabled { opacity: .45; cursor: default; }
.try-act.is-done, .try-act.is-done .try-act-icon { background: var(--ok-bg); color: var(--ok-fg); }
.try-act-main.is-done { filter: saturate(.9) brightness(1.05); }
@media (max-width: 420px) { .try-act { flex-direction: column; gap: 3px; font-size: 12px; } }
.try-act-note { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-subtle); color: var(--fg-muted); font-size: 12.5px; line-height: 1.5; }
.try-act-note svg { flex: none; margin-top: 2px; }

/* Template keys: placeholders a little larger and tinted, so the shape reads at a glance. */
.try-key .slot { width: 9px; height: 9px; border-width: 1.2px; border-radius: 2px; background: color-mix(in srgb, var(--brand) 7%, transparent); opacity: .75; }
.try-key .t-base .slot { width: 11px; height: 13px; }
.try-key sup .slot, .try-key sub .slot { width: 7px; height: 7px; }
.try-key .t-root { display: block; font-size: 22px; }
.try-key:hover .slot { opacity: 1; }
.try-key .t-frac .t-num, .try-key .t-frac .t-den { padding-left: 3px; padding-right: 3px; }
.try-key .t-frac .t-den { border-top-width: 1.5px; padding-top: 3px; margin-top: 2px; }
.try-key .t-base + sup, .try-key .t-base + sub { position: relative; margin-left: 1px; vertical-align: baseline; }
.try-key .t-base + sup { top: -7px; }
.try-key .t-base + sub { top: 6px; }

/* One look for every workspace (Convert files, Equations, Graphs, Diagrams, Tables):
   the same card, card heading, surfaces, action row, notes and plan box. */
.try-card > .try-card-head:first-child { min-height: 32px; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }
.try-card .try-editor-head { margin-top: 6px; }
.try-paper, .try-doc-page, .try-ocr-typeset, .try-ocr-original-view { border-radius: 10px; }
.try-drop, .try-good, .try-ocr-pane, .try-ocr-exportbar, .try-pdf-frame { border-radius: 14px; }
.try-good { box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .04); }
/* Export rows on Convert files, Graphs and Tables match the Equations panel: one large main
   action, then secondary actions drawn like its segmented buttons. */
.try-exports, .gb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.try-exports .btn, .gb-actions .btn { flex: 1 1 130px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); box-shadow: none; color: var(--fg); font-size: 13.5px; font-weight: 550; white-space: nowrap; transition: background .12s ease, color .12s ease, border-color .12s ease; }
.try-exports .btn:hover:not(:disabled), .gb-actions .btn:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.try-exports .btn:disabled, .gb-actions .btn:disabled { opacity: .45; cursor: default; }
.try-exports > .btn-primary, .gb-actions > .btn-primary:first-child { order: -1; flex-basis: 100%; min-height: 56px; border-color: var(--brand-hover); border-radius: var(--radius-lg); background: linear-gradient(180deg, var(--brand-hi), var(--brand)); color: #fff; font-size: 15px; font-weight: 650; box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .15); }
.try-exports > .btn-primary:hover:not(:disabled), .gb-actions > .btn-primary:first-child:hover:not(:disabled) { border-color: var(--brand-pressed); background: linear-gradient(180deg, var(--brand-hover), var(--brand-pressed)); color: #fff; }
.try-upsell { gap: 14px; margin-top: 2px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); border-radius: 12px; background: var(--brand-tint); }
.try-upsell p { font-size: 13.5px; line-height: 1.55; }
.try-upsell .btn { flex: none; min-height: 38px; padding: 7px 16px; border-radius: 10px; font-size: 14px; }
.try-status { border-radius: 10px; font-size: 13.5px; }
.try-doc-note { margin: 0; color: var(--fg-muted); font-size: 13px; line-height: 1.5; }
.try-doc-note:empty { display: none; }
.try-select { min-height: 40px; border-radius: 10px; }
.try-latex, .try-code { border-radius: 10px; }
.try-route { padding-bottom: 14px; border-bottom: 1px solid var(--border-subtle); }
#try-panel-tables .try-exports { max-width: 520px; }
#try-panel-tables .try-actions { max-width: 620px; }


/* Convert files: LaTeX to Word on the upload screen, no account. */
.try-quick { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; padding: 20px; border: 1px solid var(--border-subtle); border-radius: 20px; background: var(--bg); }
.try-quick-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.try-quick-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--fg); }
.try-quick-sub { margin: 4px 0 0; max-width: 680px; color: var(--fg-secondary); font-size: 14px; line-height: 1.55; }
.try-quick-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border: 1px solid var(--ok-border); border-radius: 999px; background: var(--ok-bg); color: var(--ok-fg); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.try-quick-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 22%, transparent); }
.try-quick-grid { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); align-items: stretch; gap: 10px; }
.try-quick-pane { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--bg); }
.try-quick-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-subtle); color: var(--fg); font-size: 13px; font-weight: 600; }
.try-quick-count { margin-left: auto; color: var(--fg-muted); font-size: 12px; font-weight: 500; }
.try-quick-chip { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; font: 700 11px/1 "Inter", system-ui, sans-serif; }
.try-quick-chip-tex { background: #3f6f45; font-size: 9.5px; }
.try-quick-chip-word { background: linear-gradient(180deg, #2b7cd3, #185abd); }
.try-quick-source { flex: 1 1 auto; min-height: 210px; margin: 0; padding: 14px 16px; border: 0; resize: vertical; background: var(--bg); color: var(--fg); font: 14px/1.65 "Cascadia Mono", Consolas, monospace; }
.try-quick-source:focus { outline: none; box-shadow: inset 0 0 0 2px var(--brand); }
.try-quick-arrow { display: grid; place-items: center; color: var(--brand); }
.try-quick-arrow svg { padding: 6px; border-radius: 50%; background: var(--brand-tint); box-sizing: content-box; }
.try-quick-paper { flex: 1 1 auto; padding: 16px; background: #e9ecf1; }
.try-quick-page { min-height: 178px; padding: 22px 26px; background: #fff; color: #111; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto; font: 15px/1.7 Calibri, Carlito, "Segoe UI", sans-serif; }
.try-quick-page math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math; font-size: 1.1em; }
.try-quick-page math[display="block"] { margin: 6px 0; }
.try-quick-page .try-doc-bad { color: #b42318; background: #fef3f2; border-radius: 4px; padding: 0 3px; }
.try-quick-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.try-quick-main { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 9px 18px; font-size: 15px; font-weight: 650; }
.try-quick-main.is-done { filter: brightness(1.05); }
.try-quick-actions > .btn:not(.btn-primary) { min-height: 44px; padding: 9px 16px; }
.try-quick-more { color: var(--fg-muted); font-size: 13px; }
/* Side by side only when each pane has room for a display equation (tablets have the sidebar too). */
@media (max-width: 1100px) {
  .try-quick-grid { grid-template-columns: minmax(0, 1fr); }
  .try-quick-arrow svg { transform: rotate(90deg); }
}
@media (max-width: 760px) {
  .try-quick { padding: 16px; }
  .try-quick-grid { grid-template-columns: minmax(0, 1fr); }
  .try-quick-arrow svg { transform: rotate(90deg); }
  .try-quick-source { min-height: 150px; }
}

/* Photos with no way to read them: the reason, the way in, and what works now. */
.try-gate-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.try-gate-actions .btn { min-height: 42px; padding: 9px 18px; }
.try-gate-alt { display: none; }
#try-ocr-input.is-locked .try-gate-alt { display: inline-flex; }
#try-ocr-input.is-gated { padding: 0; border: 0; background: none; box-shadow: none; }
#try-ocr-input.is-gated > .try-card-head, #try-ocr-input.is-gated > .try-ocr-copy, #try-ocr-input.is-gated > .try-gate-actions { display: none; }
#try-ocr-input.is-gated > .signed-out.gate { width: 100%; max-width: 680px; }
#try-ocr-input.is-locked #try-ocr-photo-controls, #try-ocr-input.is-locked #try-ocr-pdf-controls { display: none !important; }
#try-photo-sign-in[hidden] { display: none; }
#try-ocr-input input[type="file"] { width: 100%; padding: 8px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg-subtle); color: var(--fg-muted); font: inherit; font-size: 14px; cursor: pointer; }
#try-ocr-input input[type="file"]::file-selector-button { margin-right: 12px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
#try-ocr-input input[type="file"]:hover::file-selector-button { border-color: var(--brand); color: var(--brand); }
#try-ocr-photo-controls:not([hidden]), #try-ocr-pdf-controls:not([hidden]) { display: flex; flex-direction: column; gap: 12px; }


/* Equation editor: tools beside the LaTeX heading. */
.try-editor-tools { display: inline-flex; align-items: center; gap: 6px; }
.try-tool { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg); color: var(--fg-secondary); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.try-tool:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.try-tool[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
#try-latex { min-height: 96px; max-height: none; line-height: 1.6; tab-size: 2; white-space: pre-wrap; }
#try-latex.is-expanded { height: 62vh !important; min-height: 320px; }

/* Equation preview: a calmer size, long equations shrink to fit (try.ts fitPreview), then scroll. */
.try-paper { max-height: 560px; overflow: auto; align-items: start; }
.try-preview { font-size: 20px; width: 100%; min-width: 0; }
.try-preview .math-piece math { max-width: none; }
.try-preview math mtext { white-space: pre; }

/* Your work: a card like the rest of the page. */
.try-work > .section-inner { padding: 18px 20px 20px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg); }
.try-work h2 { font-size: 18px; font-weight: 700; }
.your-work-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.your-work-search { flex: 1 1 260px; min-width: 0; }
.your-work-search, .your-work-filter, .your-work-rename { min-height: 38px; padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--fg); font: inherit; font-size: 14px; }
.your-work-search:focus, .your-work-filter:focus, .your-work-rename:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.your-work-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-subtle); border-radius: var(--radius); overflow: hidden; }
.your-work-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 11px 14px; border-top: 1px solid var(--border-subtle); overflow-wrap: anywhere; }
.your-work-item:first-child { border-top: 0; }
.your-work-item:hover { background: var(--bg-subtle); }
.your-work-item.is-pinned .your-work-title::before { content: "★ "; color: var(--accent); }
.your-work-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 320px; }
.your-work-title { overflow: hidden; color: var(--fg); font: 13px/1.45 "Cascadia Mono", Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.your-work-meta { color: var(--fg-muted); font-size: 12.5px; }
.your-work-actions { display: flex; flex: none; gap: 6px; }
.your-work-actions .btn { min-height: 32px; padding: 5px 12px; border-radius: 8px; font-size: 13px; }
.your-work-empty { margin: 8px 0 0; color: var(--fg-muted); font-size: 14px; }
.your-work-more { margin-top: 10px; }

/* ---- Question paper maker (frontend/src/question-paper-view.ts) ---- */
.qp-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.qp-preview-card { position: sticky; top: 12px; }
.qp-page { max-height: 70vh; overflow: auto; }
.qp-section { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 12px; margin: 0 0 12px; min-width: 0; }
.qp-section-name { font-weight: 600; padding: 0 4px; color: var(--fg); }
.qp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; }
.qp-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12px; color: var(--fg-muted); }
.qp-wide { grid-column: 1 / -1; }
.qp-input { font: inherit; font-size: 13px; padding: 6px 8px; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; width: 100%; box-sizing: border-box; }
textarea.qp-input { resize: vertical; min-height: 52px; }
.qp-input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.qp-number { max-width: 120px; }
.qp-question { border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 8px; display: grid; gap: 8px; }
.qp-question-head { display: flex; justify-content: space-between; align-items: center; }
.qp-question-number { font-weight: 600; color: var(--fg); }
.qp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.qp-link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.qp-check { display: flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 13px; color: var(--fg); }
.qp-total { margin: 8px 0 0; font-weight: 600; color: var(--fg); }
.qp-files { margin: 0 0 8px; }
.qp-note { margin: 0 0 10px; font-size: 13px; color: var(--fg-muted); }
.qp-note:empty { display: none; }
.qp-note[data-tone="danger"] { color: var(--danger); }
.qp-tags { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
/* A question's boxes in the paper's second language, under the first's. */
.qp-second { display: grid; gap: 8px; padding: 8px 10px; border-left: 3px solid var(--brand); background: color-mix(in srgb, var(--brand) 5%, transparent); border-radius: 0 6px 6px 0; }
.qp-translate select { width: auto; min-width: 160px; }
.qp-translate-note { margin-top: 8px; }
.qp-translate-box { border-color: var(--brand); }
.qp-check-row { margin-top: 8px; }
.qp-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--border); align-items: start; }
.qp-pair-source { display: grid; gap: 2px; min-width: 0; }
.qp-pair-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.qp-pair-empty .qp-input { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.qp-pair-head { margin: 14px 0 2px; font-size: 1em; }
.qp-logo-row { margin-top: 0; }
.qp-logo-image { height: 36px; width: auto; max-width: 120px; object-fit: contain; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.qp-preview-logo { display: block; margin: 0 auto 4px; height: 56px; width: auto; max-width: 40%; object-fit: contain; }
/* The watermark as it will print: faint, across the page. */
.qp-page.qp-watermarked { position: relative; }
.qp-page.qp-watermarked::before { content: attr(data-watermark); position: sticky; top: 40%; display: block; height: 0; text-align: center; transform: rotate(-30deg); font-size: 44px; font-weight: 700; color: var(--fg); opacity: 0.08; pointer-events: none; white-space: nowrap; overflow: visible; }
@media (max-width: 900px) {
  .qp-layout { grid-template-columns: minmax(0, 1fr); }
  .qp-preview-card { position: static; }
}

/* ---- Equation editor: search, toolbar, status bar, history, preview tools ---- */
.try-search { display: inline-flex; align-items: center; gap: 7px; flex: 0 1 300px; min-width: 0; padding: 0 8px 0 10px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-subtle); color: var(--fg-muted); transition: border-color .12s ease, box-shadow .12s ease, background .12s ease; }
.try-search:focus-within { border-color: var(--brand); background: var(--bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.try-search input { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font: inherit; font-size: 13.5px; }
.try-search input::-webkit-search-cancel-button { cursor: pointer; }
.try-search-kbd { padding: 0 6px; border-color: var(--border); background: var(--bg); color: var(--fg-muted); font-size: 11px; }
.try-search:focus-within .try-search-kbd { display: none; }
.try-search-count { margin: 0; font-size: 12.5px; color: var(--fg-muted); }
.try-search-formulas { grid-column: 1 / -1; max-height: none; overflow: visible; padding: 0; }
.try-subjects[hidden], .try-groups[hidden] { display: none; }
.try-tool-icon { justify-content: center; width: 30px; height: 28px; padding: 0; }
.try-tool-sep { width: 1px; height: 18px; margin: 0 2px; background: var(--border-subtle); }
.try-tool:disabled { opacity: .45; cursor: default; }
.try-latex { font-size: 15px; line-height: 1.6; }
.try-latex.has-error, .try-latex.has-error:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(217, 45, 32, .14); }
.try-statusbar { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; margin-top: -4px; font-size: 12px; color: var(--fg-muted); }
.try-statusbar code, .try-statusbar kbd { padding: 0 4px; border: 1px solid var(--border-subtle); border-radius: 4px; background: var(--bg-subtle); font: 11.5px "Cascadia Mono", Consolas, monospace; }
.try-statusbar-pos { display: inline-flex; gap: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.try-starts { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; border-bottom: 1px solid var(--border-subtle); }
.try-start-tabs { display: flex; gap: 18px; }
.try-start-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0 9px; border: 0; background: none; color: var(--fg-muted); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.try-start-tab:hover { color: var(--fg); }
.try-start-tab[aria-selected="true"] { color: var(--brand); }
.try-start-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.try-start-count:not(:empty) { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand-tint); color: var(--brand); font-size: 11px; line-height: 17px; text-align: center; }
.try-link-btn { padding: 0; border: 0; background: none; color: var(--fg-muted); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.try-link-btn:hover { color: var(--brand); }
.try-examples[hidden] { display: none; }
.try-history-item { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-style: solid; font: 12.5px "Cascadia Mono", Consolas, monospace; }
.try-history-empty { margin: 0; font-size: 13px; color: var(--fg-muted); }
.try-preview-head { flex-wrap: wrap; row-gap: 8px; }
.try-view-tools { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.try-seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--bg-subtle); border: 1px solid var(--border-subtle); }
.try-seg button { min-width: 30px; height: 26px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--fg-muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.try-seg button:hover:not(:disabled) { color: var(--fg); }
.try-seg button[aria-pressed="true"] { background: var(--bg); color: var(--brand); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.try-seg button:disabled { opacity: .4; cursor: default; }
.try-zoom button { padding: 0 7px; }
.try-zoom #try-zoom-reset { min-width: 48px; }
#try-panel-equation .try-paper { min-height: 230px; background-color: #ffffff; background-image: radial-gradient(rgba(15, 23, 42, .07) 1px, transparent 1px); background-size: 16px 16px; }
.try-error-go { align-self: flex-start; margin-top: -4px; }
.try-error-go[hidden] { display: none; }
@media (max-width: 560px) {
  #try-panel-equation .try-card > .try-card-head:first-child { flex-wrap: wrap; }
  .try-search { flex: 1 1 100%; }
  .try-statusbar-hint { display: none; }
}
#try-panel-equation .try-paper.is-stale .try-preview { opacity: .35; filter: grayscale(1); transition: opacity .15s ease; }
.try-editor-tools { flex-wrap: wrap; justify-content: flex-end; }

/* ---- Equation editor: coloured LaTeX, matrix bar, equation set, picture options, drawing, shortcuts ---- */
.try-eqcode { position: relative; --hl-cmd: #0b5cad; --hl-env: #7a3fb8; --hl-brace: #6b7280; --hl-script: #b4235a; --hl-num: #0f766e; --hl-align: #c2410c; --hl-comment: #4d7c0f; }
@media (prefers-color-scheme: dark) { .try-eqcode { --hl-cmd: #7cb8ff; --hl-env: #c7a2ff; --hl-brace: #9ca3af; --hl-script: #ff8db4; --hl-num: #5eead4; --hl-align: #fdba74; --hl-comment: #a3e635; } }
.try-eqcode .try-latex { display: block; margin: 0; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 2; scrollbar-gutter: stable; }
.try-eqcode textarea.try-latex { position: relative; z-index: 1; background: transparent !important; color: transparent; caret-color: var(--fg); }
.try-eqcode textarea.try-latex::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); color: transparent; }
.try-eqcode .try-latex-hl { position: absolute; inset: 0; overflow: hidden; border-color: transparent; color: var(--fg); pointer-events: none; }
.try-eqcode:focus-within .try-latex-hl { background: var(--bg); }
.hl-cmd { color: var(--hl-cmd); }
.hl-env { color: var(--hl-env); }
.hl-envname { color: var(--hl-env); font-style: italic; }
.hl-brace { color: var(--hl-brace); }
.hl-script { color: var(--hl-script); font-weight: 700; }
.hl-num { color: var(--hl-num); }
.hl-align { color: var(--hl-align); font-weight: 700; }
.hl-comment { color: var(--hl-comment); font-style: italic; }
.hl-match { color: var(--fg); background: color-mix(in srgb, var(--brand) 22%, transparent); border-radius: 2px; outline: 1px solid color-mix(in srgb, var(--brand) 50%, transparent); }
.hl-bad { color: #fff; background: #d92d20; border-radius: 2px; }
.try-matrix-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -4px; padding: 6px 8px; border: 1px solid var(--brand); border-radius: 9px; background: var(--brand-tint); }
.try-matrix-bar[hidden] { display: none; }
.try-matrix-size { margin-right: auto; font-size: 12.5px; font-weight: 650; color: var(--brand); }
.try-set[hidden] { display: none; }
.try-set { display: flex; flex-direction: column; gap: 10px; }
.try-set-lead { margin: 0; font-size: 13px; color: var(--fg-muted); }
.try-set-top, .try-set-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.try-set-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; max-height: 340px; overflow-y: auto; }
.try-set-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border-subtle); border-radius: 10px; background: #ffffff; color: #111111; }
.try-set-num { flex: none; min-width: 0; font: 600 13px "Cambria Math", "STIX Two Math", serif; color: #4b5563; }
.try-set-list.is-numbered .try-set-num { min-width: 30px; }
.try-set-face { flex: 1 1 auto; min-width: 0; overflow-x: auto; padding: 4px; border: 0; border-radius: 6px; background: none; color: inherit; font-size: 18px; text-align: center; cursor: pointer; }
.try-set-face:hover { background: var(--brand-tint); }
.try-set-face math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math; }
.try-set-tools { display: inline-flex; flex: none; gap: 4px; }
.try-set-tools .try-tool { background: #ffffff; color: #374151; }
.try-set-empty { padding: 16px; border: 1px dashed var(--border); border-radius: 10px; font-size: 13px; color: var(--fg-muted); text-align: center; }
.try-act-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.try-img-opts { position: relative; font-size: 12.5px; }
.try-img-opts summary { list-style: none; cursor: pointer; color: var(--brand); font-weight: 600; }
.try-img-opts summary::-webkit-details-marker { display: none; }
.try-img-opts summary::after { content: " ▾"; }
.try-img-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 10px; width: 250px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
.try-img-panel label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--fg-secondary); font-weight: 550; }
.try-img-panel select { padding: 4px 6px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--fg); font: inherit; }
.try-img-panel input[type="color"] { width: 44px; height: 28px; padding: 0 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); }
.try-draw-dialog { width: min(100% - 24px, 960px); text-align: left; }
.try-words { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.try-words[hidden] { display: none; }
.try-words-input { flex: 1 1 220px; min-width: 0; padding: 6px 9px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; }
.try-words-note { flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--fg-muted); }
.try-words-note.is-bad { color: var(--danger); }
.try-draw-dialog[open] { align-items: stretch; }
.try-draw-dialog h2, .try-help-dialog h2 { margin: 0; font-size: 20px; }
.try-draw-lead, .try-draw-note { margin: 0; font-size: 13.5px; color: var(--fg-muted); }
.try-draw-canvas { width: 100%; aspect-ratio: 5 / 2; border: 1px solid var(--border); border-radius: 12px; background: #ffffff; touch-action: none; cursor: crosshair; }
.try-draw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.try-draw-spacer { flex: 1 1 auto; }
.try-help-dialog { text-align: left; }
.try-help-dialog[open] { align-items: stretch; }
.try-help-list { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 0; font-size: 13.5px; }
.try-help-list dt { white-space: nowrap; color: var(--fg); font-weight: 600; }
.try-help-list dd { margin: 0; color: var(--fg-secondary); }
.try-help-list kbd, .try-help-list code { padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--bg-subtle); font: 12px "Cascadia Mono", Consolas, monospace; }
.try-help-dialog > .btn { align-self: flex-end; }

/* ==========================================================================
   Reading pages (Handwritten notes, Printed & typed pages): the 2026 look.
   Desktop: the original and the converted page side by side, each scrolling
   on its own under a sticky export bar. Tablet: the tools become the top
   menu (as on a phone) and the two sides become a Converted / Original
   switch, so each gets the full width. Phone: the same, with Copy and
   Download in a bar along the bottom of the screen, under the thumb.
   ========================================================================== */

/* Upload: a softer, brighter drop zone. */
.try-drop { position: relative; overflow: hidden; border: 1.5px dashed color-mix(in srgb, var(--brand) 35%, var(--border)); border-radius: 24px; background:
  radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%), var(--bg); }
.try-drop.is-over { border-style: solid; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.try-drop-plus { width: 76px; height: 76px; border-radius: 22px; background: linear-gradient(160deg, var(--brand-hi), var(--brand) 60%, var(--brand-pressed)); box-shadow: 0 12px 30px color-mix(in srgb, var(--brand) 32%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }
.try-drop-plus:hover { transform: translateY(-2px); }
.try-drop-btn { border-color: var(--border); background: var(--bg); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.try-drop-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }

/* Tips for a photo that reads well. */
.try-tips { margin-top: 16px; padding: 18px 20px; border: 1px solid var(--border-subtle); border-radius: 18px; background: var(--bg); }
.try-tips[hidden] { display: none; }
.try-tips-title { margin: 0 0 12px; color: var(--fg); font-size: 15px; font-weight: 700; }
.try-tips-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.try-tips-list li { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--bg-subtle); color: var(--fg-secondary); font-size: 13px; line-height: 1.45; }
.try-tips-list svg { flex: none; padding: 7px; border-radius: 10px; background: var(--brand-tint); color: var(--brand); box-sizing: content-box; }
.try-tips-list strong { display: block; margin-bottom: 2px; color: var(--fg); font-size: 13.5px; }

/* Good to know: four small cards with an icon each. */
.try-good { padding: 22px; border-radius: 20px; }
.try-good-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.try-good-grid > div { position: relative; padding: 14px 16px 14px 58px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-subtle); }
.try-good-grid strong { display: block; margin-bottom: 2px; }
.try-good-icon { position: absolute; top: 14px; left: 14px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--brand-tint); color: var(--brand); }

/* The review workspace. */
.try-ocr-workspace { gap: 14px; }
.try-ocr-exportbar { position: sticky; top: calc(var(--site-header-height, 64px) + 8px); z-index: 5; gap: 10px; padding: 10px 12px; border-color: var(--border-subtle); border-radius: 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06); }
.try-ocr-exportbar .btn { min-height: 40px; border-radius: 10px; font-weight: 600; }
.try-ocr-exportbar #try-ocr-download { padding-left: 22px; padding-right: 22px; }
#try-ocr-new::before { content: "←"; margin-right: 6px; }
.try-ocr-compare { display: none; }
.try-ocr-review-grid { gap: 16px; align-items: stretch; }
.try-ocr-pane { gap: 12px; min-height: 0; padding: 14px; border-radius: 18px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.try-ocr-pane-head { flex-wrap: wrap; row-gap: 8px; }
.try-ocr-pane-head h2 { font-size: 12px; letter-spacing: .1em; }
.try-ocr-pane-head > span { min-width: 0; max-width: 100%; }
/* Both sides as tall as the screen allows, each scrolling on its own. */
.try-ocr-original-view, .try-ocr-typeset, .try-ocr-converted-pane textarea { height: clamp(460px, calc(100vh - var(--site-header-height, 64px) - 230px), 1100px); min-height: 0; }
.try-ocr-original-view { place-items: start center; padding: 14px; border: 0; border-radius: 12px; background:
  repeating-conic-gradient(color-mix(in srgb, var(--fg) 4%, transparent) 0 25%, transparent 0 50%) 0 0 / 20px 20px, var(--bg-subtle); }
.try-ocr-original-view img { width: auto; max-width: 100%; max-height: none; border-radius: 6px; box-shadow: 0 2px 10px rgba(15, 23, 42, .18); }
.try-ocr-view-switch { padding: 3px; border-radius: 999px; }
.try-ocr-view-switch button { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 550; }
.try-ocr-review { border-radius: 12px; }
/* The converted page reads like a sheet of paper, lines from the left. */
.try-ocr-typeset { padding: 28px 32px; border: 0; border-radius: 12px; background: var(--bg-subtle); font-size: 16px; line-height: 1.75; }
.try-ocr-typeset.is-lines { white-space: normal; }
.try-ocr-typeset > h3 { margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-subtle); color: var(--fg-muted); font: 700 12px/1.4 "Inter", system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.try-ocr-typeset > h3:first-child { margin-top: 0; }
.try-ocr-line { padding: 4px 0; overflow-wrap: break-word; }
.try-ocr-figure { display: block; max-width: min(100%, 520px); height: auto; margin: 8px 0; border: 1px solid var(--border-subtle); border-radius: 6px; background: #fff; }
.try-ocr-line math { display: inline math; margin: 0 .12em; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; }
.try-ocr-converted-pane textarea { padding: 18px 20px; border-radius: 12px; }
@media (prefers-color-scheme: light) {
  .try-ocr-typeset { background: #fff; box-shadow: inset 0 0 0 1px var(--border-subtle); color: #111827; }
}

/* Tablets: the tool list becomes the top menu, as on a phone, and one side shows at a time. */
@media (max-width: 1024px) {
  .try-shell.shell { grid-template-columns: minmax(0, 1fr); }
  .try-shell .sidebar { position: relative; top: 0; height: auto; gap: 10px; padding: 12px 24px; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .try-shell .mobile-menu-toggle { display: flex; }
  .try-shell .sidebar:not(.is-menu-open) .try-menu, .try-shell .sidebar:not(.is-menu-open) .sidebar-foot { display: none; }
  .try-shell .sidebar.is-menu-open .try-menu, .try-shell .sidebar.is-menu-open .sidebar-foot { display: flex; flex-direction: column; gap: 2px; }
  .try-shell .sidebar.is-menu-open .try-menu { margin-top: 8px; padding: 6px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg); box-shadow: 0 12px 28px rgba(15, 23, 42, .12); }
  .try-shell .sidebar.is-menu-open .sidebar-foot { margin-top: 8px; padding: 6px; border-top: 1px solid var(--border-subtle); }
  .try-shell .app { max-width: none; padding: 22px 24px; }
  .try-tips-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .try-ocr-compare { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--bg); }
  .try-ocr-compare button { flex: 1 1 0; min-height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--fg-secondary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
  .try-ocr-compare button[aria-selected="true"] { background: var(--brand); color: #fff; box-shadow: 0 1px 3px color-mix(in srgb, var(--brand) 35%, transparent); }
  .try-ocr-compare button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .try-ocr-export-spacer { display: none; }
  .try-ocr-exportbar .try-select { flex: 1 1 200px; min-width: 0; }
  .try-ocr-review-grid { grid-template-columns: minmax(0, 1fr); }
  .try-ocr-review-grid[data-show="result"] > .try-ocr-original-pane, .try-ocr-review-grid[data-show="original"] > .try-ocr-converted-pane { display: none; }
  .try-ocr-original-view, .try-ocr-typeset, .try-ocr-converted-pane textarea { height: auto; min-height: 60vh; max-height: none; }
  .try-ocr-original-view { overflow: visible; }
  .try-ocr-pane { padding: 14px; }
}

/* Phones. */
@media (max-width: 760px) {
  .try-shell .sidebar { padding: 12px 16px; }
  .try-shell .app { padding: 18px 16px; }
  .try-tips { padding: 14px; }
  .try-tips-list { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .try-tips-list li { flex-direction: row; align-items: flex-start; gap: 12px; padding: 10px 12px; }
  .try-good { padding: 16px; }
  .try-good-grid { grid-template-columns: minmax(0, 1fr); }

  .try-ocr-pane { padding: 10px; border-radius: 16px; }
  .try-ocr-pane-head { padding: 2px 4px 0; }
  .try-ocr-pane-head h2 { font-size: 11.5px; }
  .try-ocr-pane-actions { width: 100%; }
  .try-ocr-pane-actions .btn { flex: 1 1 auto; min-height: 38px; }
  .try-ocr-view-switch { width: 100%; }
  .try-ocr-view-switch button { flex: 1 1 0; min-height: 36px; }
  .try-ocr-typeset { padding: 18px 16px; font-size: 15px; }
  .try-ocr-original-view { padding: 8px; }
  /* Copy and Download along the bottom of the screen, under the thumb. */
  .try-ocr-exportbar { order: 3; position: sticky; top: auto; bottom: 0; margin: 0 -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 24px rgba(15, 23, 42, .1); }
  .try-ocr-export-label, .try-ocr-export-spacer { display: none; }
  .try-ocr-exportbar .try-select { order: -1; flex: 1 1 100%; min-width: 0; }
  .try-ocr-exportbar .btn { flex: 0 0 auto; padding-left: 12px; padding-right: 12px; white-space: nowrap; }
  .try-ocr-exportbar #try-ocr-download { flex: 1 1 auto; }
  #try-ocr-new::before { content: none; }
}

@media (prefers-reduced-motion: reduce) { .try-drop-plus:hover { transform: none; } }
.try-ocr-figure-box { display: block; margin: 8px 0; }
.try-ocr-figure-box .try-ocr-figure { margin: 0 0 6px; }
.try-ocr-figure.is-drawn { padding: 8px; }
.try-ocr-drawing-source { white-space: pre-wrap; font-size: 0.85em; background: var(--surface-subtle, #f6f6f6); padding: 8px; border-radius: 6px; }

/*
 * Every Convert item alike (Handwritten, Printed & typed, Word ⇄ LaTeX, MathML): nothing over the upload
 * but the upload. The format is chosen from the result's own buttons, and who reads pages is asked once
 * the files are in (desktop/ui/pdf.ts), so the bar of choices over the upload steps aside. Pages read in
 * the converter's frame keep its own Start new, so the Try page's bar steps aside there too.
 */
body:is([data-item="printed"], [data-item="handwritten"]) #try-route { display: none !important; }
#try-panel-document .try-upload-top { display: none !important; }
#try-panel-document .try-drop { border-color: color-mix(in srgb, var(--brand) 55%, transparent); background: linear-gradient(160deg, var(--brand-tint), var(--bg) 70%); }
#try-panel-document .try-drop-plus { background: var(--brand); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
#try-panel-document .try-drop-formats li { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
/* A Word file being read: the editor waits, softly, rather than looking stuck. */
#try-workflow-document[aria-busy="true"] :is(#try-doc-source, #try-doc-page) { opacity: .55; pointer-events: none; transition: opacity .2s; }
#try-workflow-document[aria-busy="true"] #try-doc-status::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: tc-spin .8s linear infinite; }
@keyframes tc-spin { to { transform: rotate(360deg); } }

/*
 * Smooth: the converter's frame grows and shrinks with what it shows (web/src/pdf.ts says its height),
 * so there's one scroll, the page's; and each view of the Convert items comes in softly, not with a jump.
 */
.try-pdf-frame.is-sized { min-height: 0; transition: height .28s ease; }
/* Till the converter shows the files (try.ts), the frame is hidden and a spinner holds its place. */
#try-workflow-pdf { position: relative; }
.try-pdf-frame.is-loading { visibility: hidden; }
.try-pdf-frame:not(.is-loading) { animation: tc-enter .26s ease both; }
#try-workflow-pdf:has(.try-pdf-frame.is-loading)::before { content: ""; position: absolute; top: 72px; left: calc(50% - 15px); width: 30px; height: 30px; border: 3px solid color-mix(in srgb, var(--brand) 22%, transparent); border-top-color: var(--brand); border-radius: 50%; animation: try-qr-spin .9s linear infinite; }
:is(#try-upload, #try-workflow-document, #try-workflow-pdf, #try-panel-photo):not([hidden]) { animation: tc-enter .26s ease both; }
@keyframes tc-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .try-pdf-frame.is-sized { transition: none; }
  .try-pdf-frame:not(.is-loading) { animation: none; }
  :is(#try-upload, #try-workflow-document, #try-workflow-pdf, #try-panel-photo):not([hidden]) { animation: none; }
}

/* A list item with its own marker, \item[(A)] or \item[15.]: the marker where the number would be. */
.try-doc-item-label { display: inline-block; min-width: 2.2em; margin-inline-start: -2.2em; }
