/* ═══════════════════════════════════════════════════════════
   PDF2File — Professional Design System
   Mobile-first, responsive for iOS / Android / Desktop
   ═══════════════════════════════════════════════════════════ */

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; }

/* ── Light Theme (default) ───────────────────────────────── */
:root {
    --bg: #f5f5f0;
    --bg-nav: rgba(255,255,255,0.82);
    --surface: #ffffff;
    --surface-dim: #f0eeeb;
    --border: #e5e2dd;
    --border-focus: #7c3aed;
    --text: #1c1917;
    --text-2: #44403c;
    --text-3: #78716c;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-bg: rgba(124,58,237,0.06);
    --accent-bg-strong: rgba(124,58,237,0.12);
    --success: #059669;
    --success-bg: rgba(5,150,105,0.06);
    --danger: #dc2626;
    --danger-bg: rgba(220,38,38,0.06);
    --warning: #d97706;
    --warning-bg: rgba(217,119,6,0.06);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --ease: cubic-bezier(0.4,0,0.2,1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Dark Theme ──────────────────────────────────────────── */
[data-theme="dark"] {
    --bg: #0c0a09;
    --bg-nav: rgba(12,10,9,0.85);
    --surface: #1c1917;
    --surface-dim: #292524;
    --border: #292524;
    --border-focus: #8b5cf6;
    --text: #fafaf9;
    --text-2: #d6d3d1;
    --text-3: #78716c;
    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-bg: rgba(139,92,246,0.08);
    --accent-bg-strong: rgba(139,92,246,0.16);
    --success: #34d399;
    --success-bg: rgba(52,211,153,0.08);
    --danger: #f87171;
    --danger-bg: rgba(248,113,113,0.08);
    --warning: #fbbf24;
    --warning-bg: rgba(251,191,36,0.08);
    --shadow-sm: none;
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

/* ── Base ────────────────────────────────────────────────── */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden { display: none !important; }

/* ── Ambient Blobs (dark only) ───────────────────────────── */
.bg-blob {
    position: fixed; border-radius: 50%; filter: blur(140px);
    opacity: 0; pointer-events: none; z-index: 0;
    transition: opacity 0.6s ease;
}
[data-theme="dark"] .bg-blob { opacity: 0.3; }
.blob-1 { width: 520px; height: 520px; background: #7c3aed; top: -15%; left: -10%; }
.blob-2 { width: 420px; height: 420px; background: #2563eb; bottom: -10%; right: -8%; }
.blob-3 { width: 320px; height: 320px; background: #06b6d4; top: 45%; left: 55%; }

/* ── Page Layout ─────────────────────────────────────────── */
.page-wrapper {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1rem;
    padding-bottom: env(safe-area-inset-bottom, 1.5rem);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ═══════════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════════ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding-top: env(safe-area-inset-top, 0);
    background: var(--bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}
.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    max-width: 640px;
    margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { width: 28px; height: 28px; color: var(--accent); }
.logo-text { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.3px; }
.logo-accent { color: var(--accent); }

.theme-toggle {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-3);
    transition: all 0.2s var(--ease);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }

/* Nav right area */
.nav-right { display: flex; align-items: center; gap: 0.5rem; }
.nav-link {
    display: flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all 0.2s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.nav-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.nav-link.ai-link {
    background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(59,130,246,0.08));
    border-color: rgba(124,58,237,0.2);
    color: var(--accent);
}
.nav-link.ai-link:hover { background: var(--accent-bg-strong); border-color: var(--accent); }

/* AI badge */
.ai-badge-row { margin-bottom: 0.25rem; }
.ai-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.3rem 0.75rem; border-radius: 999px;
    font-size: 0.7rem; font-weight: 700;
    background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(59,130,246,0.1));
    color: var(--accent);
    border: 1px solid rgba(124,58,237,0.2);
}

/* AI button */
.ai-btn { background: linear-gradient(135deg, var(--accent), #3b82f6); }
.ai-btn:hover:not(:disabled) { box-shadow: 0 8px 24px rgba(124,58,237,0.3); }

/* AI progress bar */
.ai-progress { background: linear-gradient(90deg, var(--accent), #3b82f6); }

/* API Key input */
.key-input-row { display: flex; gap: 0.5rem; align-items: center; }
.text-input {
    flex: 1; padding: 0.7rem 1rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    background: var(--surface-dim); color: var(--text);
    font: inherit; font-size: 0.9rem;
    transition: border-color 0.2s var(--ease);
    min-height: 44px;
}
.text-input:focus { outline: none; border-color: var(--accent); }
.text-input::placeholder { color: var(--text-3); }
.icon-toggle {
    width: 44px; height: 44px; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    background: var(--surface); color: var(--text-3);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s var(--ease);
}
.icon-toggle:hover { color: var(--accent); border-color: var(--accent); }
.key-hint { font-size: 0.7rem; color: var(--text-3); margin-top: 0.4rem; opacity: 0.6; }

/* ═══════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════ */
.hero {
    padding: 2rem 0 1.5rem;
}
.hero-title {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.5px;
}
.hero-highlight { color: var(--accent); }
.hero-sub {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-3);
    line-height: 1.5;
    max-width: 480px;
}

/* ═══════════════════════════════════════════════════════════
   MAIN AREA — Section system
   ═══════════════════════════════════════════════════════════ */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeUp 0.35s var(--ease);
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Cards */
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.section-card:hover {
    box-shadow: var(--shadow-md);
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-3);
}

/* ═══════════════════════════════════════════════════════════
   DROPZONE
   ═══════════════════════════════════════════════════════════ */
.dropzone {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    box-shadow: var(--shadow-sm);
}
.dropzone:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
}
.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-bg-strong);
    transform: scale(1.01);
    box-shadow: var(--shadow-md);
}
.drop-icon {
    width: 52px; height: 52px;
    margin: 0 auto 1rem;
    color: var(--text-3);
    transition: color 0.2s var(--ease);
}
.dropzone:hover .drop-icon,
.dropzone.dragover .drop-icon { color: var(--accent); }
.drop-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.drop-sub { color: var(--text-3); font-size: 0.85rem; }
.drop-hint { margin-top: 0.75rem; font-size: 0.72rem; color: var(--text-3); opacity: 0.6; }

/* ═══════════════════════════════════════════════════════════
   FILE CARD
   ═══════════════════════════════════════════════════════════ */
.file-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.file-badge {
    flex-shrink: 0;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: var(--radius-xs);
    font-weight: 700; font-size: 0.65rem;
    letter-spacing: 1px; text-transform: uppercase;
    color: #fff;
}
.file-meta { flex: 1; min-width: 0; }
.file-name {
    font-weight: 600; font-size: 0.95rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-size { color: var(--text-3); font-size: 0.8rem; margin-top: 0.1rem; }

/* ═══════════════════════════════════════════════════════════
   FORMAT SELECTOR
   ═══════════════════════════════════════════════════════════ */
.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.format-chip {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 0.65rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-2);
    background: var(--surface);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.format-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}
.format-chip.active {
    border-color: var(--accent);
    background: var(--accent-bg-strong);
    color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.primary-btn {
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    font-size: 0.95rem; font-weight: 700;
    color: #fff;
    background: var(--accent);
    border: none; border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
    -webkit-tap-highlight-color: transparent;
    min-height: 48px; /* touch target */
}
.primary-btn:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.primary-btn:active:not(:disabled) { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.primary-btn.success { background: var(--success); }
.primary-btn.success:hover { background: #047857; }

.link-btn {
    background: none; border: none;
    color: var(--accent); font-weight: 600; font-size: 0.85rem;
    text-decoration: underline; text-underline-offset: 3px;
    transition: color 0.2s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.link-btn:hover { color: var(--accent-hover); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { color: #b91c1c; }
.link-btn.center { align-self: center; }

.badge {
    display: inline-flex;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: var(--accent-bg-strong);
    color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   STATS GRID
   ═══════════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.4rem;
    text-align: center;
    display: flex; flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    box-shadow: var(--shadow-sm);
}
.stat-icon { font-size: 1.1rem; }
.stat-value { font-size: 0.9rem; font-weight: 800; }
.stat-label { font-size: 0.55rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════════════ */
.progress-card { display: flex; flex-direction: column; gap: 0.5rem; }
.progress-file-label { font-size: 0.85rem; color: var(--text-2); margin-top: -0.5rem; }

.progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-dim);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.5s var(--ease);
    position: relative;
}
.progress-fill::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: shimmer 1.5s infinite;
}
.progress-fill.paused {
    background: var(--warning);
}
.progress-fill.paused::after { animation: none; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.progress-message {
    font-size: 0.8rem;
    color: var(--text-3);
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   CONTROL BUTTONS
   ═══════════════════════════════════════════════════════════ */
.control-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.ctrl-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.45rem;
    padding: 0.7rem 1rem;
    font-size: 0.85rem; font-weight: 600;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-2);
    transition: all 0.2s var(--ease);
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}
.pause-btn:hover { border-color: var(--warning); color: var(--warning); background: var(--warning-bg); }
.pause-btn.is-paused { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.cancel-btn { color: var(--danger); }
.cancel-btn:hover { border-color: var(--danger); background: var(--danger-bg); }

/* ═══════════════════════════════════════════════════════════
   RESULT BANNERS (done / error)
   ═══════════════════════════════════════════════════════════ */
.result-banner {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.6rem;
    text-align: center;
    padding: 2rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.success-banner { background: var(--success-bg); border-color: var(--success); }
.success-banner .result-icon { color: var(--success); }
.error-banner { background: var(--danger-bg); border-color: var(--danger); }
.error-banner .result-icon { color: var(--danger); }
.error-banner.warn { background: var(--warning-bg); border-color: var(--warning); }
.error-banner.warn .result-icon { color: var(--warning); }

.result-icon { width: 48px; height: 48px; }
.result-title { font-size: 1.1rem; font-weight: 700; }
.result-detail { font-size: 0.85rem; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
.footer {
    text-align: center;
    padding: 2rem 0 1.5rem;
    display: flex; flex-direction: column;
    align-items: center; gap: 0.65rem;
    margin-top: auto;
}
.footer-label {
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-3);
}
.footer-chips {
    display: flex; flex-wrap: wrap;
    justify-content: center; gap: 0.35rem;
}
.route-chip {
    background: var(--surface-dim);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.65rem; font-weight: 600;
    color: var(--text-3);
}
.footer-copy {
    font-size: 0.7rem;
    color: var(--text-3);
    opacity: 0.5;
    margin-top: 0.25rem;
}
.footer-brand {
    font-size: 0.72rem;
    color: var(--text-3);
    margin-top: 0.25rem;
}
.footer-brand a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.footer-brand a:hover { text-decoration: underline; }

/* Logo link */
.logo-link {
    display: flex; align-items: center; gap: 0.5rem;
    text-decoration: none; color: inherit;
}

/* ═══════════════════════════════════════════════════════════
   MODE CARDS (Split page)
   ═══════════════════════════════════════════════════════════ */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-top: 0.75rem;
}
.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 1.15rem 0.6rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    -webkit-tap-highlight-color: transparent;
    text-align: center;
    position: relative;
    min-height: 100px;
}
.mode-card:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.mode-card.active {
    border-color: var(--accent);
    background: var(--accent-bg-strong);
    box-shadow: 0 0 0 4px var(--accent-bg), var(--shadow-md);
    transform: translateY(-2px);
}
.mode-card.active::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.mode-icon { font-size: 1.75rem; line-height: 1; }
.mode-label { font-size: 0.78rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.mode-desc { font-size: 0.62rem; color: var(--text-3); line-height: 1.3; }

/* Split button & progress */
.split-btn { background: linear-gradient(135deg, #059669, #10b981); }
.split-btn:hover:not(:disabled) { box-shadow: 0 8px 24px rgba(5,150,105,0.3); }
.split-progress { background: linear-gradient(90deg, #059669, #10b981); }
.split-badge { background: rgba(5,150,105,0.12); color: #059669; }

/* ═══════════════════════════════════════════════════════════
   PIPELINE STEPS
   ═══════════════════════════════════════════════════════════ */
.pipeline {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    padding: 0.5rem 0;
}
.pipe-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    min-width: 70px;
    opacity: 0.35;
    transition: opacity 0.4s ease;
}
.pipe-step.active, .pipe-step.done { opacity: 1; }

.pipe-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--text-3);
    transition: all 0.3s ease;
    position: relative;
}
.pipe-step.active .pipe-dot {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 4px var(--accent-bg);
}
.pipe-step.done .pipe-dot {
    border-color: #059669;
    color: #fff;
    background: #059669;
    box-shadow: 0 0 0 4px rgba(5,150,105,0.15);
}

.pipe-spinner {
    width: 20px; height: 20px;
    display: none;
}
.pipe-step.active .pipe-spinner {
    display: block;
    animation: pipeSpin 1s linear infinite;
}
.pipe-step.done .pipe-spinner { display: none; }

.pipe-check {
    width: 16px; height: 16px;
}
.pipe-step.done .pipe-check { display: block !important; }
.pipe-step:not(.done) .pipe-check { display: none !important; }

@keyframes pipeSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pipe-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}
.pipe-step.active .pipe-label { color: var(--accent); font-weight: 700; }
.pipe-step.done .pipe-label { color: #059669; }

.pipe-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin-top: 18px; /* center with dot */
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    min-width: 30px;
}
.pipe-line::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0;
    background: #059669;
    border-radius: 2px;
    transition: width 0.5s ease;
}
.pipe-line.filled::after { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

/* ── Small phones (< 380px) ──────────────────────────────── */
@media (max-width: 379px) {
    .hero-title { font-size: 1.4rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .format-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-link span { display: none; }
    .nav-link { padding: 0.4rem 0.55rem; }
}

/* ── Phones (380–640px) ──────────────────────────────────── */
@media (min-width: 380px) and (max-width: 640px) {
    .hero-title { font-size: 1.6rem; }
    .format-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Tablets and up (641px+) ─────────────────────────────── */
@media (min-width: 641px) {
    .page-wrapper { padding: 0 2rem; }
    .navbar { margin: 0 -2rem; padding-left: 2rem; padding-right: 2rem; }

    .hero { padding: 2.5rem 0 2rem; }
    .hero-title { font-size: 2rem; }

    .dropzone { padding: 3.5rem 2rem; }

    .section-card { padding: 1.5rem; }
    .format-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Desktop (900px+) ────────────────────────────────────── */
@media (min-width: 900px) {
    .page-wrapper { max-width: 720px; }
    .hero-title { font-size: 2.25rem; }
    .hero-sub { font-size: 1rem; }
    .dropzone { padding: 4rem 2rem; }
}

/* ── iOS safe areas ──────────────────────────────────────── */
@supports (padding: env(safe-area-inset-top)) {
    .navbar { padding-top: env(safe-area-inset-top); }
    .page-wrapper {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ── Hover-capable devices only ──────────────────────────── */
@media (hover: none) {
    .dropzone:hover { border-color: var(--border); background: var(--surface); }
    .dropzone:hover .drop-icon { color: var(--text-3); }
    .section-card:hover { box-shadow: var(--shadow-sm); }
}
