:root {
    --tool-ink: #2C3E50;
    --tool-action: #3498DB;
    --tool-action-dark: #21618C;
    --tool-action-strong: #21618C;
    --tool-action-pressed: #1B4F72;
    --tool-action-soft: #EBF5FB;
    --tool-action-border: #BDE0F5;
    --tool-canvas: #F5F5F5;
    --tool-surface: #FFFFFF;
    --tool-text: #333333;
    --tool-muted: #566573;
    --tool-danger: #B03A2E;
    --tool-success: #196F3D;
    --tool-shadow: 0 14px 40px rgba(44, 62, 80, .12);
    --tool-shadow-small: 0 4px 14px rgba(44, 62, 80, .08);
    --tool-line: #DDE4E8;
    --tool-action-contrast: #FFFFFF;
    --tool-disabled: #AEBBC4;
    --tool-danger-soft: #FCEDEB;
    --tool-success-soft: #EAF7EF;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 44px;
    --space-10: 48px;
    --space-11: 52px;
    --space-12: 56px;
    --space-13: 64px;
    --space-14: 80px;
    --type-hero: clamp(36px, 7vw, 64px);
    --type-title: 24px;
    --type-lead: clamp(17px, 2.3vw, 21px);
    --type-section: 17px;
    --type-body: 15px;
    --type-small: 13px;
    --type-caption: 12px;
    --type-micro: 11px;
    --radius-small: 8px;
    --radius-medium: 14px;
    --radius-large: 22px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 0;
    margin: 0;
    padding-bottom: 130px;
    overflow-x: hidden;
    background: var(--tool-canvas);
    color: var(--tool-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
    font-size: var(--type-body);
    line-height: 1.65;
    word-break: keep-all;
}

button,
input {
    font: inherit;
}

button,
a,
label {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--tool-action-dark);
}

svg {
    display: block;
}

[hidden] {
    display: none !important;
}

.skip-link {
    position: fixed;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 9999;
    padding: var(--space-3) var(--space-4);
    transform: translateY(-160%);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    border-radius: var(--radius-small);
    background: var(--tool-ink);
    color: var(--tool-action-contrast);
    font-weight: 800;
}

.skip-link:focus {
    transform: translateY(0);
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: var(--space-3) max(var(--space-5), calc((100% - 1080px) / 2));
    border-bottom: 1px solid var(--tool-line);
    background: var(--tool-surface);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--tool-ink);
    font-size: var(--type-section);
    font-weight: 800;
    text-decoration: none;
}

.brand-link svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.tool-header nav,
footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
}

.tool-header nav a,
footer nav a {
    color: var(--tool-muted);
    font-size: var(--type-small);
    font-weight: 700;
    text-decoration: none;
}

.tool-header nav a:hover,
footer nav a:hover {
    color: var(--tool-action-dark);
    text-decoration: underline;
}

main {
    width: min(1080px, calc(100% - 40px));
    margin: 0 auto;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(230px, .65fr);
    align-items: center;
    gap: var(--space-8);
    min-height: 390px;
    padding: var(--space-13) var(--space-9) var(--space-11);
}

.eyebrow,
.step-label {
    margin: 0 0 var(--space-2);
    color: var(--tool-action-dark);
    font-size: var(--type-caption);
    font-weight: 800;
    letter-spacing: .08em;
}

.hero h1 {
    margin: 0;
    color: var(--tool-ink);
    font-size: var(--type-hero);
    font-weight: 850;
    letter-spacing: -.05em;
    line-height: 1.08;
}

.hero-lead {
    max-width: 650px;
    margin: var(--space-5) 0;
    color: var(--tool-text);
    font-size: var(--type-lead);
    font-weight: 650;
    line-height: 1.65;
}

.privacy-note {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--tool-action-border);
    border-radius: 999px;
    background: var(--tool-action-soft);
    color: var(--tool-ink);
    font-size: var(--type-small);
    font-weight: 750;
}

.privacy-note svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--tool-action-dark);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.hero-art {
    width: 100%;
    max-width: 300px;
    margin-inline: auto;
    filter: drop-shadow(0 18px 18px rgba(44, 62, 80, .14));
}

.hero-sheet {
    stroke-width: 2;
}

.hero-sheet-back {
    fill: var(--tool-action-soft);
    stroke: var(--tool-action-border);
}

.hero-sheet-front {
    fill: var(--tool-surface);
    stroke: var(--tool-ink);
}

.hero-line,
.hero-arrow,
.hero-fold {
    fill: none;
    stroke: var(--tool-action);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 5;
}

.hero-fold {
    stroke: var(--tool-ink);
    stroke-width: 2;
}

.hero-art text {
    fill: var(--tool-danger);
    font-size: var(--type-section);
    font-weight: 900;
}

.tool-surface {
    border: 1px solid var(--tool-line);
    border-radius: var(--radius-large);
    background: var(--tool-surface);
    box-shadow: var(--tool-shadow);
}

.workspace {
    padding: clamp(var(--space-6), 5vw, var(--space-10));
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.section-heading h2,
.tool-result h2,
.trust-section h2,
.faq-section h2 {
    margin: 0;
    color: var(--tool-ink);
    font-size: var(--type-title);
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.35;
}

.format-note {
    flex: none;
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
    background: var(--tool-action-soft);
    color: var(--tool-action-dark);
    font-size: var(--type-caption);
    font-weight: 800;
}

.drop-zone {
    display: grid;
    justify-items: center;
    min-height: 250px;
    margin-top: var(--space-6);
    padding: var(--space-7);
    border: 2px dashed var(--tool-action-border);
    border-radius: var(--radius-medium);
    background: var(--tool-canvas);
    text-align: center;
    transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.drop-zone.is-dragging {
    transform: translateY(-2px);
    border-color: var(--tool-action);
    background: var(--tool-action-soft);
}

.drop-zone > svg {
    width: 52px;
    height: 52px;
    margin-bottom: var(--space-3);
    fill: none;
    stroke: var(--tool-action-dark);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.drop-zone p {
    margin: var(--space-1) 0;
    color: var(--tool-muted);
}

.drop-zone strong {
    color: var(--tool-ink);
    font-size: var(--type-section);
}

#file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.tool-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--space-10);
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-weight: 800;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.tool-button:hover {
    transform: translateY(-1px);
}

.tool-button:active {
    transform: translateY(1px);
}

.tool-button.primary {
    border-color: var(--tool-action-strong);
    background: var(--tool-action-strong);
    color: var(--tool-action-contrast);
}

.tool-button.primary:hover {
    border-color: var(--tool-ink);
    background: var(--tool-ink);
}

.tool-button.primary:active {
    border-color: var(--tool-action-pressed);
    background: var(--tool-action-pressed);
}

.tool-button.secondary {
    border-color: var(--tool-action-border);
    background: var(--tool-surface);
    color: var(--tool-action-dark);
}

.tool-button.secondary:hover {
    border-color: var(--tool-action);
    background: var(--tool-action-soft);
}

.tool-button:disabled {
    transform: none;
    border-color: var(--tool-disabled);
    background: var(--tool-disabled);
    color: var(--tool-action-contrast);
    cursor: wait;
}

.tool-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.queue-section {
    margin-top: var(--space-8);
    padding-top: var(--space-7);
    border-top: 1px solid var(--tool-line);
}

.queue-heading {
    align-items: center;
}

.queue-help {
    margin: var(--space-2) 0 var(--space-4);
    color: var(--tool-muted);
    font-size: var(--type-small);
}

.text-button {
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border: 0;
    border-radius: var(--radius-small);
    background: transparent;
    cursor: pointer;
    font-weight: 750;
}

.text-button.danger {
    color: var(--tool-danger);
}

.text-button.danger:hover {
    background: var(--tool-danger-soft);
}

.file-queue {
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: file-order;
}

.file-queue-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-3);
    border: 1px solid var(--tool-line);
    border-radius: var(--radius-medium);
    background: var(--tool-surface);
    box-shadow: var(--tool-shadow-small);
    counter-increment: file-order;
}

.file-queue-card.is-dragging {
    opacity: .55;
}

.file-order {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: var(--tool-action-soft);
    color: var(--tool-action-dark);
    font-size: var(--type-small);
    font-weight: 850;
}

.file-order::before {
    content: counter(file-order);
}

.file-details {
    min-width: 0;
}

.file-name {
    display: block;
    overflow: hidden;
    color: var(--tool-ink);
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    color: var(--tool-muted);
    font-size: var(--type-caption);
    font-weight: 650;
}

.file-actions {
    display: flex;
    gap: var(--space-1);
}

.icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--tool-line);
    border-radius: var(--radius-small);
    background: var(--tool-surface);
    color: var(--tool-muted);
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--tool-action-border);
    background: var(--tool-action-soft);
    color: var(--tool-action-dark);
}

.icon-button.danger:hover {
    border-color: var(--tool-danger);
    background: var(--tool-danger-soft);
    color: var(--tool-danger);
}

.icon-button:disabled {
    background: var(--tool-canvas);
    color: var(--tool-disabled);
    cursor: default;
}

.icon-button svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.output-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-3) var(--space-4);
    align-items: end;
    margin-top: var(--space-6);
    padding: var(--space-5);
    border-radius: var(--radius-medium);
    background: var(--tool-action-soft);
}

.output-panel > label {
    grid-column: 1 / -1;
    color: var(--tool-ink);
    font-size: var(--type-small);
    font-weight: 800;
}

.output-name-row {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: var(--space-10);
    padding-right: var(--space-3);
    border: 1px solid var(--tool-action-border);
    border-radius: var(--radius-small);
    background: var(--tool-surface);
}

.output-name-row input {
    min-width: 0;
    width: 100%;
    height: 46px;
    padding: 0 0 0 var(--space-3);
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--tool-text);
}

.output-name-row span {
    flex: none;
    color: var(--tool-muted);
    font-weight: 750;
}

.merge-button {
    min-width: 184px;
}

.tool-status {
    margin-top: var(--space-5);
    padding: var(--space-3) var(--space-4);
    border-left: 4px solid var(--tool-action);
    border-radius: var(--radius-small);
    background: var(--tool-action-soft);
    color: var(--tool-ink);
    font-size: var(--type-small);
    font-weight: 650;
}

.tool-status.error {
    border-color: var(--tool-danger);
    background: var(--tool-danger-soft);
    color: var(--tool-danger);
}

.tool-status.success {
    border-color: var(--tool-success);
    background: var(--tool-success-soft);
    color: var(--tool-success);
}

.tool-result {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-5);
    margin-top: var(--space-6);
    padding: var(--space-6);
    border: 1px solid var(--tool-success);
    border-radius: var(--radius-medium);
    background: var(--tool-success-soft);
}

.result-icon {
    width: 52px;
    height: 52px;
    fill: var(--tool-surface);
    stroke: var(--tool-success);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.tool-result p {
    margin: var(--space-1) 0 0;
    color: var(--tool-muted);
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.ad-wrap {
    width: min(100%, 380px);
    min-height: 292px;
    margin: var(--space-5) auto 0;
    padding: var(--space-3);
    text-align: center;
}

.ad-wrap > p {
    margin: 0 0 var(--space-2);
    color: var(--tool-muted);
    font-size: var(--type-micro);
}

.ad-wrap ins {
    margin-inline: auto;
}

#adfit-bottom:not(:has(iframe)),
#result-ad-wrap:not(:has(iframe)) {
    display: none !important;
}

.info-section,
.faq-section {
    padding: var(--space-14) 0 var(--space-6);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-6);
}

.tool-info-card {
    padding: var(--space-6);
    border: 1px solid var(--tool-line);
    border-radius: var(--radius-medium);
    background: var(--tool-surface);
}

.info-number {
    display: grid;
    width: 38px;
    height: 38px;
    margin-bottom: var(--space-4);
    place-items: center;
    border-radius: 50%;
    background: var(--tool-ink);
    color: var(--tool-action-contrast);
    font-weight: 850;
}

.tool-info-card h3 {
    margin: 0;
    color: var(--tool-ink);
    font-size: var(--type-section);
}

.tool-info-card p {
    margin: var(--space-2) 0 0;
    color: var(--tool-muted);
}

.trust-section {
    display: grid;
    grid-template-columns: minmax(230px, .8fr) minmax(0, 1.2fr);
    gap: var(--space-7);
    margin-top: var(--space-12);
    padding: var(--space-7);
}

.trust-section > p {
    margin: 0;
    color: var(--tool-muted);
}

.trust-privacy-line {
    display: block;
    margin-top: var(--space-2);
}

.faq-section {
    max-width: 820px;
    margin-inline: auto;
}

.faq-list {
    display: grid;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

.faq-list details {
    border: 1px solid var(--tool-line);
    border-radius: var(--radius-medium);
    background: var(--tool-surface);
}

.faq-list summary {
    padding: var(--space-5);
    color: var(--tool-ink);
    cursor: pointer;
    font-size: var(--type-section);
    font-weight: 800;
}

.faq-no-break {
    white-space: nowrap;
}

.faq-list details p {
    margin: 0;
    padding: 0 var(--space-5) var(--space-5);
    color: var(--tool-muted);
}

footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    width: min(1080px, calc(100% - 40px));
    margin: var(--space-10) auto 0;
    padding: var(--space-6) 0;
    border-top: 1px solid var(--tool-line);
    color: var(--tool-muted);
    font-size: var(--type-small);
}

footer p {
    margin: 0;
}

.noscript-message {
    position: fixed;
    inset: auto var(--space-4) var(--space-4);
    z-index: 10000;
    padding: var(--space-4);
    border-radius: var(--radius-small);
    background: var(--tool-danger);
    color: var(--tool-action-contrast);
    text-align: center;
    font-weight: 800;
}

:focus-visible {
    outline: 3px solid var(--tool-action);
    outline-offset: 3px;
}

@media (max-width: 760px) {
    .tool-header {
        align-items: flex-start;
        gap: var(--space-3);
    }

    .tool-header nav {
        justify-content: flex-end;
        gap: var(--space-3);
    }

    .tool-header nav a:nth-child(2),
    .tool-header nav a:nth-child(3) {
        display: none;
    }

    main {
        width: min(100% - 28px, 680px);
    }

    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: var(--space-11) var(--space-3) var(--space-8);
    }

    .hero-art {
        max-width: 230px;
    }

    .privacy-note {
        align-items: flex-start;
        border-radius: var(--radius-medium);
    }

    .workspace {
        padding: var(--space-5);
        border-radius: var(--radius-medium);
    }

    .drop-zone {
        min-height: 230px;
        padding: var(--space-5);
    }

    .file-queue-card {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .file-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        padding-top: var(--space-2);
        border-top: 1px solid var(--tool-line);
    }

    .output-panel {
        grid-template-columns: 1fr;
        padding: var(--space-4);
    }

    .output-panel > label {
        grid-column: auto;
    }

    .merge-button {
        width: 100%;
    }

    .tool-result {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .result-icon {
        margin-inline: auto;
    }

    .result-actions {
        justify-content: center;
    }

    .result-actions .tool-button {
        width: 100%;
    }

    .info-grid,
    .trust-section {
        grid-template-columns: 1fr;
    }

    .info-section,
    .faq-section {
        padding-top: 56px;
    }

    footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 390px) {
    main,
    footer {
        width: min(100% - 20px, 370px);
    }

    .tool-header {
        padding-inline: var(--space-3);
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .queue-heading {
        flex-direction: row;
    }

    .format-note {
        align-self: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
