:root {
    --bg: #f6f3ee;
    --surface: rgba(255, 250, 243, 0.92);
    --surface-strong: #fffdf9;
    --ink: #171412;
    --muted: #6f675e;
    --line: rgba(23, 20, 18, 0.12);
    --accent: #d4582b;
    --accent-dark: #b4461e;
    --shadow: 0 20px 50px rgba(59, 43, 29, 0.12);
    --danger: #c33b2e;
    --success: #ebf7ed;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(212, 88, 43, 0.18), transparent 24%),
        radial-gradient(circle at 85% 15%, rgba(72, 121, 102, 0.14), transparent 22%),
        linear-gradient(180deg, #fcf9f4 0%, var(--bg) 100%);
}

.shell {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.topbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.eyebrow,
.step-index {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted);
    font-size: 0.78rem;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 0.96;
}

.muted {
    color: var(--muted);
}

.step-card {
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.dropzone-step {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 24px;
    padding: 28px;
}

.dropzone-copy p:last-child {
    margin-bottom: 0;
    max-width: 560px;
    color: var(--muted);
    line-height: 1.65;
}

.dropzone {
    min-height: 320px;
    border: 2px dashed rgba(212, 88, 43, 0.32);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 248, 242, 0.9)),
        repeating-linear-gradient(
            135deg,
            rgba(212, 88, 43, 0.05),
            rgba(212, 88, 43, 0.05) 10px,
            transparent 10px,
            transparent 20px
        );
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.dropzone.is-dragover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.dropzone-title {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
}

.dropzone-subtitle {
    display: block;
    margin-top: 10px;
    color: var(--muted);
}

.editor-step {
    display: grid;
    gap: 18px;
}

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

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

.side-panel {
    padding: 22px;
    align-self: start;
}

.side-panel ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.6;
}

.timeline-panel {
    min-width: 0;
}

.timeline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
}

.page-card {
    position: relative;
    width: 180px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface-strong);
    box-shadow: 0 16px 34px rgba(54, 39, 26, 0.08);
    cursor: grab;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.page-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 36px rgba(54, 39, 26, 0.12);
}

.page-card.is-dragging {
    opacity: 0.42;
    cursor: grabbing;
}

.page-card.is-drop-target {
    outline: 2px solid rgba(212, 88, 43, 0.35);
    outline-offset: 4px;
}

.thumb-frame {
    width: 100%;
    aspect-ratio: 1 / 1.42;
    border-radius: 14px;
    border: 1px solid rgba(23, 20, 18, 0.08);
    background: linear-gradient(180deg, #f7f5f2 0%, #ffffff 100%);
    overflow: hidden;
    display: grid;
    place-items: center;
}

.thumb-frame canvas {
    width: 100%;
    height: auto;
    display: block;
}

.page-meta {
    padding-top: 10px;
}

.page-index {
    margin: 0;
    font-weight: 700;
}

.page-source {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-button,
.add-button,
.ghost-button,
.download-button {
    border: 0;
    font: inherit;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.remove-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--danger);
    box-shadow: 0 8px 20px rgba(54, 39, 26, 0.12);
    font-size: 1.05rem;
}

.remove-button:hover,
.add-button:hover,
.ghost-button:hover,
.download-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.add-slot {
    width: 68px;
    min-height: 260px;
    display: grid;
    place-items: center;
}

.add-button {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: rgba(212, 88, 43, 0.11);
    color: var(--accent);
    font-size: 1.7rem;
    font-weight: 500;
}

.ghost-button {
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(23, 20, 18, 0.06);
    color: var(--ink);
}

.download-button {
    padding: 14px 20px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.download-button:disabled {
    opacity: 0.05;
    cursor: not-allowed;
}

.status-banner {
    padding: 14px 18px;
    border: 1px solid rgba(55, 118, 70, 0.18);
    border-radius: 18px;
    background: var(--success);
}

.empty-state {
    width: 100%;
    padding: 42px 24px;
    border: 1px dashed var(--line);
    border-radius: 22px;
    text-align: center;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.6);
}

.hidden {
    display: none !important;
}

@media (max-width: 960px) {
    .dropzone-step,
    .editor-grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .editor-header {
        align-items: start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 16px, 1180px);
        padding-top: 18px;
    }

    .dropzone-step,
    .editor-header,
    .side-panel {
        padding: 18px;
    }

    .timeline {
        gap: 12px;
    }

    .page-card {
        width: calc(50% - 6px);
        min-width: 150px;
    }

    .add-slot {
        width: 52px;
        min-height: 208px;
    }

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