:root {
    --parchment: #f6f0e3;
    --parchment-deep: #ebdfc9;
    --forest: #1f4638;
    --forest-soft: #315c4c;
    --gold: #c39a42;
    --clay: #a25231;
    --ink: #1e2621;
    --muted: #61706a;
    --card: rgba(250, 246, 238, 0.92);
    --line: rgba(71, 53, 35, 0.12);
    --shadow: 0 24px 60px rgba(31, 45, 40, 0.18);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --max-width: 1320px;
    --heading-font: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    --body-font: "Trebuchet MS", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--body-font);
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(195, 154, 66, 0.28), transparent 32%),
        radial-gradient(circle at bottom right, rgba(43, 102, 80, 0.2), transparent 26%),
        linear-gradient(160deg, #f7f2e7 0%, #ebe1cd 52%, #d7cab2 100%);
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    padding: 0.15rem 0.35rem;
    border-radius: 999px;
    background: rgba(31, 70, 56, 0.08);
    font-size: 0.95em;
}

.page-shell {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    padding: 1.5rem;
}

.ambient {
    position: absolute;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(24px);
    opacity: 0.7;
}

.ambient-one {
    width: 320px;
    height: 320px;
    top: -80px;
    right: -40px;
    background: rgba(195, 154, 66, 0.34);
}

.ambient-two {
    width: 280px;
    height: 280px;
    bottom: -50px;
    left: -20px;
    background: rgba(49, 92, 76, 0.24);
}

.app-header,
.app-frame {
    position: relative;
    z-index: 1;
}

.app-header {
    width: min(100%, var(--max-width));
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.brand-lockup h1,
.hero-copy h2,
.panel-intro h2,
.processing-panel h2,
.result-copy h2 {
    margin: 0;
    font-family: var(--heading-font);
    line-height: 1.05;
    letter-spacing: 0.01em;
}

.brand-lockup h1 {
    font-size: clamp(1.9rem, 3vw, 2.6rem);
}

.subhead,
.lead,
.feature-list,
.tip-card p,
.background-copy span,
.privacy-note,
.countdown-text,
.processing-status {
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 0.35rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--forest);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.mode-pill {
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: rgba(31, 70, 56, 0.08);
    color: var(--forest);
    font-weight: 700;
    font-size: 0.95rem;
}

.app-frame {
    width: min(100%, var(--max-width));
    margin: 0 auto;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.25rem;
}

.step-panel,
.content-panel,
.showcase-card,
.setup-card,
.panel-card,
.info-card,
.processing-panel,
.result-panel,
.hero-panel {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.step-panel,
.content-panel {
    border-radius: var(--radius-xl);
}

.step-panel {
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.dev-tools {
    margin-top: auto;
    display: grid;
    gap: 0.5rem;
    justify-items: start;
}

.dev-launch-shell {
    position: relative;
    width: 100%;
    max-width: 11.5rem;
    min-height: 4rem;
    overflow: hidden;
    border-radius: 1.15rem;
    border: 1px solid rgba(162, 82, 49, 0.34);
    background: rgba(255, 250, 242, 0.84);
    box-shadow: 0 12px 24px rgba(31, 45, 40, 0.1);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.dev-launch-shell:hover,
.dev-launch-shell:focus-within {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(31, 45, 40, 0.16);
}

.dev-launch-shell.is-loading {
    border-color: rgba(195, 154, 66, 0.68);
    box-shadow: 0 16px 30px rgba(195, 154, 66, 0.22);
}

.dev-launch-shell.is-enabled {
    border-color: rgba(31, 70, 56, 0.46);
    box-shadow: 0 16px 30px rgba(31, 70, 56, 0.18);
}

.dev-action {
    width: 100%;
    height: 100%;
    min-height: 4rem;
    padding: 0.75rem 0.95rem;
    border-radius: 1.15rem;
    border: 0;
    background: linear-gradient(135deg, #ba6d44 0%, #d18454 100%);
    color: #fff8ef;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.2rem;
    text-align: left;
    font-weight: 800;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.dev-launch-shell.is-loading .dev-action {
    background: linear-gradient(135deg, #cf9c39 0%, #e3b55a 100%);
    color: #2f2411;
}

.dev-launch-shell.is-enabled .dev-action {
    background: linear-gradient(135deg, var(--forest) 0%, #2f6956 100%);
    color: #f4f9f5;
}

.dev-action-title {
    font-size: 0.88rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1;
}

.dev-action-hint {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    opacity: 0.92;
}

.dev-launch-frame {
    position: absolute;
    width: 1px;
    height: 1px;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

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

.dev-toggle-box {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0.35rem;
    border: 2px solid rgba(31, 70, 56, 0.28);
    background: rgba(246, 240, 227, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.dev-toggle-input:checked + .dev-toggle-box {
    background: rgba(195, 154, 66, 0.78);
    border-color: rgba(162, 82, 49, 0.72);
    transform: translateY(-1px);
}

.dev-toggle-text {
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    font-weight: 700;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 0.95rem;
    border-radius: var(--radius-md);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.38);
}

.step-item.is-active {
    color: var(--ink);
    background: linear-gradient(135deg, rgba(195, 154, 66, 0.24), rgba(49, 92, 76, 0.14));
    border: 1px solid rgba(195, 154, 66, 0.22);
}

.step-number {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--forest);
    color: white;
    font-weight: 700;
}

.content-panel {
    padding: 1.6rem;
}

.flash-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.flash-message {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    font-weight: 700;
}

.flash-error {
    color: #7c2d17;
    background: rgba(204, 110, 74, 0.18);
}

.hero-panel,
.split-panel,
.result-panel {
    display: grid;
    gap: 1.4rem;
}

.hero-panel {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    padding: 2rem;
}

.hero-copy,
.panel-intro,
.result-copy {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.lead {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.65;
}

.builder-credit {
    margin: -0.35rem 0 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.builder-credit-link {
    color: var(--forest);
    font-weight: 800;
}

.builder-credit-link:hover,
.builder-credit-link:focus-visible {
    color: var(--clay);
}

.info-grid,
.tip-list {
    display: grid;
    gap: 1rem;
}

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

.info-card,
.showcase-card,
.setup-card,
.tip-card,
.compact-card {
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.15rem;
}

.info-card h3,
.showcase-card h3,
.setup-card h3,
.tip-card h3,
.panel-card h3 {
    margin: 0 0 0.45rem;
    font-family: var(--heading-font);
    font-size: 1.15rem;
}

.feature-list {
    margin: 0;
    padding-left: 1.25rem;
    display: grid;
    gap: 0.6rem;
    line-height: 1.5;
}

.showcase-label {
    margin: 0 0 0.65rem;
    color: var(--forest);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.hero-side {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.split-panel {
    grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.1fr);
}

.panel-card,
.processing-panel {
    border-radius: var(--radius-xl);
    padding: 1.5rem;
}

.upload-form,
.processing-panel {
    display: grid;
    gap: 1rem;
}

.file-caption {
    margin: 0;
    text-align: center;
    font-weight: 700;
    color: var(--forest-soft);
}

.preview-shell {
    min-height: 260px;
    border-radius: var(--radius-lg);
    border: 2px dashed rgba(49, 92, 76, 0.18);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(236, 228, 212, 0.7));
    display: grid;
    place-items: center;
    overflow: hidden;
}

.preview-shell img,
.mini-preview {
    width: 100%;
    height: 100%;
}

.preview-shell img {
    object-fit: contain;
    max-height: 360px;
    background: rgba(255, 255, 255, 0.75);
    padding: 0.35rem;
}

.mini-preview {
    object-fit: cover;
}

.preview-shell.is-empty img {
    display: none;
}

.preview-placeholder {
    max-width: 20rem;
    text-align: center;
    line-height: 1.6;
    color: var(--muted);
    padding: 1.4rem;
}

.button-row,
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.primary-button,
.secondary-button,
.ghost-button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    min-height: 3.25rem;
    padding: 0.9rem 1.35rem;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
    touch-action: manipulation;
}

.primary-button,
.secondary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--forest) 0%, #2e6452 100%);
    box-shadow: 0 14px 28px rgba(31, 70, 56, 0.2);
}

.accent-button {
    background: linear-gradient(135deg, var(--clay) 0%, #c06c46 100%);
}

.secondary-button {
    color: var(--forest);
    background: rgba(31, 70, 56, 0.08);
}

.ghost-button {
    color: var(--forest);
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(31, 70, 56, 0.12);
}

.wide-button {
    width: 100%;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.background-card:hover {
    transform: translateY(-1px);
}

.background-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.background-card {
    display: grid;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(49, 92, 76, 0.12);
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.background-card::after {
    content: "";
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--forest) 0%, #2e6452 100%);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 20px rgba(31, 70, 56, 0.22);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}

.background-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.background-card img {
    aspect-ratio: 4 / 3;
    width: 100%;
    object-fit: cover;
}

.background-copy {
    display: grid;
    gap: 0.35rem;
    padding: 0.95rem 1rem 1.05rem;
}

.background-card.is-selected,
.background-card:has(input:checked) {
    border-color: rgba(31, 70, 56, 0.85);
    background: rgba(255, 255, 255, 0.96);
    box-shadow:
        0 0 0 4px rgba(31, 70, 56, 0.18),
        0 18px 32px rgba(31, 70, 56, 0.18);
    transform: translateY(-2px);
}

.background-card.is-selected::after,
.background-card:has(input:checked)::after {
    content: "Selected";
    opacity: 1;
    transform: translateY(0);
}

.background-card.is-selected img,
.background-card:has(input:checked) img {
    filter: saturate(1.04) contrast(1.03);
}

.background-card.is-selected .background-copy,
.background-card:has(input:checked) .background-copy {
    background: linear-gradient(180deg, rgba(31, 70, 56, 0.08), rgba(195, 154, 66, 0.1));
}

.background-card.is-selected .background-copy strong,
.background-card:has(input:checked) .background-copy strong {
    color: var(--forest);
}

.mini-preview {
    margin-top: 0.9rem;
    border-radius: var(--radius-md);
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.processing-panel {
    align-items: center;
    justify-items: center;
    text-align: center;
    min-height: 520px;
}

.spinner-ring {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    border: 10px solid rgba(31, 70, 56, 0.12);
    border-top-color: var(--gold);
    border-right-color: var(--forest);
    animation: spin 1s linear infinite;
}

.processing-status {
    min-height: 1.6rem;
    font-weight: 700;
}

.processing-estimate {
    max-width: 34rem;
    margin: -0.15rem 0 0.35rem;
    color: var(--muted);
    font-weight: 600;
}

.result-panel {
    grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.2fr);
    align-items: center;
    border-radius: var(--radius-xl);
    padding: 1.6rem;
}

.result-preview {
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: calc(var(--radius-xl) - 8px);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(232, 220, 197, 0.78));
    min-height: 560px;
    padding: 1rem;
}

.result-preview img {
    width: 100%;
    height: auto;
    max-height: 720px;
    object-fit: contain;
    border-radius: calc(var(--radius-lg) - 4px);
}

.countdown-text {
    margin: 0;
    font-weight: 700;
}

.countdown-text span {
    color: var(--clay);
}

.empty-state {
    padding: 1.2rem 0 1.5rem;
}

.empty-state h3 {
    margin: 0 0 0.5rem;
    font-family: var(--heading-font);
}

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

.kiosk-mode .page-shell {
    padding: 1.75rem;
}

.kiosk-mode .content-panel {
    padding: 1.8rem;
}

.kiosk-mode .primary-button,
.kiosk-mode .secondary-button,
.kiosk-mode .ghost-button {
    min-height: 3.7rem;
    padding: 1rem 1.6rem;
    font-size: 1.05rem;
}

.kiosk-mode .step-item {
    padding: 1rem;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1080px) {
    .app-frame,
    .hero-panel,
    .split-panel,
    .result-panel {
        grid-template-columns: 1fr;
    }

    .step-panel {
        order: 2;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .step-item {
        justify-content: center;
        text-align: center;
        min-height: 100%;
    }

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

    .result-preview {
        min-height: 420px;
    }
}

@media (max-width: 720px) {
    .page-shell {
        padding: 1rem;
    }

    .app-header {
        flex-direction: column;
    }

    .header-actions,
    .button-row,
    .hero-actions {
        width: 100%;
    }

    .header-actions {
        justify-content: space-between;
    }

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

    .content-panel,
    .hero-panel,
    .panel-card,
    .processing-panel,
    .result-panel {
        padding: 1.2rem;
    }

    .background-grid {
        grid-template-columns: 1fr;
    }

    .sticky-actions {
        position: sticky;
        bottom: 0;
        z-index: 6;
        margin-top: 1.1rem;
        padding: 0.9rem;
        border-radius: var(--radius-lg);
        background: linear-gradient(180deg, rgba(244, 239, 229, 0.84), rgba(244, 239, 229, 0.98) 35%);
        border: 1px solid rgba(31, 70, 56, 0.12);
        box-shadow: 0 -10px 24px rgba(31, 70, 56, 0.12);
        backdrop-filter: blur(12px);
    }

    .sticky-actions > * {
        flex: 1 1 calc(50% - 0.45rem);
    }
}
