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

:root {
    --primary-blue: #3B82F6;
    --primary-blue-hover: #2563EB;
    --secondary-yellow: #FCD34D;
    --secondary-yellow-hover: #FBBF24;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --border-color: #E5E7EB;
    --bg-white: #FFFFFF;
    --bg-gray: #F9FAFB;
    --success-green: #16a34a;
    --error-red: #EF4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
    
    /* Typography Scale */
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
}

html {
    overflow-y: scroll;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-white);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* MathsBox Branding */
.mathsbox-branding {
    position: fixed;
    top: 12px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 101;
    text-decoration: none;
    cursor: pointer;
    opacity: 0.7;
}

/* Move logo to top center from 1452px down to 0px */
@media (max-width: 1452px) {
    .mathsbox-branding {
        position: relative !important;
        top: 0 !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        font-size: 13px;
        gap: 8px;
        z-index: 101;
        margin-top: 16px;
        margin-bottom: 4px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
}

/* Add Saved Codes Container */
.add-saved-codes-container {
    width: 100%;
    padding: 8px;
    margin: 0;
}

/* Add Saved Codes Button */
.add-saved-codes-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.add-saved-codes-btn:hover {
    background: var(--bg-white) !important;
    border-color: #D1D5DB !important;
    color: var(--text-primary) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.add-saved-codes-btn .add-icon {
    font-size: 20px;
    font-weight: var(--font-weight-bold);
    line-height: 1;
}

/* Save Topics Button */
.save-topics-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--bg-white);
    border: 1.5px solid #9CA3AF;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.save-topics-btn:hover {
    background: var(--bg-white);
    border-color: #6B7280;
    color: var(--text-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.save-topics-btn .save-icon {
    width: 18px;
    height: 18px;
    filter: brightness(0) saturate(100%) invert(45%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(95%) contrast(90%);
    flex-shrink: 0;
}

.save-topics-btn:hover .save-icon {
    filter: brightness(0) saturate(100%) invert(35%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(90%) contrast(85%);
}

.mathsbox-logo {
    height: 32px;
    width: auto;
}

.mathsbox-text {
    font-family: 'Roboto', sans-serif;
    font-size: 22px;
    color: #1a1a1a;
    display: flex;
    align-items: baseline;
}

.maths-text {
    font-weight: 700;
}

.box-text {
    font-weight: 300;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 100px 20px; /* Increased bottom padding for fixed navigation bar */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-x: hidden;
}

.container.step-1-active {
    height: 100vh;
    min-height: 100vh;
    justify-content: flex-start;
    padding: 0 20px 100px 20px; /* Increased bottom padding for fixed navigation bar */
    overflow: hidden;
}

.container.step-2-active {
    height: 100vh;
    min-height: 100vh;
    justify-content: flex-start;
    padding: 0 20px 100px 20px; /* Increased bottom padding for fixed navigation bar */
    overflow: hidden;
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
}

.container.step-3-active {
    max-width: 1040px;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 100px; /* Added bottom padding for fixed navigation bar */
    overflow: visible; /* Allow sticky right panel to stick to viewport on scroll */
}

.container.step-4-active {
    min-height: auto;
    height: auto;
    padding: 0 20px 0 20px; /* Same padding as other steps for consistent progress bar width */
}

/* Progress Bar – stays inside container so circles are never clipped */
.progress-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-white);
    padding-top: 20px;
    padding-bottom: 20px;
    margin-bottom: 0px;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    transition: var(--transition);
    flex-shrink: 0;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.progress-steps {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    overflow: visible;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
    flex: 1;
}

.how-to-use-link {
    color: #3590ff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-right: 24px;
}

.how-to-use-link:hover {
    color: #2d7ae6;
    background-color: rgba(53, 144, 255, 0.1);
    text-decoration: none;
}

.how-to-use-link:active {
    transform: scale(0.98);
}

/* Hide how-to-use-link button on mobile devices */
@media (max-width: 768px) {
    #how-to-use-link,
    button.info-button#how-to-use-link {
        display: none !important;
    }
}

/* Line runs slightly inset so it's a tad narrower than the circle span */
.progress-line {
    position: absolute;
    top: 19px;
    left: 52px;   /* 44px + 8px inset */
    right: 52px;
    height: 4px;
    background-color: #d1d5db;
    z-index: 1;
    border-radius: 2px;
}

.progress-line-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--success-green);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 0%;
}

/* Step circles container */
.steps-container {
    position: relative;
    width: 100%;
    min-height: 75px;
    z-index: 2;
    overflow: visible;
}

/* Step circles - evenly spaced */
.step {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    top: 0;
}

.step[data-step="1"] {
    left: 0;
}

.step[data-step="2"] {
    left: calc((100% - 40px) / 3 + 20px);
    transform: translateX(-50%);
}

.step[data-step="3"] {
    left: calc(2 * (100% - 40px) / 3 + 20px);
    transform: translateX(-50%);
}

.step[data-step="4"] {
    right: 0;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 3px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #6b7280;
    position: relative;
}

.step.active:not(.completed) .step-circle {
    border-color: #6b7280;
    background-color: #ffffff;
    color: #374151;
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.25);
}

.step.completed .step-circle {
    border-color: var(--success-green);
    background-color: var(--success-green);
    color: #ffffff;
}

/* White tick icon */
.step-circle::after {
    content: '';
    display: none;
}

.step.completed .step-circle::after {
    content: '\2713';
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    font-family: Arial, sans-serif;
}

.step.completed .step-circle {
    font-size: 0;
    position: relative;
}

/* Step labels */
.step-label {
    margin-top: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #4b5563;
    text-align: center;
    white-space: nowrap;
}

.step.active .step-label {
    color: #374151;
    font-weight: 600;
}

.step.completed .step-label {
    color: var(--success-green);
}

/* Responsive design for progress bar */
@media (max-width: 530px) {
    .step-label {
        display: none;
    }
    
    .steps-container {
        min-height: 45px;
    }

    .step-circle {
        width: 20px;
        height: 20px;
        font-size: 0.8rem;
        border-width: 2px;
    }

    .progress-steps {
        padding-left: 14px;
        padding-right: 14px;
    }

    .progress-line {
        left: 30px;   /* 24px + 6px inset */
        right: 30px;
        top: 8px; /* Center of 20px circle (10px) minus half of 4px line (2px) = 8px */
    }

    .step[data-step="1"] {
        left: 0;
    }

    .step[data-step="2"] {
        left: calc((100% - 20px) / 3 + 10px);
    }

    .step[data-step="3"] {
        left: calc(2 * (100% - 20px) / 3 + 10px);
    }

    .step[data-step="4"] {
        right: 0;
    }
}

@media (max-width: 768px) {
    .step-circle {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .step-label {
        font-size: 0.85rem;
    }

    .progress-line {
        left: 56px;   /* 49px + 7px inset */
        right: 56px;
        top: 23px; /* Center of 50px circle (25px) minus half of 4px line (2px) = 23px */
    }
}

@media (max-width: 480px) {
    .step-circle {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .step-label {
        font-size: 0.75rem;
    }

    .progress-line {
        left: 54px;   /* 47px + 7px inset */
        right: 54px;
        top: 20.5px; /* Center of 45px circle (22.5px) minus half of 4px line (2px) = 20.5px */
    }
}


/* Step Containers - only as tall as content (title + main layout) */
.step-container {
    animation: slideFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
}

/* Step 1 - title + options grid */
[data-step="1"].step-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: auto 0;
    margin-top: 50px;
    width: 100%;
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
    flex: 1;
    justify-content: flex-start;
}

[data-step="1"] .step-badge,
[data-step="2"] .step-badge {
    display: inline-block;
    background-color: var(--secondary-yellow);
    color: #1F2937;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    padding: 5px 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(252, 211, 77, 0.3);
}

[data-step="3"] .step-badge {
    display: block;
    background-color: var(--secondary-yellow);
    color: #1F2937;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    padding: 5px 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    margin-left: auto;
    margin-right: auto;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(252, 211, 77, 0.3);
    width: fit-content;
}

[data-step="4"] .step-badge {
    display: block;
    background-color: var(--secondary-yellow);
    color: #1F2937;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    padding: 5px 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    margin-left: auto;
    margin-right: auto;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(252, 211, 77, 0.3);
    width: fit-content;
}

[data-step="1"] .step-title {
    margin-bottom: 16px;
    font-size: 48px;
}

[data-step="1"] .step-description {
    margin-bottom: 24px;
}

/* Step 1 - Modern Card Design */
[data-step="1"] .cards-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

[data-step="1"] .card-container {
    flex: 0 0 auto;
    max-width: none;
    min-width: auto;
}

[data-step="1"] .modern-card {
    background: #FFFFFF;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px -1px rgba(0, 0, 0, 0.1), 0 2px 8px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 70px;
    width: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

/* Hover Effect: Lift and Shadow Increase for step 1 */
[data-step="1"] .modern-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 32px -5px rgba(0, 0, 0, 0.1), 0 10px 16px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary-blue);
    background-color: var(--primary-blue);
}

[data-step="1"] .modern-card:hover .card-title {
    color: #fff;
}

/* Selected state - blue background for step 1 */
[data-step="1"] .modern-card.selected {
    border-color: var(--primary-blue);
    background-color: var(--primary-blue);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* Image container - hidden for step 1 */
[data-step="1"] .card-image-container {
    display: none;
}

/* Card content for step 1 */
[data-step="1"] .card-content {
    padding: 1rem 2.5rem;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

[data-step="1"] .card-title {
    font-size: 1.25rem;
    font-weight: 400;
    color: #1F2937;
    margin-bottom: 0;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

[data-step="1"] .modern-card.selected .card-title {
    color: #fff;
}

/* Color themes for step 1 */
[data-step="1"] .card-theme-red .card-image-container {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
}

[data-step="1"] .card-theme-blue .card-image-container {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
}

[data-step="1"] .card-theme-yellow .card-image-container {
    background: linear-gradient(135deg, #FFD93D 0%, #FFC107 100%);
}

[data-step="1"] .card-theme-purple .card-image-container {
    background: linear-gradient(135deg, #A78BFA 0%, #8B5CF6 100%);
}

body {
    overflow-x: hidden;
}

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

.step-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.2;
}

[data-step="3"] .step-title {
    font-size: 36px;
    margin-bottom: 16px;
}

/* Step 4 - Settings */
[data-step="4"].step-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
    margin: 0 auto;
    margin-top: 0;
    margin-bottom: 100px; /* Added bottom margin for fixed navigation bar */
    width: 100%;
    max-width: 1040px;
    position: relative;
}

[data-step="4"] .step-title {
    margin-bottom: 16px;
    font-size: 48px;
}

[data-step="4"] .step-description {
    margin-bottom: 24px;
}

.step-description {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-weight: var(--font-weight-regular);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Step 3 description – one line, wide enough so no scroll */
[data-step="3"] .step-description-dynamic {
    white-space: nowrap;
    font-size: 15px;
    margin-bottom: 24px;
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.step-desc-insert {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 8px 3px 8px;
    background: linear-gradient(180deg, #F9FAFB 0%, #F3F4F6 100%);
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-weight: 300;
    color: #6B7280;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    vertical-align: middle;
    height: 28px;
}
.step-description-dynamic select.step-desc-insert {
    min-width: 180px;
    width: auto;
    max-width: 280px;
    cursor: pointer;
    appearance: none;
    background-color: #F3F4F6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
    padding-left: 8px;
    padding-top: 3px;
    padding-bottom: 3px;
    margin-right: 0.35em;
    font-size: 0.95em;
    font-weight: 300;
    color: #6B7280;
    height: 28px;
    min-height: 28px;
    box-sizing: border-box;
}
.step-description-dynamic select.step-desc-insert:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* Custom resource type dropdown in step description */
.step-description-dynamic .step-desc-resource-dropdown {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.35em;
}

.step-description-dynamic .step-desc-resource-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    height: 28px;
    padding: 3px 8px 3px 8px;
    background: linear-gradient(180deg, #F9FAFB 0%, #F3F4F6 100%);
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-weight: 300;
    color: #6B7280;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95em;
    transition: all 0.2s ease;
}

.step-description-dynamic .step-desc-resource-trigger:hover {
    border-color: #D1D5DB;
    background: linear-gradient(180deg, #FFFFFF 0%, #F9FAFB 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.step-description-dynamic .step-desc-resource-dropdown.open .step-desc-resource-trigger {
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.step-description-dynamic .step-desc-resource-trigger svg {
    flex-shrink: 0;
    color: #6B7280;
    transition: transform 0.2s ease;
}

.step-description-dynamic .step-desc-resource-dropdown.open .step-desc-resource-trigger svg {
    transform: rotate(180deg);
}

.step-description-dynamic .step-desc-resource-text {
    white-space: nowrap;
}

.step-description-dynamic .step-desc-resource-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    max-width: 320px;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.step-description-dynamic .step-desc-resource-dropdown.open .step-desc-resource-menu {
    display: block;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-description-dynamic .step-desc-resource-menu li {
    margin: 0;
    padding: 0;
}

.step-description-dynamic .step-desc-resource-item {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    font-weight: 300;
    color: #4B5563;
    cursor: pointer;
    font-family: inherit;
    border-radius: 6px;
    transition: all 0.15s ease;
    display: block;
}

.step-description-dynamic .step-desc-resource-item:hover {
    background: #F3F4F6;
    color: #111827;
}

.step-description-dynamic .step-desc-resource-item.selected {
    background: #EBF4FF;
    color: #3B82F6;
    font-weight: 400;
}

.step-description-dynamic .step-desc-resource-item.selected:hover {
    background: #DBEAFE;
}

/* Options Grid - Centered */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Level Selection - 4 buttons in one row, styled like step 2 */
[data-step="1"] .options-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1100px;
    gap: 14px;
}

[data-step="1"] .option-card {
    padding: 24px 28px;
    font-size: 16px;
    font-weight: var(--font-weight-medium);
    background: var(--bg-white);
    border: 1.5px solid #D1D5DB;
    border-radius: 12px;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
}

[data-step="1"] .option-card .option-label {
    display: block;
    line-height: 1.35;
    max-width: 100%;
}

[data-step="1"] .option-card::before {
    display: none;
}

[data-step="1"] .option-card:hover {
    border-color: #9CA3AF;
    background-color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

[data-step="1"] .option-card.selected {
    border-color: var(--primary-blue);
    background-color: var(--primary-blue);
    color: #fff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

[data-step="1"] .option-card.selected:hover {
    border-color: var(--primary-blue);
    background-color: var(--primary-blue);
    color: #fff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

[data-step="1"] .option-card.selected .option-label {
    color: #fff;
}

.option-card {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.02) 100%);
    opacity: 0;
    transition: var(--transition);
}

.option-card:hover {
    border-color: #9CA3AF;
    background-color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.option-card:hover::before {
    opacity: 0;
}

.option-card.selected {
    border-color: var(--primary-blue);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2), 0 0 0 3px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.option-card.selected::before {
    opacity: 1;
}

/* Step 2 - Layout like step 1 */
[data-step="2"].step-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: auto 0;
    margin-top: 50px;
    width: 100%;
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
    flex: 1;
    justify-content: flex-start;
}

[data-step="2"] .step-title {
    margin-bottom: 16px;
    font-size: 48px;
}

[data-step="2"] .step-description {
    margin-bottom: 24px;
}

/* Step 2 - Modern Card Design */
[data-step="2"] .cards-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
}

[data-step="2"] .card-container {
    flex: 0 0 auto;
    max-width: none;
    min-width: auto;
}

[data-step="2"] .modern-card {
    background: #FFFFFF;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px -1px rgba(0, 0, 0, 0.1), 0 2px 8px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 60px;
    width: auto;
    min-width: fit-content;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

/* Hover Effect: Lift and Shadow Increase */
[data-step="2"] .modern-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 32px -5px rgba(0, 0, 0, 0.1), 0 10px 16px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary-blue);
    background-color: var(--primary-blue);
}

[data-step="2"] .modern-card:hover .card-title {
    color: #fff;
}

/* Selected state - blue background */
[data-step="2"] .modern-card.selected {
    border-color: var(--primary-blue);
    background-color: var(--primary-blue);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

[data-step="2"] .modern-card.selected .card-title,
[data-step="2"] .modern-card.selected .card-description {
    color: #fff;
}

[data-step="2"] .modern-card.selected .resource-info-btn {
    color: rgba(255, 255, 255, 0.7);
}

[data-step="2"] .modern-card.selected .resource-info-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Image container - removed for step 2 */

/* Card content */
[data-step="2"] .card-content {
    padding: 1rem 2.5rem;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

[data-step="2"] .card-title {
    font-size: 1.125rem;
    font-weight: 400;
    color: #1F2937;
    margin-bottom: 0;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

[data-step="2"] .card-description {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6B7280;
    line-height: 1.4;
    margin-bottom: 0;
    opacity: 0.85;
}

/* Color themes - removed for step 2 (no image containers) */

/* Resource info button (?) in corner - light color */
.resource-info-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #D1D5DB;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    transition: all 0.2s ease;
    z-index: 10;
    pointer-events: auto;
}

.resource-info-btn:hover {
    background-color: #F3F4F6;
    color: #4B5563;
}


/* Constraints shown in preview card only - badge under buttons hidden */
.resource-constraints-badge {
    display: none !important;
}

.constraint-badge-text {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-regular);
}

/* Preview Panel - Grey “preview” card, flex to fit */
.preview-panel {
    position: sticky;
    top: 24px;
    flex: 0 0 340px;
    width: 340px;
    min-width: 0;
    height: 420px;
    min-height: 420px;
    max-height: 420px;
    display: flex;
    flex-direction: column;
    border-left: 2px solid #E5E7EB;
    padding-left: 28px;
    margin-left: 28px;
}

.preview-panel::before {
    display: none;
}

.preview-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}


.preview-active {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.preview-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 16px 0 14px 0;
    line-height: 1.25;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    min-height: 1.25em;
}

.preview-image-container {
    width: 100%;
    height: 160px;
    min-height: 160px;
    max-height: 160px;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 14px;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.preview-description {
    font-size: 14px;
    color: #4B5563;
    line-height: 1.6;
    font-weight: 400;
    margin: 0;
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.preview-constraints {
    padding: 10px 14px;
    background: #F3F4F6;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    margin: 16px 0 0 0;
    flex-shrink: 0;
}

.preview-constraints-text {
    font-size: 13px;
    color: #374151;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Settings Form - Centered */
.settings-form {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
    display: block;
    width: 100%;
}

.form-group {
    margin-bottom: 32px;
}

.form-label {
    display: block;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.color-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.color-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
    transition: var(--transition);
    width: 48px;
    height: 48px;
}

.color-option:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

.color-option.active {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.color-swatch {
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
    border: none;
    position: relative;
}

.color-swatch.color-picker-swatch {
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-swatch.color-picker-swatch .color-picker-icon {
    color: rgba(0, 0, 0, 0.4);
    width: 16px;
    height: 16px;
    position: absolute;
    opacity: 0.6;
}

.color-option.active .color-swatch.color-picker-swatch .color-picker-icon {
    opacity: 0.3;
}

.color-checkmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-blue);
    font-size: 20px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    text-shadow: none;
    z-index: 1;
}

.color-option.active .color-checkmark {
    opacity: 1;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.form-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.toggle-text {
    font-weight: var(--font-weight-medium);
}

.toggle-switch {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background-color: #e5e7eb;
    border-radius: 12px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch:checked + .toggle-slider {
    background-color: var(--primary-blue);
}

.toggle-switch:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.form-radio {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.custom-color-picker {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.custom-color-picker-modal {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    background: transparent;
}

.custom-color-picker-modal::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-picker-modal::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.custom-color-picker-modal::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Code Modal Styles */
.code-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
    padding: 20px;
    box-sizing: border-box;
}

.code-modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

#save-topics-modal .code-modal-content,
#add-saved-codes-modal .code-modal-content {
    max-width: 400px;
}

.code-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.code-modal-header h3 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.code-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: var(--transition);
    line-height: 1;
}

.code-modal-close:hover {
    background: var(--bg-gray);
    color: var(--text-primary);
}

.code-modal-body {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
}

#save-topics-modal .code-modal-body {
    padding: 20px 24px;
}

.code-modal-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.code-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', 'Menlo', 'Courier New', monospace;
    font-size: var(--font-size-sm);
    resize: none;
    margin-bottom: 16px;
    transition: var(--transition);
    box-sizing: border-box;
    outline: none;
    letter-spacing: 0.01em;
}

.code-input:focus {
    outline: none;
    border-color: var(--border-color);
    box-shadow: none;
}

.save-topics-code {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', 'Menlo', 'Courier New', monospace;
    padding: 12px;
    letter-spacing: 0.01em;
}

.code-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

#save-topics-modal .code-modal-actions {
    justify-content: center;
}

.code-error {
    margin-top: 12px;
    padding: 12px;
    background: #FEE2E2;
    border: 1px solid #FECACA;
    border-radius: var(--radius);
    color: var(--error-red);
    font-size: var(--font-size-sm);
}

.code-success {
    margin-top: 12px;
    padding: 12px;
    background: #D1FAE5;
    border: 1px solid #A7F3D0;
    border-radius: var(--radius);
    color: var(--success-green);
    font-size: var(--font-size-sm);
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Navigation - always fixed to bottom of viewport at any screen height */
.navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 20px 24px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-white);
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    min-height: 84px;
    /* Ensure it stays on screen regardless of scroll or container */
    transform: translateZ(0);
}

.navigation-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    max-width: 1040px;
    width: 100%;
    margin: 0 auto;
}

.nav-spacer {
    flex: 1;
    min-width: 16px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
    position: relative;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-blue-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Tooltip for disabled Next button */
.btn-primary:disabled::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 6px 12px;
    background-color: var(--text-primary);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-regular);
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.btn-primary:disabled:hover::after {
    opacity: 1;
}

.btn-secondary {
    background-color: var(--bg-gray);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    transform: translateY(-1px);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
    padding: 20px;
}

/* Resource Preview Modal – badge, blue center gradient, carousel, title, description, Learn more button */
.resource-preview-modal .preview-modal-content-new {
    max-width: 480px;
    width: 92%;
    position: relative;
    padding: 0;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: visible;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Badge: top left, 50% hanging over top of modal; yellow bg, black text; round corners 50% */
.preview-modal-badge {
    position: absolute;
    top: 0;
    left: 24px;
    transform: translateY(-50%);
    z-index: 11;
    padding: 8px 14px;
    background: #FCD34D;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.resource-preview-modal .modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    color: #374151;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s, color 0.2s;
}

.resource-preview-modal .modal-close-btn:hover {
    background: #fff;
    color: #111827;
}

/* Hero: white with blue circular gradient in center only; more spacing */
.preview-modal-hero {
    position: relative;
    padding: 16px 24px 0;
    min-height: 200px;
}

.preview-modal-hero-bg {
    position: absolute;
    inset: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
}


/* Single image */
.preview-modal-image-wrap {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 8px 16px;
}

.resource-preview-modal .preview-modal-image {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
}

/* Larger image for worksheet, bingo, card sort, exit ticket, treasure hunt (modal size unchanged) */
.resource-preview-modal[data-resource-type="worksheet"] .preview-modal-image-wrap,
.resource-preview-modal[data-resource-type="bingo-game"] .preview-modal-image-wrap,
.resource-preview-modal[data-resource-type="loop-cards"] .preview-modal-image-wrap,
.resource-preview-modal[data-resource-type="exit-ticket"] .preview-modal-image-wrap,
.resource-preview-modal[data-resource-type="treasure-hunt"] .preview-modal-image-wrap {
    max-width: 520px;
    min-height: 280px;
    padding: 4px 16px 0;
}
.resource-preview-modal[data-resource-type="worksheet"] .preview-modal-image,
.resource-preview-modal[data-resource-type="bingo-game"] .preview-modal-image,
.resource-preview-modal[data-resource-type="loop-cards"] .preview-modal-image,
.resource-preview-modal[data-resource-type="exit-ticket"] .preview-modal-image,
.resource-preview-modal[data-resource-type="treasure-hunt"] .preview-modal-image {
    max-height: 280px;
}
.resource-preview-modal[data-resource-type="worksheet"] .preview-modal-body,
.resource-preview-modal[data-resource-type="bingo-game"] .preview-modal-body,
.resource-preview-modal[data-resource-type="loop-cards"] .preview-modal-body,
.resource-preview-modal[data-resource-type="exit-ticket"] .preview-modal-body,
.resource-preview-modal[data-resource-type="treasure-hunt"] .preview-modal-body {
    padding-top: 4px;
}

.preview-modal-body {
    padding: 12px 28px 32px;
    text-align: center;
}

.resource-preview-modal .preview-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 18px 0;
    line-height: 1.3;
}

.resource-preview-modal .preview-modal-description {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 28px 0;
}

.preview-modal-learn-more-btn {
    display: inline-block;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: #3b82f6;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.preview-modal-learn-more-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Legacy single-image modal (keep for any other use) */
.preview-modal-content {
    max-width: 600px;
    width: 90%;
    position: relative;
    padding: 0;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.preview-modal-image-container {
    width: 100%;
    height: 280px;
    border-radius: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border: none;
    border-bottom: 1px solid #E5E7EB;
    position: relative;
}

.preview-modal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    padding: 32px;
    transition: transform 0.3s ease;
}

.preview-modal-constraints {
    padding: 20px 40px 32px 40px;
    background: linear-gradient(to bottom, #F9FAFB 0%, #F3F4F6 100%);
    border-top: 1px solid #E5E7EB;
    margin: 0;
    border-radius: 0;
}

.preview-modal-constraints-text {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    letter-spacing: 0.01em;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.6;
}

.preview-modal-constraints-text::before {
    content: 'ℹ️';
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-content h3 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: var(--font-size-base);
}

.code-display {
    background-color: var(--bg-gray);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
    position: relative;
}

.code-display code {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    word-break: break-all;
    line-height: 1.6;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background-color: var(--primary-blue-hover);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .resource-type-layout {
        flex-direction: column;
        gap: 24px;
    }
    
    .preview-panel {
        position: relative;
        top: 0;
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        height: 420px;
        min-height: 420px;
        max-height: 420px;
        border-left: none;
        margin-left: 0;
        padding-left: 0;
        border-top: 1px solid #D1D5DB;
        padding-top: 24px;
        margin-top: 24px;
    }
    
    /* Ensure step-3-layout stays side by side between 901px and 1024px */
    @media (min-width: 901px) {
        .step-3-layout.resource-creator-layout {
            flex-direction: row !important;
        }
        
        .step-3-layout .right-panel.step-3-right-panel-desktop {
            display: flex !important;
        }
        
        .step-3-layout .right-panel.step-3-right-panel-mobile {
            display: none !important;
        }
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

    .step-title {
        font-size: var(--font-size-2xl);
    }
    
    /* Step 2 - reduce gaps between title, description, and cards grid on mobile */
    [data-step="2"] .step-container {
        text-align: center; /* Center content */
        align-items: center; /* Center items */
    }
    
    [data-step="2"] .step-title {
        margin-bottom: 5px;
        font-size: calc(var(--font-size-2xl) - 1px); /* Reduce by 1px */
        text-align: center; /* Center title */
    }
    
    [data-step="2"] .step-description {
        margin-bottom: 8px;
        font-size: calc(15px - 1px); /* Reduce by 1px */
        text-align: center; /* Center description */
    }
    
    /* Step 2 cards grid - reduce padding on mobile and center */
    [data-step="2"] .cards-grid {
        padding: 1rem 0; /* Reduced from 2rem 0 */
        justify-content: center; /* Center cards */
    }
    
    /* Step 2 cards - reduce border radius on mobile */
    [data-step="2"] .modern-card {
        border-radius: 16px; /* Reduced from 20px */
    }

    .options-grid {
        grid-template-columns: 1fr;
    }
    
    /* Level selection - 2 columns on tablet, 1 on mobile */
    [data-step="1"] .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .browser-controls {
        flex-direction: column;
    }

    .filter-container {
        flex-direction: column;
    }

    .filter-select {
        width: 100%;
    }

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

    .progress-steps {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .step-label {
        font-size: var(--font-size-xs);
    }

    .navigation {
        flex-direction: column;
        gap: 12px;
    }

    .btn {
        width: 100%;
    }
    
    .resource-type-layout {
        flex-direction: column;
    }
    
    /* Level selection - single column on mobile */
    [data-step="1"] .options-grid {
        grid-template-columns: 1fr;
    }
}

/* Removed duplicate - consolidated into comprehensive responsive section below */

/* ============================================
   Comprehensive Responsive Design
   ============================================ */

/* Large screens (above 1360px) - Keep progress bar centered and narrow */
@media (min-width: 1361px) {
    /* Progress steps - centered, no extra left padding needed, just narrow and centered */
    .progress-steps {
        padding-left: 24px !important;
        padding-right: 24px !important;
        max-width: 900px !important;
        margin: 0 auto !important;
        overflow: visible;
        justify-content: center;
    }
}

/* Medium screens (900px - 1360px) */
@media (max-width: 1360px) and (min-width: 901px) {
    /* Keep desktop layout but add gaps */
    .container {
        padding: 0 24px 100px 24px;
    }
    
    .container.step-3-active {
        padding-left: 24px;
        padding-right: 24px;
    }
    
    /* Logo positioning handled by 1452px media query */
    
    .mathsbox-logo {
        width: 22px;
        height: 22px;
    }
    
    /* Progress Bar - Thinner and responsive */
    .progress-bar {
        padding-top: 12px;
        padding-bottom: 12px;
        margin-bottom: 15px;
    }
    
    /* Progress steps - responsive width that gets narrower to avoid logo */
    .progress-steps {
        padding-left: 40px;
        padding-right: 40px;
        max-width: clamp(600px, calc(100% - 200px), 900px); /* Gets narrower on smaller screens, max 900px */
        margin: 0 auto; /* Center the progress steps */
        justify-content: center; /* Center the steps */
        overflow: visible; /* Allow segments to extend */
    }
    
    /* Progress line - narrower to account for increased padding */
    .progress-line {
        left: 68px;   /* 52px original + 16px extra padding */
        right: 68px;  /* 52px original + 16px extra padding */
    }
    
    /* Make progress bar elements more compact */
    .progress-step {
        min-width: 50px;
        max-width: 50px;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .step-label {
        font-size: var(--font-size-sm); /* Keep original size, don't make smaller */
    }
    
    .progress-segment {
        min-width: 15px;
        margin-top: 16px; /* Align with circle center (half of 32px circle) */
        margin-left: -16px; /* Extend to center of left circle */
        margin-right: -16px; /* Extend to center of right circle */
    }
    
    .progress-segment-track {
        left: 16px !important; /* Start from center of left circle */
        right: 16px !important; /* End at center of right circle */
    }
    
    .progress-segment-fill {
        left: 16px !important; /* Start from center of left circle */
        width: calc(var(--segment-fill, 0%) * (100% - 32px) / 100%) !important;
    }
    
    /* Step 3 - Keep side by side layout */
    .step-3-layout.resource-creator-layout {
        flex-direction: row !important; /* Keep side by side - force with !important */
        gap: 20px;
        display: flex !important; /* Ensure flex display */
    }
    
    .step-3-layout .right-panel.step-3-right-panel-desktop {
        display: flex !important; /* Ensure desktop panel is visible */
        max-height: calc(100vh - 70px);
        order: 0 !important; /* Keep normal order */
        flex: 0 0 320px !important;
        width: 320px !important;
        min-width: 320px !important;
        max-width: 320px !important;
    }
    
    .step-3-layout .right-panel.step-3-right-panel-mobile {
        display: none !important; /* Hide mobile panel, use desktop */
    }
    
    .step-3-layout #qg-left-panel-wrapper {
        flex: 2 !important;
        width: auto !important;
    }
}

/* Medium screens (around 900px) */
@media (max-width: 900px) {
    /* Container - add gaps left and right */
    .container {
        padding: 0 20px 100px 20px;
    }
    
    .container.step-1-active,
    .container.step-2-active {
        padding: 0 20px 100px 20px;
    }
    
    .container.step-3-active {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    /* Logo positioning handled by 1452px media query */
    
    .mathsbox-logo {
        width: 22px;
        height: 22px;
    }
    
    /* Progress Bar - Centered below logo, reduced gap */
    .progress-bar {
        padding-top: 4px;
        padding-bottom: 10px;
        margin-top: 0;
        margin-bottom: 16px;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        position: relative;
        overflow: visible;
    }
    
    .progress-steps {
        padding-left: 24px;
        padding-right: 24px;
        padding-top: 0;
        max-width: 100%;
        overflow: visible;
    }
    
    /* Steps container - margin top, remove min-height, add margin bottom */
    .steps-container {
        margin-top: 10px;
        margin-bottom: 10px;
        padding-top: 0;
        overflow: visible;
        min-height: 0;
    }
    
    /* Recenter progress line after adding margin-top to steps-container */
    .progress-line {
        top: 19px;
    }
    
    .step-label {
        font-size: 14px;
    }
    
    /* Step 1 - 2 columns */
    [data-step="1"] .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        max-width: 100%;
    }
    
    /* Step 2 - 2 columns */
    [data-step="2"] .cards-grid {
        gap: 0.75rem;
        padding: 0.75rem; /* Reduced from 1rem */
        justify-content: center;
    }
    
    [data-step="2"] .card-content {
        padding: 0.75rem 1rem; /* Further reduced padding */
    }
    
    /* Step 2 card title - reduce font size on tablet */
    [data-step="2"] .card-title {
        font-size: 1rem; /* Reduced from 1.125rem */
    }
    
    /* Step 2 cards - reduce border radius on tablet */
    [data-step="2"] .modern-card {
        border-radius: 18px; /* Reduced from 20px */
    }
    
    /* Step 3 - Stack layout at 900px and below */
    
    /* Step 4 - Adjust form width */
    [data-step="4"] .settings-form {
        max-width: 100%;
    }
}

/* Between 768px and 900px - step badge margin top 50px */
@media (max-width: 900px) and (min-width: 768px) {
    .step-badge {
        margin-top: 50px;
    }
    
    /* Recenter progress line - account for steps-container margin-top */
    .progress-line {
        top: 19px;
    }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767px) {
    /* Container padding - increased bottom padding for fixed navigation bar */
    .container {
        padding: 0 16px 100px 16px;
    }
    
    .container.step-1-active,
    .container.step-2-active {
        padding: 0 16px 100px 16px;
        min-height: 100vh;
        height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .container.step-3-active {
        padding-left: 16px;
        padding-right: 16px;
        padding-bottom: 100px; /* Added bottom padding for fixed navigation bar */
    }
    
    .container.step-4-active {
        padding: 0 16px 0 16px; /* Same padding as other steps for consistent progress bar width */
    }
    
    /* Step containers - remove top margin */
    [data-step="1"].step-container,
    [data-step="2"].step-container {
        margin-top: 0;
        padding-top: 0;
    }
    
    /* Progress Bar - 90% width, centered below logo, circles never clipped */
    .progress-bar {
        padding-top: 0;
        padding-bottom: 10px;
        margin-bottom: 12px;
        width: 90%;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
        position: relative;
        display: flex;
        justify-content: center;
        overflow: visible;
    }
    
    .progress-steps {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        padding-left: 0;
        padding-right: 0;
        gap: 0;
        justify-content: center;
        align-items: center;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        max-width: 100%;
        width: 100%;
    }
    
    .progress-steps::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    .progress-step {
        flex-shrink: 0;
        min-width: 60px;
        max-width: 60px;
        flex: 0 0 60px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .step-label {
        display: none; /* Hide step labels on mobile */
    }
    
    .step-number {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .progress-segment {
        /* Keep segments visible on mobile, bigger */
        flex: 1;
        min-width: 30px;
        max-width: none;
        margin-top: 22px; /* Align with circle center (half of 44px circle) */
        margin-left: -22px; /* Extend to center of left circle */
        margin-right: -22px; /* Extend to center of right circle */
        height: 2px;
    }
    
    .progress-segment-track {
        left: 22px !important; /* Start from center of left circle */
        right: 22px !important; /* End at center of right circle */
    }
    
    .progress-segment-fill {
        left: 22px !important; /* Start from center of left circle */
        width: calc(var(--segment-fill, 0%) * (100% - 44px) / 100%) !important;
    }
    
    /* Progress line - centered for 44px circles on mobile */
    .progress-line {
        top: 30px; /* Center of 44px circle (22px) minus half of 4px line (2px) = 20px */
    }
    
    /* Step container - add margin top */
    .step-container {
        margin-top: 30px;
    }
    
    /* Step container - reduce top spacing */
    [data-step="1"].step-container {
        margin-top: 60px; /* Move container down more on mobile */
        padding-top: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    [data-step="2"].step-container {
        margin-top: 30px;
        padding-top: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center; /* Center items */
        text-align: center; /* Center text */
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Step 3 container - allow dropdowns to work */
    [data-step="3"].step-container {
        margin-top: 30px;
        overflow: visible;
    }
    
    /* Step badge - standard spacing below 900px */
    .step-badge {
        margin-bottom: 6px;
        margin-top: 4px;
    }
    
    /* Step titles */
    .step-title {
        font-size: 22px;
        margin-bottom: 6px;
        margin-top: 0;
    }
    
    [data-step="2"] .step-title,
    [data-step="4"] .step-title {
        font-size: 25px; /* Reduced from 26px by 1px */
        margin-bottom: 6px;
    }
    
    [data-step="3"] .step-title {
        font-size: 22px;
    }
    
    /* Step description - bigger and reduced gap below */
    .step-description {
        font-size: 14px; /* Reduced from 15px by 1px */
        margin-bottom: 0;
    }
    
    /* Step 2 description - specific font size */
    [data-step="2"] .step-description {
        font-size: 14px; /* Reduced from 15px by 1px */
    }
    
    /* Step 1 description - bigger text and reduced gap on mobile */
    [data-step="1"] .step-description {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    /* Step 2 - reduce gaps between title, description, and cards grid on mobile */
    [data-step="2"] .step-title {
        margin-bottom: 4px;
    }
    
    [data-step="2"] .step-description {
        margin-bottom: 6px;
    }
    
    /* Hide step 3 description on mobile */
    [data-step="3"] .step-description {
        display: none;
    }
    
    /* Step 1 - Single column on mobile */
    [data-step="1"] .options-grid {
        grid-template-columns: 1fr;
        gap: 4px;
        margin-top: 0;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    [data-step="1"] .option-card {
        padding: 18px 22px;
        font-size: 17px;
        min-height: 60px;
    }
    
    [data-step="1"] .modern-card {
        height: 60px;
    }
    
    [data-step="1"] .card-title {
        font-size: 17px;
    }
    
    /* Step 2 - Auto width on mobile, centered */
    [data-step="2"] .cards-grid {
        gap: 0.7rem;
        padding: 0;
        justify-content: center; /* Center cards */
        margin-top: 0;
        flex-wrap: wrap;
        align-content: flex-start;
    }
    
    [data-step="2"] .card-container {
        flex: 0 0 auto;
        max-width: none;
        min-width: auto;
    }
    
    [data-step="2"] .modern-card {
        width: auto;
        min-width: fit-content;
        height: 64px;
        cursor: pointer;
        border-radius: 16px; /* Reduced from 20px */
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
        touch-action: manipulation;
        user-select: none;
    }
    
    /* Hide info icon on mobile */
    [data-step="2"] .resource-info-btn {
        display: none !important;
    }
    
    [data-step="2"] .card-content {
        padding: 0.625rem 0.875rem; /* Reduced padding */
    }
    
    [data-step="2"] .card-title {
        font-size: 0.9375rem; /* Reduced from 1.125rem (15px) */
    }
    
    /* Step 3 - Stack layout at 900px and below */
    .step-3-layout {
        flex-direction: column;
        gap: 16px;
        margin-top: 0;
    }
    
    .step-3-layout .right-panel.step-3-right-panel-mobile {
        position: relative;
        top: 0;
        max-height: none;
        order: -1;
        width: 100%;
    }
    
    .step-3-container .year-header-section {
        position: relative;
        top: 0;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
        padding-top: 8px;
        padding-bottom: 8px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .step-3-container .year-header-section .qg-year-heading {
        font-size: 20px;
        margin: 0;
        width: 100%;
        order: 1;
    }
    
    .step-3-container .year-header-section .qg-header-controls {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        order: 2;
    }
    
    .step-3-container .year-header-section .qg-search-filter-group-header {
        width: 100%;
        max-width: 100%;
        order: 1;
    }
    
    .step-3-container .year-header-section .qg-filter-controls {
        width: 100%;
        max-width: 100%;
    }
    
    .step-3-container .year-header-section .qg-filter-dropdown {
        width: 100%;
        max-width: 100%;
    }
    
    .step-3-container .year-header-section #qg-year-dropdown-container {
        order: 2;
    }
    
    .step-3-container .year-header-section #qg-filter-controls-container {
        order: 3;
    }
    
    /* Step 4 - Mobile form */
    [data-step="4"].step-container {
        padding: 0 24px;
        max-width: 100%;
        margin-top: 30px;
        margin-bottom: 100px; /* Added bottom margin for fixed navigation bar */
    }
    
    [data-step="4"] .step-title {
        font-size: 32px;
        margin-bottom: 12px;
    }
    
    [data-step="4"] .step-description {
        font-size: 15px;
        margin-bottom: 20px;
    }
    
    [data-step="4"] .settings-form {
        max-width: 100%;
        padding: 0;
        width: 100%;
    }
    
    .form-group {
        margin-bottom: 24px;
    }
    
    .form-label {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .form-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Hide preview modals on mobile, but keep code modals functional */
    .preview-modal,
    #resource-preview-modal,
    [id*="preview-modal"]:not(#add-saved-codes-modal):not(#save-topics-modal),
    .modal:not(.code-modal) {
        display: none !important;
    }
    
    /* Prevent zoom on input focus - set font-size to at least 16px */
    #add-saved-codes-input.code-input {
        font-size: 16px !important;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        padding: 14px 20px;
    }
    
    .add-saved-codes-btn,
    .save-topics-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    /* Logo positioning handled by 1452px media query - only adjust font size for mobile */
    .mathsbox-branding {
        font-size: 12px;
        margin-top: 6px;
        margin-bottom: 6px;
    }
    
    .mathsbox-logo {
        width: 24px;
        height: 24px;
    }
    
    .mathsbox-logo {
        width: 20px;
        height: 20px;
    }
    
    /* Progress Bar - reduced gap below logo, circles never clipped */
    .progress-bar {
        padding-top: 0;
        padding-bottom: 10px;
        margin-bottom: 20px;
        width: 90%;
        margin-left: auto;
        margin-right: auto;
        position: relative;
        overflow: visible;
    }
    
    .progress-steps {
        max-width: 100%;
        padding-left: 24px;
        padding-right: 24px;
        overflow: visible;
    }
    
    /* Step 4 - Mobile responsive */
    [data-step="4"].step-container {
        padding: 0 16px;
        max-width: 100%;
        margin-top: 30px;
        margin-bottom: 100px; /* Added bottom margin for fixed navigation bar */
    }
    
    [data-step="4"] .step-title {
        font-size: 32px;
        margin-bottom: 12px;
    }
    
    [data-step="4"] .step-description {
        font-size: 15px;
        margin-bottom: 20px;
    }
    
    [data-step="4"] .settings-form {
        max-width: 100%;
        padding: 0;
        width: 100%;
    }
    
    .form-label {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .form-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Settings form elements */
    .color-options {
        gap: 8px;
    }
    
    .color-option {
        width: 40px;
        height: 40px;
    }
    
    .custom-color-picker-wrapper {
        width: 100%;
    }
    
    .custom-color-picker {
        width: 100%;
        height: 48px;
    }
    
    .save-topics-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .radio-group {
        gap: 12px;
    }
    
    .radio-label {
        font-size: 15px;
        padding: 12px 16px;
    }
    
    .toggle-label {
        font-size: 15px;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 12px 100px 12px; /* Increased bottom padding for fixed navigation bar */
    }
    
    .container.step-1-active,
    .container.step-2-active,
    .container.step-3-active {
        padding-bottom: 100px; /* Ensure all steps have bottom padding for fixed navigation bar */
    }
    
    .container.step-4-active {
        padding: 0 16px 40px 16px; /* Same padding as other steps for consistent progress bar width */
    }
    
    /* Prevent zoom on input focus - set font-size to at least 16px */
    #add-saved-codes-input.code-input {
        font-size: 16px !important;
    }
    
    /* Logo positioning handled by 1452px media query - only adjust font size for small mobile */
    .mathsbox-branding {
        font-size: 11px;
        gap: 7px;
        margin-top: 16px;
        margin-bottom: 6px;
    }
    
    .mathsbox-logo {
        width: 22px;
        height: 22px;
    }
    
    /* Progress Bar - circles never clipped */
    .progress-bar {
        padding-top: 0;
        padding-bottom: 10px;
        margin-bottom: 10px;
        margin-top: 0;
        width: 90%;
        max-width: 550px;
        margin-left: auto;
        margin-right: auto;
        overflow: visible;
    }
    
    .progress-steps {
        padding-left: 24px;
        padding-right: 24px;
        gap: 8px;
        justify-content: center;
        overflow: visible;
    }
    
    .progress-step {
        min-width: 50px;
        max-width: 50px;
        flex: 0 0 50px;
    }
    
    .step-label {
        display: none; /* Hide step labels on small mobile */
    }
    
    .step-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .progress-segment {
        /* Keep segments visible on small mobile */
        min-width: 20px;
        max-width: none;
        margin-left: -25px;
        margin-right: -25px;
    }
    
    /* Step 1 - Bigger buttons */
    [data-step="1"] .options-grid {
        grid-template-columns: 1fr;
        gap: 3px;
        max-width: 100%;
        margin-top: 0;
    }
    
    [data-step="1"] .option-card {
        padding: 18px 20px;
        font-size: 17px;
        min-height: 60px;
    }
    
    [data-step="1"] .modern-card {
        height: 60px;
    }
    
    [data-step="1"] .card-content {
        padding: 1.125rem 1.25rem;
    }
    
    [data-step="1"] .card-title {
        font-size: 17px;
    }
    
    /* Step 1 description - bigger text and reduced gap on small mobile */
    [data-step="1"] .step-description {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    /* Step 4 - Small mobile responsive */
    [data-step="4"].step-container {
        padding: 0 20px 40px 20px;
        margin-top: 30px;
        margin-bottom: 100px; /* Added bottom margin for fixed navigation bar */
    }
    
    [data-step="4"] .step-title {
        font-size: 26px;
        margin-bottom: 10px;
    }
    
    [data-step="4"] .step-description {
        font-size: 14px;
        margin-bottom: 18px;
    }
    
    [data-step="4"] .settings-form {
        max-width: 100%;
        padding: 0;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .form-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .color-options {
        gap: 6px;
    }
    
    .color-option {
        width: 36px;
        height: 36px;
    }
    
    .save-topics-btn {
        width: 100%;
        padding: 12px 18px;
        font-size: 14px;
    }
    
    .radio-label {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .toggle-label {
        font-size: 14px;
    }
    
    /* Step 2 - Bigger buttons */
    [data-step="2"] .modern-card {
        height: 62px;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
        touch-action: manipulation;
    }
    
    [data-step="2"] .card-content {
        padding: 1rem 1.375rem;
    }
    
    [data-step="2"] .card-title {
        font-size: 1.125rem;
    }
    
    /* Step description - bigger on small mobile, no margin */
    .step-description {
        font-size: 15px;
        margin-bottom: 0;
    }
    
    /* Step badge - add more space above */
    .step-badge {
        margin-top: 10px;
    }
    
    /* Step titles */
    .step-title {
        font-size: 22px;
    }
    
    [data-step="2"] .step-title,
    [data-step="4"] .step-title {
        font-size: 24px;
    }
    
    [data-step="3"] .step-title {
        font-size: 22px;
    }
    
    .step-description {
        font-size: 13px;
    }
    
    /* Step 2 buttons - smaller */
    [data-step="2"] .card-content {
        padding: 0.75rem 1rem;
    }
    
    [data-step="2"] .card-title {
        font-size: 0.875rem; /* Further reduced from 0.9375rem (14px) */
    }
    
    /* Step 2 card content - further reduce padding on small mobile */
    [data-step="2"] .card-content {
        padding: 0.5rem 0.75rem; /* Further reduced padding */
    }
    
    [data-step="2"] .modern-card {
        height: 54px;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
        touch-action: manipulation;
        user-select: none;
    }
    
    .step-title {
        font-size: 24px;
    }
    
    [data-step="2"] .step-title,
    [data-step="4"] .step-title {
        font-size: 28px;
    }
    
    [data-step="1"] .option-card {
        padding: 16px 12px;
        font-size: 14px;
    }
    
    [data-step="2"] .card-content {
        padding: 0.875rem 1rem;
    }
    
    /* Logo already centered above, no need to override */
}
