﻿        body { font-family: 'Sarabun', sans-serif; background-color: #111827; color: #e5e7eb; }

        .upload-area, .file-drop-zone { border: 2px dashed #4a5568; }

        .thumbnail {

            filter: brightness(0.9);

            transition: filter 0.15s ease;

        }

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

        .spinner-overlay {
            position: fixed; inset: 0; background-color: rgba(0, 0, 0, 0.75); display: flex;
            flex-direction: column; align-items: center; justify-content: center; z-index: 100;
        }
        .spinner-overlay.hidden {
            display: none;
        }

        .spinner-progress {
            display: flex;
            gap: 0.35rem;
            width: min(20rem, 80vw);
            margin-top: 0.9rem;
        }

        .spinner-progress-seg {
            flex: 1;
            height: 0.375rem;
            background: rgba(255, 255, 255, 0.14);
            border-radius: 2px;
        }

        .spinner-progress-seg.active {
            background: rgba(255, 255, 255, 0.82);
        }
        .card { background-color: #1f2937; border: 1px solid #374151; }

        .dragging {

            opacity: 0.5;

            border: 2px dashed rgba(255, 255, 255, 0.22);

        }

        /* Style for mapping radio labels */

        .mapping-label {

            transition: all 0.15s ease;

        }

        .mapping-label img { transition: transform 0.1s ease-in-out; }

        .mapping-radio:checked + .mapping-label img { transform: scale(1.1); }

        .mapping-radio:checked + .mapping-label {

            opacity: 0.9;

            filter: brightness(0.95);

        }

        .relationship-option {
            transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
        }

        .relationship-option.selected {
            border-color: rgba(255, 255, 255, 0.22);
            background-color: rgba(255, 255, 255, 0.06);
            box-shadow: none;
        }

        .step-chip {

            display: inline-flex;

            align-items: center;

            gap: 0.65rem;

            padding: 0.5rem 1.25rem;

            border-radius: 0.5rem;

            background: rgba(17, 24, 39, 0.75);

            color: #e5e7eb;

            font-weight: 400;

            letter-spacing: 0.01em;

            box-shadow: none;

            border: 1px solid rgba(255, 255, 255, 0.10);

        }

        .step-chip-number {

            display: inline-flex;

            min-width: 2.1rem;

            height: 1.85rem;

            padding: 0 0.6rem;

            border-radius: 0.25rem;

            align-items: center;

            justify-content: center;

            font-weight: 700;

            font-size: 1rem;

            background: rgba(0, 0, 0, 0.25);

            border: 1px solid rgba(255, 255, 255, 0.14);

        }

        .step-chip--compact {

            padding: 0.4rem 1rem;

            border-radius: 0.45rem;

            gap: 0.55rem;

            font-size: 1.15rem;

            box-shadow: none;

        }

        .step-chip--compact .step-chip-number {

            min-width: 1.75rem;

            height: 1.55rem;

            font-size: 0.92rem;

            border-radius: 0.2rem;

        }

        .step-title-bar {

            display: flex;

            align-items: center;

            width: 100%;

            padding: 0.6rem 1.2rem;

            border-radius: 4px;

            background: rgba(17, 24, 39, 0.55);

            border: 1px solid rgba(255, 255, 255, 0.10);

            color: #f3f4f6;

            font-weight: 400;

            letter-spacing: 0.01em;

            box-shadow: none;

        }

        .step-title-bar--lg {

            font-size: 20px;

            line-height: 1.1;

        }

        .step-title-bar--md {

            font-size: 20px;

            line-height: 1.2;

        }

        .step-title-plain {

            font-size: 24px;

            line-height: 1.15;

            font-weight: 300;

            color: #f3f4f6;

            margin: 0;

            padding: 0 1.2rem;

            letter-spacing: 0.01em;

        }

        .step-subtitle {

            margin: 0.15rem 0 0 0;

            padding: 0 1.2rem;

            font-size: 0.85rem;

            line-height: 1.3;

            font-style: italic;

            font-weight: 300;

            color: rgba(209, 213, 219, 0.9);

        }

        .fade-section {

            opacity: 0;

            transform: translateY(12px);

            pointer-events: none;

            transition: opacity 0.28s ease, transform 0.28s ease;

        }

        .fade-section.visible {

            opacity: 1;

            transform: translateY(0);

            pointer-events: auto;

        }

        .framing-toggle-group {

            display: flex;

            align-items: center;

            gap: 1.25rem;

            width: 100%;

        }

        .framing-toggle {

            display: inline-flex;

            align-items: center;

            gap: 0.4rem;

            font-weight: 600;

            font-size: 0.95rem;

            color: rgba(191, 219, 254, 0.88);

            cursor: pointer;

            transition: color 0.2s ease;

        }

        .framing-toggle input {

            width: 1rem;

            height: 1rem;

            accent-color: rgba(96, 165, 250, 0.95);

        }

        .framing-toggle input:checked + span {

            color: #f9fafb;

        }

        .framing-toggle-description {

            margin-top: 0.5rem;

            font-size: 0.85rem;

            color: rgba(209, 213, 219, 0.75);

            text-align: center;

        }

        @media (max-width: 640px) {

            .setup-grid {

                display: flex;

                flex-direction: column;

                gap: 1.75rem;

            }

            .scene-scroll {

                gap: 0.85rem;

                padding-bottom: 0.25rem;

            }

            .scene-card {

                min-width: 135px;

                max-width: 140px;

            }

            .scene-card img {

                height: 95px;

            }

        }

        @media (max-width: 480px) {

            .framing-toggle-group {

                flex-direction: column;

                gap: 0.5rem;

            }

            .framing-toggle {

                font-size: 0.85rem;

                gap: 0.35rem;

            }

            .framing-toggle-description {

                font-size: 0.8rem;

            }

            #generate-base-btn,

            #retry-generation-btn,

            #final-swap-btn,

            #pay-btn,

            #download-link {

                font-size: 0.9rem;

                padding: 0.6rem 0.8rem;

            }

            .step-chip {

                font-size: 0.9rem;

                padding: 0.35rem 0.85rem;

                border-radius: 0.25rem;

                gap: 0.5rem;

            }

            .step-chip-number {

                min-width: 1.55rem;

                height: 1.4rem;

                font-size: 0.82rem;

                border-radius: 0.2rem;

            }

        }

        @keyframes shimmer {

            0% { background-position: -468px 0; }

            100% { background-position: 468px 0; }

        }

        .skeleton {

            background: linear-gradient(90deg, rgba(30, 41, 59, 0.4) 25%, rgba(51, 65, 85, 0.55) 50%, rgba(30, 41, 59, 0.4) 75%);

            background-size: 400% 100%;

            animation: shimmer 1.2s ease-in-out infinite;

        }

        .scene-card:not(.loaded)::before {

            content: '';

            position: absolute;

            inset: 0;

            border-radius: 0.75rem;

            background: linear-gradient(90deg, rgba(30, 41, 59, 0.45) 25%, rgba(55, 65, 81, 0.6) 50%, rgba(30, 41, 59, 0.45) 75%);

            background-size: 400% 100%;

            animation: shimmer 1.2s ease-in-out infinite;

            z-index: 1;

            pointer-events: none;

        }

        .scene-card.loaded::before {

            display: none;

        }

        .scene-scroll {

            display: flex;

            gap: 1rem;

            overflow-x: auto;

            padding-bottom: 0.5rem;

            scroll-snap-type: x mandatory;

        }

        .scene-scroll::-webkit-scrollbar {

            height: 8px;

        }

        .scene-scroll::-webkit-scrollbar-thumb {

            background: rgba(148, 163, 184, 0.35);

            border-radius: 999px;

        }

        @media (min-width: 1024px) {

            .scene-scroll {

                display: grid;

                grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));

                overflow-x: hidden;

                overflow-y: auto;

                max-height: 28rem;

                padding-bottom: 0;

                row-gap: 1.25rem;

            }

            .scene-card {

                flex: initial;

                min-width: 0;

                max-width: none;

                width: 100%;

            }

            .scene-card img {

                height: 140px;

            }

        }

        .scene-card {

            position: relative;

            overflow: hidden;

            border-radius: 0.75rem;

            border: 2px solid transparent;

            cursor: pointer;

            background-color: rgba(17, 24, 39, 0.7);

            min-width: 150px;

            max-width: 180px;

            flex: 0 0 auto;

            scroll-snap-align: start;

            transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;

        }

        .scene-card img {
            width: 100%;
            height: 110px;
            object-fit: cover;
            display: block;
            transition: transform 0.3s ease;
            position: relative;
            z-index: 2;
        }
        .scene-card-placeholder {
            width: 100%;
            height: 110px;
            border-radius: 0.75rem;
            background: linear-gradient(135deg, rgba(31, 41, 55, 0.65), rgba(17, 24, 39, 0.85));
            color: #e5e7eb;
            font-weight: 600;
            font-size: 0.85rem;
            letter-spacing: 0.05em;
            display: flex;
            align-items: center;
            justify-content: center;
            text-transform: uppercase;
        }
        .scene-card:hover img {

            transform: scale(1.04);

        }

        .scene-card:hover {

            transform: translateY(-3px);

            box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);

        }

        .scene-card.selected {

            border-color: rgba(156, 163, 175, 0.7);

            box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);

        }

        .scene-card-label {

            display: block;

            padding: 0.6rem 0.75rem;

            text-align: center;

            font-weight: 600;

            font-size: 0.85rem;

            color: #f9fafb;

            background: rgba(17, 24, 39, 0.82);

            position: relative;

            z-index: 2;

        }

        .scene-card-range {

            display: block;

            padding: 0 0.75rem 0.45rem;

            font-size: 0.75rem;

            color: rgba(226, 232, 240, 0.88);

            text-align: center;

        }

        .scene-card.selected .scene-card-label {

            background: rgba(31, 41, 55, 0.9);

        }



        .home-btn {

            display: inline-flex;

            align-items: center;

            gap: 8px;

            padding: 10px 16px;

            border-radius: 9999px;

            font-weight: 600;

            background: rgba(31, 41, 55, 0.9);

            color: #f9fafb;

            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

            transition: transform 0.15s ease, box-shadow 0.15s ease;

        }



        .home-btn:hover {

            transform: translateY(-1px);

            box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);

        }



        .home-btn:focus-visible {

            outline: 2px solid rgba(156, 163, 175, 0.85);

            outline-offset: 3px;

        }



        .app-banner {

            background: rgba(17, 24, 39, 0.96);

            border-bottom: 1px solid rgba(75, 85, 99, 0.6);

            color: #e5e7eb;

            min-height: 64px;

            display: flex;

            flex-wrap: wrap;

            align-items: center;

            justify-content: space-between;

            gap: 16px;

            padding: 12px 24px;

            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);

        }



        .app-banner-logo {

            display: inline-flex;

            align-items: center;

            gap: 10px;

            font-size: 1.4rem;

            font-weight: 700;

            letter-spacing: 0.08em;

            text-transform: uppercase;

        }

        .app-banner-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 34px;
            height: 34px;
        }

        .app-banner-icon svg {
            width: 30px;
            height: 30px;
        }



        .app-banner-logo span {
            color: #f8fafc;
            background-image: none;
        }

        .app-banner-wordmark {
            display: block;
            height: 34px;
            width: auto;
        }

        @supports (-webkit-background-clip: text) {
            .app-banner-logo span {
                color: #f8fafc;
                -webkit-text-fill-color: #f8fafc;
            }
        }

        @supports (background-clip: text) {
            .app-banner-logo span {
                color: #f8fafc;
            }
        }



        .app-banner-message {

            display: inline-flex;

            align-items: center;

            gap: 10px;

            font-size: 0.95rem;

            color: rgba(239, 246, 255, 0.9);

        }



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

        }

        /* --- Grayscale enforcement (no accent colors) --- */
        .bg-indigo-500,
        .bg-indigo-600,
        .bg-purple-500,
        .bg-purple-600,
        .bg-emerald-500,
        .bg-emerald-600,
        .bg-blue-500,
        .bg-blue-600,
        .bg-green-400,
        .bg-green-500,
        .bg-red-500,
        .bg-red-600,
        .bg-amber-500,
        .bg-yellow-500 {
            background-color: #374151 !important;
        }

        .text-indigo-200,
        .text-indigo-300,
        .text-purple-200,
        .text-purple-300,
        .text-emerald-200,
        .text-emerald-300,
        .text-blue-200,
        .text-blue-300,
        .text-green-400,
        .text-cyan-300,
        .text-red-500,
        .text-red-200,
        .text-amber-300,
        .text-yellow-200 {
            color: #e5e7eb !important;
        }

        .border-indigo-400,
        .border-purple-400,
        .border-emerald-400,
        .border-blue-500,
        .border-green-400,
        .border-red-500,
        .border-amber-500,
        .border-yellow-500 {
            border-color: rgba(156, 163, 175, 0.7) !important;
        }

        /* --- UI polish overrides (post-restore) --- */
        :root {
            --app-bg: #0b0f14;
            --app-surface: #111827;
            --app-border: rgba(255, 255, 255, 0.08);
            --app-font: 'Google Sans Text','Inter','Sarabun',system-ui,sans-serif;
        }

        body {
            font-family: var(--app-font);
            background-color: var(--app-bg);
            color: #e5e7eb;
        }

        .app-banner {
            background: rgba(11, 15, 20, 0.92);
            border-bottom: 1px solid var(--app-border);
            min-height: 56px;
            padding: 10px 18px;
            box-shadow: none;
        }

        .app-banner-logo {
            letter-spacing: 0;
            text-transform: none;
            font-size: 1.15rem;
        }

        .no-scrollbar::-webkit-scrollbar { display: none; }
        .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

        .setup-action {
            background-color: var(--app-surface) !important;
            border: 1px solid var(--app-border) !important;
            box-shadow: none !important;
        }

    
/* Typography: force regular weight (no bold UI) */
body {
  font-weight: 400;
}

/* Override Tailwind font weight utilities used across the app */
.font-bold,
.font-semibold,
.font-medium,
.font-extrabold,
.font-black {
  font-weight: 400 !important;
}

strong,
b {
  font-weight: 400 !important;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
}

/* Template cards: enforce regular weight even if nested styles differ */
.template-card,
.template-card * {
  font-weight: 400 !important;
}

/* Theme: Warm Heritage */
:root {
  --app-bg: #0f0b08;
  --app-surface: #1a1310;
  --app-surface-elev: #211916;
  --app-border: rgba(210, 168, 120, 0.18);
  --app-border-strong: rgba(210, 168, 120, 0.32);
  --app-accent: #d2a878;
  --app-accent-strong: #f0c48e;
  --app-ink: #f7efe4;
  --app-muted: #b5a89b;
  --app-font: 'Manrope','Sarabun',sans-serif;
  --app-display: 'Google Sans Text','Inter','Sarabun',system-ui,sans-serif;
}

body {
  font-family: var(--app-font);
  color: var(--app-ink);
  background-color: var(--app-bg);
  background-image:
    radial-gradient(900px 600px at 15% -10%, rgba(210, 168, 120, 0.22), transparent 60%),
    radial-gradient(800px 500px at 100% 10%, rgba(120, 88, 62, 0.22), transparent 65%),
    linear-gradient(180deg, #120c0a 0%, #0f0b08 100%);
}

a {
  color: var(--app-accent);
}

.app-banner {
  background: rgba(17, 12, 10, 0.94);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.app-banner-logo {
  font-family: var(--app-display);
  letter-spacing: 0;
  text-transform: none;
}

.app-banner-icon {
  color: var(--app-accent-strong);
}

.step-title-plain,
.step-title-bar,
.step-title-bar--lg,
.step-title-bar--md {
  font-family: var(--app-display);
  letter-spacing: 0;
  color: var(--app-ink);
}

.step-subtitle {
  color: rgba(181, 168, 155, 0.92);
}

.setup-action,
.card {
  background: linear-gradient(180deg, rgba(30, 22, 18, 0.96) 0%, rgba(22, 16, 13, 0.96) 100%) !important;
  border: 1px solid var(--app-border) !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5) !important;
}

.upload-area,
.file-drop-zone {
  border-color: rgba(210, 168, 120, 0.35);
}

.template-card,
.scene-card {
  background: rgba(27, 20, 17, 0.9);
  border: 1px solid rgba(210, 168, 120, 0.2);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
}

.template-card:hover,
.scene-card:hover {
  border-color: var(--app-border-strong);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.55);
}

.scene-card.selected,
.template-card.selected {
  border-color: var(--app-accent-strong);
  box-shadow: 0 0 0 1px rgba(240, 196, 142, 0.35), 0 24px 46px rgba(0, 0, 0, 0.55);
}

.scene-card-label,
.scene-card-range {
  color: rgba(247, 239, 228, 0.9);
}

.step-chip {
  background: rgba(24, 18, 15, 0.78);
  border: 1px solid rgba(210, 168, 120, 0.2);
}

.step-chip-number {
  background: rgba(12, 9, 8, 0.6);
  border: 1px solid rgba(210, 168, 120, 0.3);
  color: var(--app-accent-strong);
}

.spinner-progress-seg.active {
  background: linear-gradient(90deg, #d2a878 0%, #f0c48e 100%);
}

.generate-base-btn,
#final-swap-btn,
#pay-btn,
#download-link-full,
#download-link-hd {
  background: linear-gradient(135deg, #d2a878 0%, #f0c48e 100%) !important;
  color: #231913 !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
}

.generate-base-btn:hover,
#final-swap-btn:hover,
#pay-btn:hover,
#download-link-full:hover,
#download-link-hd:hover {
  background: linear-gradient(135deg, #ddb27d 0%, #f5d3a0 100%) !important;
}

#report-issue-btn {
  background: rgba(30, 22, 18, 0.88) !important;
  color: var(--app-ink) !important;
  border: 1px solid rgba(210, 168, 120, 0.2);
}

#report-issue-btn:hover {
  border-color: var(--app-border-strong);
}

#maintenance-modal > div {
  background: linear-gradient(180deg, rgba(32, 24, 20, 0.98) 0%, rgba(20, 15, 12, 0.98) 100%);
  border: 1px solid rgba(210, 168, 120, 0.28);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.75);
}

#maintenance-message {
  font-family: var(--app-display);
  letter-spacing: 0;
  text-transform: none;
}

.input-field {
  background-color: #374151;
  border: 1px solid #4b5563;
  color: #f9fafb;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}
.input-field::placeholder {
  color: #9ca3af;
}
