/* ===== DESIGN TOKENS ===== */
:root {
  --accent: #e8372a;
  --accent-dark: #c42d21;
  --accent-light: rgba(232, 55, 42, 0.08);
  --accent-glow: rgba(232, 55, 42, 0.25);
  --rotate-blue: #2563eb;
  --rotate-blue-dark: #1d4ed8;
  --rotate-blue-bg: rgba(37, 99, 235, 0.1);
  --rotate-blue-glow: rgba(37, 99, 235, 0.25);
  --success-green: #10b981;
  --success-green-dark: #059669;
  --success-bg: rgba(16, 185, 129, 0.1);
  --font-heading: "Sora", sans-serif;
  --font-body: "DM Sans", 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: 1200px;
  --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.92);
  --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);
}

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

/* ===== 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);
  border: none;
  background: none;
}

ol,
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ===== 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;
}

/* Header Buttons */
.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);
  }
}

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

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

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

/* ===== MOBILE SIDE MENU ===== */
.side-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.side-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

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

.side-menu.open {
  transform: translateX(-320px);
}

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

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

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

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

.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-weight: 500;
  font-size: 0.94rem;
  transition: all var(--transition);
}

.side-nav a:hover {
  background: var(--surface-2);
  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);
  background: var(--surface);
}

.breadcrumb__list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

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

.breadcrumb__sep {
  color: var(--border-focus);
}

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

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

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
  border: 1px solid rgba(232, 55, 42, 0.18);
}

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

.hero__title .accent {
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, #ff6b4a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__sub {
  font-size: 1.1rem;
  color: var(--text-2);
  margin-bottom: 24px;
  line-height: 1.6;
}

.hero__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

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

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

/* ===== TOOL SECTION ===== */
.tool-section {
  padding: 16px 0 54px;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  position: relative;
  outline: none;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(232, 55, 42, 0.08);
}

.upload-zone:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

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

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

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

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

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  padding: 13px 28px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.96rem;
  box-shadow: 0 4px 14px rgba(232, 55, 42, 0.3);
  transition:
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.86rem;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

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

.btn-rotate-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 13px 28px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 16px rgba(232, 55, 42, 0.35);
  transition:
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
}

.btn-rotate-main:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232, 55, 42, 0.45);
}

.btn-rotate-main:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-xs {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

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

.btn-xs.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-xs-blue {
  background: var(--rotate-blue-bg);
  color: var(--rotate-blue);
  border-color: rgba(37, 99, 235, 0.25);
}

.btn-xs-blue:hover {
  background: rgba(37, 99, 235, 0.2);
  color: var(--rotate-blue-dark);
  border-color: var(--rotate-blue);
}

#fileInput {
  display: none;
}

/* ===== WORKSPACE ===== */
.workspace {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.workspace.active {
  display: block;
}

/* File Info Bar */
.file-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

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

.file-info-bar__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;
}

.file-info-bar__meta {
  min-width: 0;
}

.file-info-bar__name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}

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

.badge-low-ram {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(234, 179, 8, 0.15);
  color: #b45309;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

[data-theme="dark"] .badge-low-ram {
  color: #fde047;
}

.badge-ram {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .badge-ram {
  color: #60a5fa;
}

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

/* Toolbar & Control Panel */
.rotator-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.control-group-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-3);
  letter-spacing: 0.05em;
  margin-right: 6px;
}

.quick-rotations {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.smart-fixes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.range-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
  max-width: 580px;
}

.range-input-wrapper {
  position: relative;
  flex-grow: 1;
}

.range-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

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

.range-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.view-controls-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.filter-tab {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  color: var(--text-2);
  transition: all var(--transition);
}

.filter-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

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

.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Summary Banner */
.summary-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.summary-banner.has-rotations {
  background: var(--rotate-blue-bg);
  border-color: rgba(37, 99, 235, 0.3);
  color: var(--text);
}

.summary-text strong {
  font-weight: 700;
}

.summary-badge-rot {
  color: var(--rotate-blue);
  font-weight: 700;
}

.summary-badge-orig {
  color: var(--text-2);
  font-weight: 700;
}

/* ===== PAGES GRID ===== */
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.pages-grid.grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
}

.pages-grid.grid-lg {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
}

/* Page Card */
.page-card {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  user-select: none;
}

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

.page-card.rotated {
  border-color: var(--rotate-blue);
}

.page-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  transition: background var(--transition);
}

.page-card.rotated .page-card__head {
  background: rgba(37, 99, 235, 0.08);
  color: var(--rotate-blue);
}

.page-card__num {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-orient-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-3);
  text-transform: uppercase;
}

.page-card__actions-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-card__inspect {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-3);
  transition: all var(--transition);
}

.page-card__inspect:hover {
  background: var(--surface-3);
  color: var(--accent);
}

/* Card Body & Dynamic Rotated Viewport */
.page-card__body {
  position: relative;
  aspect-ratio: 1 / 1.15;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}

.page-thumb-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.page-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  background: #ffffff;
}

/* Hover Quick Rotators Overlay */
.page-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.page-card:hover .page-card__overlay,
.page-card:focus-within .page-card__overlay {
  opacity: 1;
  pointer-events: auto;
}

.overlay-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  color: #111110;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
  cursor: pointer;
}

.overlay-btn:hover {
  transform: scale(1.18);
  background: var(--accent);
  color: #ffffff;
}

.overlay-btn:active {
  transform: scale(0.95);
}

/* Angle Badge */
.page-angle-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--rotate-blue);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  display: none;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 6;
}

.page-card.rotated .page-angle-badge {
  display: inline-flex;
}

/* Page Card Footer */
.page-card__footer {
  padding: 8px 10px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.page-rotate-left-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all var(--transition);
  flex-shrink: 0;
}

.page-rotate-left-btn:hover {
  border-color: var(--rotate-blue);
  color: var(--rotate-blue);
  background: var(--rotate-blue-bg);
}

.page-rotate-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all var(--transition);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.page-rotate-btn:hover {
  border-color: var(--rotate-blue);
  color: var(--rotate-blue);
  background: var(--rotate-blue-bg);
}

.page-reset-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-3);
  transition: all var(--transition);
}

.page-reset-btn:hover {
  background: var(--surface-3);
  color: var(--accent);
  border-color: var(--accent);
}

/* Loader in Card */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 0.8rem;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Filter Hidden */
.page-card.filter-hidden {
  display: none !important;
}

/* ===== BOTTOM ACTION BAR ===== */
.action-bar {
  position: sticky;
  bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.action-bar__info {
  font-size: 0.95rem;
  color: var(--text-2);
  font-weight: 500;
}

.action-bar__btns {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== RESULTS / SUCCESS CARD ===== */
.results-card {
  display: none;
  background: var(--surface);
  border: 2px solid var(--success-green);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  margin-top: 28px;
  box-shadow: 0 12px 36px rgba(16, 185, 129, 0.12);
  animation: fadeSlideUp 0.3s ease-out forwards;
}

.results-card.active {
  display: block;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.results-sub {
  color: var(--text-2);
  font-size: 0.95rem;
  margin-bottom: 24px;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.results-stats {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
}

.results-stat-val {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.results-stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

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

/* ===== LOADING PROGRESS MODAL ===== */
.loading-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.loading-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.loading-modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.loading-modal__icon {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.loading-modal__title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.loading-modal__sub {
  font-size: 0.88rem;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.5;
}

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

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

.loading-modal__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-3);
  margin-bottom: 12px;
}

.loading-mode-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(37, 99, 235, 0.1);
  color: var(--rotate-blue);
  font-size: 0.74rem;
  font-weight: 700;
}

/* ===== INSPECT MODAL ===== */
.inspect-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.inspect-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

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

.inspect-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.inspect-modal__title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.inspect-modal__body {
  padding: 24px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  background: var(--bg);
  min-height: 380px;
}

.inspect-thumb-wrapper {
  max-width: 100%;
  max-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.inspect-canvas {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  background: #ffffff;
}

.inspect-modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
  gap: 12px;
}

.inspect-modal__rotators {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inspect-modal__nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.25s ease;
  z-index: 2500;
  white-space: nowrap;
}

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

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

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

.toast.error {
  border-color: #ef4444;
}

.toast.error .toast-icon {
  color: #ef4444;
}

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

.toast-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-full);
  margin-left: 6px;
  transition: all var(--transition);
}

.toast-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ===== SEO CONTENT SECTIONS ===== */
.section {
  padding: 64px 0;
}

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

.section__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 12px;
}

.section__title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.25;
}

.section__sub {
  font-size: 1.02rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* Overview Layout */
.what-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
}

.what-body p {
  color: var(--text-2);
  margin-bottom: 16px;
  font-size: 0.98rem;
  line-height: 1.7;
}

.what-visual {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.what-visual__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.mini-page {
  width: 44px;
  height: 60px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  transition: transform 0.3s ease;
}

.mini-page.rotated {
  border-color: var(--rotate-blue);
  background: var(--rotate-blue-bg);
  color: var(--rotate-blue);
  transform: rotate(90deg);
}

.what-visual__arrow {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 800;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.comp-table td:first-child {
  font-weight: 600;
  color: var(--text);
}

.comp-table tr:hover td {
  background: var(--surface-2);
}

.comp-highlight {
  background: var(--accent-light) !important;
  color: var(--accent) !important;
  font-weight: 700;
}

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

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

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

.faq-q {
  width: 100%;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  gap: 16px;
  background: none;
}

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

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-a {
  display: none;
  padding: 0 22px 20px;
  font-size: 0.92rem;
  color: var(--text-2);
  line-height: 1.7;
}

.faq-item.open .faq-a {
  display: block;
}

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

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}

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

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

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

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

.tool-card__arrow {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent);
}

/* Contact Strip */
.contact-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
}

.contact-strip h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.contact-strip p {
  color: var(--text-2);
  margin-bottom: 20px;
  font-size: 0.96rem;
}

.contact-strip__email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.05rem;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 54px 0 28px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 40px;
}

.footer__brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.footer__brand-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
}

.footer__brand-name span {
  color: var(--accent);
}

.footer__brand p {
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 18px;
  max-width: 320px;
}

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

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

.footer__social:hover {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--accent);
}

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

.footer__col ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer__col a {
  font-size: 0.88rem;
  color: var(--text-2);
  transition: color var(--transition);
}

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

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

.footer__copy a {
  font-weight: 700;
}

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

.footer__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}

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

.back-top.visible {
  opacity: 1;
  pointer-events: auto;
}

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

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablet & Smaller Desktops (<= 992px) */
@media (max-width: 992px) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .what-grid {
    grid-template-columns: 1fr;
  }
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablets & Large Phones (<= 768px) */
@media (max-width: 768px) {
  .hero__title {
    font-size: 2.1rem;
  }
  .rotator-controls {
    padding: 16px;
  }
  .control-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .quick-rotations,
  .smart-fixes {
    width: 100%;
  }
  .range-input-group {
    max-width: 100%;
    width: 100%;
  }
  .action-bar {
    position: sticky;
    bottom: 12px;
    border-radius: var(--radius);
    padding: 14px 18px;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  }
  .action-bar__info {
    font-size: 0.9rem;
    line-height: 1.35;
  }
  .action-bar__btns {
    width: 100%;
    justify-content: center;
  }
  .btn-rotate-main {
    width: 100%;
    justify-content: center;
  }
  .comp-table {
    min-width: 520px;
  }
  .comp-table th,
  .comp-table td {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
}

/* Standard Mobile Devices (<= 640px) */
@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }
  .hero {
    padding: 36px 0 20px;
  }
  .hero__badge {
    font-size: 0.78rem;
    padding: 4px 12px;
    margin-bottom: 14px;
  }
  .hero__title {
    font-size: 1.85rem;
    line-height: 1.25;
    margin-bottom: 12px;
  }
  .hero__sub {
    font-size: 0.94rem;
    margin-bottom: 24px;
  }
  .upload-zone {
    padding: 36px 16px;
    border-radius: var(--radius);
  }
  .upload-zone__icon {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
  }
  .upload-zone__title {
    font-size: 1.22rem;
  }
  .upload-zone__sub {
    font-size: 0.86rem;
  }
  .upload-badges {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .upload-badge {
    font-size: 0.74rem;
  }
  .workspace {
    padding: 14px;
    border-radius: var(--radius);
  }
  .file-info-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }
  .file-info-bar__left {
    width: 100%;
  }
  .file-info-bar__name {
    max-width: 220px;
    font-size: 0.95rem;
  }
  .file-info-bar__actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .rotator-controls {
    padding: 12px;
    gap: 12px;
    border-radius: var(--radius-sm);
  }
  .control-row {
    gap: 10px;
  }
  .control-group-title {
    display: block;
    width: 100%;
    margin-bottom: 2px;
  }
  .quick-rotations {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .quick-rotations .btn-xs {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    text-align: center;
    font-size: 0.76rem;
    padding: 7px 6px;
  }
  .quick-rotations .btn-xs:last-child {
    flex: 1 1 100%;
  }
  .smart-fixes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .smart-fixes .btn-xs {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    font-size: 0.76rem;
    padding: 7px 8px;
  }
  .history-btns {
    display: flex;
    gap: 6px;
    width: 100%;
    justify-content: flex-end;
  }
  .range-input-group {
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    gap: 6px;
  }
  .range-input-wrapper {
    width: 100%;
    flex: 1 1 100%;
  }
  .range-input {
    font-size: 0.86rem;
    padding: 8px 12px 8px 34px;
  }
  .range-input-group .btn-xs {
    flex: 1;
    justify-content: center;
    padding: 7px 4px;
    font-weight: 700;
  }
  .quick-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .quick-actions .btn-xs {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 0.76rem;
    padding: 6px 8px;
  }
  .view-controls-group {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .filter-tabs {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 3px;
    gap: 4px;
  }
  .filter-tab {
    padding: 5px 8px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .summary-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px;
    font-size: 0.84rem;
  }
  .pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
  }
  .pages-grid.grid-sm {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 8px;
  }
  .pages-grid.grid-lg {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .action-bar {
    position: sticky;
    bottom: 12px;
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 8px;
    border-radius: var(--radius);
  }
  .action-bar__info {
    font-size: 0.85rem;
    line-height: 1.35;
  }
  .action-bar__btns {
    width: 100%;
    justify-content: center;
  }
  .btn-rotate-main {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.94rem;
    justify-content: center;
  }
  .results-card {
    padding: 24px 16px;
    margin-top: 20px;
  }
  .results-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
  }
  .results-title {
    font-size: 1.35rem;
  }
  .results-sub {
    font-size: 0.88rem;
    margin-bottom: 18px;
  }
  .results-stats {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
  }
  .results-stats > div:not(.results-stat-divider) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .results-stat-divider {
    display: block !important;
    width: 100% !important;
    height: 1px !important;
    background: var(--border) !important;
  }
  .results-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  .results-actions button {
    width: 100%;
    justify-content: center;
  }
  .what-visual {
    padding: 18px 12px;
    gap: 14px;
  }
  .what-visual__row {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 100%;
  }
  .mini-page {
    width: 32px;
    height: 44px;
    font-size: 0.7rem;
  }
  .what-visual__arrow {
    font-size: 1.1rem;
    margin: 0 4px;
  }
  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .feature-card {
    padding: 20px 16px;
  }
  .steps-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .step-card {
    padding: 24px 18px;
  }
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .tool-card {
    padding: 18px 16px;
  }
  .section {
    padding: 48px 0;
  }
  .section__title {
    font-size: 1.45rem;
  }
  .section__sub {
    font-size: 0.9rem;
  }
  .faq-q {
    padding: 14px 16px;
    font-size: 0.92rem;
  }
  .faq-a {
    padding: 0 16px 14px;
    font-size: 0.86rem;
  }
  .footer {
    padding: 40px 0 20px;
  }
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .footer__bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
  .footer__badges {
    flex-wrap: wrap;
    justify-content: center;
  }
  .back-top {
    bottom: 16px;
    right: 14px;
    width: 38px;
    height: 38px;
  }
  .toast {
    bottom: 74px;
    max-width: calc(100vw - 32px);
    width: auto;
    white-space: normal;
    text-align: center;
    padding: 10px 14px;
    font-size: 0.82rem;
    border-radius: var(--radius);
  }
  .inspect-modal {
    max-height: 94vh;
    margin: 8px;
    width: calc(100vw - 16px);
  }
  .inspect-modal__head {
    padding: 12px 14px;
  }
  .inspect-modal__title {
    font-size: 0.95rem;
  }
  .inspect-modal__body {
    padding: 12px;
    min-height: 220px;
  }
  .inspect-modal__foot {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .inspect-modal__rotators {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .inspect-modal__rotators button {
    flex: 1;
    justify-content: center;
  }
  .inspect-modal__nav {
    width: 100%;
    justify-content: space-between;
  }
  .inspect-modal__nav button {
    flex: 1;
    justify-content: center;
  }
}

/* Small Mobile Devices (<= 480px) */
@media (max-width: 480px) {
  .pages-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
    margin-bottom: 16px;
  }
  .pages-grid.grid-sm {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px;
  }
  .pages-grid.grid-lg {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .page-card {
    border-width: 1.5px;
    border-radius: var(--radius-sm);
  }
  .page-card__head {
    padding: 5px 8px;
  }
  .page-card__num {
    font-size: 0.74rem;
    gap: 4px;
  }
  .page-orient-tag {
    font-size: 0.65rem;
    padding: 1px 4px;
  }
  .page-card__inspect {
    width: 24px;
    height: 24px;
  }
  .page-card__inspect svg {
    width: 12px;
    height: 12px;
  }
  .page-card__body {
    padding: 6px;
    min-height: 130px;
  }
  .page-angle-badge {
    top: 4px;
    right: 4px;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 4px;
  }
  .page-angle-badge svg {
    width: 9px;
    height: 9px;
  }
  .page-card__footer {
    padding: 5px 6px;
    gap: 4px;
  }
  .page-rotate-btn {
    font-size: 0.7rem;
    padding: 5px 4px;
    gap: 3px;
  }
  .page-rotate-btn svg {
    width: 11px;
    height: 11px;
  }
  .page-rotate-left-btn {
    width: 26px;
    height: 26px;
  }
  .page-rotate-left-btn svg {
    width: 11px;
    height: 11px;
  }
  .page-reset-btn {
    width: 26px;
    height: 26px;
  }
  .page-reset-btn svg {
    width: 11px;
    height: 11px;
  }
  .quick-rotations .btn-xs {
    flex: 1 1 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.78rem;
    padding: 8px 10px;
  }
  .view-controls-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .view-controls-group .filter-tabs {
    width: 100%;
    justify-content: center;
  }
  .nav-right {
    gap: 8px;
  }
  .theme-toggle,
  .recovery-btn {
    width: 36px;
    height: 36px;
  }
  .theme-toggle svg,
  .recovery-btn svg {
    width: 16px;
    height: 16px;
  }
  .logo-text {
    font-size: 1.15rem;
  }
  .nav-logo img {
    width: 30px;
    height: 30px;
  }
  .hero__title {
    font-size: 1.65rem;
  }
  .file-info-bar__name {
    max-width: 180px;
  }
}

/* Extra Small Screens (<= 360px) */
@media (max-width: 360px) {
  .container {
    padding: 0 10px;
  }
  .workspace {
    padding: 10px 8px;
  }
  .pages-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px;
  }
  .pages-grid.grid-sm {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px;
  }
  .mini-page {
    width: 26px;
    height: 36px;
    font-size: 0.62rem;
  }
  .file-info-bar__name {
    max-width: 140px;
  }
  .hero__title {
    font-size: 1.48rem;
  }
  .action-bar {
    padding: 10px 12px;
  }
  .btn-rotate-main {
    font-size: 0.88rem;
    padding: 10px 14px;
  }
}
