/* =========================================================
   Enhanced PDF Merger — soft pastel "cute" theme
   Class names / IDs are used by script.js — keep them.
   ========================================================= */

:root {
    --pink: #ff9cc2;
    --pink-deep: #f06a9e;
    --pink-soft: #ffe4ef;
    --lav: #bba8ff;
    --lav-deep: #8b6ff0;
    --lav-soft: #efe9ff;
    --mint: #8fdcbc;
    --mint-deep: #2f9e76;
    --mint-soft: #dcf7ec;
    --peach: #ffc9a3;
    --peach-soft: #fff0e3;
    --butter: #ffe08a;
    --butter-soft: #fff8dc;
    --sky: #a8d8ff;
    --sky-soft: #e6f4ff;
    --coral: #ff8a8a;
    --coral-soft: #ffe8e8;

    --ink: #594a70;
    --ink-soft: #9b8fb3;
    --line: #f1e7fa;
    --card: #ffffff;

    --radius-lg: 32px;
    --radius-md: 22px;
    --radius-sm: 16px;
    --pill: 999px;

    --shadow-soft: 0 10px 30px rgba(186, 140, 220, 0.18);
    --shadow-pop: 0 14px 30px rgba(240, 106, 158, 0.28);
    --font: 'Nunito', ui-rounded, 'SF Pro Rounded', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    color: var(--ink);
    min-height: 100vh;
    padding: 28px 18px;
    background:
        radial-gradient(circle at 12% 18%, #ffd9ea 0, transparent 32%),
        radial-gradient(circle at 88% 12%, #e3dbff 0, transparent 30%),
        radial-gradient(circle at 85% 85%, #d3f5e6 0, transparent 34%),
        radial-gradient(circle at 10% 90%, #ffe7d4 0, transparent 30%),
        #fff7fb;
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* Floating pastel blobs in the background */
body::before,
body::after {
    content: '';
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.55;
    pointer-events: none;
    animation: blobFloat 14s ease-in-out infinite;
}

body::before {
    width: 220px;
    height: 220px;
    top: 8%;
    left: -60px;
    background: radial-gradient(circle at 30% 30%, #ffc2dc, #ffb1d1 60%, transparent 70%);
}

body::after {
    width: 260px;
    height: 260px;
    bottom: 4%;
    right: -80px;
    background: radial-gradient(circle at 30% 30%, #d6ccff, #c5b6ff 60%, transparent 70%);
    animation-delay: -7s;
}

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(24px, -30px) scale(1.08); }
}

.container {
    max-width: 880px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.86);
    border: 3px solid #ffffff;
    border-radius: var(--radius-lg);
    padding: 44px 40px 40px;
    box-shadow: 0 24px 60px rgba(186, 140, 220, 0.22), 0 0 0 8px rgba(255, 255, 255, 0.35);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    position: relative;
}

/* ---- Header ---- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 30px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 900;
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 4px;
    border-radius: 14px;
    background: var(--pink-soft);
}

.brand-mark img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

/* ---- GitHub star button ---- */
.github-star {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    background: #ffffff;
    color: var(--ink);
    border: 2px solid var(--line);
    border-radius: var(--pill);
    box-shadow: var(--shadow-soft);
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
}

.github-star:hover {
    border-color: var(--pink);
    transform: translateY(-1px);
    box-shadow: var(--shadow-pop);
}

.github-star svg {
    flex-shrink: 0;
}

.github-star-count {
    display: none;
    padding: 1px 8px;
    background: var(--pink-soft);
    color: var(--pink-deep);
    border-radius: var(--pill);
    font-size: 12px;
    font-weight: 900;
}

.site-header nav,
.site-footer nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* Keep the landing page focused on the PDF merger interface. */
.app-page .hero-subtitle,
.app-page .hero-description,
.app-page .content-section,
.app-page .site-footer {
    display: none;
}

.docs-link {
    margin: 24px 0 0;
    text-align: center;
}

.docs-link a,
.back-link {
    color: var(--pink-deep);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.docs-link a:hover,
.back-link:hover {
    text-decoration: underline;
}

.rotate-choice {
    width: auto;
    height: auto;
    border-radius: var(--pill);
    padding: 10px 20px;
    background: #ffffff;
    color: var(--ink);
    border: 2px solid var(--line);
    font-weight: 800;
}

.rotate-choice.active {
    background: var(--lav-deep);
    color: #ffffff;
    border-color: var(--lav-deep);
    box-shadow: var(--shadow-pop);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.tools-menu {
    position: relative;
}

.tools-menu summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--lav-soft);
    color: var(--lav-deep);
    border: 2px solid var(--lav);
    border-radius: var(--pill);
    font-size: 14px;
    font-weight: 800;
}

.tools-menu summary::-webkit-details-marker {
    display: none;
}

.tools-menu[open] summary {
    box-shadow: var(--shadow-soft);
}

.tools-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    min-width: 190px;
    padding: 8px;
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pop);
}

.tools-menu-panel a {
    padding: 9px 12px;
    border-radius: 12px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.tools-menu-panel a:hover {
    background: var(--pink-soft);
    color: var(--pink-deep);
}

.tools-menu-panel a.current {
    color: var(--mint-deep);
    background: var(--mint-soft);
}

.site-header nav a,
.site-footer nav a {
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.site-header nav a:hover,
.site-footer nav a:hover {
    color: var(--pink-deep);
}

h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    text-align: center;
    margin-bottom: 8px;
    font-size: 2.5em;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.hero-subtitle {
    margin: 0 auto 8px;
    color: var(--ink);
    text-align: center;
    font-size: 20px;
    font-weight: 800;
}

.hero-description {
    max-width: 620px;
    margin: 0 auto 28px;
    color: var(--ink-soft);
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.65;
}

.section-kicker {
    margin: 0 0 18px;
    color: var(--ink);
    text-align: center;
    font-size: 21px;
}

.logo-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--sky-soft), var(--sky));
    color: var(--pink-deep);
    box-shadow: 0 8px 18px rgba(106, 170, 240, 0.22), inset 0 -4px 0 rgba(168, 216, 255, 0.35);
    animation: bob 3.2s ease-in-out infinite;
}

.logo-bubble img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    display: block;
}

.logo-bubble svg {
    width: 34px;
    height: 34px;
    display: block;
}

@keyframes bob {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-6px) rotate(4deg); }
}

.title-text {
    background: linear-gradient(90deg, var(--pink-deep) 0%, var(--lav-deep) 55%, #5aa9e6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: var(--lav-deep);
}

.tagline {
    text-align: center;
    color: var(--ink-soft);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 28px;
}

/* ---- File count pill ---- */
.stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    margin: 0 auto 22px;
    padding: 10px 22px;
    border-radius: var(--pill);
    background: var(--lav-soft);
    border: 2px dashed #d9ccff;
    color: var(--ink);
    font-weight: 700;
}

.stats-emoji {
    font-size: 18px;
    line-height: 1;
}

#file-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: var(--pill);
    background: linear-gradient(135deg, var(--pink), var(--lav));
    color: #fff;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(240, 106, 158, 0.3);
}

/* ---- Drop zone ---- */
.drag-drop-area {
    border: 3px dashed #ffb8d5;
    border-radius: var(--radius-md);
    padding: 38px 20px;
    text-align: center;
    margin-bottom: 22px;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.9), transparent 60%),
        linear-gradient(135deg, #fff1f7 0%, #f5f0ff 100%);
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.drag-drop-area:hover {
    border-color: var(--pink-deep);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.drag-drop-area:hover .drag-drop-icon {
    animation: wiggle 0.6s ease-in-out;
}

.drag-drop-area.dragover {
    border-color: var(--mint-deep);
    background: linear-gradient(135deg, var(--mint-soft) 0%, #eafff6 100%);
    transform: scale(1.02);
}

.drag-drop-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--ink);
    font-size: 19px;
    font-weight: 800;
    margin-bottom: 6px;
}

.drag-drop-icon {
    width: 58px;
    height: 58px;
    padding: 14px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--pink-deep);
    box-shadow: 0 8px 20px rgba(240, 106, 158, 0.22);
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.drag-drop-subtext {
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
}

/* ---- Buttons (shared squishy feel) ---- */
.add-file-btn,
.merge-btn,
.clear-all-btn,
.unlock-btn,
.move-btn,
.remove-btn {
    font-family: inherit;
}

.upload-section {
    margin-bottom: 26px;
}

.add-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--mint-soft);
    color: var(--mint-deep);
    border: 2px solid var(--mint);
    border-radius: var(--pill);
    cursor: pointer;
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 20px;
    box-shadow: 0 5px 0 #bfe9d6;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.add-file-btn:hover {
    background: #cff3e3;
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #bfe9d6, 0 12px 20px rgba(47, 158, 118, 0.2);
}

.add-file-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #bfe9d6;
}

/* ---- PDF cards ---- */
.pdf-item {
    --accent: var(--pink);
    --accent-soft: var(--pink-soft);
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    padding: 24px 24px 24px 30px;
    margin-bottom: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    position: relative;
    overflow: hidden;
    will-change: transform;
    box-shadow: 0 6px 16px rgba(186, 140, 220, 0.12);
}

/* Colorful accent stripe; cycles through pastels */
.pdf-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: var(--accent);
}

.pdf-item:nth-child(4n+2) { --accent: var(--pink); --accent-soft: var(--pink-soft); }
.pdf-item:nth-child(4n+3) { --accent: var(--lav); --accent-soft: var(--lav-soft); }
.pdf-item:nth-child(4n+4) { --accent: var(--mint); --accent-soft: var(--mint-soft); }
.pdf-item:nth-child(4n+5) { --accent: var(--peach); --accent-soft: var(--peach-soft); }

.pdf-item:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}

.pdf-item.has-file {
    background: linear-gradient(135deg, #ffffff 60%, var(--accent-soft) 140%);
}

.pdf-item.dragging {
    transform: scale(1.02) rotate(-1deg);
    transition: none;
    background: var(--pink-soft);
    border-color: var(--pink-deep);
    box-shadow: var(--shadow-pop);
    opacity: 1;
}

/* Drop indicators are instant feedback — no transition lag */
.pdf-item.drag-over-top,
.pdf-item.drag-over-bottom {
    transition: none;
}

.pdf-item.drag-over-top {
    box-shadow: inset 0 5px 0 -1px var(--lav-deep);
}

.pdf-item.drag-over-bottom {
    box-shadow: inset 0 -5px 0 -1px var(--lav-deep);
}

/* Highlight a card right after it has been moved/reordered. */
.pdf-item.just-moved {
    border-color: var(--butter);
    background: var(--butter-soft);
    box-shadow: 0 0 0 4px rgba(255, 224, 138, 0.5);
}

.drag-handle {
    cursor: grab;
    color: #cbbfe0;
    display: inline-flex;
    align-items: center;
    padding: 4px;
    margin-right: 8px;
    border-radius: 10px;
    touch-action: none;
    transition: color 0.15s ease, background 0.15s ease;
}

.drag-handle:hover {
    color: var(--lav-deep);
    background: var(--lav-soft);
}

.drag-handle:active {
    cursor: grabbing;
}

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

.pdf-number {
    background: var(--accent-soft);
    color: var(--ink);
    border: 2px solid var(--accent);
    padding: 6px 16px;
    border-radius: var(--pill);
    font-weight: 800;
    font-size: 14px;
}

.move-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--lav-soft);
    color: var(--lav-deep);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    margin: 0 3px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, color 0.2s ease;
}

.move-btn:hover:not(:disabled) {
    background: var(--lav);
    color: #fff;
    transform: scale(1.15);
}

.move-btn:disabled {
    background: #f5f2f9;
    color: #d8d0e4;
    cursor: not-allowed;
    transform: none;
}

.remove-btn {
    width: 32px;
    height: 32px;
    margin-left: 3px;
    background: var(--coral-soft);
    color: #e25b6c;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, color 0.2s ease;
}

.remove-btn:hover {
    background: var(--coral);
    color: #fff;
    transform: scale(1.15) rotate(90deg);
}

.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 19px;
}

.img-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--line);
    flex-shrink: 0;
}

.file-name {
    display: flex;
    align-items: center;
    color: var(--ink);
    font-weight: 700;
    flex: 1;
    min-width: 0;
    word-break: break-all;
}

.file-name svg {
    stroke: var(--pink-deep);
}

.toc-input {
    width: 100%;
    padding: 13px 16px;
    margin-bottom: 0;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 600;
    color: var(--ink);
    background: #fdfbff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.toc-input:last-child {
    margin-bottom: 0;
}

.toc-input::placeholder {
    color: #c3b8d6;
    font-weight: 600;
}

.toc-input:hover {
    border-color: #e6d9f7;
}

.toc-input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--pink);
    box-shadow: 0 0 0 4px rgba(255, 156, 194, 0.25);
}

.title-field {
    margin-bottom: 18px;
}

.title-field:last-child {
    margin-bottom: 0;
}

.title-field label {
    display: block;
    margin-bottom: 3px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.title-field label span {
    color: var(--ink-soft);
    font-weight: 700;
}

.title-field small {
    display: block;
    margin-bottom: 9px;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
}

.title-field .toc-input {
    margin-bottom: 0;
}

/* ---- Password / security status on a card ---- */
.lock-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 19px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    border: 2px solid transparent;
}

.lock-status svg { flex-shrink: 0; }
.lock-status.checking { background: #f6f3fb; color: var(--ink-soft); border-color: #ece6f5; }
.lock-status.unlocked { background: var(--mint-soft); color: #23795a; border-color: #bdebd7; }
.lock-status.locked   { background: var(--butter-soft); color: #9a6a12; border-color: #ffe7a8; }
.lock-status.failed   { background: var(--coral-soft); color: #b3394a; border-color: #ffcccc; }

.lock-status.checking svg {
    animation: bob 1.4s ease-in-out infinite;
}

.lock-form {
    display: flex;
    gap: 8px;
    width: 100%;
}

.lock-form .toc-input {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
    padding: 9px 14px;
    font-size: 15px;
    background: #ffffff;
}

.unlock-btn {
    padding: 9px 20px;
    border: none;
    border-radius: var(--pill);
    background: linear-gradient(135deg, var(--pink) 0%, var(--lav) 100%);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 0 #e08bb5;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.2s ease;
}

.unlock-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.unlock-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #e08bb5; }
.unlock-btn:disabled { filter: grayscale(0.4) opacity(0.7); cursor: wait; transform: none; }

.lock-error {
    width: 100%;
    color: #c2405a;
    font-weight: 800;
}

.lock-link {
    margin-left: auto;
    background: #ffffff;
    border: 2px solid #bdebd7;
    border-radius: var(--pill);
    padding: 4px 12px;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.lock-link:hover {
    background: #ecfbf4;
    transform: translateY(-1px);
}

/* ---- Bottom controls ---- */
.controls {
    display: flex;
    gap: 16px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.toc-toggle {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 16px 18px;
    margin-bottom: 4px;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #fff8fc, #f7f3ff);
    cursor: pointer;
}

.toc-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-track {
    display: inline-flex;
    align-items: center;
    width: 44px;
    height: 25px;
    padding: 3px;
    flex: 0 0 auto;
    border-radius: var(--pill);
    background: #d8d0e7;
    transition: background 0.2s ease;
}

.toggle-thumb {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(89, 74, 112, 0.22);
    transition: transform 0.2s ease;
}

.toc-toggle input:checked + .toggle-track {
    background: linear-gradient(135deg, var(--pink), var(--lav-deep));
}

.toc-toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(19px);
}

.toc-toggle input:focus-visible + .toggle-track {
    outline: 3px solid rgba(240, 106, 158, 0.25);
    outline-offset: 2px;
}

.toc-toggle:has(input:disabled) {
    opacity: 0.6;
    cursor: wait;
}

.toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toggle-copy strong {
    color: var(--ink);
    font-size: 14px;
}

.toggle-copy small {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
}

.merge-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
    padding: 17px;
    background: linear-gradient(135deg, var(--pink) 0%, var(--lav) 55%, var(--sky) 100%);
    background-size: 160% 160%;
    color: #ffffff;
    border: none;
    border-radius: var(--pill);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 6px 0 #d98cc0, 0 14px 26px rgba(240, 106, 158, 0.25);
    text-shadow: 0 1px 2px rgba(140, 80, 160, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-position 0.5s ease;
}

.merge-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background-position: 100% 100%;
    box-shadow: 0 8px 0 #d98cc0, 0 18px 30px rgba(240, 106, 158, 0.3);
}

.merge-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #d98cc0, 0 6px 12px rgba(240, 106, 158, 0.2);
}

.merge-btn:disabled {
    background: #efeaf5;
    color: #c4bad3;
    text-shadow: none;
    box-shadow: 0 6px 0 #e3dcec;
    cursor: not-allowed;
    transform: none;
}

.clear-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: #ffffff;
    color: #e25b6c;
    border: 2px solid #ffc4cc;
    border-radius: var(--pill);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 0 #ffe0e4;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.clear-all-btn:hover {
    background: var(--coral-soft);
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #ffd5db;
}

.clear-all-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #ffd5db;
}

/* ---- Progress ---- */
.progress {
    margin-top: 22px;
    text-align: center;
    color: var(--ink);
    font-weight: 700;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border: 2px solid #e6dcff;
    background: repeating-linear-gradient(
        -45deg,
        var(--lav-soft) 0 16px,
        #f7f3ff 16px 32px
    );
    background-size: 200% 100%;
    animation: stripes 2.5s linear infinite;
}

@keyframes stripes {
    from { background-position: 0 0; }
    to { background-position: -90px 0; }
}

.success {
    background: var(--mint-soft);
    color: #23795a;
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 20px;
    text-align: center;
    font-weight: 700;
    line-height: 1.6;
}

/* ---- Success card ---- */
.result-card {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #fff8fc 100%);
    max-width: 580px;
    margin: 26px auto 6px;
    padding: 40px 32px 32px;
    border: 3px solid #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(186, 140, 220, 0.25), 0 0 0 6px var(--pink-soft);
    text-align: center;
    color: var(--ink);
    font-family: var(--font);
    animation: cardRise 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cardRise {
    0% { transform: translateY(16px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.result-check {
    position: relative;
    width: 88px;
    height: 88px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9ff0cf 0%, var(--mint) 45%, var(--sky) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(143, 220, 188, 0.5), inset 0 -5px 0 rgba(47, 158, 118, 0.18);
    animation: checkPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.spark {
    position: absolute;
    border-radius: 50%;
    background: var(--butter);
    opacity: 0.9;
    animation: sparkFloat 2.4s ease-in-out infinite;
}
.spark-1 { width: 10px; height: 10px; top: -4px; right: 4px; animation-delay: 0s; }
.spark-2 { width: 8px; height: 8px; bottom: 2px; left: -8px; background: var(--pink); animation-delay: 0.6s; }
.spark-3 { width: 6px; height: 6px; top: 10px; left: -12px; background: var(--lav); animation-delay: 1.2s; }

@keyframes sparkFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
    50% { transform: translateY(-6px) scale(1.25); opacity: 1; }
}

.result-title {
    font-size: 28px;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 8px;
}

.result-sub {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--ink-soft);
    line-height: 1.55;
    margin-bottom: 26px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

.metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 22px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius-md);
    text-align: left;
    border: 2px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.metric-pages { background: linear-gradient(135deg, var(--lav-soft) 0%, #e4dcff 100%); }
.metric-sections { background: linear-gradient(135deg, var(--mint-soft) 0%, #c9f1e0 100%); }

.metric-emoji {
    font-size: 28px;
    line-height: 1;
}

.metric-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1.1;
}

.metric-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
    margin-top: 2px;
}

.download-card {
    background: linear-gradient(135deg, var(--pink-soft) 0%, var(--lav-soft) 60%, var(--sky-soft) 100%);
    border: 2px solid #ffffff;
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 24px;
}

.download-file {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    margin-bottom: 16px;
}

.download-file-icon {
    font-size: 26px;
    flex-shrink: 0;
}

.download-file-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.download-file-name {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--ink);
    word-break: break-all;
}

.download-file-size {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-top: 2px;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--pink-deep) 0%, var(--lav-deep) 55%, #5aa9e6 100%);
    background-size: 160% 160%;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
    border-radius: var(--pill);
    box-shadow: 0 6px 0 #c77fb5, 0 12px 24px rgba(139, 111, 240, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-position 0.5s ease;
}

.btn-download:hover {
    transform: translateY(-2px);
    background-position: 100% 100%;
    box-shadow: 0 8px 0 #c77fb5, 0 16px 28px rgba(139, 111, 240, 0.36);
}

.btn-download:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #c77fb5;
}

.preview-block {
    margin-top: 4px;
    text-align: left;
}

.preview-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--ink-soft);
    margin-bottom: 10px;
}

.preview-scroll {
    max-height: 600px;
    overflow: auto;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #fbf7ff 0%, #f3f0fa 100%);
    padding: 16px;
}

/* ---- Icon system ---- */
svg { flex-shrink: 0; }

.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.metric-card:hover .icon-badge { transform: scale(1.1) rotate(-6deg); }

.icon-indigo { background: #ffffff; color: var(--lav-deep); }
.icon-green  { background: #ffffff; color: var(--mint-deep); }
.icon-violet { background: #ffffff; color: var(--pink-deep); }
.icon-sky    { background: #ffffff; color: #3d95d6; }

.preview-title { display: flex; align-items: center; gap: 8px; }
.preview-title svg { color: var(--pink-deep); }
.download-file-size { display: inline-flex; align-items: center; gap: 6px; }
.download-file-size svg { color: var(--ink-soft); }

/* ---- Footer ---- */
.site-footer {
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 700;
    padding: 26px 16px 8px;
}

.site-footer p {
    margin-bottom: 10px;
}

.site-footer nav {
    justify-content: center;
}

.trust-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 34px 0 12px;
    padding: 16px;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.72);
}

.trust-strip div {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    align-items: center;
}

.trust-strip span {
    grid-row: span 2;
    color: var(--pink-deep);
    font-size: 20px;
}

.trust-strip strong,
.trust-strip small {
    display: block;
}

.trust-strip strong {
    color: var(--ink);
    font-size: 13px;
}

.trust-strip small {
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
}

.content-section {
    max-width: 760px;
    margin: 72px auto 0;
    scroll-margin-top: 24px;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--pink-deep);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
}

.content-section > h2 {
    margin-bottom: 10px;
    color: var(--ink);
    font-size: clamp(24px, 4vw, 32px);
    text-align: center;
}

.section-intro,
.explanation-section > p,
.use-cases-section > p {
    max-width: 680px;
    margin: 0 auto 14px;
    color: var(--ink-soft);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.75;
}

.section-intro {
    text-align: center;
}

.steps-list {
    display: grid;
    gap: 14px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.steps-list li {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.72);
}

.steps-list li > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--lav-soft);
    color: var(--lav-deep);
    font-weight: 900;
}

.steps-list h3,
.benefits-grid h3 {
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 16px;
}

.steps-list p,
.benefits-grid p {
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.55;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
}

.benefits-grid article {
    padding: 22px 18px;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.74);
}

.benefit-icon {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 25px;
}

.explanation-section,
.use-cases-section {
    padding: 28px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(255, 241, 247, 0.8), rgba(245, 240, 255, 0.8));
}

.faq-list {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}

.faq-list details {
    padding: 17px 20px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.78);
}

.faq-list summary {
    color: var(--ink);
    cursor: pointer;
    font-weight: 900;
}

.faq-list details p {
    margin: 12px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.65;
}

/* ---- Security page ---- */
.security-main {
    max-width: 900px;
    margin: 0 auto;
}

.security-hero {
    padding: 34px 20px 28px;
    border-bottom: 2px solid var(--line);
    text-align: center;
}

.security-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 7px 12px;
    border: 1px solid #b9dfcf;
    border-radius: var(--pill);
    background: #f0fbf6;
    color: var(--mint-deep);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #39b982;
    box-shadow: 0 0 0 4px rgba(57, 185, 130, 0.14);
}

.security-hero h1 {
    margin-bottom: 12px;
    color: var(--ink);
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    letter-spacing: -0.04em;
}

.security-hero .hero-subtitle {
    max-width: 590px;
    margin-bottom: 20px;
    color: var(--ink-soft);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.55;
}

.security-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.security-meta span {
    padding: 7px 11px;
    border-radius: var(--pill);
    background: var(--lav-soft);
    color: var(--lav-deep);
    font-size: 12px;
    font-weight: 800;
}

.security-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 28px 0 18px;
}

.security-card {
    min-height: 164px;
    padding: 20px;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 18px rgba(186, 140, 220, 0.08);
}

.security-card:nth-child(2) { background: linear-gradient(145deg, #fff, var(--lav-soft)); }
.security-card:nth-child(3) { background: linear-gradient(145deg, #fff, var(--mint-soft)); }

.security-card-label {
    display: block;
    margin-bottom: 18px;
    color: var(--pink-deep);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.security-card h2 {
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 20px;
}

.security-card p,
.security-copy p,
.security-footnote {
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.7;
}

.security-boundary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 46px;
    padding: 16px 18px;
    border-left: 4px solid var(--pink-deep);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--pink-soft);
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.6;
}

.security-boundary strong {
    flex: 0 0 auto;
    color: var(--ink);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.security-section {
    display: grid;
    grid-template-columns: minmax(210px, 0.72fr) 1.28fr;
    gap: 42px;
    margin: 0;
    padding: 34px 0;
    border-top: 1px solid var(--line);
}

.security-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.security-section-heading .eyebrow {
    margin: 3px 0 7px;
    text-align: left;
}

.security-section-heading h2 {
    color: var(--ink);
    font-size: clamp(21px, 3vw, 28px);
    line-height: 1.12;
}

.security-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 11px;
    background: var(--lav-soft);
    color: var(--lav-deep);
    font-size: 13px;
    font-weight: 900;
}

.security-copy p + p {
    margin-top: 14px;
}

.security-limits {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.security-limits div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.66);
}

.security-limits strong {
    color: var(--ink);
    font-size: 21px;
}

.security-limits span {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
}

.security-footnote {
    grid-column: 2;
    margin-top: -26px;
}

.security-warning {
    border: 2px solid #f1d4a2;
    border-radius: var(--radius-md);
    padding: 26px 28px;
    background: #fffaf0;
}

.security-warning + .security-section {
    margin-top: 22px;
}

.security-section code {
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--lav-soft);
    color: var(--lav-deep);
    font-size: 0.9em;
}

.footer-love {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #b7abca;
}

/* ---- Errors ---- */
.error {
    background: var(--coral-soft);
    color: #a8324a;
    border: 2px solid #ffc4cc;
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 20px;
    text-align: center;
    font-weight: 700;
    line-height: 1.6;
}

.download-btn {
    display: inline-block;
    padding: 14px 28px;
    background: var(--mint-soft);
    color: var(--mint-deep);
    text-decoration: none;
    border: 2px solid var(--mint);
    border-radius: var(--pill);
    font-weight: 800;
    margin-top: 15px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    font-size: 16px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(47, 158, 118, 0.25);
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 46px 20px;
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.6);
    border: 2px dashed var(--line);
}

.empty-state-icon {
    margin-bottom: 14px;
    color: var(--lav);
    display: flex;
    justify-content: center;
    animation: bob 3.2s ease-in-out infinite;
}

.empty-state-hint {
    font-size: 14px;
    font-weight: 600;
    margin-top: 8px;
    color: var(--ink-soft);
}

/* Hidden until script.js shows them (it sets an explicit inline display). */
#clearAllBtn,
#progress,
#result {
    display: none;
}

/* ---- Toast notifications (file added / converted / rejected) ---- */
.toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--line);
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-soft);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    pointer-events: auto;
    animation: toast-in 0.2s ease-out;
}

.toast-success { border-color: var(--mint); background: var(--mint-soft); }
.toast-error { border-color: #ffc4cc; background: var(--coral-soft); color: #a8324a; }
.toast-info { border-color: var(--lav); background: var(--lav-soft); }

.toast-icon { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.toast-success .toast-icon { color: var(--mint-deep); }
.toast-info .toast-icon { color: var(--lav-deep); animation: toast-spin 1s linear infinite; }

.toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-detail { display: block; margin-top: 2px; font-weight: 600; opacity: 0.85; }

.toast-close {
    flex: none;
    border: 0;
    background: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    opacity: 0.6;
}
.toast-close:hover { opacity: 1; }

.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-spin { to { transform: rotate(360deg); } }

/* ---- Small screens ---- */
@media (max-width: 600px) {
    .toast-stack { right: 16px; bottom: 16px; }
    body { padding: 14px 10px; }
    .container { padding: 30px 18px 24px; border-radius: 26px; }
    .site-header { align-items: flex-start; margin-bottom: 24px; }
    .site-header nav { gap: 10px; }
    .site-header nav a { font-size: 12px; }
    .github-star { top: 10px; right: 10px; padding: 7px 10px; gap: 5px; }
    .github-star-label { display: none; }
    h1 { font-size: 1.9em; gap: 10px; }
    .logo-bubble { width: 50px; height: 50px; border-radius: 18px; }
    .logo-bubble img { width: 42px; height: 42px; }
    .logo-bubble svg { width: 28px; height: 28px; }
    .tagline { font-size: 14.5px; }
    .pdf-item { padding: 20px 16px 20px 24px; }
    .clear-all-btn { flex: 1; justify-content: center; }
    .trust-strip { grid-template-columns: repeat(2, 1fr); gap: 16px 10px; }
    .content-section { margin-top: 52px; }
    .benefits-grid { grid-template-columns: 1fr; }
    .explanation-section, .use-cases-section { padding: 22px 18px; }
    .security-summary { grid-template-columns: 1fr; }
    .security-card { min-height: 0; }
    .security-section { grid-template-columns: 1fr; gap: 20px; }
    .security-footnote { grid-column: auto; margin-top: 0; }
    .security-warning { padding: 22px 18px; }
}

@media (max-width: 480px) {
    .result-card { padding: 28px 18px 22px; border-radius: 24px; }
    .metric-grid { grid-template-columns: 1fr; }
    .result-title { font-size: 23px; }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
