:root {
    --bg: #0a1014;
    --bg-2: #10181d;
    --surface: rgba(16, 24, 29, 0.88);
    --surface-strong: rgba(22, 33, 40, 0.95);
    --surface-soft: rgba(255, 255, 255, 0.04);
    --ink: #f4efe6;
    --muted: rgba(244, 239, 230, 0.72);
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.22);
    --accent: #ff9140;
    --accent-strong: #ffb36f;
    --accent-soft: rgba(255, 145, 64, 0.14);
    --teal: #78b8b4;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
    --radius-xl: 34px;
    --radius-lg: 24px;
    --radius-md: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
        radial-gradient(circle at 15% 0%, rgba(120, 184, 180, 0.16), transparent 34%),
        radial-gradient(circle at 84% 18%, rgba(255, 145, 64, 0.2), transparent 28%),
        linear-gradient(180deg, #081015, #0d1419 48%, #091116);
    background-size: 30px 30px, 30px 30px, auto, auto, auto;
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

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

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

.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;
}

.hidden {
    display: none !important;
}

.app-shell {
    max-width: 1220px;
    margin: 0 auto;
    padding: 24px 18px 64px;
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.brand-mark {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    border: 1px solid rgba(255, 179, 111, 0.52);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,145,64,0.18)),
        linear-gradient(180deg, rgba(8,16,21,0.2), rgba(8,16,21,0.05));
    color: #fff8ef;
    font-family: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    box-shadow: 0 16px 40px rgba(255, 145, 64, 0.16);
}

.app-brand small,
.eyebrow {
    display: block;
    color: var(--accent-strong);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.app-brand strong {
    display: block;
    font-family: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
    font-size: 1.15rem;
    line-height: 1.2;
}

.ghost-link,
.primary-button,
.back-link,
.is-button {
    appearance: none;
    border: 0;
    cursor: pointer;
}

.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.ghost-link:hover,
.is-button:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 179, 111, 0.4);
}

.hero-panel {
    margin: 28px 0 22px;
    padding: 32px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.09);
    background:
        radial-gradient(circle at 84% 24%, rgba(255,145,64,0.18), transparent 24%),
        radial-gradient(circle at 12% 16%, rgba(120,184,180,0.14), transparent 26%),
        linear-gradient(140deg, rgba(15,24,29,0.94), rgba(9,14,18,0.86));
    box-shadow: var(--shadow);
}

.hero-copy {
    max-width: 820px;
}

.hero-copy h1,
.step-copy h2 {
    margin: 10px 0 14px;
    font-family: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    line-height: 0.97;
    letter-spacing: -0.03em;
}

.hero-copy p:last-child,
.step-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 1.04rem;
    line-height: 1.7;
}

.hero-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-highlights span,
.primary-pill,
.secondary-pill,
.selection-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 12px 16px;
    font-weight: 700;
}

.hero-highlights span {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(244, 239, 230, 0.88);
}

.progress-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 960px;
    margin: 28px auto 26px;
}

.progress-bar {
    flex: 1;
    height: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    border: 1px solid var(--line);
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--teal), var(--accent), #ffd19c);
    transition: width 0.25s ease;
}

.progress-label {
    min-width: 46px;
    color: var(--muted);
    font-size: 0.92rem;
}

.wizard,
.status-screen {
    max-width: 980px;
    margin: 0 auto;
}

.step-card,
.status-card,
.result-panel {
    animation: fadeUp 0.28s ease;
}

.step-copy {
    max-width: 780px;
    margin: 0 auto 24px;
    text-align: center;
}

.center-copy {
    max-width: 680px;
}

.form-copy h2 {
    font-size: clamp(1.9rem, 3.5vw, 2.9rem);
}

.upload-stage,
.mask-editor,
.status-card,
.result-panel,
.summary-panel,
.note-strip {
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
        linear-gradient(140deg, rgba(15,24,29,0.95), rgba(10,16,20,0.82));
    box-shadow: var(--shadow);
}

.upload-stage {
    display: block;
    min-height: 520px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.upload-stage.dragging {
    border-color: rgba(255, 179, 111, 0.58);
    transform: translateY(-2px);
}

.upload-empty {
    min-height: 520px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 36px;
    gap: 14px;
}

.upload-empty strong {
    font-family: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
    font-size: clamp(1.9rem, 4vw, 3rem);
    max-width: 14ch;
    line-height: 1.02;
}

.upload-empty span {
    color: var(--muted);
    max-width: 52ch;
    line-height: 1.6;
}

.upload-icon {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: linear-gradient(135deg, #fffaf2, var(--accent));
    color: #10181d;
    font-size: 2.5rem;
    font-weight: 700;
    box-shadow: 0 18px 40px rgba(255, 145, 64, 0.22);
}

.upload-preview {
    position: relative;
    min-height: 520px;
}

.upload-preview img {
    width: 100%;
    height: 520px;
    object-fit: cover;
}

.preview-overlay {
    position: absolute;
    inset: auto 18px 18px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.preview-tag {
    padding: 12px 14px;
    border-radius: 999px;
    background: rgba(10, 16, 20, 0.76);
    border: 1px solid rgba(255,255,255,0.12);
}

.primary-pill {
    background: linear-gradient(135deg, #fff4df, var(--accent));
    color: #10181d;
}

.secondary-pill,
.selection-pill,
.status-pill {
    border: 1px solid var(--line);
    background: rgba(8, 12, 16, 0.72);
    color: var(--ink);
}

.selection-pill {
    appearance: none;
}

.selection-jump {
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.selection-jump:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(255, 179, 111, 0.45);
}

.selection-jump-disabled,
.selection-jump:disabled {
    opacity: 0.45;
    cursor: default;
}

.step-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 24px;
}

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

.step-actions.stack {
    flex-direction: column;
    align-items: center;
}

.primary-button {
    min-width: 260px;
    padding: 16px 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fff1de, var(--accent));
    color: #10181d;
    font-family: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
    font-size: 1.03rem;
    letter-spacing: 0.02em;
    box-shadow: 0 18px 40px rgba(255, 145, 64, 0.2);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.primary-button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.primary-button:disabled {
    opacity: 0.65;
    cursor: default;
}

.back-link {
    background: transparent;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.selection-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 22px;
}

.option-grid {
    display: grid;
    gap: 14px;
}

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

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

.option-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
        linear-gradient(150deg, rgba(14,22,28,0.98), rgba(11,16,20,0.88));
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.option-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 179, 111, 0.36);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.2);
}

.option-card.active {
    border-color: rgba(255, 179, 111, 0.72);
    box-shadow: inset 0 0 0 1px rgba(255, 179, 111, 0.28), 0 24px 48px rgba(255, 145, 64, 0.12);
}

.option-card strong {
    font-family: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
    font-size: 1.24rem;
    line-height: 1.08;
}

.option-card span:last-child {
    color: var(--muted);
    line-height: 1.55;
}

.option-badge {
    align-self: flex-start;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    border: 1px solid rgba(255, 145, 64, 0.2);
    color: var(--accent-strong);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.option-swatch {
    width: 100%;
    height: 82px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.02));
}

.mask-editor {
    padding: 18px;
}

.mask-stage {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    min-height: 440px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255,255,255,0.08);
}

.mask-stage img,
.mask-stage canvas {
    width: 100%;
    display: block;
}

.mask-stage img {
    min-height: 440px;
    object-fit: contain;
    background: rgba(8, 12, 16, 0.6);
}

.mask-stage canvas {
    position: absolute;
    inset: 0;
    touch-action: none;
}

.mask-empty-state {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 28px;
    gap: 8px;
    background: linear-gradient(180deg, rgba(8,12,16,0.3), rgba(8,12,16,0.8));
}

.mask-empty-state strong {
    font-family: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
    font-size: 1.4rem;
}

.mask-empty-state span,
.mask-help,
.status-meta {
    color: var(--muted);
}

.mask-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 18px;
}

.is-button.active {
    border-color: rgba(255, 179, 111, 0.48);
    background: rgba(255, 145, 64, 0.14);
}

.brush-size {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.04);
}

.mask-help {
    margin: 16px 0 0;
    text-align: center;
    line-height: 1.6;
}

.summary-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
    margin-bottom: 20px;
}

.summary-panel small {
    display: block;
    margin-bottom: 6px;
    color: var(--accent-strong);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 800;
}

.summary-panel strong {
    font-size: 1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.info-grid label {
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.info-grid input {
    width: 100%;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: var(--ink);
}

.info-grid input:focus {
    outline: 2px solid rgba(255, 145, 64, 0.28);
    border-color: rgba(255, 145, 64, 0.42);
}

.status-card,
.result-panel,
.note-strip {
    padding: 26px;
}

.status-card {
    text-align: center;
}

.status-pill.completed {
    border-color: rgba(120, 184, 180, 0.34);
    background: rgba(120, 184, 180, 0.14);
}

.status-pill.failed {
    border-color: rgba(255, 120, 120, 0.34);
    background: rgba(255, 120, 120, 0.12);
}

.status-card h2,
.result-heading h3 {
    margin: 14px 0 10px;
    font-family: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.7rem);
    line-height: 1.02;
}

.result-panel {
    margin-top: 18px;
}

.result-list {
    display: grid;
    gap: 18px;
}

.result-item {
    display: grid;
    gap: 18px;
    padding: 18px;
    border-radius: 26px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}

.result-media {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.result-image-wrap {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(8,12,16,0.7);
}

.result-image-wrap img {
    width: 100%;
    height: 320px;
    object-fit: cover;
}

.result-caption {
    display: inline-flex;
    margin: 14px 14px 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(8,12,16,0.76);
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-strong);
}

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

.note-strip {
    margin-top: 18px;
    color: #ffd1c2;
    background:
        linear-gradient(180deg, rgba(255,120,120,0.1), rgba(255,120,120,0.04)),
        linear-gradient(140deg, rgba(24,12,12,0.9), rgba(16,10,10,0.86));
}

.linear-oak {
    background: linear-gradient(135deg, #d7c1a6, #b7926c 50%, #dfcfb6);
}

.deep-walnut,
.timberwood {
    background: linear-gradient(135deg, #5b3d2c, #7b563b 46%, #3f2b1f);
}

.warm-greige {
    background: linear-gradient(135deg, #cbb8a4, #a9927d 50%, #ddd3c6);
}

.sandstone-flake,
.cafe-sand-blend,
.paradise-island-tan {
    background: linear-gradient(135deg, #d5b690, #b98d63 50%, #efe0c8);
}

.graphite-gray,
.charcoal {
    background: linear-gradient(135deg, #5f646a, #2b3138 55%, #89929b);
}

.bronze-drift,
.gold-river {
    background: linear-gradient(135deg, #a87956, #6f4c35 50%, #d9be98);
}

.shoreline,
.silver-smoke {
    background: linear-gradient(135deg, #d5d7d6, #aab0b0 55%, #eef0ee);
}

.cabin-fever {
    background: linear-gradient(135deg, #84644f, #5f4635 52%, #b1927b);
}

.white-color-coat {
    background: linear-gradient(135deg, #f3eee4, #d9d1c1 55%, #ffffff);
}

.weathered-ash {
    background: linear-gradient(135deg, #c9c0b1, #8c867d 55%, #e3ddd3);
}

.arbor-green {
    background: linear-gradient(135deg, #8b977d, #50624f 55%, #c0ccb4);
}

.ocean-steel {
    background: linear-gradient(135deg, #8ca0ab, #4f6470 55%, #d4dee1);
}

.black-pearl {
    background: linear-gradient(135deg, #52565c, #171a1f 55%, #8e949b);
}

.beach-blonde-blend {
    background: linear-gradient(135deg, #e2d1b1, #c5aa81 55%, #f6ecd8);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 960px) {
    .option-grid-projects,
    .option-grid-styles,
    .option-grid-looks,
    .result-media,
    .summary-panel,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .preview-overlay,
    .app-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .mask-stage img {
        min-height: 320px;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 18px 14px 48px;
    }

    .hero-panel,
    .status-card,
    .result-panel,
    .upload-stage,
    .mask-editor,
    .note-strip {
        border-radius: 24px;
    }

    .hero-panel,
    .status-card,
    .result-panel,
    .note-strip {
        padding: 20px;
    }

    .upload-empty,
    .upload-preview img {
        min-height: 420px;
        height: 420px;
    }

    .step-actions .primary-button {
        width: 100%;
        min-width: 0;
    }

    .mask-toolbar {
        justify-content: stretch;
    }

    .mask-toolbar > * {
        width: 100%;
        justify-content: center;
    }
}
