/* ==========================================================================
   PDFMaster - OCR PDF (Optical Character Recognition & Searchable PDF)
   Production-Grade · Clean & Minimal UI/UX · Dark/Light Mode · Low-RAM Architecture
   ========================================================================== */

/* ===== DESIGN TOKENS ===== */
:root {
  --accent: #e8372a;
  --accent-dark: #c42d21;
  --accent-light: rgba(232, 55, 42, 0.08);
  --accent-glow: rgba(232, 55, 42, 0.25);

  --shield-green: #10b981;
  --shield-green-dark: #059669;
  --shield-green-bg: rgba(16, 185, 129, 0.1);
  --shield-green-border: rgba(16, 185, 129, 0.35);

  --warning-orange: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.35);

  --danger-red: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.3);

  --font-heading: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --transition: 0.2s ease;
  --max-w: 1240px;
  --nav-h: 68px;
}

[data-theme="light"] {
  --bg: #f8f7f5;
  --surface: #ffffff;
  --surface-2: #f2f1ef;
  --surface-3: #eae9e6;
  --border: #e4e2de;
  --border-focus: #c8c5be;
  --text: #1a1917;
  --text-2: #4a4845;
  --text-3: #7a7875;
  --nav-bg: rgba(248, 247, 245, 0.94);
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
  --modal-overlay: rgba(15, 15, 15, 0.65);
  --badge-bg: #f1f0ee;
  --thumb-bg: #ffffff;
  --scan-line: rgba(232, 55, 42, 0.6);
  --box-highlight: rgba(232, 55, 42, 0.25);
  --box-border: rgba(232, 55, 42, 0.7);
}

[data-theme="dark"] {
  --bg: #111110;
  --surface: #1c1b1a;
  --surface-2: #252422;
  --surface-3: #2e2c2a;
  --border: #333230;
  --border-focus: #4a4845;
  --text: #f0ede8;
  --text-2: #b5b0a8;
  --text-3: #7a7875;
  --nav-bg: rgba(17, 17, 16, 0.94);
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --modal-overlay: rgba(0, 0, 0, 0.82);
  --badge-bg: #272523;
  --thumb-bg: #181716;
  --scan-line: rgba(232, 55, 42, 0.8);
  --box-highlight: rgba(232, 55, 42, 0.35);
  --box-border: rgba(232, 55, 42, 0.85);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition:
    background var(--transition),
    color var(--transition);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== NAVBAR ===== */
.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  transition:
    background var(--transition),
    border-color var(--transition);
}

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: contain;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-text span {
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.recovery-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.theme-toggle:hover,
.recovery-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-focus);
}

.theme-toggle svg,
.recovery-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.recovery-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  animation: pulse-badge 2s infinite ease-in-out;
}

@keyframes pulse-badge {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(232, 55, 42, 0.6);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(232, 55, 42, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(232, 55, 42, 0);
  }
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  gap: 4px;
  transition: all var(--transition);
}

.hamburger-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-focus);
}

.h-bar {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.25s ease;
}

/* ===== SIDE MENU (MOBILE) ===== */
.side-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0.3s;
}

.side-overlay.active {
  opacity: 1;
  visibility: visible;
}

.side-menu {
  position: fixed;
  top: 0;
  right: -320px;
  width: min(300px, 85vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 1200;
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.side-menu.active {
  right: 0;
}

.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.side-menu-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  transition: all var(--transition);
}

.close-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition);
}

.side-nav a:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.side-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  padding: 14px 0;
  font-size: 0.85rem;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.breadcrumb__list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb__item a {
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb__item a:hover {
  color: var(--accent);
}

.breadcrumb__sep {
  color: var(--text-3);
}

/* ===== HERO SECTION ===== */
.hero {
  padding: 44px 0 28px;
  text-align: center;
}

.hero__inner {
  max-width: 840px;
  margin: 0 auto;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--shield-green-bg);
  color: var(--shield-green-dark);
  border: 1px solid var(--shield-green-border);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 18px;
}

[data-theme="dark"] .hero__badge {
  color: var(--shield-green);
}

.hero__title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--text);
}

.hero__title .accent {
  color: var(--accent);
}

.hero__sub {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 680px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

.hero__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  color: var(--text-2);
}

.pill svg {
  color: var(--shield-green);
}

/* ===== TOOL SECTION & DROPZONE ===== */
.tool-section {
  padding: 10px 0 40px;
}

.upload-zone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  max-width: 780px;
  margin: 0 auto;
  box-shadow: var(--card-shadow);
}

.upload-zone:hover,
.upload-zone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}

.upload-zone__icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  transition: transform var(--transition);
}

.upload-zone:hover .upload-zone__icon {
  transform: scale(1.1);
}

.upload-zone__title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.upload-zone__sub {
  color: var(--text-3);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.upload-zone__formats {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 20px;
}

#fileInput {
  display: none;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 28px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all var(--transition);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--text-3);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(232, 55, 42, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 10px;
  transition: all var(--transition);
}

.btn-ghost:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 14px 34px;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-red);
  border: 1px solid var(--danger-border);
}

.btn-danger:hover {
  background: var(--danger-red);
  color: #fff;
}

/* ===== ACTIVE WORKSPACE ===== */
.workspace {
  display: none;
  margin-top: 10px;
}

.file-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 auto 24px;
  max-width: 920px;
  box-shadow: var(--shadow-sm);
}

.file-info-bar__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.file-info-bar__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-info-bar__name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  word-break: break-all;
}

.file-info-bar__size {
  font-size: 0.84rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-2);
}

/* Zero-Trace Ephemeral RAM Banner */
.zero-trace-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--shield-green-border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.zero-trace-banner__icon {
  color: var(--shield-green);
  flex-shrink: 0;
  margin-top: 2px;
}

.zero-trace-banner__tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--shield-green);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.zero-trace-banner__desc {
  font-size: 0.84rem;
  color: var(--text-2);
  line-height: 1.5;
}

/* ===== WORKSPACE CONFIGURATION LAYOUT ===== */
.workspace-grid {
  display: block;
  max-width: 920px;
  margin: 0 auto 30px;
}

/* Configuration Panels */
.security-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.config-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.config-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.config-card__title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.config-card__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.config-card__icon.is-green {
  background: var(--shield-green-bg);
  color: var(--shield-green);
}

.config-card__title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.config-card__desc {
  font-size: 0.86rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.form-select,
.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: all var(--transition);
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Radio Cards Grid */
.radio-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.radio-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--accent);
}

.radio-card:hover {
  border-color: var(--border-focus);
}

.radio-card.is-active {
  background: var(--accent-light);
  border-color: var(--accent);
}

.radio-card__title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.radio-card__desc {
  font-size: 0.76rem;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.4;
}

/* Page Range Switcher */
.page-range-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.range-tab-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.range-tab-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.custom-range-input-wrap {
  display: none;
  margin-top: 8px;
}

.custom-range-input-wrap.is-visible {
  display: block;
}

/* Toggle Switch / Checkbox Row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  gap: 12px;
}

.toggle-row:hover {
  border-color: var(--border-focus);
}

.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.toggle-row__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.toggle-row__desc {
  font-size: 0.78rem;
  color: var(--text-3);
}

/* Output Formats Pill Grid */
.output-checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.output-pill-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.output-pill-check input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Right Column: Engine HUD Card */
.shield-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.shield-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #ff7b54, var(--accent));
  background-size: 200% 100%;
  animation: gradientFlow 3s ease infinite;
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.shield-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  position: relative;
}

.shield-icon.is-active-scan::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  animation: rotate 6s linear infinite;
}

.shield-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.shield-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 22px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.shield-specs {
  list-style: none;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.86rem;
}

.shield-specs li {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shield-spec__label {
  color: var(--text-3);
}

.shield-spec__val {
  font-weight: 700;
  color: var(--text);
}

.shield-privacy-note {
  font-size: 0.78rem;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.45;
}

/* ===== BOTTOM ACTION BAR ===== */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  bottom: 20px;
  z-index: 50;
  gap: 16px;
  max-width: 920px;
  margin: 20px auto 0;
}

@media (max-width: 650px) {
  .action-bar {
    flex-direction: column;
    text-align: center;
  }
  .action-bar__btn-wrap {
    width: 100%;
  }
  .action-bar__btn-wrap .btn-primary {
    width: 100%;
  }
}

.action-bar__status {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== PROGRESS & BENCHMARK HUD ===== */
.progress-hud {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 920px;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-sm);
}

.progress-hud__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-hud__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-hud__pct {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--accent);
}

.progress-track {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ff7b54);
  border-radius: var(--radius-full);
  transition: width 0.25s ease-out;
}

.progress-hud__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-3);
  flex-wrap: wrap;
  gap: 8px;
}

.progress-hud__status-txt {
  font-weight: 600;
  color: var(--text-2);
}

/* ===== OCR STUDIO & RESULTS INSPECTOR ===== */
.ocr-studio {
  display: none;
  margin-top: 24px;
}

/* Metrics Summary Bar */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.metric-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-card__icon.is-green {
  background: var(--shield-green-bg);
  color: var(--shield-green);
}

.metric-card__val {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.metric-card__label {
  font-size: 0.78rem;
  color: var(--text-3);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

/* Studio Split Workspace */
.studio-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

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

.studio-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 600px;
}

.studio-panel__header {
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.studio-panel__title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-panel__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Left Panel: Preview Canvas */
.preview-viewport {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
}

.preview-canvas-wrap {
  position: relative;
  box-shadow: var(--shadow);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  line-height: 0;
}

.preview-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* OCR Bounding Boxes Layer */
.bbox-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bbox-box {
  position: absolute;
  background: var(--box-highlight);
  border: 1px solid var(--box-border);
  border-radius: 2px;
  pointer-events: auto;
  cursor: pointer;
  transition: background 0.15s ease;
}

.bbox-box:hover {
  background: rgba(232, 55, 42, 0.55);
}

/* Right Panel: Extracted Text Editor */
.editor-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.editor-tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.editor-tabs-bar .btn-secondary.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.page-tab-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.page-tab-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.ocr-textarea {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.94rem;
  line-height: 1.65;
  padding: 18px 20px;
  resize: none;
  outline: none;
}

/* Download Actions Toolbar */
.studio-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  gap: 14px;
}

.studio-actions-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Spinner */
.spinner {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

/* ===== CONTENT & SEO SECTIONS ===== */
.content-section {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.section-head {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 44px;
}

.section-head h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--text);
}

.section-head p {
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.6;
}

/* Steps Grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  position: relative;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.step-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.step-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.step-card p {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.55;
}

/* Feature Cards Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.feat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.feat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.feat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.feat-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.feat-card p {
  font-size: 0.92rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* Comparison Table */
.comparison-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.comparison-table-wrap {
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.comparison-table th,
.comparison-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.comparison-table th {
  background: var(--surface-2);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.comparison-table th.highlight-col,
.comparison-table td.highlight-col {
  background: rgba(232, 55, 42, 0.04);
}

[data-theme="dark"] .comparison-table th.highlight-col,
[data-theme="dark"] .comparison-table td.highlight-col {
  background: rgba(232, 55, 42, 0.08);
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--shield-green);
  font-weight: 700;
}

.cross-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--danger-red);
  font-weight: 700;
}

/* Architecture Section */
.arch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  box-shadow: var(--shadow-sm);
}

.arch-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 28px 0;
  position: relative;
}

.arch-node {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  position: relative;
}

.arch-node__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}

.arch-node__title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.arch-node__desc {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.45;
}

/* FAQ Accordion */
.faq-grid {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.faq-item[open] {
  border-color: var(--accent);
}

.faq-summary {
  padding: 18px 22px;
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  gap: 12px;
  color: var(--text);
}

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

.faq-summary svg {
  color: var(--text-3);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.faq-item[open] .faq-summary svg {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-answer {
  padding: 0 22px 20px;
  font-size: 0.94rem;
  color: var(--text-2);
  line-height: 1.65;
}

.faq-answer p:not(:last-child) {
  margin-bottom: 12px;
}

/* Related Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.tool-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.tool-card p {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 16px;
}

.tool-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
}

.tool-card-link svg {
  transition: transform var(--transition);
}

.tool-card-link:hover svg {
  transform: translateX(3px);
}

/* Back to Top */
.back-top {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  left: auto !important;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 900;
  cursor: pointer;
}

.back-top.active,
.back-top.visible,
.back-top.show {
  opacity: 1;
  visibility: visible;
}

.back-top:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .back-top {
    bottom: 20px !important;
    right: 16px !important;
    left: auto !important;
    width: 40px;
    height: 40px;
  }
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  max-width: 420px;
  transform: translateY(30px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast.success {
  border-left: 4px solid var(--shield-green);
}

.toast.error {
  border-left: 4px solid var(--danger-red);
}

.toast.info {
  border-left: 4px solid var(--accent);
}

.toast.warning {
  border-left: 4px solid var(--warning-orange);
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.toast.success .toast-icon {
  color: var(--shield-green);
}

.toast.error .toast-icon {
  color: var(--danger-red);
}

.toast.info .toast-icon {
  color: var(--accent);
}

.toast.warning .toast-icon {
  color: var(--warning-orange);
}

.toast-btn {
  padding: 5px 12px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: auto;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}

.toast-btn:hover {
  background: var(--accent-dark);
}

