/* ============================================
   Pixia â€” AI tool pages (remove background / upscale)
   ============================================ */

:root {
  --at-radius-xl: 24px;
  --at-radius-lg: 18px;
  --at-radius-md: 12px;
  --at-ring: 0 0 0 1px var(--glass-border);
  --at-shadow: 0 18px 48px -26px rgba(0, 0, 0, .5);
  --at-ease: cubic-bezier(.22, .61, .36, 1);
}

.at-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 82% -6%, rgba(217, 70, 239, .16), transparent 60%),
    radial-gradient(820px 500px at 6% 10%, rgba(6, 182, 212, .14), transparent 60%);
}

body.at-body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.at-wrap {
  width: 100%;
  max-width: 1300px;
  margin-inline: auto;
  padding-inline: 22px;
}

.at-main {
  flex: 1 0 auto;
  padding-block: 118px 72px;
}

/* ---------- Header ---------- */
.at-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 900;
  background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-block-end: 1px solid var(--glass-border);
}

.at-header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-block: 14px;
}

.at-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.at-logo-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff9800, #ffc947);
  color: #1b1408;
}

.at-logo-mark svg {
  width: 20px;
  height: 20px;
}

.at-logo em {
  font-style: normal;
  color: var(--accent-primary);
}

.at-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  transition: color .2s var(--at-ease), border-color .2s var(--at-ease);
}

.at-back:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.at-back svg {
  width: 15px;
  height: 15px;
}

[dir="rtl"] .at-back svg {
  transform: scaleX(-1);
}

.at-header-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.at-header-actions .theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
}

html[data-theme="dark"] .theme-toggle .sun-icon,
html[data-theme="light"] .theme-toggle .moon-icon {
  display: none;
}

/* ---------- Breadcrumb ---------- */
.at-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-block-end: 18px;
}

.at-crumbs a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.at-crumbs a:hover {
  color: var(--accent-primary);
}

.at-crumbs span[aria-current] {
  color: var(--text-secondary);
}

/* ---------- Headline ---------- */
.at-head {
  margin-block-end: 30px;
}

.at-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  color: #fff;
}

.at-up .at-kicker {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.at-head h1 {
  margin: 16px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  line-height: 1.1;
  letter-spacing: -.032em;
  font-weight: 700;
}

.at-head p {
  margin: 16px 0 0;
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.at-badges {
  margin-block-start: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.at-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.at-badge svg {
  width: 15px;
  height: 15px;
  color: var(--accent-emerald);
}

[dir="rtl"] .at-badge svg {
  transform: scaleX(-1);
}

/* ---------- Tool layout ---------- */
.at-tool {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.at-panel {
  border-radius: var(--at-radius-xl);
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
  box-shadow: var(--at-shadow);
  padding: 22px;
  min-height: 92px;
}

.at-panel + .at-panel {
  margin-block-start: 18px;
}

.at-panel h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.06rem;
  letter-spacing: -.015em;
}

.at-panel-hint {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* Dropzone */
.at-drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 34px 20px;
  text-align: center;
  border-radius: var(--at-radius-lg);
  border: 1.5px dashed var(--glass-border-hover);
  background: var(--glass-bg);
  cursor: pointer;
  transition: border-color .25s var(--at-ease), background .25s var(--at-ease), transform .25s var(--at-ease);
}

.at-drop:hover,
.at-drop.drag {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 8%, var(--glass-bg));
}

.at-drop.drag {
  transform: scale(1.01);
}

.at-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.at-drop-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(217, 70, 239, .18));
  color: #d946ef;
}

.at-up .at-drop-icon {
  background: linear-gradient(135deg, rgba(6, 182, 212, .18), rgba(59, 130, 246, .18));
  color: #0891b2;
}

.at-drop-icon svg {
  width: 25px;
  height: 25px;
}

.at-drop-title {
  font-size: 15px;
  font-weight: 600;
}

.at-drop-sub {
  font-size: 12.5px;
  color: var(--text-tertiary);
  line-height: 1.55;
}

/* Options */
.at-opt {
  margin-block-start: 18px;
}

.at-opt > label,
.at-legend {
  display: flex;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-secondary);
  margin-block-end: 9px;
}

.at-select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--at-radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: 0;
  /* Make the native picker honour the page theme (dark popup in dark mode,
     light popup in light mode) instead of the OS white default. */
  color-scheme: light dark;
}

.at-select option {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.at-select:focus {
  border-color: var(--accent-primary);
}

/* ============================================
   Modern custom select dropdown
   ============================================ */
.at-select-wrap {
  position: relative;
}

.at-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--at-radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .2s var(--at-ease), box-shadow .2s var(--at-ease);
  user-select: none;
}

.at-select-trigger:hover {
  border-color: var(--glass-border-hover);
}

.at-select-wrap.open .at-select-trigger {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 18%, transparent);
}

.at-select-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.at-select-trigger-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  transition: transform .25s var(--at-ease);
}

.at-select-wrap.open .at-select-trigger-icon {
  transform: rotate(180deg);
}

.at-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 100;
  border-radius: var(--at-radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .35);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  pointer-events: none;
  transition: opacity .2s var(--at-ease), transform .2s var(--at-ease);
}

.at-select-wrap.open .at-select-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.at-select-search {
  padding: 10px 12px;
  border-block-end: 1px solid var(--glass-border);
}

.at-select-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: 0;
}

.at-select-search input:focus {
  border-color: var(--accent-primary);
}

.at-select-options {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.at-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s var(--at-ease), color .15s var(--at-ease);
}

.at-select-option:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.at-select-option.selected {
  background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  color: var(--text-primary);
  font-weight: 600;
}

.at-select-option-label {
  flex: 1;
  min-width: 0;
}

.at-select-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* Scrollbar styling for dropdown */
.at-select-options::-webkit-scrollbar {
  width: 6px;
}

.at-select-options::-webkit-scrollbar-track {
  background: transparent;
}

.at-select-options::-webkit-scrollbar-thumb {
  background: var(--glass-border-hover);
  border-radius: 3px;
}

.at-select-options::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Resize dimension inputs */
.at-num-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.at-num-cell {
  display: grid;
  gap: 6px;
}

.at-num-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-secondary);
}

.at-num {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--at-radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: 0;
}

.at-num:focus {
  border-color: var(--accent-primary);
}

.at-segment {
  display: flex;
  gap: 7px;
}

.at-segment button {
  flex: 1 1 0;
  padding: 10px;
  border-radius: var(--at-radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .22s var(--at-ease);
}

.at-segment button:hover {
  color: var(--text-primary);
  border-color: var(--glass-border-hover);
}

.at-segment button.active {
  color: #1b1408;
  background: linear-gradient(135deg, #ff9800, #ffc947);
  border-color: transparent;
}

.at-switch {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--at-radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.at-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.at-switch i {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--bg-secondary);
  transition: background .22s var(--at-ease);
}

.at-switch i::after {
  content: "";
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .22s var(--at-ease);
}

[dir="rtl"] .at-switch i::after {
  transform: translateX(16px);
}

.at-switch input:checked + i {
  background: var(--accent-primary);
}

.at-switch input:checked + i::after {
  transform: translateX(16px);
}

[dir="rtl"] .at-switch input:checked + i::after {
  transform: translateX(-16px);
}

.at-range {
  width: 100%;
  accent-color: var(--accent-primary);
}

.at-range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.at-range-row output {
  min-width: 34px;
  text-align: end;
  font-size: 12.5px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Buttons */
.at-actions {
  margin-block-start: 20px;
  display: grid;
  gap: 9px;
}

.at-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 20px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .22s var(--at-ease), box-shadow .22s var(--at-ease), opacity .22s var(--at-ease);
  box-shadow: 0 16px 34px -18px rgba(139, 92, 246, .95);
}

.at-up .at-btn {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  box-shadow: 0 16px 34px -18px rgba(6, 182, 212, .95);
}

.at-btn:hover:not([disabled]) {
  transform: translateY(-2px);
}

.at-btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

.at-btn svg {
  width: 18px;
  height: 18px;
}

.at-btn-alt {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  box-shadow: none;
}

.at-btn-alt:hover:not([disabled]) {
  border-color: var(--glass-border-hover);
}

.at-btn-download {
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  color: #1b1408;
  box-shadow: 0 16px 34px -18px rgba(255, 152, 0, .95);
}

/* Stage */
.at-stage {
  position: relative;
  min-height: 340px;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: var(--at-radius-xl);
  border: 1px solid var(--glass-border);
  background:
    repeating-conic-gradient(rgba(128, 128, 128, .16) 0% 25%, transparent 0% 50%) 50% / 22px 22px;
  overflow: hidden;
}

.at-stage-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1.7;
  max-width: 34ch;
}

.at-stage-empty svg {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  color: var(--text-muted);
}

.at-stage img {
  max-width: 100%;
  max-height: 560px;
  border-radius: 8px;
  display: block;
}

.at-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  margin-block-end: 14px;
}

.at-tabs button {
  padding: 7px 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s var(--at-ease);
}

.at-tabs button.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Progress */
.at-progress {
  margin-block-start: 18px;
  display: none;
}

.at-progress.show {
  display: block;
}

.at-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.at-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #d946ef);
  transition: width .3s var(--at-ease);
}

.at-up .at-progress-fill {
  background: linear-gradient(90deg, #06b6d4, #3b82f6);
}

.at-progress-msg {
  margin-block-start: 9px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.at-spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--glass-border-hover);
  border-top-color: var(--accent-primary);
  animation: at-spin .7s linear infinite;
  flex: 0 0 auto;
}

@keyframes at-spin {
  to { transform: rotate(360deg); }
}

.at-meta {
  margin-block-start: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.at-meta code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* FAQ + related */
.at-section {
  margin-block-start: 62px;
}

.at-section h2 {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: -.025em;
}

.at-faq {
  display: grid;
  gap: 11px;
}

.at-faq details {
  border-radius: var(--at-radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  overflow: hidden;
}

.at-faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.at-faq summary::-webkit-details-marker {
  display: none;
}

.at-faq summary::after {
  content: "";
  margin-inline-start: auto;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-inline-end: 2px solid var(--text-tertiary);
  border-block-end: 2px solid var(--text-tertiary);
  transform: rotate(45deg);
  transition: transform .25s var(--at-ease);
}

.at-faq details[open] summary::after {
  transform: rotate(-135deg);
}

.at-faq details p {
  margin: 0;
  padding: 0 20px 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.at-related {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.at-related a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: var(--at-radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  transition: transform .25s var(--at-ease), border-color .25s var(--at-ease);
}

.at-related a:hover {
  transform: translateY(-3px);
  border-color: var(--glass-border-hover);
}

.at-related svg {
  width: 19px;
  height: 19px;
  color: var(--accent-primary);
  flex: 0 0 auto;
}

/* Footer */
.at-footer {
  border-block-start: 1px solid var(--glass-border);
  padding-block: 26px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
}

.at-footer nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.at-footer a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.at-footer a:hover {
  color: var(--accent-primary);
}

@media (max-width: 900px) {
  .at-tool {
    grid-template-columns: 1fr;
  }

  .at-main {
    padding-block: 100px 56px;
  }

  .at-stage {
    min-height: 240px;
  }
}

@media (max-width: 560px) {
  .at-wrap {
    padding-inline: 16px;
  }

  .at-back span {
    display: none;
  }

  .at-stage img {
    max-height: 380px;
  }
}

/* ============================================
   Batch (multi-image) queue
   ============================================ */
.at-batch {
  margin-block-start: 18px;
  padding-block-start: 16px;
  border-block-start: 1px solid var(--glass-border);
}
.at-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 10px;
}
.at-batch-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.at-batch-clear {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s var(--at-ease), border-color .2s var(--at-ease);
}
.at-batch-clear:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}
.at-batch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  /* Clamp the implicit grid track to the panel width. Without this the column
     sizes to max-content (the names are nowrap) and overflows sideways,
     which also drags the remove button out of view. */
  grid-template-columns: minmax(0, 1fr);
  display: grid;
  gap: 8px;
}
.at-batch-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-md);
  background: var(--glass-bg);
  transition: border-color .2s var(--at-ease), background .2s var(--at-ease);
}
.at-batch-item.is-active {
  border-color: #8b5cf6;
  background: color-mix(in srgb, #8b5cf6 10%, var(--glass-bg));
}
.at-batch-thumb {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 9px;
  object-fit: contain;
  background-color: var(--bg-secondary);
  background-image:
    linear-gradient(45deg, var(--glass-border) 25%, transparent 25%),
    linear-gradient(-45deg, var(--glass-border) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--glass-border) 75%),
    linear-gradient(-45deg, transparent 75%, var(--glass-border) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.at-batch-info {
  min-width: 0;
  flex: 1;
}
.at-batch-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.at-batch-status {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.at-batch-item.is-working .at-batch-status { color: #d946ef; }
.at-batch-item.is-done .at-batch-status    { color: #22c55e; }
.at-batch-item.is-error .at-batch-status   { color: #ef4444; }
.at-batch-rm {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: inline-flex;
  transition: color .2s var(--at-ease), background .2s var(--at-ease);
}
.at-batch-rm:hover {
  color: #ef4444;
  background: color-mix(in srgb, #ef4444 12%, transparent);
}
.at-batch-dl {
  flex: 0 0 auto;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 5px;
  transition: border-color .2s var(--at-ease);
}
.at-batch-dl:hover { border-color: #8b5cf6; }
.at-batch-item.is-done .at-batch-dl { display: inline-flex; }

/* ============================================
   Merge: queue position is the page order
   ============================================ */
.at-batch-pos {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, #8b5cf6 16%, transparent);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.at-batch-mv {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 2px;
}
.at-batch-mv-btn {
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 7px;
  display: inline-flex;
  transition: color .2s var(--at-ease), background .2s var(--at-ease);
}
.at-batch-mv-btn:hover:not(:disabled) {
  color: #8b5cf6;
  background: color-mix(in srgb, #8b5cf6 12%, transparent);
}
.at-batch-mv-btn:disabled {
  opacity: .3;
  cursor: default;
}

/* Merge result summary (right-hand panel) */
.at-merge-box {
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-md);
  background: var(--glass-bg);
  overflow: hidden;
}
.at-merge-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-block-end: 1px solid var(--glass-border);
}
.at-merge-head > svg {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  color: #8b5cf6;
}
.at-merge-head-txt {
  min-width: 0;
}
.at-merge-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.at-merge-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.at-merge-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: grid;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}
.at-merge-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 12.5px;
}
.at-merge-list li:nth-child(odd) {
  background: color-mix(in srgb, var(--glass-border) 40%, transparent);
}
.at-merge-pos {
  flex: 0 0 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.at-merge-name {
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.at-merge-pages {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   Long-form page content (prose, steps, CTA)
   ============================================ */
.at-prose {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-secondary);
}
.at-prose ul {
  margin: 16px 0 0;
  padding-inline-start: 20px;
  display: grid;
  gap: 9px;
}
.at-prose li { line-height: 1.65; }
.at-prose strong { color: var(--text-primary); }

.at-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}
.at-step {
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-lg);
  background: var(--glass-bg);
  padding: 20px;
}
.at-step-media {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  border-radius: var(--at-radius-md);
  margin-block-end: 14px;
  background-color: var(--bg-secondary);
}
.at-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-block-end: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, #8b5cf6 18%, transparent);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 700;
}
.at-step h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: -.015em;
}
.at-step p {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
}
.at-step-tip { color: var(--text-muted) !important; font-size: 12.5px !important; }

/* CTA card — matches the .px-cta block on the home page */
.at-cta {
  position: relative;
  margin-block-start: 62px;
  padding: 62px clamp(26px, 5vw, 64px);
  border: 0;
  border-radius: var(--px-radius-xl);
  background: linear-gradient(135deg, #ff9800, #ffc947 52%, #ff8a3d);
  color: #241701;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 40px 90px -46px rgba(255, 152, 0, .9);
}
.at-cta::before,
.at-cta::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .28);
  filter: blur(10px);
  pointer-events: none;
}
.at-cta::before {
  width: 320px;
  height: 320px;
  inset-block-start: -130px;
  inset-inline-start: -70px;
}
.at-cta::after {
  width: 260px;
  height: 260px;
  inset-block-end: -120px;
  inset-inline-end: -50px;
}
.at-cta > * {
  position: relative;
}
.at-cta h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  letter-spacing: -.028em;
  line-height: 1.16;
}
.at-cta p {
  margin: 16px auto 0;
  max-width: 58ch;
  font-size: 1.03rem;
  line-height: 1.68;
  color: rgba(36, 23, 1, .78);
  opacity: 1;
}
.at-cta .at-btn {
  margin-block-start: 30px;
  padding: 16px 30px;
  font-size: 16px;
  background: #241701;
  color: #ffc947;
  box-shadow: 0 16px 34px -18px rgba(36, 23, 1, .8);
}
.at-cta .at-btn:hover:not([disabled]) {
  box-shadow: 0 22px 44px -18px rgba(36, 23, 1, .85);
}
@media (max-width: 560px) {
  .at-cta {
    padding-block: 44px;
  }
}

.at-btn-stop {
  background: var(--glass-bg);
  color: #ef4444;
  border: 1px solid color-mix(in srgb, #ef4444 45%, transparent);
  box-shadow: none;
}
.at-btn-stop:hover:not(:disabled) {
  background: color-mix(in srgb, #ef4444 12%, var(--glass-bg));
}
.at-btn-stop:disabled {
  opacity: .6;
  cursor: progress;
}

/* ============================================
   OCR (body.at-ocr) — accent + text result panel
   ============================================ */
.at-ocr .at-kicker {
  background: linear-gradient(135deg, #059669, #10b981);
}

.at-ocr .at-drop-icon {
  background: linear-gradient(135deg, rgba(5, 150, 105, .18), rgba(16, 185, 129, .18));
  color: #047857;
}

.at-ocr .at-btn {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 16px 34px -18px rgba(5, 150, 105, .95);
}

.at-ocr .at-progress-fill {
  background: linear-gradient(90deg, #059669, #10b981);
}

.at-text-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 10px;
}

.at-text-head h2 {
  margin: 0;
}

.at-text-copy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, #10b981 40%, transparent);
  background: color-mix(in srgb, #10b981 10%, var(--glass-bg));
  color: #047857;
  font: 600 12.5px/1 var(--font-body);
  cursor: pointer;
  transition: background .2s, transform .2s;
}

.at-text-copy svg {
  width: 14px;
  height: 14px;
}

.at-text-copy:hover:not([disabled]) {
  background: color-mix(in srgb, #10b981 18%, var(--glass-bg));
  transform: translateY(-1px);
}

.at-text-copy[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

.at-text {
  display: block;
  width: 100%;
  min-height: 220px;
  height: 539px;
  max-height: 600px;
  overflow: auto;
  resize: vertical;
  padding: 14px 16px;
  border-radius: var(--at-radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary, inherit);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  /* Recognised text is preformatted: keep Tesseract's own line breaks. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.at-text:focus-visible {
  outline: 2px solid color-mix(in srgb, #10b981 60%, transparent);
  outline-offset: 1px;
}
