:root {
  /* Brand Colors - Vibrant & Trustworthy */
  --brand: #3b82f6;
  --brand-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --brand-glow: 0 0 20px rgba(59, 130, 246, 0.5);

  /* Accent Colors */
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-error: #ef4444;

  /* Neutral Colors */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  /* Backgrounds & Glassmorphism */
  --bg: #f8fafc;
  --bg-gradient: radial-gradient(circle at 50% 0%, #eff6ff 0%, #f8fafc 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --card-bg: rgba(255, 255, 255, 0.8);
  --bg-elev: #ffffff;
  --muted: #64748b;

  /* UI Elements */
  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #64748b;

    --bg: #0f172a;
    --bg-gradient: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);

    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --card-bg: rgba(30, 41, 59, 0.6);
    --bg-elev: #1e293b;
    --muted: #94a3b8;

    --border: #334155;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.2s ease;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.2rem;
}

.brand img {
  display: block;
  height: 40px;
}

.nav {
  display: flex;
  gap: 24px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-link.active,
.nav-link:hover {
  color: var(--brand);
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .site-header {
    padding: 10px 16px;
  }

  .brand img {
    height: 36px;
  }

  .nav {
    display: none;
  }
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 0 60px;
}

/* Animated background mesh */
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.15), transparent 60%),
    radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.1), transparent 50%);
  animation: meshMove 20s linear infinite;
  z-index: -1;
}

@keyframes meshMove {
  0% {
    transform: rotate(0deg);
  }

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

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

/* Glass Panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

/* Trust Badges */
.trust-badges {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}

.trust-icon {
  font-size: 1.2rem;
}

/* Mobile Hero Optimizations */
@media (max-width: 768px) {

  html,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  body {
    position: relative;
  }

  .hero-inner {
    padding: 40px 16px 32px;
  }

  .hero h1 {
    font-size: clamp(22px, 6vw, 32px);
    line-height: 1.2;
    margin-bottom: 12px;
  }

  .hero p {
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.4;
  }
}

@media (max-width: 640px) {
  .hero-inner {
    padding: 36px 22px 30px;
    text-align: left;
  }

  .hero h1,
  .hero p {
    text-align: left;
  }

  .home-drop {
    width: 100%;
    justify-items: stretch;
  }

  .hero-dropzone,
  .suggestions,
  .tool-interface {
    max-width: 520px;
  }

  .hero-dropzone {
    border-radius: 20px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
  }

  .tool-content {
    border-radius: 20px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
  }

  .tools-list.container {
    padding: 0 24px;
  }
}

@media (max-width: 480px) {
  .hero-inner {
    padding: 32px 20px 24px;
  }

  .hero h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .hero p {
    font-size: 0.95rem;
    margin-bottom: 16px;
  }
}


/* Dynamic Tool Interface */
.tool-interface {
  width: 100%;
  max-width: 900px;
  margin: 8px auto 0;
}

.tool-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.mode-callouts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0 0;
}

.mode-note {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-elev) 80%, transparent);
  padding: 12px 16px;
  font-size: 0.95rem;
  color: var(--muted);
}

.mode-note strong {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
}

.mode-note ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.mode-note li {
  margin: 4px 0;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}

.tool-header-actions {
  display: flex;
  gap: 12px;
}

.tool-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

/* Mobile Tool Interface */
@media (max-width: 768px) {
  .tool-interface {
    margin: 4px auto 0;
    padding: 0 12px;
  }

  .tool-header {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 8px;
  }

  .tool-header h2 {
    font-size: 1.3rem;
    text-align: center;
  }

  .tool-header-actions {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .tool-header-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    padding: 10px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tool-panel {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .tool-header-actions {
    flex-direction: column;
    gap: 6px;
  }

  .tool-header-actions .btn {
    flex: none;
    width: 100%;
    font-size: 0.9rem;
    padding: 12px;
  }
}

.btn.secondary {
  background: var(--bg-elev);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  background: var(--bg);
  color: var(--text);
}

.tool-panel {
  padding: 16px;
}

/* Tool-specific styles */
.file-list-display {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.file-item-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.file-item-display:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.file-list-display.reorder-enabled .file-item-display {
  cursor: grab;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.file-list-display.reorder-enabled .file-item-display.dragging {
  opacity: 0.75;
  cursor: grabbing;
}

.file-list-display.reorder-enabled .file-item-display.drag-over {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, var(--bg-elev));
}

.file-list-display.reorder-enabled .file-item-display.drag-over-before {
  box-shadow: 0 -3px 0 0 var(--brand), 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent);
}

.file-list-display.reorder-enabled .file-item-display.drag-over-after {
  box-shadow: 0 3px 0 0 var(--brand), 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent);
}

.file-item-display.is-image {
  align-items: center;
  padding: 14px 16px;
  gap: 16px;
}

.file-item-display .file-preview {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}

.file-item-display .file-icon {
  font-size: 24px;
}

.file-item-display .file-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.file-item-display .drag-handle {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: grab;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  touch-action: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.file-item-display .drag-handle .drag-dots {
  font-size: 16px;
  letter-spacing: 2px;
  line-height: 1;
}

.file-list-display.image-grid .drag-handle {
  align-self: flex-end;
}

.file-item-display .drag-handle:hover,
.file-item-display .drag-handle:focus-visible {
  color: var(--brand-700);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  outline: none;
}

.file-item-display .drag-handle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.file-item-display .drag-handle:active {
  cursor: grabbing;
}

.file-list-display:not(.reorder-enabled) .drag-handle {
  display: none;
}

.file-item-display.is-image .file-preview {
  width: 80px;
  height: 80px;
  border-radius: 10px;
}

.file-item-display.has-thumbnail .file-thumbnail {
  border-radius: 8px;
}

.file-list-display.image-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.file-list-display.image-grid .file-item-display {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.file-list-display.image-grid .file-preview {
  width: 100%;
  height: 180px;
}

.file-list-display.image-grid .file-info {
  width: 100%;
}

.file-item-display .file-info {
  flex: 1;
}

.file-item-display .file-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.file-item-display .file-size {
  color: var(--muted);
  font-size: 0.875rem;
}

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-elev);
  border-radius: 8px;
}

.tool-controls .control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-controls label {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.875rem;
}

.tool-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

.home-drop {
  display: grid;
  gap: 16px;
  place-items: center;
  margin-top: 24px;
}

.hero-dropzone {
  width: 100%;
  max-width: 800px;
  padding: 48px 24px;
  text-align: center;
  transition: all 0.3s ease;
  border: 2px dashed var(--border);
}

.hero-dropzone:hover,
.hero-dropzone.dragover {
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.05);
  transform: scale(1.01);
}

.drop-icon-wrapper {
  width: 64px;
  height: 64px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-md);
}

.drop-icon {
  font-size: 32px;
}

.hero-dropzone strong {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text);
}

.suggestions {
  width: 100%;
  max-width: 900px;
  text-align: left;
}

.suggestions h3 {
  margin: 0 0 10px;
}

.suggestion-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.suggestion-actions .btn {
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
  padding: 16px;
  flex-direction: column;
  gap: 4px;
  min-height: 80px;
  background: var(--card);
  border: 2px solid var(--border);
  box-shadow: none;
  transition: all 0.2s ease;
}

.suggestion-actions .btn:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(23, 135, 255, 0.15);
}

.suggestion-actions .btn.primary {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 5%, var(--card));
}

.suggestion-actions .btn.primary:hover {
  background: color-mix(in srgb, var(--brand) 10%, var(--card));
  box-shadow: 0 4px 20px rgba(23, 135, 255, 0.25);
}

.suggestion-actions .btn span {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.suggestion-actions .btn .note {
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--brand-glow);
  border: none;
}

.btn.primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn.secondary:hover {
  background: white;
  color: var(--brand);
  border-color: var(--brand);
}

/* Mobile Touch Improvements */
@media (max-width: 768px) {

  /* Ensure minimum touch target sizes */
  .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
    font-size: 1rem;
  }

  .tool {
    min-height: 88px;
    position: relative;
  }

  /* Touch feedback */
  .btn:active {
    transform: scale(0.98);
  }

  .tool:active {
    transform: translateY(0px);
  }

  /* Better touch targets for tool buttons */
  .tool::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 18px;
  }

  /* Improved input fields for mobile */
  input[type="number"],
  input[type="text"],
  select {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 16px;
    /* Prevents zoom on iOS */
    border-radius: 8px;
  }

  /* Better file input styling */
  .dropzone label {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Remove hover effects on touch devices */
@media (hover: none) {
  .tool:hover {
    transform: none;
    box-shadow: var(--shadow);
  }

  .btn:hover {
    filter: none;
  }
}

.tools-list {
  padding: 40px 0 30px;
}

.tools-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 60px;
  max-width: 900px;
  margin: 0 auto;
}

.tools-column h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.tool-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-links li {
  margin: 0;
  padding: 0;
}

.tool-links a {
  display: inline-block;
  padding: 10px 0;
  color: var(--brand);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.5;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.tool-links a:hover {
  opacity: 0.7;
}

.tool-links a span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

@media (max-width: 768px) {
  .tools-columns {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .tools-column h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .tool-links {
    gap: 4px;
  }

  .tool-links a {
    padding: 8px 0;
    font-size: 0.9rem;
  }

  .tool-links a span {
    display: block;
    margin-top: 2px;
    font-size: 0.85rem;
  }
}


.privacy {
  padding: 28px 0;
}

/* Mobile Privacy Section */
@media (max-width: 768px) {
  .privacy {
    padding: 24px 0;
  }

  .privacy h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
  }

  .privacy p {
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .privacy {
    padding: 20px 0;
  }

  .privacy h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    text-align: center;
  }

  .privacy p {
    font-size: 0.9rem;
    line-height: 1.65;
  }

  /* Slightly better spacing for hero dropzone */
  .hero-dropzone {
    padding: 26px 18px;
  }

  .dropzone .btn.choose-files {
    padding: 14px 24px;
    font-size: 1.05rem;
  }
}

/* Efficient tools layout */
.tools-categories {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 32px;
  margin-top: 24px;
}

.tool-category h3 {
  margin: 0 0 16px 0;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text);
}

.category-tools {
  display: grid;
  gap: 12px;
}

/* Single PDF category gets 2 columns */
.tool-category:nth-child(1) .category-tools {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

/* Multiple Files and Convert get single column */
.tool-category:nth-child(2) .category-tools,
.tool-category:nth-child(3) .category-tools {
  grid-template-columns: 1fr;
}

/* Responsive adjustments */
@media (max-width: 1000px) {
  .tools-categories {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .tool-category:nth-child(3) {
    grid-column: span 2;
  }

  .tool-category:nth-child(3) .category-tools {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .tools-categories {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .tool-category:nth-child(3) {
    grid-column: span 1;
  }

  .tool-category h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .category-tools {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }

  .tool {
    padding: 12px;
    gap: 4px;
  }

  .tool .title {
    font-size: 0.9rem;
  }

  .tool .desc {
    font-size: 0.8rem;
  }

  .tool .icon {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .tools-categories {
    gap: 16px;
  }

  .category-tools {
    grid-template-columns: 1fr !important;
  }

  .tool {
    padding: 16px;
    text-align: center;
  }

  .tool .title {
    font-size: 1rem;
  }

  .tool .desc {
    font-size: 0.85rem;
  }
}

.site-footer {
  margin-top: 60px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.footer-inner {
  display: flex;
  gap: 24px;
  padding: 32px 20px;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}

.footer-nav a {
  color: var(--text);
  text-decoration: none;
  margin-left: 24px;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: var(--brand);
}

/* Mobile Footer */
@media (max-width: 768px) {
  .site-footer {
    margin-top: 24px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    padding: 20px 16px;
    gap: 12px;
  }

  .footer-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
  }

  .footer-nav a {
    margin: 0;
  }
}

/* Tool pages */
.tool-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.tool-page h1 {
  margin: 8px 0 16px;
  font-size: clamp(24px, 3.2vw, 36px);
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.controls label {
  font-weight: 600;
  color: var(--muted);
}

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

input[type="number"],
input[type="text"],
select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.dropzone {
  border: 2px dashed color-mix(in srgb, var(--brand) 60%, var(--border));
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 6%, transparent), transparent);
  transition: border-color .12s ease, background .12s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dropzone.dragover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}

.dropzone:active {
  transform: scale(0.995);
}

/* Mobile Dropzone */
@media (max-width: 768px) {
  .dropzone {
    padding: 20px 16px;
    border-radius: 12px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .dropzone .btn {
    margin-top: 8px;
    padding: 12px 24px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .dropzone {
    padding: 16px 12px;
    min-height: 100px;
  }

  .dropzone .btn {
    width: 100%;
    max-width: 200px;
    margin: 8px auto 0;
  }
}

.file-list {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  height: 8px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress>span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand-700) 20%, var(--brand)));
  transition: width .15s ease;
}

.note {
  color: var(--muted);
  font-size: .95rem;
  padding: 12px;
  background: var(--bg-elev);
  border-radius: 8px;
  text-align: center;
  margin-top: 16px;
  border: 1px solid var(--border);
}

/* Universal Drop Modal */
.universal-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.universal-modal {
  background: var(--card);
  border-radius: 16px;
  max-width: min(90vw, 600px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text);
  background: var(--bg-elev);
}

.modal-content {
  padding: 20px 24px 24px;
}

.modal-files-list {
  margin-bottom: 20px;
}

.modal-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-elev);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.modal-file-item .file-icon {
  font-size: 16px;
}

.modal-file-item .file-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-file-item .file-size {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Enhanced Tools Grid */
.immediate-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.tool-selection-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
  height: 100%;
  text-align: center;
}

.tool-selection-btn:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: color-mix(in srgb, var(--brand) 5%, var(--bg-elev));
}

.tool-selection-btn.primary {
  background: color-mix(in srgb, var(--brand) 10%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}

.tool-selection-btn span {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}

.tool-selection-btn .note {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: normal;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  font-style: normal;
}

/* Enhanced File List */
.file-list-display {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.file-item-display,
.file-preview-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.2s ease;
}

.file-item-display:hover {
  background: rgba(255, 255, 255, 0.05);
}

.file-icon {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.file-name {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.file-size {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Action Area */
.tool-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Space out buttons */
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.tool-actions .btn {
  min-width: 140px;
}

/* Secondary button style for "Use different tool" */
.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

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

/* Subtle Note - Remove box styling */
/* Subtle Note - Remove box styling */
.note {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  text-align: center;
  margin-top: 12px;
  opacity: 0.7;
  padding: 0;
  background: transparent !important;
  border: none !important;
  width: 100%;
  box-shadow: none !important;
}

.tool-controls .note {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  line-height: 1.4;
}

.tool-controls {
  margin-top: 16px;
  margin-bottom: 0;
  padding: 0;
  background: transparent !important;
  border: none !important;
}


/* Enhanced site header for drop zone hint */

.site-header.drop-hint {
  background: color-mix(in srgb, var(--brand) 5%, var(--bg));
  border-bottom-color: var(--brand);
}

.site-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.2s ease;
}

.site-header.drop-hint::after {
  background: var(--brand);
}

/* Alert messages */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert.info {
  background: color-mix(in srgb, var(--brand) 8%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
  color: var(--brand-700);
}

.alert strong {
  font-weight: 700;
}

/* Utility */
.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.spacer {
  flex: 1;
}

.hidden {
  display: none !important;
}

/* New ILovePDF-inspired split tool styles */
.split-mode-tabs {
  display: flex;
  gap: 2px;
  background: var(--border);
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 24px;
}

.split-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--muted);
}

.split-tab:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.split-tab.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.tab-icon {
  font-size: 1.5em;
}

.tab-label {
  font-size: 0.9em;
  font-weight: 500;
}

.split-content-area {
  position: relative;
  min-height: 200px;
}

.split-mode-content {
  display: none;
}

.split-mode-content.active {
  display: block;
}

.mode-header {
  margin-bottom: 20px;
}

.mode-header h4 {
  margin: 0 0 12px 0;
  color: var(--text);
  font-size: 1.1em;
  font-weight: 600;
}

.extract-options,
.range-options {
  display: flex;
  gap: 16px;
}

.extract-option,
.range-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg);
  color: var(--text);
}

.extract-option:hover,
.range-option:hover {
  border-color: var(--brand);
}

.extract-option.active,
.range-option.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--bg));
}

.extract-option input,
.range-option input {
  margin: 0;
}

.info-box {
  background: color-mix(in srgb, var(--brand) 8%, var(--bg-elev));
  border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--border));
  border-radius: 6px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.95em;
  line-height: 1.4;
}

.range-input-container {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.range-input-container input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95em;
}

.range-input-container input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 20%, transparent);
}

.add-range-btn {
  padding: 10px 16px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: background 0.2s ease;
}

.add-range-btn:hover {
  background: color-mix(in srgb, black 10%, var(--brand));
}

.ranges-list {
  margin-top: 16px;
}

.range-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
}

.range-text {
  color: var(--text);
  font-size: 0.95em;
}

.remove-range {
  width: 24px;
  height: 24px;
  background: var(--error, #dc3545);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.size-input-group input {
  width: 100px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.size-input-group select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.split-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-size: 1.05em;
  font-weight: 600;
}

.btn-icon {
  font-size: 0.9em;
}

/* Tool controls section (below PDF preview) */
.tool-controls-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .split-option-card {
    margin-bottom: 8px;
  }

  .split-option-label {
    padding: 12px;
  }

  .split-option-title {
    font-size: 1em;
  }

  .split-option-desc,
  .split-option-example {
    font-size: 0.9em;
  }

  .custom-controls,
  .chunks-controls {
    padding: 12px;
    margin: 16px 0;
  }

  .chunks-controls .control-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .tool-controls-section {
    margin-top: 24px;
    padding-top: 20px;
  }
}

/* Page Selector Styles */
.page-selector {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-elev);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.page-selector.hidden {
  display: none;
}

.page-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.page-selector-header h5 {
  margin: 0;
  font-size: 1em;
  font-weight: 600;
  color: var(--text);
}

.page-selector-actions {
  display: flex;
  gap: 8px;
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.9em;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: var(--bg);
}

.page-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-checkbox:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
}

.page-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.page-checkbox input[type="checkbox"]:checked+.page-number {
  background: var(--brand);
  color: white;
}

.page-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--text);
  border-radius: 4px;
  transition: all 0.2s ease;
}

@media (max-width: 768px) {
  .page-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 6px;
    padding: 10px;
  }

  .page-checkbox {
    height: 40px;
  }

  .page-number {
    font-size: 0.85em;
  }

  .page-selector-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}

/* Range Controls Styles */
.custom-range-controls.hidden,
.fixed-range-controls.hidden {
  display: none;
}

.fixed-range-controls {
  margin-top: 16px;
}

.control-group {
  margin-bottom: 16px;
}

.control-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text);
}

.control-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95em;
}

.control-group select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 20%, transparent);
}

/* Preview Section Title */
.preview-section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-section-title::before {
  content: '👁️';
  font-size: 1.1em;
}

.pdf-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Better spacing */
  gap: 16px;
  margin-bottom: 20px;
  /* Increased margin */
  padding: 0 4px;
}

/* Ensure the header doesn't collapse awkwardly */
.pdf-selector-header select {
  max-width: 300px;
}