/* ==========================================================================
   PDFMaster - Extract Photos from PDF Stylesheet
   Clean & Minimal · Strict Brand Palette (#e8372a) · Low-RAM Architecture
   Production Grade · Full Light/Dark Theme Support
   ========================================================================== */

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

  --badge-photo: #2563eb;
  --badge-photo-bg: rgba(37, 99, 235, 0.1);
  --badge-photo-border: rgba(37, 99, 235, 0.25);

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

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

  --font-heading: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  --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;

  /* Checkerboard pattern for transparent images */
  --checker-bg1: #f0f0f0;
  --checker-bg2: #ffffff;
}

[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.72);
  --badge-bg: #f1f0ee;
  --thumb-bg: #f5f6f8;
  --checker-bg1: #eceff2;
  --checker-bg2: #ffffff;
  --viewer-bg: #1e242d;
}

[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.85);
  --badge-bg: #272523;
  --thumb-bg: #181716;
  --checker-bg1: #1f2023;
  --checker-bg2: #141517;
  --viewer-bg: #0f1217;
}

/* ===== 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-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

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

.theme-toggle,
.recovery-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, border-color 0.3s, transform 0.2s, color 0.2s;
  color: var(--text-2);
  flex-shrink: 0;
  cursor: pointer;
}

.theme-toggle:hover,
.recovery-btn:hover {
  background: rgba(232, 55, 42, 0.07);
  border-color: rgba(232, 55, 42, 0.18);
  color: var(--accent);
  transform: scale(1.08);
}

.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);
  }
}

/* Session Recovery Floating Toaster */
.recovery-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2800;
  max-width: 430px;
  width: calc(100vw - 32px);
  margin: 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 16px 42px -8px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: toasterSlideUp 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
  overflow: hidden;
}

.recovery-banner.hiding {
  opacity: 0 !important;
  transform: translateY(20px) scale(0.96) !important;
  pointer-events: none;
}

.recovery-toaster__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.recovery-toaster__progress-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: toasterProgress 7.5s linear forwards;
}

@keyframes toasterProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.recovery-banner:hover .recovery-toaster__progress-bar {
  animation-play-state: paused;
}

@keyframes toasterSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.recovery-toaster__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.18s ease;
  padding: 0;
}

.recovery-toaster__close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.recovery-banner__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 20px;
}

.recovery-banner__icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recovery-banner__title-wrap {
  flex: 1;
  min-width: 0;
}

.recovery-banner__title {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px 0;
  line-height: 1.25;
}

.recovery-banner__file {
  font-size: 0.82rem;
  color: var(--text-2);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recovery-banner__file span#recoveryFileName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 230px;
  font-weight: 500;
}

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

.recovery-banner__size {
  color: var(--text-3);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.recovery-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 48px;
}

.recovery-banner__actions .btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 600px) {
  .recovery-banner {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
  .recovery-banner__actions {
    padding-left: 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;
  padding: 0;
  gap: 5px;
  transition: background 0.2s, border-color 0.2s;
}

.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: transform 0.25s, opacity 0.25s;
}

/* ===== SIDE MENU (MOBILE) ===== */
.side-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-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);
  color: var(--text-2);
  background: transparent;
  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);
  transition: color var(--transition);
}

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

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

/* ===== HERO SECTION ===== */
.hero-section {
  padding: 48px 0 32px;
  text-align: center;
}

.hero-content {
  max-width: 880px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  border: 1px solid rgba(232, 55, 42, 0.2);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

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

.hero-title em {
  font-style: normal;
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, #ff6b5e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 740px;
  margin: 0 auto 28px;
}

.hero-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-2);
  font-weight: 500;
}

.hero-badge svg {
  color: var(--accent);
}

/* ===== TOOL SECTION & UPLOAD ZONE ===== */
.tool-section {
  padding-bottom: 60px;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  background: var(--surface);
  transition: all var(--transition);
  cursor: pointer;
  max-width: 820px;
  margin: 0 auto;
}

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

.upload-zone__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 18px;
  transition: transform var(--transition);
}

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

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

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

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

#fileInput {
  display: none;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition);
  box-shadow: 0 3px 12px rgba(232, 55, 42, 0.3);
  cursor: pointer;
  text-decoration: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(232, 55, 42, 0.4);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  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);
  cursor: pointer;
}

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

.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: 6px 12px;
  transition: all var(--transition);
  cursor: pointer;
}

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

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* ===== 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-bottom: 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.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);
  margin-top: 2px;
}

.file-info-bar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== CONFIGURATION & PAGE RANGE CARD ===== */
.config-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.config-card.highlight-pulse {
  animation: pulse-border 1.5s ease-in-out;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(232, 55, 42, 0.5); border-color: var(--accent); }
  50% { box-shadow: 0 0 0 8px rgba(232, 55, 42, 0.15); border-color: var(--accent); }
  100% { box-shadow: var(--shadow-sm); border-color: var(--border); }
}

.config-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

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

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

.config-card__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

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

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 22px;
}

.config-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-box__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.config-box__label svg {
  color: var(--accent);
}

.range-radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.range-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-2);
  cursor: pointer;
  flex: 1;
  min-width: 130px;
  transition: all var(--transition);
  user-select: none;
}

.range-radio-label input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.range-radio-label:hover {
  border-color: var(--accent);
  color: var(--text);
}

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

.custom-range-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}

.range-input-inner {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.range-text-input {
  width: 100%;
  padding: 10px 92px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--text);
  font-family: var(--font-body);
  transition: all var(--transition);
}

.range-text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.range-status-pill {
  position: absolute;
  right: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-2);
  pointer-events: none;
}

.range-quick-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-3);
  margin-right: 2px;
}

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

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

.config-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color var(--transition);
}

.config-select:focus {
  outline: none;
  border-color: var(--accent);
}

.config-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.4;
  margin-top: 4px;
  user-select: none;
}

.config-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.config-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.config-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-3);
}

.config-hint svg {
  color: var(--accent);
  flex-shrink: 0;
}

.btn-lg {
  padding: 13px 26px;
  font-size: 1.02rem;
  font-weight: 700;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.stats-item--time {
  background: var(--accent-light);
  border: 1px solid rgba(232, 55, 42, 0.2);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stats-item--time:hover {
  background: rgba(232, 55, 42, 0.16);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(232, 55, 42, 0.15);
}

.stats-item--time:active {
  transform: translateY(0);
}

.stats-item--time:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stats-item--time strong {
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 800;
}

.stats-time-icon {
  font-size: 0.88rem;
  animation: pulse-glow 2s infinite ease-in-out;
}

/* Live Stats & Diagnostics Strip */
.stats-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.stats-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-2);
}

.stats-item strong {
  color: var(--text);
  font-weight: 700;
}

.stats-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.stats-badge.good {
  background: var(--success-bg);
  color: var(--success-green-dark);
  border: 1px solid var(--success-border);
}

/* Progress Box */
.progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  display: none;
}

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

.progress-title {
  font-weight: 700;
  font-size: 0.95rem;
}

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

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

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

.progress-sub {
  font-size: 0.82rem;
  color: var(--text-3);
}

/* Controls & Filter Toolbar */
.toolbar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-3);
}

.filter-select {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

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

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.filter-check input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

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

/* Gallery Grid */
.gallery-section {
  display: block;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
}

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

.photo-thumb-wrap {
  position: relative;
  height: 220px;
  background-color: var(--thumb-bg);
  background-image: 
    linear-gradient(45deg, var(--checker-bg1) 25%, transparent 25%), 
    linear-gradient(-45deg, var(--checker-bg1) 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, var(--checker-bg1) 75%), 
    linear-gradient(-45deg, transparent 75%, var(--checker-bg1) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
  overflow: hidden;
}

.photo-thumb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.photo-thumb-wrap:hover .photo-thumb-img {
  transform: scale(1.04);
}

/* Badges on Thumbnail */
.photo-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.photo-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}

.photo-badge.jpg {
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
}

.photo-badge.png {
  background: rgba(37, 99, 235, 0.9);
  color: #fff;
}


.photo-badge.other {
  background: rgba(100, 116, 139, 0.9);
  color: #fff;
}

.photo-check-wrap {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.photo-check {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.photo-meta {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.photo-dimensions {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.photo-details-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-3);
}

.photo-source-tag {
  font-size: 0.74rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.photo-actions .btn-primary {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.photo-inspect-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.photo-inspect-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-focus);
}

/* Empty State */
.empty-gallery {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 30px;
  display: none;
}

.empty-gallery__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--text-3);
}

.empty-gallery__title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-gallery__desc {
  color: var(--text-2);
  font-size: 0.95rem;
  max-width: 500px;
  margin: 0 auto 20px;
}



/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.lightbox-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
}

.lightbox-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  overflow: hidden;
  flex: 1;
}

.lightbox-view {
  background-color: var(--thumb-bg);
  background-image: 
    linear-gradient(45deg, var(--checker-bg1) 25%, transparent 25%), 
    linear-gradient(-45deg, var(--checker-bg1) 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, var(--checker-bg1) 75%), 
    linear-gradient(-45deg, transparent 75%, var(--checker-bg1) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}

.lightbox-img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  box-shadow: var(--shadow);
}

.lightbox-sidebar {
  padding: 20px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.lightbox-meta-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lightbox-meta-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.lightbox-meta-val {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

/* ===== FEATURES SECTION ===== */
.features-section {
  padding: 80px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 680px;
  margin-bottom: 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

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

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

.feature-card__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;
}

.feature-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

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

/* ===== HOW-TO SECTION ===== */
.howto-section {
  padding: 80px 0;
}

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

.step-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
}

.step-number {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.3;
  line-height: 1;
  margin-bottom: 12px;
}

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

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

/* ===== COMPARISON TABLE SECTION ===== */
.comparison-section {
  padding: 80px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.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;
  color: var(--text);
}

.comparison-table td.highlight {
  background: rgba(232, 55, 42, 0.04);
  font-weight: 600;
  color: var(--accent);
}

.comparison-table th.highlight {
  background: rgba(232, 55, 42, 0.04);
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.comparison-table th.highlight span {
  color: var(--accent);
}

/* ===== FAQ SECTION ===== */
.faq-section {
  padding: 80px 0;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 860px;
}

.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(--border-focus);
}

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

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

.faq-q svg {
  color: var(--text-3);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

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

.faq-a {
  padding: 0 22px 20px;
  font-size: 0.94rem;
  color: var(--text-2);
  line-height: 1.65;
  border-top: 1px solid transparent;
}

.faq-item[open] .faq-a {
  border-top-color: var(--border);
  padding-top: 16px;
}

/* ===== RELATED TOOLS ===== */
.related-block {
  padding: 80px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

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

.rel-tool-card {
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
}

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

.rel-tool-card__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;
  margin-bottom: 14px;
}

.rel-tool-card h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.rel-tool-card p {
  font-size: 0.86rem;
  color: var(--text-2);
  line-height: 1.5;
  flex: 1;
}

.rel-tool-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 14px;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 60px 0 30px;
  font-size: 0.88rem;
  color: var(--text-2);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}

.footer-col h5 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: var(--text-2);
  transition: color var(--transition);
}

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

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-3);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-badges {
  display: flex;
  gap: 8px;
}

.footer__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-size: 0.74rem;
  color: var(--text-2);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
  .lightbox-body {
    grid-template-columns: 1fr;
  }
  .lightbox-sidebar {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }
  .toolbar-card {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
