:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --navy: #0c1950;
    --muted: #53689f;
    --line: #d4d5d8;
    --blue: #526cf0;
    --orange: #ff6b05;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: #f8fbff;
}

body.merger-body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--navy);
    background:
        radial-gradient(circle at 18% 12%, rgba(231, 242, 255, 0.95), transparent 35%),
        linear-gradient(140deg, #fbfdff 0%, #f4f8ff 54%, #eef4ff 100%);
}

button,
input {
    font: inherit;
}

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

button {
    cursor: pointer;
}

.merger-app {
    min-height: 100vh;
}

.merger-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 40px 18px;
}

.merger-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.history-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 58px;
    padding: 0 16px;
    border: 1px solid #d3d4d7;
    border-radius: 12px;
    color: #233a7a;
    background: rgba(255, 255, 255, 0.42);
    font-size: 16px;
    font-weight: 700;
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.history-toggle:hover,
.history-toggle[aria-expanded="true"] {
    background: #fff;
    box-shadow: 0 8px 18px rgba(74, 103, 171, 0.1);
    transform: translateY(-1px);
}

.history-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.history-count {
    display: inline-grid;
    min-width: 23px;
    height: 23px;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    color: #fff;
    background: #526cf0;
    font-size: 12px;
    font-weight: 800;
}

.history-backdrop {
    position: fixed;
    z-index: 20;
    inset: 0;
    background: rgba(15, 28, 67, 0.22);
    opacity: 0;
    transition: opacity 220ms ease;
}

.history-backdrop.is-visible {
    opacity: 1;
}

.history-sidebar {
    position: fixed;
    z-index: 21;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    width: min(420px, 92vw);
    flex-direction: column;
    padding: 26px 22px 22px;
    border-left: 1px solid #d4d5d8;
    color: var(--navy);
    background: #fff;
    box-shadow: -18px 0 46px rgba(31, 54, 103, 0.2);
    transform: translateX(102%);
    transition: transform 220ms ease;
}

.history-sidebar.is-open {
    transform: translateX(0);
}

.history-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.history-sidebar h2 {
    margin: 0;
    color: #111d55;
    font-size: 28px;
    letter-spacing: -0.035em;
}

.history-close {
    position: static;
    flex: 0 0 auto;
}

.history-description {
    margin: 14px 0 0;
    color: #65718a;
    font-size: 13px;
    line-height: 1.5;
}

.history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    padding-bottom: 13px;
    border-bottom: 1px solid #e1e3e6;
    color: #52648e;
    font-size: 12px;
    font-weight: 700;
}

.clear-history-button {
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    color: #7c5960;
    background: #fff1f1;
    font-size: 11px;
    font-weight: 750;
}

.clear-history-button:hover:not(:disabled) {
    color: #fff;
    background: #bb5b66;
}

.clear-history-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.history-list {
    display: grid;
    align-content: start;
    gap: 10px;
    margin-top: 14px;
    overflow-y: auto;
}

.history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 6px;
    padding: 5px;
    border: 1px solid #dfe2e6;
    border-radius: 10px;
    background: #fafbfc;
}

.history-item-open {
    display: grid;
    min-width: 0;
    gap: 4px;
    padding: 9px;
    border: 0;
    border-radius: 7px;
    color: #233a7a;
    background: transparent;
    text-align: left;
    text-decoration: none;
}

.history-item-open:hover {
    background: #eef3ff;
}

.history-item-open strong {
    overflow: hidden;
    color: #17275f;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-open span,
.history-item-open small {
    color: #71809e;
    font-size: 11px;
}

.history-item-open small {
    color: #52648e;
    font-weight: 700;
}

.history-item-delete {
    width: 28px;
    height: 28px;
    align-self: center;
    margin-right: 4px;
    border: 0;
    border-radius: 6px;
    color: #8992a3;
    background: transparent;
    font-size: 20px;
    line-height: 1;
}

.history-item-delete:hover {
    color: #a23b3b;
    background: #fff0f0;
}

.history-empty {
    margin: 22px 4px 0;
    color: #7c89a4;
    font-size: 13px;
    line-height: 1.55;
}

body.history-is-open {
    overflow: hidden;
}

.merger-brand {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    color: var(--navy);
    text-decoration: none;
}

.merger-brand-icon {
    display: block;
    width: 74px;
    height: 68px;
    flex: 0 0 74px;
}

.merger-brand-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.merger-title,
.merger-subtitle {
    display: block;
}

.merger-title {
    font-size: clamp(25px, 2.4vw, 39px);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.02;
}

.back-home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 58px;
    padding: 0 18px;
    border: 1px solid #d3d4d7;
    border-radius: 12px;
    color: #233a7a;
    background: rgba(255, 255, 255, 0.42);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.back-home:hover {
    background: white;
    box-shadow: 0 8px 18px rgba(74, 103, 171, 0.1);
    transform: translateY(-1px);
}

.back-home svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.merger-subtitle {
    margin-top: 7px;
    color: #50679d;
    font-size: clamp(14px, 1.35vw, 21px);
    font-weight: 520;
    letter-spacing: 0.005em;
}

.how-it-works {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    min-height: 58px;
    padding: 0 22px;
    border: 1px solid #d3d4d7;
    border-radius: 12px;
    color: #233a7a;
    background: rgba(255, 255, 255, 0.42);
    font-size: 18px;
    font-weight: 620;
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.how-it-works:hover {
    background: white;
    box-shadow: 0 8px 18px rgba(74, 103, 171, 0.1);
    transform: translateY(-1px);
}

.help-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 3px solid #5064a0;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.merger-main {
    width: min(100%, 1900px);
    margin: 0 auto;
    padding: 0 32px 32px;
}

.slide-grid-panel {
    padding: 14px 12px 25px;
    border: 1px solid #d4d5d8;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 13px 34px rgba(76, 112, 176, 0.06);
}

.bulk-upload-panel {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #d4d5d8;
    border-radius: 12px;
    background: rgba(248, 249, 250, 0.86);
}

.bulk-upload-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 16px;
}

.bulk-upload-dropzone {
    display: flex;
    min-height: 128px;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    border: 2px dashed #b8bcc3;
    border-radius: 10px;
    color: #59616d;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.bulk-upload-dropzone:hover,
.bulk-upload-dropzone.is-drag-over {
    border-color: #6178f1;
    background: #f4f7ff;
    box-shadow: 0 0 0 3px rgba(97, 120, 241, 0.12);
}

.bulk-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.bulk-upload-icon {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border-radius: 12px;
    color: #526cf0;
    background: #e8edff;
}

.bulk-upload-icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.bulk-upload-copy {
    display: grid;
    gap: 4px;
    color: #68717e;
    font-size: 14px;
}

.bulk-upload-copy strong {
    color: #19285e;
    font-size: 18px;
    font-weight: 800;
}

.bulk-upload-action {
    display: flex;
    min-width: 220px;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auto-arrange-button {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 18px;
    border: 1px solid #526cf0;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #6178f1, #4059d8);
    box-shadow: 0 7px 16px rgba(73, 94, 218, 0.18);
    font-size: 15px;
    font-weight: 800;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.auto-arrange-button:not(:disabled):hover {
    box-shadow: 0 10px 20px rgba(73, 94, 218, 0.28);
    filter: saturate(1.08);
    transform: translateY(-1px);
}

.auto-arrange-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

.auto-arrange-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.bulk-arrange-status {
    margin: 0;
    color: #65718a;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.bulk-upload-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    color: #65718a;
    font-size: 13px;
}

.bulk-upload-meta strong {
    color: #19285e;
}

.bulk-file-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.bulk-file-item {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid #d9dde3;
    border-radius: 8px;
    color: #34415f;
    background: #fff;
}

.bulk-file-item.is-invalid {
    border-color: #e4b4b4;
    background: #fff8f8;
}

.bulk-file-details {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.bulk-file-details strong {
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bulk-file-details small {
    color: #74809a;
    font-size: 11px;
}

.bulk-file-remove {
    flex: 0 0 auto;
    padding: 4px 6px;
    border: 0;
    border-radius: 5px;
    color: #5b6572;
    background: #eef0f2;
    font-size: 11px;
    font-weight: 750;
}

.bulk-file-remove:hover {
    color: #842d2d;
    background: #f7dede;
}

.bulk-upload-warnings {
    display: grid;
    gap: 4px;
    margin-top: 10px;
    padding: 9px 11px;
    border: 1px solid #e3b8b8;
    border-radius: 8px;
    color: #842d2d;
    background: #fff7f7;
    font-size: 12px;
}

.bulk-upload-warnings p {
    margin: 0;
}

.slide-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px 18px;
}

.slide-card {
    position: relative;
    min-width: 0;
    aspect-ratio: 1.84 / 1;
    overflow: hidden;
    border: 1px solid #d0d2d6;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 4px 13px rgba(68, 102, 161, 0.1);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.slide-card:hover {
    border-color: #aeb1b7;
    box-shadow: 0 8px 20px rgba(68, 102, 161, 0.15);
    transform: translateY(-1px);
}

.slide-card.is-dragging {
    opacity: 0.45;
}

.slide-card.is-drag-over {
    border-color: #4e6fee;
    box-shadow: 0 0 0 3px rgba(78, 111, 238, 0.24), 0 10px 22px rgba(68, 102, 161, 0.16);
    transform: translateY(-2px);
}

.slide-card-header {
    position: absolute;
    z-index: 4;
    top: 8px;
    right: 8px;
    left: 8px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: start;
    gap: 6px;
    pointer-events: none;
}

.slide-number {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border: 1px solid #d4d5d8;
    border-radius: 50%;
    color: #0e1b51;
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 3px 10px rgba(71, 99, 156, 0.13);
    font-size: 18px;
    font-weight: 760;
}

.slide-menu-dots {
    min-width: 37px;
    padding: 5px 7px 7px;
    border: 1px solid rgba(211, 212, 215, 0.94);
    border-radius: 12px;
    color: #24427f;
    background: rgba(255, 255, 255, 0.86);
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 12px;
    text-align: center;
}

.slide-card-title,
.slide-generation-status {
    overflow: hidden;
    align-self: center;
    padding: 6px 8px;
    border: 1px solid rgba(211, 212, 215, 0.94);
    border-radius: 9px;
    color: #1d3472;
    background: rgba(255, 255, 255, 0.88);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slide-generation-status {
    color: #6c7894;
    font-size: 10px;
    font-weight: 650;
}

.slide-card.is-generating .slide-generation-status {
    color: #8b6219;
    background: #fff7dd;
}

.slide-card.is-ready .slide-generation-status {
    color: #16734c;
    background: #eafaf1;
}

.slide-prompt-details {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 7;
    padding: 7px 9px;
    border: 1px solid rgba(211, 212, 215, 0.94);
    border-radius: 8px;
    color: #20335f;
    background: rgba(255, 255, 255, 0.95);
    font-size: 11px;
}

.slide-prompt-details summary {
    cursor: pointer;
    font-weight: 700;
}

.slide-prompt-details p {
    max-height: 82px;
    margin: 7px 0 0;
    overflow-y: auto;
    color: #5d6f99;
    line-height: 1.4;
}

.slide-visual {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
}

.slide-placeholder,
.slide-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.slide-placeholder {
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #0d1b51;
    background: linear-gradient(135deg, #ffffff 0%, #f1f6ff 72%, #dbe9ff 100%);
}

.slide-placeholder-2,
.slide-placeholder-6,
.slide-placeholder-12,
.slide-placeholder-17 {
    background: linear-gradient(135deg, #fffdf3 0%, #f5f8ff 62%, #ffe7bd 100%);
}

.slide-placeholder-3,
.slide-placeholder-8,
.slide-placeholder-14 {
    background: linear-gradient(135deg, #ffffff 0%, #effdff 65%, #c8f0f3 100%);
}

.slide-placeholder-5,
.slide-placeholder-11,
.slide-placeholder-15,
.slide-placeholder-18 {
    background: linear-gradient(135deg, #ffffff 0%, #f8f7ff 60%, #e5d9ff 100%);
}

.upload-plus {
    position: relative;
    z-index: 1;
    color: #53699e;
    font-size: clamp(34px, 4vw, 64px);
    font-weight: 300;
    line-height: 1;
}

.slide-preview {
    z-index: 2;
    object-fit: contain;
    background: #fff;
}

.drop-hint {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 5;
    display: none;
    padding: 7px 8px;
    border-radius: 8px;
    color: #fff;
    background: rgba(26, 49, 112, 0.82);
    font-size: 12px;
    font-weight: 650;
    text-align: center;
}

.slide-card.is-drag-over .drop-hint {
    display: block;
}

.slide-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.remove-slide {
    position: absolute;
    right: 9px;
    bottom: 8px;
    z-index: 6;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid #d1d2d5;
    border-radius: 10px;
    color: #132965;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 3px 10px rgba(56, 81, 133, 0.12);
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 160ms ease, transform 160ms ease, color 160ms ease, background 160ms ease;
}

.slide-card:hover .remove-slide,
.slide-card:focus-within .remove-slide,
.slide-card.has-image .remove-slide {
    opacity: 1;
    transform: translateY(0);
}

.remove-slide:hover {
    color: #fff;
    background: #526cf0;
}

.remove-slide svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.grid-reminder {
    margin: 24px 2px 0;
    color: #586b9e;
    font-size: 16px;
    font-style: italic;
    line-height: 1.35;
}

.merge-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
    padding: 14px 18px;
    border: 1px solid #d4d5d8;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 10px 26px rgba(76, 112, 176, 0.06);
}

.merge-summary {
    display: flex;
    align-items: center;
    gap: 13px;
}

.summary-icon {
    display: grid;
    width: 46px;
    height: 50px;
    place-items: center;
    color: #53679f;
}

.summary-icon svg {
    width: 36px;
    height: 40px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.merge-summary strong,
.merge-summary small {
    display: block;
}

.merge-summary strong {
    color: #132052;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.merge-summary small {
    margin-top: 3px;
    color: #586b9e;
    font-size: 13px;
}

.merge-button,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    min-height: 60px;
    padding: 0 28px;
    border: 1px solid #ff6800;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #ff8a08, #ff5b00);
    box-shadow: 0 8px 18px rgba(255, 105, 0, 0.2);
    font-size: 20px;
    font-weight: 800;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.reset-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 52px;
    padding: 0 18px;
    border: 1px solid #b8bcc3;
    border-radius: 10px;
    color: #59616d;
    background: #f4f5f6;
    box-shadow: 0 4px 10px rgba(81, 89, 101, 0.08);
    font-size: 15px;
    font-weight: 750;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.reset-button:hover {
    background: #eceef0;
    box-shadow: 0 7px 15px rgba(81, 89, 101, 0.14);
    transform: translateY(-1px);
}

.reset-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

.reset-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.merge-button:not(:disabled):hover,
.download-button:hover {
    box-shadow: 0 11px 22px rgba(255, 105, 0, 0.29);
    filter: saturate(1.08);
    transform: translateY(-1px);
}

.merge-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

.merge-button svg,
.download-button svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.merged-pdf {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid rgba(210, 224, 246, 0.9);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 10px 26px rgba(76, 112, 176, 0.06);
}

.merged-pdf-heading,
.merged-pdf-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.section-kicker {
    margin: 0 0 6px;
    color: #4d6fe9;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.17em;
    text-transform: uppercase;
}

.merged-pdf h2 {
    margin: 0;
    color: #111d55;
    font-size: 28px;
    letter-spacing: -0.035em;
}

.pdf-page-count {
    color: #586b9e;
    font-size: 14px;
    font-weight: 650;
}

.pdf-preview-frame {
    aspect-ratio: 16 / 9;
    min-height: 0;
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid #cfd1d5;
    border-radius: 10px;
    background: #edf3fc;
}

.pdf-preview-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    background: #fff;
}

.compression-result {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid #d8e3f4;
    border-radius: 12px;
    background: linear-gradient(135deg, #f7faff, #eef3ff);
}

.compression-result .section-kicker {
    margin: 0 0 10px;
}

.compression-result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.compression-result-grid > div {
    padding: 11px 12px;
    border: 1px solid rgba(216, 227, 244, 0.9);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.82);
}

.compression-result-grid span {
    display: block;
    color: #6879a5;
    font-size: 12px;
    font-weight: 700;
}

.compression-result-grid strong {
    display: block;
    margin-top: 5px;
    color: #243a78;
    font-size: 17px;
    font-weight: 850;
}

.merged-pdf-footer {
    margin-top: 16px;
}

.merged-pdf-footer p {
    margin: 0;
    color: #586b9e;
    font-size: 14px;
}

.pdf-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

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

.compression-controls label {
    color: #53689f;
    font-size: 13px;
    font-weight: 700;
}

.compression-controls select {
    min-height: 42px;
    padding: 0 30px 0 11px;
    border: 1px solid #d8e3f4;
    border-radius: 8px;
    color: #243a78;
    background: #f8fbff;
    font-size: 13px;
    font-weight: 650;
}

.compress-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid #526cf0;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(135deg, #6178f1, #4059d8);
    box-shadow: 0 6px 14px rgba(73, 94, 218, 0.2);
    font-size: 14px;
    font-weight: 800;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.compress-button:not(:disabled):hover {
    box-shadow: 0 9px 18px rgba(73, 94, 218, 0.28);
    filter: saturate(1.08);
    transform: translateY(-1px);
}

.compress-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

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

.pdf-name-control {
    position: relative;
    display: flex;
    min-width: 360px;
    align-self: flex-end;
}

.pdf-name-control label {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    color: #53689f;
    font-size: 11px;
    font-weight: 750;
}

.pdf-name-control input {
    width: 100%;
    min-height: 48px;
    padding: 0 11px;
    border: 1px solid #d8e3f4;
    border-radius: 8px;
    outline: 0;
    color: #243a78;
    background: #f8fbff;
    font-size: 13px;
    font-weight: 650;
}

.pdf-name-control input:focus {
    border-color: #526cf0;
    box-shadow: 0 0 0 3px rgba(82, 108, 240, 0.14);
}

.download-button {
    min-height: 48px;
    padding: 0 19px;
    font-size: 15px;
    text-decoration: none;
}

.download-button svg {
    width: 21px;
    height: 21px;
}

.download-button[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.45;
}

.merger-alert {
    margin-top: 16px;
    padding: 13px 16px;
    border: 1px solid #f0bbbb;
    border-radius: 10px;
    color: #a23b3b;
    background: #fff4f4;
    font-size: 14px;
    font-weight: 600;
}

.how-dialog {
    width: min(480px, calc(100% - 32px));
    padding: 28px;
    border: 1px solid #d3d4d7;
    border-radius: 15px;
    color: var(--navy);
    background: #fff;
    box-shadow: 0 25px 70px rgba(23, 43, 96, 0.24);
}

.how-dialog::backdrop {
    background: rgba(19, 35, 76, 0.24);
    backdrop-filter: blur(3px);
}

.how-dialog h2 {
    margin: 0;
    font-size: 25px;
    letter-spacing: -0.035em;
}

.how-dialog ol {
    margin: 18px 0 0;
    padding-left: 22px;
    color: #50679d;
    line-height: 1.65;
}

.dialog-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 30px;
    height: 30px;
    border: 0;
    color: #586b9e;
    background: transparent;
    font-size: 26px;
    line-height: 1;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1400px) {
    .slide-grid {
        gap: 14px;
    }

    .slide-number {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .slide-menu-dots {
        min-width: 32px;
        padding-right: 4px;
        padding-left: 4px;
        font-size: 14px;
    }
}

@media (max-width: 1080px) {
    .slide-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .merger-header {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 14px 18px 16px;
    }

    .merger-header-actions {
        margin-left: auto;
    }

    .merger-brand-icon {
        width: 58px;
        height: 54px;
        flex-basis: 58px;
    }

    .merger-subtitle {
        max-width: 340px;
        line-height: 1.25;
    }

    .how-it-works {
        min-height: 46px;
        padding: 0 12px;
        font-size: 0;
    }

    .history-toggle {
        min-height: 46px;
        padding: 0 12px;
        font-size: 14px;
    }

    .back-home {
        min-height: 46px;
        padding: 0 12px;
        font-size: 14px;
    }

    .help-icon {
        width: 26px;
        height: 26px;
        font-size: 16px;
    }

    .merger-main {
        padding: 0 14px 24px;
    }

    .slide-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 11px;
    }

    .slide-grid-panel {
        padding: 10px 9px 18px;
    }

    .bulk-upload-row {
        grid-template-columns: 1fr;
    }

    .bulk-upload-action {
        min-width: 0;
        align-items: stretch;
        flex-direction: column;
    }

    .auto-arrange-button {
        width: 100%;
    }

    .bulk-upload-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .slide-number {
        width: 29px;
        height: 29px;
        font-size: 13px;
    }

    .slide-card-header {
        top: 5px;
        right: 5px;
        left: 5px;
    }

    .slide-card-title {
        padding: 5px 6px;
        font-size: 9px;
    }

    .slide-generation-status {
        display: none;
    }

    .slide-menu-dots {
        min-width: 27px;
        padding: 3px 2px 5px;
        border-radius: 8px;
        font-size: 11px;
        letter-spacing: 1px;
    }

    .remove-slide {
        right: 5px;
        bottom: 5px;
        width: 29px;
        height: 29px;
        border-radius: 8px;
    }

    .remove-slide svg {
        width: 16px;
        height: 16px;
    }

    .grid-reminder {
        margin-top: 17px;
        font-size: 13px;
    }

    .merge-toolbar {
        align-items: stretch;
        flex-direction: column;
        margin-top: 14px;
    }

    .merge-button {
        width: 100%;
    }

    .reset-button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .merger-header {
        gap: 10px;
    }

    .merger-header-actions {
        width: 100%;
        justify-content: stretch;
    }

    .back-home,
    .history-toggle,
    .how-it-works {
        flex: 1;
    }

    .how-it-works {
        font-size: 14px;
    }

    .merger-brand {
        gap: 9px;
    }

    .merger-title {
        font-size: 22px;
    }

    .merger-subtitle {
        margin-top: 4px;
        font-size: 12px;
    }

    .merger-brand-icon {
        width: 47px;
        height: 45px;
        flex-basis: 47px;
    }

    .slide-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .slide-grid-panel {
        border-radius: 11px;
    }

    .merged-pdf {
        padding: 14px;
    }

    .merged-pdf-heading,
    .merged-pdf-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .pdf-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .compression-controls {
        justify-content: space-between;
    }

    .compression-controls select {
        flex: 1;
    }

    .compression-result-grid {
        grid-template-columns: 1fr;
    }

    .compress-button {
        width: 100%;
    }

    .pdf-name-control {
        width: 100%;
        min-width: 0;
    }

    .download-button {
        width: 100%;
    }
}
