@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ==========================================
   CSS Variables & Design System (Modern Clean)
   ========================================== */
:root {
    /* Palette: Clean White & Slate */
    --color-bg-dark: #f8fafc;
    /* Slate 50 */
    --color-bg-card: #ffffff;
    /* Pure White */

    /* Accents */
    --color-primary: #e11d48;
    /* Holiday Red (Modern) */
    --color-primary-light: #f43f5e;
    --color-accent: #0f172a;
    /* Slate 900 (Dark Text) */

    --color-text: #0f172a;
    /* Main Text */
    --color-text-muted: #64748b;
    /* Slate 500 */
    --color-border: #e2e8f0;
    /* Slate 200 */

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Typography */
    --font-display: 'Mountains of Christmas', serif;
    --font-body: 'Outfit', sans-serif;
    --font-mono: 'Courier New', monospace;
    /* Unify fonts */

    /* Global Scale */
    --type-base: 1rem;

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    /* Modern rounded */

    /* Shadows (Soft & Deep) */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* ==========================================
   Reset & Base Styles
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
}

body {
    background-color: var(--color-bg-dark);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    /* Force scroll */
    position: relative;
    font-family: var(--font-body);
    font-size: var(--type-base);
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    /* Crisp text */
}

/* Footer Typography Override */
.footer,
.footer a {
    font-family: var(--font-body) !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Vintage Snow Background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: 0;
    width: 100%;
    height: 200%;
    background:
        radial-gradient(4px 4px at 50% 50%, #fff 50%, transparent),
        radial-gradient(6px 6px at 10% 20%, #fff 50%, transparent),
        radial-gradient(3px 3px at 90% 80%, #fff 50%, transparent);
    background-size: 200px 200px;
    z-index: -1;
    opacity: 0.2;
    animation: snowFall 20s linear infinite;
}

@keyframes snowFall {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(50%);
    }
}

/* Retro Canvas System */
/* Removed retro effects */

/* Old Image/Video Styles Removed/Ignored */
.bg-video,
.bg-image {
    display: none;
}

/* ==========================================
   File Upload Styling
   ========================================== */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    background: #f1f5f9;
    /* Darker Slate */
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.file-upload-wrapper:hover {
    border-color: var(--color-primary);
    background: #fff;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    /* Clickable */
}

/* Hide label contents if preview is active? 
   Or just stack them. */

#previewImg {
    max-height: 250px;
    width: auto;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    box-shadow: var(--shadow-md);
    z-index: 1;
    /* Below input? Input needs to cover it to re-upload */
    pointer-events: none;
    /* Let clicks pass to input */
}

#previewImg.hidden {
    display: none;
}

/* ==========================================
   Progress Bar
   ========================================== */
.progress-bar-container {
    width: 100%;
    max-width: 300px;
    height: 10px;
    background: #e2e8f0;
    border-radius: 9999px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--color-primary);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* ==========================================
   Cinematic Background System
   ========================================== */
/* Slideshow Container */
#slideshow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #1a1b26;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    transform-origin: center center;
}

.slide.active {
    opacity: 1;
    animation: kenBurns 20s ease-out infinite alternate;
}

/* Ken Burns Animation */
/* Ken Burns Animation Suite */
@keyframes kb-pan-right {
    0% {
        transform: scale(1.2) translate(0%, 0%);
    }

    100% {
        transform: scale(1.2) translate(-10%, 0%);
    }
}

@keyframes kb-pan-left {
    0% {
        transform: scale(1.2) translate(-10%, 0%);
    }

    100% {
        transform: scale(1.2) translate(0%, 0%);
    }
}

@keyframes kb-zoom-in {
    0% {
        transform: scale(1.0) translate(0%, 0%);
    }

    100% {
        transform: scale(1.25) translate(0%, 0%);
    }
}

@keyframes kb-zoom-out {
    0% {
        transform: scale(1.25) translate(0%, 0%);
    }

    100% {
        transform: scale(1.0) translate(0%, 0%);
    }
}

@keyframes kb-tilt-up {
    0% {
        transform: scale(1.2) translate(0%, 0%);
    }

    100% {
        transform: scale(1.2) translate(0%, -5%);
    }
}

@keyframes kb-tilt-down {
    0% {
        transform: scale(1.2) translate(0%, -5%);
    }

    100% {
        transform: scale(1.2) translate(0%, 0%);
    }
}

/* Animation Classes */
.slide.kb-pan-right {
    animation: kb-pan-right 10s ease-out infinite;
}

.slide.kb-pan-left {
    animation: kb-pan-left 10s ease-out infinite;
}

.slide.kb-zoom-in {
    animation: kb-zoom-in 10s ease-out infinite;
}

.slide.kb-zoom-out {
    animation: kb-zoom-out 10s ease-out infinite;
}

.slide.kb-tilt-up {
    animation: kb-tilt-up 10s ease-out infinite;
}

.slide.kb-tilt-down {
    animation: kb-tilt-down 10s ease-out infinite;
}

/* Custom Photo Seamless Loop (Wrap Around) */
.slide.custom-loop {
    background-size: cover;
    /* Do not stretch, allow repeat if needed, or cover for full immersion */
    background-repeat: repeat-x;
    /* Seamless horiz loop */
    background-size: auto 100%;
    /* Fit height, loop width */
    animation: panLoop 30s linear infinite;
}

@keyframes panLoop {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: -200% center;
    }
}

/* ==========================================
   Modern App Container
   ========================================== */
.app-container {
    padding: 2rem;
    max-width: 1000px;
    /* Reduced from 1400px */
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

/* Header Text (with Icon) */
.modern-title {
    font-size: 4rem;
    margin-top: 1rem;
    color: var(--color-text);
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    line-height: 1.2;
}

/* ==========================================
   Full Width Button Stack
   ========================================== */
.selection-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Full Width Stack */
    gap: 10px;
}

/* Buttons inside cards (Horizontal Layout) */
.select-btn {
    font-size: 1.5rem;
    /* Ensure 1.5rem scale */
    display: flex;
    flex-direction: row;
    /* Horizontal */
    align-items: center;
    justify-content: flex-start;
    /* Left Aligned */
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    color: var(--color-text);
    width: 100%;
    text-align: left;
}

.select-btn i {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 0;
    /* Remove bottom margin */
    width: 40px;
    /* Fixed width for alignment */
    text-align: center;
}

.select-btn.active i {
    color: white;
}

/* Ensure Grid items stretch */
.steps-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Single Column for Focused Flow? User said "Reduce max width". */
    /* Or keeping 2 columns? "Buttons should fill the width of the card" -> works in 2 cols too. */
    /* Let's keep 2 columns on desktop but narrower container. */
    gap: 2rem;
    align-items: stretch;
}

@media (min-width: 768px) {
    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================
   Loading Indicator
   ========================================== */
/* ==========================================
   Global Background & Snow (Charlie Brown Style)
   ========================================== */
body {
    background: linear-gradient(to bottom, #0B1026 0%, #2B3266 100%);
    /* Charlie Brown Midnight Blue */
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    font-family: var(--font-body);
    font-size: var(--type-base);
}

/* Fluffy Drifting Snow Layer 1 (Close/Fast) */
body::before {
    content: '';
    position: absolute;
    top: -10vh;
    left: 0;
    width: 100%;
    height: 120vh;
    background-image:
        radial-gradient(8px 8px at 10% 10%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(6px 6px at 30% 40%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(8px 8px at 50% 20%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(6px 6px at 70% 60%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(8px 8px at 90% 30%, rgba(255, 255, 255, 0.8), transparent);
    background-size: 400px 400px;
    animation: snowDrift 15s linear infinite;
    z-index: 1;
    pointer-events: none;
}

/* Drifting Snow Layer 2 (Far/Slow) */
body::after {
    content: '';
    position: absolute;
    top: -10vh;
    left: 0;
    width: 100%;
    height: 120vh;
    background-image:
        radial-gradient(4px 4px at 15% 15%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(3px 3px at 45% 45%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(4px 4px at 75% 25%, rgba(255, 255, 255, 0.4), transparent);
    background-size: 300px 300px;
    animation: snowDrift 25s linear infinite reverse;
    /* Drifts opposite way */
    z-index: 0;
    pointer-events: none;
}

/* Charlie Brown Meander Animation */
@keyframes snowDrift {
    0% {
        transform: translateY(0) translateX(0);
    }

    25% {
        transform: translateY(25vh) translateX(30px);
    }

    50% {
        transform: translateY(50vh) translateX(-20px);
    }

    75% {
        transform: translateY(75vh) translateX(30px);
    }

    100% {
        transform: translateY(100vh) translateX(0);
    }
}

/* ==========================================
   Result / Slideshow Container
   ========================================== */
#slideshow-container {
    position: absolute;
    /* Scroll naturally with document */
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    z-index: 50;
    background: var(--color-bg-dark);
    /* Cover the form */
    display: none;
    /* Default Hidden */
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 20px 100px 20px;
}

/* Active State */
#slideshow-container.active {
    display: flex;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Responsive Result Canvas */
.result-canvas {
    width: 95%;
    /* Mobile Default */
    height: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .result-canvas {
        height: 85vh;
        /* Desktop: Constrain by height to float */
        width: auto;
        max-width: 100%;
    }
}

/* ==========================================
   Cinematic Loading Screen
   ========================================== */
/* Cinematic Loading Screen */
#loadingIndicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    /* Ensure MAXIMUM z-index */

    /* Dark Solid Background */
    background: rgba(11, 16, 38, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    opacity: 0;
    /* Fade base */
    transition: opacity 0.5s ease;
    color: #ffffff;
}

#loadingIndicator.active {
    display: flex;
    /* Activate */
    opacity: 1;
}

/* Festive Elf Spinner */
.elf-spinner {
    font-size: 4rem;
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.elf {
    z-index: 2;
    animation: elfBounce 0.5s infinite alternate;
}

.hammer {
    position: absolute;
    right: -10px;
    top: 10px;
    font-size: 3rem;
    transform-origin: bottom left;
    animation: hammerHit 0.5s infinite;
}

@keyframes hammerHit {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(-45deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@keyframes elfBounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-5px);
    }
}

#loadingIndicator::before {
    display: none;
}

#loadingText {
    color: #ffffff !important;
    text-transform: none !important;
    font-size: 1.5rem;
    font-family: var(--font-display);
}

/* Festive Candy Cane Spinner */
.festive-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #d42426;
    /* Red */
    border-right-color: #2e7d32;
    /* Green */
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes drift {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Cinematic Spinner - "The Portal" */
.spinner {
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, var(--color-primary), #c41e3a, transparent);
    animation: spin 1s linear infinite;
    position: relative;
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.3);
    margin-bottom: var(--spacing-lg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #fff calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #fff calc(100% - 3px));
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Loading Text */
#loadingText {
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.2rem;
    text-transform: none;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-bottom: var(--spacing-md);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Cinematic Progress Bar */
#progressBarContainer {
    width: 60%;
    max-width: 600px;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    /* Barely visible track */
    border-radius: 2px;
    margin-top: var(--spacing-lg);
    position: relative;
    overflow: visible;
    /* Allow glow to spill out */
    border: none;
    box-shadow: none;
}

#progressBarFill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #8b0000, #ffd700, #fff);
    background-size: 200% 100%;
    border-radius: 2px;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 20px var(--color-primary), 0 0 40px var(--color-accent);
    /* Intense Glow */
    animation: shimmer 2s linear infinite;
    position: relative;
}

/* Leading edge of the light */
#progressBarFill::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    transform: translate(50%, -50%);
    box-shadow: 0 0 20px #fff, 0 0 40px var(--color-primary);
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

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

/* Update Canvas z-index */
#animationCanvas {
    z-index: 2;
    /* Above images, below text */
    opacity: 0.6;
    /* Subtle overlay */
    mix-blend-mode: screen;
}

/* ==========================================
   Input Panel
   ========================================== */
/* Hidden Utility */
.hidden {
    display: none !important;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-bottom: var(--spacing-lg);
}

/* ==========================================
   Input Group
   ========================================== */
.input-group {
    margin-bottom: var(--spacing-lg);
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--color-text);
}

#poemInput,
.api-input {
    width: 100%;
    padding: var(--spacing-md);
    /* Vintage Input Styles */
    font-family: var(--font-body);
    font-size: 0.9rem;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    line-height: 1.6;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#poemInput {
    resize: vertical;
}

#poemInput:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#poemInput::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
}

/* ==========================================
   Buttons
   ========================================== */
.controls {
    display: flex;
    justify-content: center;
    margin-top: var(--spacing-lg);
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

/* ==========================================
   Modern Buttons
   ========================================== */
.btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-md);
    border-radius: 9999px;
    /* Pill Shape */
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: var(--color-primary-light);
    box-shadow: var(--shadow-lg);
}

.select-btn {
    background: white;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    text-transform: none;
}

.select-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

/* ==========================================
   Modern Cards
   ========================================== */
/* ==========================================
   CSS Santa (Modern Geometric Branding)
   ========================================== */
.css-santa {
    width: 80px;
    height: 80px;
    background: #ffe3e0;
    /* Skin tone */
    border-radius: 50%;
    position: relative;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-md);
}

.santa-hat {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 50px solid var(--color-primary);
    /* Red Hat */
    z-index: 2;
}

.santa-hat::after {
    content: "";
    /* Pompom */
    position: absolute;
    top: -15px;
    left: -10px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
}

.santa-beard {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 50px;
    background: white;
    border-radius: 0 0 50px 50px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05);
}

.santa-stache {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 10px;
    background: white;
    border-radius: 10px;
    z-index: 3;
}

/* ==========================================
   Modern Typography & Layout
   ========================================== */
.step-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    /* More breathing room */
    box-shadow: var(--shadow-md);
    font-size: 1.5rem;
    /* Requested Base Size */
    display: flex;
    flex-direction: column;
}

.step-card h3 {
    font-size: 2.3rem;
    /* Updated to 2.3rem */
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: none;
    /* Clean */
    padding-bottom: 0;
}

.step-num {
    color: var(--color-primary);
    opacity: 0.8;
    font-family: var(--font-display);
}

/* Buttons inside cards need to match 1.5rem scale */
.select-btn {
    font-size: 1.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    color: var(--color-text);
}

.select-btn i {
    font-size: 2.5rem;
    color: var(--color-primary);
    margin-bottom: 5px;
}

.select-btn.active i {
    color: white;
}

/* Ensure Grid items stretch */
.steps-grid {
    align-items: stretch;
}

/* Header Text */
.modern-title {
    font-size: 4rem;
    /* Updated to 4rem */
    margin-top: 1rem;
    color: var(--color-text);
}

.step-badge {
    background: var(--color-text);
    /* Dark Slate Badge */
    color: white;
    border: 3px solid var(--color-bg-dark);
    /* Match body bg for cutout effect */
}

/* Remove Vintage Borders */
.holiday-btn {
    background: var(--color-primary);
    border: none;
    border-radius: 9999px;
    box-shadow: var(--shadow-lg);
    font-family: var(--font-body);
}

/* Modern Header */
/* .modern-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    letter-spacing: -0.02em;
} */

/* .step-card h3 {
    text-align: center;
    font-family: var(--font-display);
    color: var(--color-text);
    margin-top: 15px;
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--color-text-muted);
    padding-bottom: 5px;
    font-size: 1.8rem;
    /* Increased size */
/* } */

.action-bar {
    text-align: center;
    margin-top: 2rem;
}

.status-footer {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Adjustments for Step Contents */
.step-card .selection-grid {
    grid-template-columns: repeat(2, 1fr);
    /* 2x3 inside the card */
    gap: 8px;
}

.step-card .selectextarea {
    resize: none;
    font-size: 1.1rem;
}

textarea::placeholder {
    font-size: 1.2rem;
    color: rgba(0, 0, 0, 0.6);
    font-family: var(--font-body);
}

.step-card .select-btn {
    padding: 15px;
    font-size: 1.8rem;
    /* 60% Larger */
    text-transform: none;
    /* No Caps */
    line-height: 1.2;
}

.step-card textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    font-family: var(--font-body);
    font-size: 1.2rem;
    resize: none;
    background: #fff;
}

.btn-icon {
    font-size: 1.5rem;
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    padding: 4rem 1rem;
    text-align: center;
    font-size: 1.5rem;
}

/* Universal Footer (Visible on Dark & Light) */
.universal-footer {
    font-size: 1.2rem !important;
    font-weight: bold;
    color: #ffffff !important;
    /* White text */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    /* Strong shadow */
    margin-top: 2rem;
    text-align: center;
}

.universal-footer a {
    color: #38bdf8 !important;
    /* Light Blue links */
    text-decoration: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.universal-footer a:hover {
    text-decoration: underline;
    color: #7dd3fc !important;
    /* Lighter Blue on hover */
}

.footer a {
    color: var(--color-accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--color-accent);
}

.footer a:hover {
    color: #fff;
    border-bottom-style: solid;
}

/* ==========================================
   Info Section
   ========================================== */
.info-section {
    padding: var(--spacing-md);
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
}

.info-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--color-primary-light);
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    padding: var(--spacing-xs) 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.info-section strong {
    color: var(--color-text);
}

/* ==========================================
   Visual Controls
   ========================================== */
#visualControls {
    position: absolute;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 20;
    display: flex;
    gap: var(--spacing-sm);
    pointer-events: auto;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

/* ==========================================
   Footer Emulation (Bootstrap-like)
   ========================================== */
.footer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

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

.small {
    font-size: 0.85rem;
}

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

.text-decoration-none {
    text-decoration: none;
    transition: color 0.3s ease;
}

.text-decoration-none:hover {
    color: var(--color-primary-light);
    text-decoration: none;
}

/* ==========================================
   Utility Classes
   ========================================== */
.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    .panel-content {
        padding: var(--spacing-lg);
    }

    .controls {
        flex-direction: column;
    }

    #visualControls {
        bottom: var(--spacing-sm);
        right: var(--spacing-sm);
    }

    .control-btn {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    #poemText {
        font-size: clamp(1.2rem, 5vw, 2rem);
    }
}

@media (max-width: 480px) {
    .panel {
        width: 95%;
        max-height: 95vh;
    }

    .panel-content {
        padding: var(--spacing-md);
    }

    #textOverlay {
        padding: var(--spacing-md);
    }

    .info-section {
        font-size: 0.85rem;
    }
}

/* ==========================================
   Scrollbar Styling
   ========================================== */
.panel::-webkit-scrollbar {
    width: 8px;
}

.panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.panel::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-sm);
}

.panel::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-light);
}

/* ==========================================
   DEBUG FAILSAFE
   ========================================== */
body,
#appContainer {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* ==========================================
   Final Polish: Colors & Title
   ========================================== */
.modern-title {
    color: #ffffff;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Green Color Variable Injection */
:root {
    --color-secondary: #059669;
    /* Emerald 600 - Good Green */
}

/* Icon Logic: Default Red, Active White */
.selection-grid .select-btn i,
.file-upload-wrapper i,
.main-header i {
    color: var(--color-primary);
    /* Default Red */
}

.selection-grid .select-btn.active i {
    color: #ffffff !important;
}

/* Step Numbers */
.step-num {
    color: var(--color-secondary);
    font-family: var(--font-body);
    /* Match title font */
    font-weight: 700;
}

/* Create Button Size */
#createBtn {
    font-size: 1.8rem;
    padding: 1.25rem 2rem;
}

/* ==========================================
   Utility & Error Classes
   ========================================== */
.hidden {
    display: none !important;
}

.error-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 38, 38, 0.95);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    z-index: 10000;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

/* Subheads */
h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.25rem;
    /* Adjusted to 2.25rem per request */
    color: var(--color-primary);
    display: flex;
    /* Align number and text */
    align-items: center;
    gap: 0.5rem;
}

/* Universal Footer (Visible on Dark & Light) */
.universal-footer {
    font-size: 1.2rem !important;
    font-weight: bold;
    color: #ffffff !important;
    /* White text */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    /* Strong shadow */
    margin-top: 2rem;
    text-align: center;
}

.universal-footer a {
    color: #38bdf8 !important;
    /* Light Blue links */
    text-decoration: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.universal-footer a:hover {
    text-decoration: underline;
    color: #7dd3fc !important;
    /* Lighter Blue on hover */
}

/* Results Page Footer (Dark Text on Light) */
html body footer.results-footer {
    text-shadow: none !important;
    color: #333333 !important;
    /* Dark Grey/Black */
}

html body footer.results-footer a {
    color: #003366 !important;
    /* Dark Blue */
    text-shadow: none !important;
}

html body footer.results-footer a:hover {
    color: #0056b3 !important;
}
/* Share Modal */
.share-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.share-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.share-modal {
    background: var(--color-bg-card);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.share-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}
.share-option-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.9rem;
}
.share-option-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}
.close-modal {
    margin-top: 1.5rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}
