/* ── Reset & Variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #4f46e5;
  --primary-dark: #4338ca;
  --primary-light:#eef2ff;
  --green:        #16a34a;
  --green-light:  #dcfce7;
  --red-light:    #fee2e2;
  --bg:           #f1f5f9;
  --card:         #ffffff;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --muted:        #64748b;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.07);
  --shadow:       0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:    0 12px 32px rgba(0,0,0,.13);
  --transition:   0.15s ease;
  --content-width: 1280px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 2.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.3px;
}
.navbar-brand:hover { text-decoration: none; }
.brand-icon { font-size: 1.5rem; line-height: 1; }
.navbar-brand strong { color: var(--text); }

.navbar-tagline {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: .01em;
}

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  color: #fff;
  padding: 3.5rem 2.5rem;
  text-align: center;
}
.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -.6px;
  margin-bottom: .6rem;
}
.hero p {
  font-size: 1.1rem;
  opacity: .88;
  max-width: 620px;
  margin: 0 auto;
}

/* ── Tools Section ──────────────────────────────────────────────────────────── */
.tools-section {
  max-width: var(--content-width);
  margin: 0 auto;
  width: 100%;
  padding: 2.5rem 2.5rem 1rem;
  flex: 1;
}

.section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
}

/* ── Tool Grid ───────────────────────────────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem;
}

.tool-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent, var(--primary));
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent, var(--primary));
  text-decoration: none;
}
.tool-card-icon  { font-size: 1.8rem; margin-bottom: .3rem; display: block; }
.tool-card-name  { font-size: .92rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.tool-card-desc  { font-size: .75rem; color: var(--muted); line-height: 1.4; margin-top: .15rem; }
.tool-card-arrow {
  font-size: .85rem;
  color: var(--accent, var(--primary));
  margin-top: auto;
  padding-top: .5rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity var(--transition);
}
.tool-card:hover .tool-card-arrow { opacity: 1; }

/* ── Featured Edit Card ──────────────────────────────────────────────────────── */
.featured-edit-card {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  background: linear-gradient(135deg, #0891b2 0%, #0369a1 60%, #1e40af 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  text-decoration: none;
  margin-bottom: 2.25rem;
  box-shadow: 0 4px 24px rgba(8,145,178,.28);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.featured-edit-card::after {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
  top: -90px; right: -70px;
  pointer-events: none;
}
.featured-edit-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 36px rgba(8,145,178,.38);
  text-decoration: none;
  color: #fff;
}
.featured-edit-icon {
  font-size: 3.5rem;
  line-height: 1;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.featured-edit-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  position: relative;
  z-index: 1;
  min-width: 0;
}
.featured-edit-badge {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 999px;
  padding: .2rem .65rem;
  display: inline-block;
  width: fit-content;
}
.featured-edit-name {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.2;
}
.featured-edit-desc {
  font-size: .9rem;
  opacity: .88;
  line-height: 1.5;
  max-width: 520px;
}
.featured-edit-cta {
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.42);
  border-radius: 999px;
  padding: .75rem 1.6rem;
  font-size: .95rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: background var(--transition), border-color var(--transition);
}
.featured-edit-card:hover .featured-edit-cta {
  background: rgba(255,255,255,.26);
  border-color: rgba(255,255,255,.65);
}

/* ── Categories Row (3-col horizontal on PC) ─────────────────────────────────── */
.categories-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.category-block .tools-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}

/* ── Category Blocks ──────────────────────────────────────────────────────────── */
.category-block {
  margin-bottom: 0;
}
.category-header {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1rem;
  padding-bottom: .65rem;
  border-bottom: 2px solid var(--border);
}
.category-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }
.category-title {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--text);
}
.category-sep { color: var(--border); font-size: .9rem; }
.category-sub {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
}

/* ── Features Row ────────────────────────────────────────────────────────────── */
.features-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: var(--content-width);
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem 2.5rem 3rem;
}
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.feature-icon { font-size: 1.75rem; flex-shrink: 0; }
.feature strong { display: block; font-size: .95rem; margin-bottom: .2rem; }
.feature p { font-size: .8rem; color: var(--muted); }

/* ── Tool Page Layout ────────────────────────────────────────────────────────── */
.tool-page {
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 2.5rem 4rem;
  flex: 1;
}

.tool-page-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.back-link {
  position: absolute;
  top: 1.5rem;
  left: 2.5rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .82rem;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}
.back-link:hover { color: var(--primary); text-decoration: none; }

.tool-page-icon { font-size: 2.75rem; line-height: 1; flex-shrink: 0; }
.tool-page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--accent, var(--primary));
  margin-bottom: .2rem;
}
.tool-page-header p { color: var(--muted); font-size: .9rem; }

/* Wrap the header in a relative container so back-link positions correctly */
.tool-page { position: relative; padding-top: 3.5rem; }

.tool-card-body {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* ── Dropzone ────────────────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  position: relative;
  transition: border-color var(--transition), background var(--transition);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.dropzone-body {
  text-align: center;
  padding: 2rem 1.5rem;
  pointer-events: none;
  user-select: none;
}
.dropzone-upload-icon { font-size: 2.75rem; margin-bottom: .6rem; display: block; }
.dropzone-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.link-text { color: var(--primary); font-weight: 700; }
.dropzone-sub { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

/* ── File List ───────────────────────────────────────────────────────────────── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-top: .75rem;
}
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: .55rem 1rem;
  font-size: .85rem;
}
.file-item-name { font-weight: 500; color: var(--text); }
.file-item-size { color: var(--muted); font-size: .78rem; }

/* ── Options Panel ───────────────────────────────────────────────────────────── */
.options-panel {
  margin-top: 1.5rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
}
.options-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* Radio cards */
.radio-row { display: flex; gap: .65rem; flex-wrap: wrap; }

label.radio-opt { display: flex; cursor: pointer; }
label.radio-opt input[type="radio"] { display: none; }
label.radio-opt .radio-box {
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .7rem 1.1rem;
  background: var(--card);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  min-width: 110px;
  cursor: pointer;
}
label.radio-opt .radio-box:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
label.radio-opt input[type="radio"]:checked + .radio-box {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px #c7d2fe;
}
label.radio-opt .radio-box strong { font-size: .9rem; color: var(--text); }
label.radio-opt .radio-box small  { font-size: .75rem; color: var(--muted); margin-top: .15rem; }

/* Form controls */
.option-row { margin-top: .85rem; }
.option-label {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .4rem;
}
.option-input,
.option-select {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  height: 40px;
}
.option-input:focus,
.option-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.option-hint {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  margin-top: .35rem;
  line-height: 1.5;
}
.option-hint code {
  background: rgba(79,70,229,.1);
  color: var(--primary);
  padding: .05em .3em;
  border-radius: 3px;
  font-size: .9em;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  margin-top: .3rem;
  height: 6px;
  cursor: pointer;
}

/* Info / warning box */
.info-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: .8rem 1.1rem;
  font-size: .82rem;
  color: #78350f;
  margin-top: 1.25rem;
  line-height: 1.55;
}

.source-banner-ok {
  display: inline-block;
  margin-top: .25rem;
  color: #166534;
  font-weight: 600;
}
.source-banner-warn {
  display: inline-block;
  margin-top: .25rem;
  color: #b45309;
  font-weight: 600;
}
.source-banner-row {
  display: flex;
  gap: .9rem;
  align-items: center;
  justify-content: space-between;
}
.source-banner-copy {
  min-width: 0;
  flex: 1;
}
.source-banner-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
}
.source-banner-btn {
  appearance: none;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .45rem .8rem;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}
.source-banner-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79,70,229,.18);
}
.source-banner-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.source-banner-btn-secondary {
  background: #fff;
  color: var(--primary);
}
.source-banner-btn-secondary:hover:not(:disabled) {
  background: var(--primary-light);
}
.source-banner-selected {
  border-color: #34d399;
  background: #ecfdf5;
}

.watermark-preview {
  position: relative;
  display: none;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  min-height: 280px;
}
.watermark-preview canvas {
  display: block;
  width: 100%;
  height: auto;
}
.watermark-preview-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: .5rem .85rem;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 1px dashed rgba(15,23,42,.35);
  color: #6b7280;
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(45deg);
  transform-origin: center center;
}
.watermark-preview-overlay img {
  display: block;
  max-width: none;
  max-height: none;
}

/* ── Process Button ──────────────────────────────────────────────────────────── */
.btn-process {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  margin-top: 1.75rem;
  padding: .9rem 1.5rem;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  height: 48px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  letter-spacing: .01em;
}
.btn-process:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79,70,229,.4);
}
.btn-process:active:not(:disabled) { transform: translateY(0); }
.btn-process:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Progress ────────────────────────────────────────────────────────────────── */
.progress-box {
  display: none;
  text-align: center;
  padding: 2.5rem 1rem;
}
.progress-box.active { display: block; }
.progress-box p { color: var(--muted); font-size: .9rem; margin-top: .85rem; }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Result ──────────────────────────────────────────────────────────────────── */
.result-box { display: none; margin-top: 1.5rem; }
.result-box.show { display: block; }

.result-success,
.result-error {
  border-radius: var(--radius-sm);
  padding: 1.75rem;
  text-align: center;
}
.result-success {
  background: var(--green-light);
  border: 1.5px solid #86efac;
}
.result-error {
  background: var(--red-light);
  border: 1.5px solid #fca5a5;
}
.result-icon { font-size: 2.5rem; margin-bottom: .6rem; }
.result-success h3 { color: #14532d; font-size: 1.1rem; }
.result-error h3   { color: #7f1d1d; font-size: 1.1rem; }
.result-msg { font-size: .86rem; color: var(--muted); margin: .4rem 0 1.25rem; line-height: 1.5; }

.result-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0 .75rem;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--green);
  color: #fff;
  padding: .7rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition);
  height: 44px;
}
.btn-download-secondary {
  background: #334155;
}
.btn-download-secondary:hover {
  background: #1e293b;
}
.btn-download:hover {
  background: #15803d;
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

.result-again {
  display: block;
  margin-top: 1rem;
  font-size: .8rem;
  color: var(--muted);
}
.result-again a { color: var(--primary); }

.bundle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .55rem;
  margin-top: .75rem;
}
.bundle-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .7rem;
  font-size: .85rem;
  color: var(--text);
}
.bundle-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-preview-panel {
  margin-bottom: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.delete-preview-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .9rem;
}
.delete-preview-header strong {
  display: block;
  font-size: .92rem;
  margin-bottom: .1rem;
}
.delete-preview-header small {
  color: var(--muted);
  font-size: .76rem;
}
.delete-preview-summary {
  max-width: 42%;
  font-size: .76rem;
  color: var(--muted);
  text-align: right;
}
.delete-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
}
.delete-preview-card {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .65rem .65rem .7rem;
  background: #fff;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.delete-preview-card:hover,
.delete-preview-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  transform: translateY(-1px);
}
.delete-preview-card input[type="checkbox"] {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.delete-preview-badge {
  position: absolute;
  left: .5rem;
  top: .5rem;
  background: rgba(15,23,42,.8);
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
  padding: .16rem .38rem;
  border-radius: 999px;
  pointer-events: none;
}
.delete-preview-thumb {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 1.35rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
}
.delete-preview-label {
  margin-top: .5rem;
  font-size: .78rem;
  color: var(--text);
  font-weight: 600;
  text-align: center;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.25rem 2rem;
  font-size: .78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--card);
  margin-top: auto;
  line-height: 1.6;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .tools-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 900px) {
  .tools-grid { grid-template-columns: repeat(4, 1fr); }
  .features-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile (≤ 640px) ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Navbar */
  .navbar { padding: 0 1rem; height: 54px; }
  .navbar-tagline { display: none; }
  .navbar-brand { font-size: 1.2rem; }

  /* Hero — compact */
  .hero { padding: 1.5rem 1.25rem 1.75rem; }
  .hero h1 { font-size: 1.6rem; letter-spacing: -.3px; }
  .hero-sub { font-size: .85rem; opacity: .82; }

  /* Tools section */
  .tools-section { padding: 1.25rem 1rem 0; }

  /* Featured edit card — stacked vertically */
  .featured-edit-card {
    flex-direction: column;
    text-align: center;
    align-items: center;
    padding: 1.5rem 1.25rem 1.75rem;
    gap: .7rem;
    margin-bottom: 1.75rem;
  }
  .featured-edit-icon { font-size: 2.75rem; }
  .featured-edit-badge { margin: 0 auto; }
  .featured-edit-name { font-size: 1.4rem; }
  .featured-edit-desc { font-size: .85rem; max-width: none; }
  .featured-edit-cta {
    width: 100%;
    text-align: center;
    padding: .9rem 1rem;
    font-size: 1rem;
    margin-top: .2rem;
  }

  /* Categories: stack vertically on mobile */
  .categories-row { display: block; }
  .category-block { margin-bottom: 1.5rem; }
  .category-block .tools-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .category-sub { display: none; }
  .category-sep { display: none; }
  .category-title { font-size: .7rem; }

  /* Tool grid — 2 columns, bigger touch targets */
  .tools-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .tool-card {
    padding: 1rem .9rem 1rem;
    min-height: 100px;
    touch-action: manipulation;
  }
  .tool-card-icon { font-size: 1.65rem; margin-bottom: .3rem; }
  .tool-card-name { font-size: .88rem; }
  .tool-card-desc { font-size: .72rem; line-height: 1.35; }
  .tool-card-arrow { display: none; }

  /* Features row */
  .features-row {
    padding: 1rem 1rem 2.25rem;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
  }
  .feature { padding: .9rem 1rem; gap: .7rem; }
  .feature-icon { font-size: 1.4rem; }
  .feature strong { font-size: .87rem; }
  .feature p { font-size: .74rem; }

  /* Tool pages */
  .tool-page { padding: 1rem 1rem 3rem; padding-top: 3.5rem; }
  .tool-card-body { padding: 1.25rem; }
  .back-link { left: 1rem; }
  .tool-page-header h1 { font-size: 1.45rem; }

  /* Dropzone — bigger tap area */
  .dropzone { min-height: 150px; }
  .dropzone-upload-icon { font-size: 2.25rem; }
  .dropzone-title { font-size: .95rem; }

  /* Radio options — stack vertically */
  .radio-row { flex-direction: column; }
  label.radio-opt .radio-box { min-width: unset; }

  /* Submit button */
  .btn-process { font-size: .95rem; height: 50px; }

  /* Source banner — stack actions on mobile */
  .source-banner-row { flex-direction: column; gap: .6rem; }
  .source-banner-actions { width: 100%; }
  .source-banner-btn { flex: 1; text-align: center; padding: .65rem .8rem; }

  /* Result actions */
  .result-actions { flex-direction: column; align-items: stretch; }
  .btn-download { justify-content: center; }
}

/* ── Very small phones (≤ 380px) ────────────────────────────────────────────── */
@media (max-width: 380px) {
  .hero h1 { font-size: 1.4rem; }
  .tools-grid { gap: .5rem; }
  .tool-card { min-height: 90px; padding: .85rem .75rem; }
  .tool-card-icon { font-size: 1.5rem; }
  .tool-card-name { font-size: .83rem; }
}

/* ── Touch devices — remove hover effects ────────────────────────────────────── */
@media (hover: none) {
  .tool-card:hover { transform: none; box-shadow: var(--shadow-sm); }
  .featured-edit-card:hover { transform: none; }
  .btn-process:hover:not(:disabled) { transform: none; box-shadow: none; }
  .btn-download:hover { transform: none; }
}

/* ── Mobile-only / desktop-only helpers ──────────────────────────────────────── */
.mob-only { display: none !important; }
@media (max-width: 640px) {
  .mob-only  { display: flex !important; }
  .desk-only { display: none !important; }
}

/* ── Merge page mobile tweaks ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* File cards — disable drag cursor, add move buttons */
  .merge-file-card { cursor: default; gap: .35rem; padding: .4rem .5rem; }
  .merge-thumb     { width: 30px; height: 40px; }
  .merge-thumb-placeholder { width: 30px; height: 40px; font-size: .85rem; }
  .merge-file-name { font-size: .8rem; }
  .merge-file-meta { font-size: .68rem; }

  /* Page order rows — disable drag cursor */
  .page-order-item { cursor: default; }
  .poi-drag-icon   { display: none; }
  .poi-thumb       { width: 22px; height: 28px; }
  .poi-thumb-ph    { width: 22px; height: 28px; font-size: .58rem; }

  /* Mode tabs */
  .mode-tab { font-size: .78rem; padding: .35rem .5rem; }

  /* Page order list height */
  .page-order-list { max-height: 280px; }

  /* Drag hint hidden on mobile (using buttons instead) */
  .drag-hint { display: none; }
}

/* ── Session banner mobile ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .session-banner { flex-direction: column; gap: .5rem; padding: .65rem .75rem; }
  .session-banner-btns { width: 100%; display: flex; gap: .4rem; }
  .btn-session-use, .btn-session-clear { flex: 1; text-align: center; }
}

/* ── Watermark page mobile ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .wm-tabs { gap: .3rem; }
  .wm-preview-wrap { display: block; width: 100%; }
  .wm-preview-wrap canvas { width: 100% !important; height: auto !important; }
}

/* ── Delete pages mobile ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .select-all-row { gap: .35rem; }
  .sel-btn { padding: .3rem .55rem; font-size: .76rem; }
  .pages-grid { gap: .35rem; }
  .page-thumb { min-width: 54px; padding: .25rem; }
}

/* ── Options panel mobile ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .options-panel { padding: 1rem; }
  .radio-row { gap: .4rem; }
  label.radio-opt .radio-box { padding: .55rem .75rem; }
}
