:root {
    /* Palette — design spec */
    --color-orange-solid-1000: #F75C19;
    --color-white-solid-1000: #FFFFFF;
    --color-neutral-solid-600: #717475;
    --color-neutral-solid-500: #8E9192;
    --color-neutral-solid-400: #AFB2B2;
    --color-neutral-solid-300: #D1D2D3;
    --color-neutral-solid-100: #EBECED;
    --color-neutral-solid-50: #F5F5F5;
    --color-dark-solid-1000: #00070A;
    --color-dark-solid-900: #27292A;
    --color-dark-alpha-1000-10: rgba(0, 7, 10, 0.1);
    --color-dark-alpha-1000-6: rgba(0, 7, 10, 0.06);

    /* Layout (palette-backed) */
    --layout-page-bg: var(--color-dark-solid-900);
    --layout-form-bg: var(--color-white-solid-1000);
    --layout-preview-bg: var(--color-neutral-solid-50);

    --content-secondary: var(--color-neutral-solid-600);
    --content-tertiary: var(--color-neutral-solid-500);
    --border-secondary: var(--color-neutral-solid-300);
    --bg-onmain-primary: var(--color-white-solid-1000);
    --bg-onmain-disabled-strong: var(--color-neutral-solid-400);

    --bg: #0f1115;
    --surface: #181b22;
    --surface-2: #20242d;
    --border: #2a2f3a;
    --text: #e6e8ee;
    --text-dim: #9ca3af;
    --accent: #5b8def;
    --accent-hover: #7aa2ff;
    --warning: #f5a524;
    --error: #ef4444;
    --radius: 10px;
    --gap: 16px;

    /* Typography — shared */
    --font-display: "Funnel Display", ui-sans-serif, system-ui, sans-serif;
    --font-body: "Satoshi", ui-sans-serif, system-ui, sans-serif;
}

/* Reset — common baseline */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

body {
    background: var(--layout-page-bg);
    color: var(--color-dark-solid-1000);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

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

button {
    cursor: pointer;
}

textarea {
    resize: vertical;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

ul,
ol {
    list-style: none;
    padding: 0;
}

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

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-inline-size: 0;
}

/* -------------------------------------------------------------------------
   Typography utilities
   Mobile (375) vs desktop (1440): only Title/H1 size changes (28px → 32px).
   Use .title-h1 for responsive H1.
   ------------------------------------------------------------------------- */

/* Title / H1 — Funnel Display SemiBold */
.title-h1 {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: 0;
}

@media (min-width: 768px) {
    /* Desktop (1440): Title / H1 */
    .title-h1 {
        font-size: 32px;
    }
}

/* Body 2XL / Medium — Satoshi */
.body-2xl-medium {
    font-family: var(--font-body);
    font-size: 24px;
    line-height: 1.3;
    font-weight: 500;
    letter-spacing: 0;
}

/* Body XL / Medium */
.body-xl-medium {
    font-family: var(--font-body);
    font-size: 22px;
    line-height: 1.3;
    font-weight: 500;
    letter-spacing: 0;
}

/* Body L / Medium */
.body-l-medium {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.3;
    font-weight: 500;
    letter-spacing: 0;
}

/* Body M / SemiBold */
.body-m-semibold {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: 0;
}

/* Body M / Regular */
.body-m-regular {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 400;
    letter-spacing: 0;
}

/* Body S / Medium */
.body-s-medium {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 500;
    letter-spacing: 0;
}

/* Body S / Regular */
.body-s-regular {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 400;
    letter-spacing: 0;
}

/* Body Tiny / Regular */
.body-tiny-regular {
    font-family: var(--font-body);
    font-size: 12px;
    line-height: 1.3;
    font-weight: 400;
    letter-spacing: 0;
}

.hidden {
    display: none !important;
}

.app {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.app-form-column {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 24px;
    background: var(--layout-form-bg);
    color: var(--color-dark-solid-1000);
    padding: 20px;
}

.app-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 24px;
}

.app-header-logo {
    display: block;
    width: min(100%, 134px);
    height: auto;
    margin-bottom: 20px;
}

.app-form-content {
    width: 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .app-form-content {
        max-width: 364px;
    }
}

.form-section,
.preview-section {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

.preview-section {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--layout-preview-bg);
    color: var(--color-dark-solid-1000);
    padding: 20px;
}

.preview-section-main {
    flex: 1 1 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 8px;
    box-sizing: border-box;
}

.preview-download-sticky {
    position: sticky;
    bottom: 0;
    z-index: 5;
    flex-shrink: 0;
    width: 100%;
    padding: 16px 0;
    padding-bottom: 20px;
    box-sizing: border-box;
}

.preview-download-sticky .download-btn {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    margin-top: 0;
}

.card-form {
    display: grid;
    gap: var(--gap);
}

.field {
    display: grid;
    gap: 10px;
}

.form-label {
    color: var(--content-secondary, #717475);
    font-family: var(--font-body);
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 130%;
}

.field-floating .floating-input-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-self: stretch;
    height: 48px;
    max-height: 48px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border-secondary, #D1D2D3);
    background: var(--bg-onmain-primary, #FFF);
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.field-floating .floating-input-shell:focus-within {
    border-color: var(--color-orange-solid-1000);
}

.field-floating .floating-input {
    display: block;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    border: none;
    outline: none;
    background: transparent;
    box-sizing: border-box;
    align-self: stretch;
    color: var(--color-dark-solid-1000);
}

.field-floating .floating-input::placeholder {
    color: transparent;
}

.field-floating .floating-label {
    position: absolute;
    left: 16px;
    right: 16px;
    pointer-events: none;
    transition: top 0.15s ease, font-size 0.15s ease, transform 0.15s ease, line-height 0.15s ease, color 0.15s ease;
}

/* Prompt (placeholder) — same text style as input value */
.field-floating .floating-input:placeholder-shown + .floating-label {
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-dark-solid-1000);
}

.field-floating .floating-input:placeholder-shown {
    padding: 12px 16px;
}

/* Filled: small caption label (stays secondary) */
.field-floating .floating-input:not(:placeholder-shown) + .floating-label {
    top: 4px;
    transform: translateY(0);
    font-size: 12px;
    line-height: 1.3;
    color: var(--content-secondary, #717475);
}

.field-floating .floating-input-shell:has(.floating-input:not(:placeholder-shown)) {
    justify-content: flex-end;
}

.field-floating .floating-input:not(:placeholder-shown) {
    flex: 0 0 auto;
    min-height: 0;
    padding: 0px 16px 4px;
}


/* Photo Field */
.photo-input-sr-only {
    display: none!important;
}
.photo-empty {
    display: block;
}

.photo-filled {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}

.photo-filled .photo-thumb {
    margin-inline-end: 24px;
}

.photo-filled .photo-upload-btn--compact {
    margin-inline-end: 8px;
}

.photo-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--color-neutral-solid-300);
    flex-shrink: 0;
    background: var(--color-neutral-solid-100);
}

.photo-upload-btn--compact {
    display: flex;
    width: auto;
    flex: 0 0 auto;
    box-sizing: border-box;
    height: 32px;
    padding: 15px 12px;
    justify-content: center;
    align-items: center;
    gap: 4px;
    border-radius: 6px;
}

.photo-upload-btn--compact.photo-upload-btn {
    width: auto;
}

.photo-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    background: var(--color-white-solid-1000);
    color: var(--color-dark-solid-1000);
    border-radius: 8px;
    border: 1px solid var(--color-dark-solid-1000);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.photo-upload-btn-icon {
    flex-shrink: 0;
    display: block;
}

.photo-upload-btn:hover {
    border-color: var(--color-neutral-solid-400);
    background: var(--color-neutral-solid-50);
}

.photo-remove {
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    color: var(--color-neutral-solid-600);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.photo-remove:hover {
    color: var(--color-dark-solid-1000);
}

.photo-upload-btn:focus,
.photo-remove:focus {
    outline: none;
}

.photo-upload-btn:focus-visible,
.photo-remove:focus-visible {
    outline: 2px solid var(--color-orange-solid-1000);
    outline-offset: 2px;
}

.warning {
    margin: 0;
    color: var(--warning);
}

.download-btn {
    background: var(--color-dark-solid-1000);
    color: var(--color-white-solid-1000);
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn:hover:not(:disabled) {
    background: var(--color-dark-solid-900);
}

.download-btn:disabled {
    opacity: 1;
    color: var(--color-white-solid-1000);
    background: var(--bg-onmain-disabled-strong, #AFB2B2);
    cursor: default;
}

.download-btn:disabled.download-btn--busy {
    cursor: wait;
    background: var(--color-dark-solid-1000);
    color: var(--color-white-solid-1000);
}

.btn-progress {
    opacity: 0.85;
}



/* Mobile: format radios live in the form (whole field hidden ≥768px) */
.field-preview-format {
    margin: 0;
}

.preview-format-picker {
    width: 100%;
    display: grid;
    gap: 12px;
}

.preview-format-picker .preview-format-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.35;
}

.preview-format-picker-label {
    flex: 1;
    cursor: pointer;
}

.preview-format-picker input {
    accent-color: var(--color-orange-solid-1000);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

@media (min-width: 768px) {
    .field-preview-format {
        display: none;
    }

    .preview-card--mobile-hidden {
        display: grid !important;
    }
}

@media (max-width: 767px) {
    .preview-card.preview-card--mobile-hidden {
        display: none !important;
    }
}

/* Preview Grid */
.preview-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .app-form-column {
        padding: 20px
    }
    .preview-grid {
       max-width: 512px;
    }
    .preview-section {
        padding-top: 20px;
        padding-bottom: 40px;
    }
}

@media (min-width: 976px) {
    .app-form-column {
        padding: 40px 72px 0 40px;
    }
    .preview-section {
        padding-top: 128px;
        padding-bottom: 40px;
    }
}


.preview-card {
    display: grid;
    gap: 8px;

}

.preview-card-title {
    margin: 0;
    color: var(--content-tertiary, #8E9192);
    font-family: var(--font-display);
    font-size: 16px;
    font-style: normal;
    font-weight: 600;
    line-height: 150%;
}

.preview-card-visual {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-dark-alpha-1000-10);
}

.preview-card-visual > .preview-stub,
.preview-card-visual > .preview-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    box-sizing: border-box;
    border: none;
    border-radius: 0;
}

.preview-card-visual > .preview-stub {
    object-fit: contain;
}



/* Media Queries */
@media (min-width: 768px) {
    .app {
        flex-direction: row;
        align-items: stretch;
    }

    .app-form-column,
    .preview-section {
        flex: 1 1 50%;
    }
}
