/* ===== CSS Variables & Design Tokens ===== */
:root {
    /* Colors - Islamic Green Premium Palette */
    --color-primary: hsl(160, 84%, 39%);
    /* Emerald green */
    --color-primary-light: hsl(160, 84%, 49%);
    /* Lighter emerald */
    --color-primary-dark: hsl(160, 84%, 29%);
    /* Darker emerald */
    --color-secondary: hsl(142, 76%, 36%);
    /* Forest green */
    --color-accent: hsl(173, 80%, 40%);
    /* Teal accent */

    /* Gradients - Green themed */
    --gradient-primary: linear-gradient(135deg, hsl(160, 84%, 39%) 0%, hsl(142, 76%, 36%) 100%);
    --gradient-secondary: linear-gradient(135deg, hsl(142, 76%, 36%) 0%, hsl(173, 80%, 40%) 100%);
    --gradient-background: linear-gradient(135deg, hsl(160, 20%, 20%) 0%, hsl(150, 25%, 24%) 50%, hsl(140, 20%, 20%) 100%);

    /* Neutrals */
    --color-bg-dark: hsl(160, 15%, 18%);
    --color-bg-card: hsl(160, 15%, 25%);
    --color-bg-card-hover: hsl(160, 15%, 30%);
    --color-text-primary: hsl(0, 0%, 98%);
    --color-text-secondary: hsl(0, 0%, 70%);
    --color-text-muted: hsl(0, 0%, 50%);

    /* Header Variables */
    --color-header-bg: rgba(39, 53, 48, 0.95);
    --color-header-border: rgba(255, 255, 255, 0.1);

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

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;

    /* Shadows - Green glow */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(16, 185, 129, 0.3);

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

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
}

/* ===== Sunny Mode (Light Theme) ===== */
body.light-mode {
    /* Backgrounds */
    --color-bg-dark: hsl(45, 15%, 96%);
    /* Sunny Cream/White */
    --color-bg-card: hsl(0, 0%, 100%);
    --color-bg-card-hover: hsl(45, 20%, 98%);

    /* Text */
    --color-text-primary: hsl(160, 40%, 15%);
    /* Dark Green/Gray text */
    --color-text-secondary: hsl(160, 20%, 40%);
    --color-text-muted: hsl(160, 10%, 60%);

    /* Header Variables (Light) */
    --color-header-bg: rgba(255, 255, 255, 0.95);
    --color-header-border: rgba(0, 0, 0, 0.1);

    /* Gradients */
    --gradient-background: linear-gradient(135deg, hsl(45, 20%, 96%) 0%, hsl(35, 30%, 94%) 100%);

    /* Shadows */
    --shadow-sm: 0 4px 12px rgba(16, 185, 129, 0.1);
    --shadow-md: 0 8px 24px rgba(16, 185, 129, 0.15);
    --shadow-lg: 0 12px 40px rgba(16, 185, 129, 0.2);
    --shadow-glow: 0 0 40px rgba(16, 185, 129, 0.2);
}

/* Adjust pattern for light mode */
body.light-mode .background-gradient::before {
    opacity: 0.6;
    /* Higher opacity for pattern on light bg */
    mix-blend-mode: multiply;
    /* Better blending on light */
}

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

body {
    font-family: var(--font-primary);
    background: var(--color-bg-dark);
    color: var(--color-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Background with Islamic Geometric Pattern ===== */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-background);
    z-index: -1;
}

/* Islamic Geometric Pattern Overlay */
.background-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.35;
    background-image:
        /* 8-pointed star pattern */
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(16, 185, 129, 0.1) 35px, rgba(16, 185, 129, 0.1) 70px),
        repeating-linear-gradient(-45deg, transparent, transparent 35px, rgba(16, 185, 129, 0.1) 35px, rgba(16, 185, 129, 0.1) 70px),
        /* Octagon grid */
        repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(5, 150, 105, 0.08) 40px, rgba(5, 150, 105, 0.08) 80px),
        repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(5, 150, 105, 0.08) 40px, rgba(5, 150, 105, 0.08) 80px);
    background-size: 80px 80px, 80px 80px, 80px 80px, 80px 80px;
}

/* Subtle rotating glow effect */
.background-gradient::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

/* ===== Container ===== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Story Pages ===== */
.story-page {
    display: none;
    width: 100%;
    animation: fadeInUp 0.6s ease;
}

.story-page.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.story-content {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.story-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

/* ===== Welcome Page ===== */
.icon-wrapper {
    width: 100px;
    height: 100px;
    margin: 0 auto var(--spacing-lg);
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.main-icon {
    width: 50px;
    height: 50px;
    color: white;
}

.story-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-md);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.story-description {
    font-size: 1.25rem;
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.8;
}

.story-subdescription {
    font-size: 1rem;
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-xl);
}

/* ===== Progress Indicator ===== */
.progress-indicator {
    margin-bottom: var(--spacing-xl);
}

.progress-text {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 999px;
    transition: width var(--transition-slow);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* ===== Questions ===== */
.question-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.question-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xl);
}

/* ===== Relationship Dropdown ===== */
.relationship-dropdown {
    display: inline-block;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--color-text-primary);
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    outline: none;
    min-width: 300px;
    max-width: 100%;
    background-image: var(--gradient-primary);
    background-size: 200% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.relationship-dropdown:hover {
    border-color: var(--color-primary);
    background-position: 0 0;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.relationship-dropdown:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.5);
}

.relationship-dropdown option {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    padding: var(--spacing-sm);
    font-family: var(--font-primary);
    font-size: 1rem;
}

.relationship-dropdown optgroup {
    background: var(--color-bg-dark);
    color: var(--color-primary-light);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== Relationship Categories ===== */
.relationship-categories {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.relationship-categories::-webkit-scrollbar {
    width: 8px;
}

.relationship-categories::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.relationship-categories::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 999px;
}

.category-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.category-section:last-child {
    border-bottom: none;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary-light);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
    font-style: italic;
}

/* ===== Option Cards ===== */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-md);
}

.option-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    justify-content: center;
}

.option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.option-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md), 0 0 30px rgba(59, 130, 246, 0.3);
}

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

.option-card.selected {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

.option-icon {
    font-size: 2.5rem;
    position: relative;
    z-index: 1;
}

.option-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary);
    position: relative;
    z-index: 1;
    text-align: center;
}

.option-sublabel {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    position: relative;
    z-index: 1;
    text-align: center;
    font-style: italic;
}

/* Large Option Cards */
.options-grid-large {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.option-card-large {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
    overflow: hidden;
}

.option-card-large::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.option-card-large:hover {
    transform: translateY(-8px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(59, 130, 246, 0.4);
}

.option-card-large:hover::before {
    opacity: 0.15;
}

.option-icon-large {
    font-size: 4rem;
    position: relative;
    z-index: 1;
}

.option-label-large {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
    position: relative;
    z-index: 1;
}

/* ===== Number Input ===== */
.number-input-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.input-group label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.number-control {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
}

.num-btn {
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

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

.number-control input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    outline: none;
}

/* ===== Checkbox Cards ===== */
.checkbox-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.checkbox-card {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.checkbox-card:hover {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.checkbox-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.checkbox-icon {
    font-size: 2.5rem;
}

.checkbox-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.checkmark {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: transparent;
    transition: all var(--transition-normal);
}

.checkbox-card input[type="checkbox"]:checked~.checkmark {
    background: var(--gradient-primary);
    border-color: var(--color-primary);
    color: white;
}

.checkbox-card input[type="checkbox"]:checked {
    &~.checkbox-content .checkbox-label {
        color: var(--color-primary-light);
    }
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-xl);
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(59, 130, 246, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.btn-back {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.btn-back:hover {
    border-color: var(--color-primary);
    color: var(--color-primary-light);
    background: rgba(59, 130, 246, 0.1);
}

.btn-icon-left {
    width: 18px;
    height: 18px;
}

/* ===== Results Page ===== */
.results-container {
    text-align: center;
}

.results-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: linear-gradient(135deg, hsl(140, 70%, 50%) 0%, hsl(160, 70%, 45%) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(34, 197, 94, 0.4);
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.results-icon svg {
    width: 40px;
    height: 40px;
    color: white;
    stroke-width: 3;
}

.results-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.results-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xl);
}

.share-display {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    position: relative;
    overflow: hidden;
}

.share-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.1;
}

.share-fraction {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
    position: relative;
}

.share-percentage {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
    position: relative;
}

.share-description {
    font-size: 1rem;
    color: var(--color-text-muted);
    position: relative;
}

.info-card,
.breakdown-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    text-align: left;
}

.info-card h3,
.breakdown-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    color: var(--color-text-primary);
}

.info-card p {
    color: var(--color-text-secondary);
    line-height: 1.8;
}

.heir-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.heir-item:last-child {
    border-bottom: none;
}

.heir-name {
    font-weight: 600;
    color: var(--color-text-primary);
}

.heir-share {
    font-weight: 700;
    color: var(--color-primary-light);
}

.disclaimer {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.info-icon {
    width: 24px;
    height: 24px;
    color: rgba(255, 193, 7, 0.9);
    flex-shrink: 0;
}

.disclaimer p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    text-align: left;
}

.action-buttons {
    display: flex;
    gap: var(--spacing-md);
}

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

    .story-content {
        padding: var(--spacing-lg);
    }

    .story-title {
        font-size: 2rem;
    }

    .question-title {
        font-size: 1.5rem;
    }

    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .share-fraction {
        font-size: 3rem;
    }

    .results-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .story-title {
        font-size: 1.75rem;
    }

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

    .options-grid-large {
        grid-template-columns: 1fr;
    }
}

/* ===== App Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    z-index: 1000;
    background: var(--color-header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-header-border);
    padding: var(--spacing-md) var(--spacing-lg);
    transition: all var(--transition-normal);
}

.app-header:hover {
    background: var(--color-header-bg);
    border-bottom-color: var(--color-primary);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-icon {
    width: 32px;
    height: 32px;
    color: var(--color-primary);
    transition: all var(--transition-normal);
}

.app-header:hover .header-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

.header-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    transition: all var(--transition-normal);
}

.app-header:hover .header-title {
    letter-spacing: 0.5px;
}

/* Adjust body padding to account for fixed header */
body {
    padding-top: 80px;
}

/* Secondary Button Style */
.btn-secondary {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-xl);
    color: var(--color-text-secondary);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary-light);
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Action Buttons Container */
.action-buttons {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.action-buttons button {
    flex: 1;
}

/* Checkbox title and description styling */
.checkbox-title {
    display: block;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
}

.checkbox-description {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Language Toggle Button */
.language-toggle,
.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    color: var(--color-text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.language-toggle:hover,
.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.language-icon,
.theme-icon {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
}

#current-language {
    min-width: 25px;
    text-align: center;
}

/* ===== Mobile Responsive Styles ===== */
@media (max-width: 768px) {

    /* Adjust container padding for mobile */
    .container {
        padding: var(--spacing-sm);
    }

    /* Story content adjustments */
    .story-content {
        padding: var(--spacing-lg);
        border-radius: var(--radius-lg);
    }

    /* Welcome page */
    .story-title {
        font-size: 2rem;
    }

    .story-description {
        font-size: 1rem;
    }

    .story-subdescription {
        font-size: 0.875rem;
    }

    /* Question titles */
    .question-title {
        font-size: 1.5rem;
        line-height: 1.4;
        text-align: center;
    }

    .question-subtitle {
        font-size: 1rem;
        text-align: center;
    }

    /* Relationship Dropdown - Mobile Optimized */
    .relationship-dropdown {
        display: block;
        width: 100%;
        min-width: unset;
        max-width: 100%;
        font-size: 1.25rem;
        padding: var(--spacing-md);
        margin: var(--spacing-md) 0;
        /* Larger touch target */
        min-height: 56px;
        /* Better text rendering on mobile */
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        /* Add custom dropdown arrow */
        background-image: var(--gradient-primary),
            url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat, no-repeat;
        background-position: 0 0, right 12px center;
        background-size: 200% 100%, 20px;
        padding-right: 45px;
    }

    .relationship-dropdown:focus {
        /* Prevent zoom on iOS */
        font-size: 16px;
    }

    .relationship-dropdown option {
        font-size: 16px;
        padding: var(--spacing-md);
        /* Better spacing for touch */
        line-height: 1.6;
    }

    .relationship-dropdown optgroup {
        font-size: 0.85rem;
        padding: var(--spacing-sm) 0;
    }

    /* Option cards grid */
    .options-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: var(--spacing-sm);
    }

    .option-card {
        padding: var(--spacing-md);
        min-height: 100px;
    }

    .option-icon {
        font-size: 2rem;
    }

    .option-label {
        font-size: 0.875rem;
    }

    .option-sublabel {
        font-size: 0.7rem;
    }

    /* Large option cards */
    .options-grid-large {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .option-card-large {
        padding: var(--spacing-lg);
    }

    .option-icon-large {
        font-size: 3rem;
    }

    .option-label-large {
        font-size: 1.125rem;
    }

    /* Number inputs */
    .number-input-container {
        gap: var(--spacing-md);
    }

    .input-group label {
        font-size: 0.95rem;
    }

    .num-btn {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }

    .number-control input {
        font-size: 1.5rem;
    }

    /* Buttons */
    .btn-primary {
        font-size: 1rem;
        padding: var(--spacing-md);
        /* Larger touch target */
        min-height: 56px;
    }

    .btn-back {
        font-size: 0.95rem;
        padding: var(--spacing-sm) var(--spacing-md);
        margin-top: var(--spacing-sm);
    }

    /* Results page */
    .results-title {
        font-size: 2rem;
    }

    .share-fraction {
        font-size: 3rem;
    }

    .share-percentage {
        font-size: 1.5rem;
    }

    /* Header */
    .header-title {
        font-size: 1.25rem;
    }

    .language-toggle {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .language-icon {
        width: 16px;
        height: 16px;
    }

    /* Category sections */
    .category-title {
        font-size: 1.125rem;
    }

    .category-description {
        font-size: 0.8rem;
    }

    /* Checkbox cards */
    .checkbox-card {
        padding: var(--spacing-md);
    }

    .checkbox-icon {
        font-size: 2rem;
    }

    .checkbox-label {
        font-size: 1rem;
    }

    /* Info cards */
    .info-card,
    .breakdown-card {
        padding: var(--spacing-md);
    }

    .info-card h3,
    .breakdown-card h3 {
        font-size: 1.125rem;
    }
}

/* Extra small devices (phones in portrait, less than 576px) */
@media (max-width: 576px) {
    .story-content {
        padding: var(--spacing-md);
    }

    .question-title {
        font-size: 1.25rem;
    }

    .relationship-dropdown {
        font-size: 1.125rem;
        padding: var(--spacing-sm) var(--spacing-md);
        padding-right: 40px;
    }

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

    .story-title {
        font-size: 1.75rem;
    }

    .share-fraction {
        font-size: 2.5rem;
    }

    .results-title {
        font-size: 1.75rem;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .story-content {
        padding: var(--spacing-md);
    }

    .question-title {
        font-size: 1.25rem;
        margin-bottom: var(--spacing-xs);
    }

    .question-subtitle {
        font-size: 0.95rem;
        margin-bottom: var(--spacing-md);
    }

    .relationship-dropdown {
        font-size: 1.125rem;
        min-height: 48px;
        margin: var(--spacing-sm) 0;
    }

    .progress-indicator {
        margin-bottom: var(--spacing-md);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch targets */
    .relationship-dropdown {
        min-height: 56px;
        padding: var(--spacing-md);
    }

    .option-card,
    .option-card-large,
    .checkbox-card {
        /* Prevent accidental double-tap zoom */
        touch-action: manipulation;
    }

    /* Remove hover effects on touch devices */
    .relationship-dropdown:hover {
        transform: none;
    }

    .option-card:hover,
    .option-card-large:hover {
        transform: none;
    }

    /* Keep focus effects for accessibility */
    .relationship-dropdown:focus,
    .relationship-dropdown:active {
        border-color: var(--color-primary-light);
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.5);
    }
}