@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
    --bg: #f6f7f4;
    --bg-deep: #edf0eb;
    --panel: rgba(255, 255, 255, 0.72);
    --panel-strong: rgba(255, 255, 255, 0.88);
    --line: rgba(16, 24, 20, 0.08);
    --line-strong: rgba(16, 24, 20, 0.14);
    --ink: #171a19;
    --muted: #70756f;
    --accent: #3b82f6;
    --warn: #a16b31;
    --radius: 10px;
    --radius-sm: 10px;
    --shadow: 0 24px 72px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.04);
    --max-width: 1180px;
    --tool-max-width: 1460px;
    --font-sans: "Plus Jakarta Sans", "Segoe UI", "Helvetica Neue", sans-serif;
    --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-sans);
    background:
        radial-gradient(circle at 18% 14%, rgba(59, 130, 246, 0.07), transparent 22%),
        radial-gradient(circle at 82% 10%, rgba(15, 23, 42, 0.05), transparent 24%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.026) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
    opacity: 0.34;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes soft-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.08);
    }

    50% {
        transform: scale(1.04);
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

.site-main {
    width: min(calc(100% - 32px), var(--max-width));
    margin: 0 auto;
    padding: 52px 0 72px;
}

.site-main-wide {
    width: calc(100% - 96px);
    max-width: none;
    margin: 0 48px;
}

.center-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 124px);
}

.center-shell.center-shell-top {
    place-items: start center;
    min-height: auto;
}

.dashboard-shell,
.pdf-workspace {
    width: min(100%, 1140px);
}

.pdf-workspace.pdf-workspace-wide {
    width: min(100%, var(--tool-max-width));
}

.dashboard-shell,
.pdf-workspace {
    animation: fade-up 480ms ease both;
}

.dashboard-shell {
    display: grid;
    gap: 34px;
}

.dashboard-title,
.page-title,
h2,
h3 {
    margin: 0;
    letter-spacing: -0.045em;
}

.dashboard-title {
    text-align: center;
    font-size: clamp(4rem, 11vw, 7.4rem);
    font-weight: 800;
    line-height: 0.9;
}

.page-heading {
    display: grid;
    gap: 16px;
    justify-items: center;
    text-align: center;
    margin-bottom: 28px;
}

.center-shell-top .page-heading {
    justify-items: start;
    text-align: left;
    margin-bottom: 22px;
}

.page-heading-copy {
    display: grid;
    gap: 8px;
}

.page-title {
    font-size: clamp(2.8rem, 7vw, 4.8rem);
    line-height: 0.92;
    font-weight: 800;
}

.back-link,
.mono-note {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
    text-decoration: none;
}

.subtle-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    font-size: 0.94rem;
}

.tool-grid,
.mode-grid,
.workspace-split,
.uploaded-list,
.page-grid,
.merge-groups,
.reorder-canvas,
.stack-gap {
    display: grid;
}

.tool-grid-minimal,
.mode-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
}

.compress-panel,
.compress-levels,
.compress-summary {
    display: grid;
}

.tool-card,
.workspace-card,
.pdf-group,
.page-tile,
.reorder-tile,
.upload-item,
.merge-groups-empty,
.export-result {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.tool-card {
    display: grid;
    place-items: center;
    gap: 18px;
    min-height: 214px;
    padding: 28px 22px;
    border-radius: var(--radius);
    text-decoration: none;
    transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.tool-card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
}

.tool-card-minimal.is-planned {
    opacity: 0.7;
}

.tool-icon {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow: var(--shadow-soft);
    color: #1f2937;
}

.tool-icon svg,
.tool-icon [data-lucide] {
    width: 34px;
    height: 34px;
}

.tool-subtitle {
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
}

.pdf-workspace {
    display: grid;
    gap: 24px;
}

.workspace-split {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    transition: grid-template-columns 280ms ease, gap 280ms ease;
}

.workspace-card {
    border-radius: var(--radius);
    padding: 24px;
    transition: transform 240ms ease, opacity 240ms ease, box-shadow 240ms ease, border-color 240ms ease;
}

.stack-gap {
    gap: 18px;
}

.column-heading,
.action-header,
.export-bar {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
}

.upload-launch {
    display: grid;
    place-items: center;
    gap: 12px;
    min-height: 180px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line-strong);
    background: rgba(255, 255, 255, 0.56);
    cursor: pointer;
    text-decoration: none;
    transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.column-heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-launch:hover {
    transform: translateY(-2px) scale(1.003);
    border-color: rgba(59, 130, 246, 0.24);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.06);
}

.upload-launch:active {
    transform: translateY(0) scale(0.996);
}

.upload-launch input {
    display: none;
}

.upload-launch-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
}

.upload-launch-icon svg {
    width: 26px;
    height: 26px;
}

.upload-launch-title {
    font-weight: 700;
}

.upload-launch.is-compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: start;
    min-height: 0;
    gap: 8px;
    padding: 7px 12px;
    border-style: solid;
    background: rgba(255, 255, 255, 0.78);
}

.upload-launch.is-compact .upload-launch-icon {
    width: 18px;
    height: 18px;
    background: transparent;
    border: 0;
}

.upload-launch.is-compact .upload-launch-icon svg {
    width: 14px;
    height: 14px;
}

.upload-launch.is-compact .upload-launch-title {
    font-size: 0.8rem;
    font-weight: 600;
}

.feedback {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 246, 236, 0.94);
    color: var(--warn);
    border: 1px solid rgba(176, 109, 44, 0.12);
}

.uploaded-list,
.merge-groups,
.reorder-canvas {
    gap: 12px;
}

.upload-item {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
}

.upload-item-preview {
    grid-template-columns: 80px minmax(0, 1fr);
}

.upload-item img {
    width: 80px;
    height: 112px;
    object-fit: cover;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.04);
}

.upload-item-body {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.upload-actions,
.export-result {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.upload-actions {
    grid-column: 1 / -1;
}

.subtle-icon-button {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.subtle-icon-button:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.66);
    border-color: var(--line);
}

.subtle-icon-button svg {
    width: 16px;
    height: 16px;
}

.upload-title,
.pdf-group-head h3 {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

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

.button-primary {
    background: #171a19;
    color: #fff;
}

.button:disabled {
    opacity: 0.56;
    cursor: not-allowed;
    transform: none;
}

.button-secondary {
    background: rgba(255, 255, 255, 0.66);
    border-color: var(--line);
    color: var(--ink);
}

.field-group {
    display: grid;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

.field-group span,
.upload-meta,
.page-card-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.field-group input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
}

.field-group select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    appearance: none;
}

.field-group input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.24);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.field-group select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.24);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.merge-groups-empty,
.export-result {
    padding: 16px;
    border-radius: var(--radius-sm);
}

.compress-empty,
.compress-summary,
.level-card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
}

.compress-empty {
    padding: 16px;
    border-radius: var(--radius-sm);
}

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

.level-card {
    display: grid;
    gap: 6px;
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: left;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.level-card:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.level-card.is-active {
    border-color: rgba(37, 99, 235, 0.72);
    background: rgba(239, 246, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.level-title,
.summary-value {
    font-weight: 700;
}

.level-meta,
.summary-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.compress-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
}

.summary-pill {
    display: grid;
    gap: 4px;
}

.export-result:empty {
    display: none !important;
}

.footer-action-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.footer-field {
    min-width: 0;
}

.pdf-workspace[data-empty-state="true"] .workspace-split {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    justify-items: center;
}

.pdf-workspace[data-empty-state="true"] .upload-column {
    width: min(100%, 760px);
    transform: translateY(10px) scale(0.995);
    animation: fade-up 420ms ease both;
}

.pdf-workspace[data-empty-state="true"] .action-column {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    pointer-events: none;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    box-shadow: none;
    overflow: hidden;
}

.pdf-workspace[data-empty-state="true"] .upload-launch {
    min-height: 320px;
    gap: 16px;
}

.pdf-workspace[data-empty-state="true"] .upload-launch:hover {
    transform: translateY(-4px) scale(1.004);
    border-color: rgba(59, 130, 246, 0.28);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 28px 52px rgba(15, 23, 42, 0.08);
}

.pdf-workspace[data-empty-state="true"] .upload-launch-icon {
    width: 76px;
    height: 76px;
    animation: soft-pulse 2.8s ease-in-out infinite;
}

.pdf-workspace[data-empty-state="true"] .upload-launch-icon svg {
    width: 30px;
    height: 30px;
}

.pdf-workspace[data-empty-state="false"] .action-column {
    opacity: 1;
    transform: translateY(0) scale(1);
    max-height: 4000px;
    animation: fade-up 320ms ease both;
}

.pdf-group {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-sm);
}

.pdf-group-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.page-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
}

.page-tile {
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.page-tile:hover,
.reorder-tile:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.page-tile.is-selected {
    border-color: rgba(37, 99, 235, 0.72);
    background: rgba(239, 246, 255, 0.9);
    box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.18), 0 16px 30px rgba(59, 130, 246, 0.14);
}

.page-tile-hit {
    width: 100%;
    border: 0;
    padding: 10px;
    background: transparent;
    cursor: pointer;
    display: grid;
    gap: 10px;
    text-align: left;
}

.page-preview-frame {
    display: grid;
    place-items: center;
    min-height: 184px;
    padding: 8px;
    border-radius: 14px;
    background: rgba(244, 247, 250, 0.86);
    overflow: hidden;
}

.page-preview-media {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.04);
    transform: rotate(var(--page-rotation, 0deg));
    transition: transform 220ms ease;
}

.page-tile-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px 10px;
}

.tile-icon-button {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.tile-icon-button:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.96);
}

.reorder-canvas {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}

.reorder-tile {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    cursor: grab;
}

.reorder-tile[data-drop-position="before"]::before,
.reorder-tile[data-drop-position="after"]::after {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.72);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
    pointer-events: none;
}

.reorder-tile[data-drop-position="before"]::before {
    left: -8px;
}

.reorder-tile[data-drop-position="after"]::after {
    right: -8px;
}

.reorder-tile-body {
    display: grid;
    gap: 6px;
}

.text-link {
    color: var(--accent);
    text-decoration: none;
}

@media (max-width: 900px) {
    .site-main {
        width: min(calc(100% - 20px), var(--max-width));
        padding: 32px 0 48px;
    }

    .site-main-wide {
        width: calc(100% - 32px);
        margin: 0 16px;
    }

    .workspace-split,
    .column-heading,
    .action-header,
    .pdf-group-head,
    .upload-item-preview {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: start;
    }

    .tool-grid-minimal,
    .mode-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .center-shell.center-shell-top .page-heading {
        justify-items: center;
        text-align: center;
    }

    .page-grid,
    .reorder-canvas,
    .compress-levels,
    .compress-summary {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .footer-action-bar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

@media (min-width: 1200px) {
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    }

    .reorder-canvas {
        grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    }
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 24px;
    font-size: 0.875rem;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
}

.site-footer a {
    color: #6b7280;
    text-decoration: none;
}

.site-footer a:hover {
    color: #111827;
}

.site-footer-github {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s;
}

.site-footer-github:hover {
    border-color: #111827;
    color: #111827 !important;
}
