/* ===== CSS RESET ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    /* Color System */
    --color-primary: #667eea;
    --color-primary-dark: #5a6fd8;
    --color-primary-light: #8b9ef5;
    --color-accent: #764ba2;
    --color-gradient-start: #667eea;
    --color-gradient-end: #f093fb;
    
    /* Semantic Colors */
    --color-surface: rgba(255, 255, 255, 0.12);
    --color-surface-hover: rgba(255, 255, 255, 0.18);
    --color-surface-active: rgba(255, 255, 255, 0.24);
    --color-border: rgba(255, 255, 255, 0.16);
    --color-border-hover: rgba(255, 255, 255, 0.32);
    
    /* Text Colors */
    --color-text-primary: rgba(255, 255, 255, 0.95);
    --color-text-secondary: rgba(255, 255, 255, 0.75);
    --color-text-tertiary: rgba(255, 255, 255, 0.55);
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.20);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Layout */
    --container-max-width: 1200px;
    --grid-gap: 16px;
}

/* ===== BASE STYLES ===== */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-weight: var(--font-weight-regular);
    line-height: 1.6;
    color: var(--color-text-primary);
    background: linear-gradient(135deg, 
        #667eea 0%, 
        #764ba2 40%, 
        #f093fb 80%, 
        #f5576c 100%);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    overflow-x: hidden;
    position: relative;
    
    /* Texture overlay */
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.04) 0%, transparent 50%),
        linear-gradient(135deg, #667eea 0%, #764ba2 40%, #f093fb 80%, #f5576c 100%);
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--color-primary-light);
    outline-offset: 2px;
    border-color: var(--color-primary);
}

/* ===== BACKGROUND PARTICLES ===== */
.background-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(4px);
    animation: float 8s ease-in-out infinite;
}

.particle-1 { width: 60px; height: 60px; top: 15%; left: 10%; animation-delay: 0s; }
.particle-2 { width: 40px; height: 40px; top: 25%; right: 15%; animation-delay: 1.5s; }
.particle-3 { width: 80px; height: 80px; bottom: 25%; left: 20%; animation-delay: 3s; }
.particle-4 { width: 30px; height: 30px; bottom: 15%; right: 25%; animation-delay: 4.5s; }
.particle-5 { width: 50px; height: 50px; top: 60%; left: 60%; animation-delay: 6s; }
.particle-6 { width: 70px; height: 70px; top: 40%; right: 40%; animation-delay: 7.5s; }

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg) scale(1);
        opacity: 0.6;
    }
    33% { 
        transform: translateY(-15px) rotate(120deg) scale(1.1);
        opacity: 0.8;
    }
    66% { 
        transform: translateY(-25px) rotate(240deg) scale(0.9);
        opacity: 0.4;
    }
}

/* ===== MAIN LAYOUT ===== */
.app-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: var(--space-lg);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    z-index: 1;
}

/* ===== HEADER ===== */
.app-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
    padding: var(--space-xl) 0;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.app-logo {
    font-size: 4rem;
    padding: var(--space-lg);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    backdrop-filter: blur(20px);
    animation: pulse 2s ease-in-out infinite;
    transition: var(--transition-normal);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.app-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: var(--font-weight-bold);
    line-height: 1.1;
    text-align: center;
}

.title-primary {
    display: block;
    color: var(--color-text-primary);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.title-accent {
    display: block;
    background: linear-gradient(45deg, #ffd700, #ff6b6b, #4ecdc4, #45b7d1);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-flow 4s ease infinite;
}

@keyframes gradient-flow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.app-subtitle {
    font-size: clamp(1rem, 3vw, 1.25rem);
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== CLEAN TWO-TAB NAVIGATION ===== */
.main-tabs-navigation {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--space-2xl);
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-xs);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.main-tab-button {
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-xl);
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    justify-content: center;
    white-space: nowrap;
    position: relative;
}

.main-tab-button:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.main-tab-button.active {
    color: var(--color-text-primary);
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.2), 
        rgba(255, 140, 0, 0.15));
    border: 1px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.2);
}

.main-tab-button .tab-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.main-tab-button .tab-label {
    font-size: 0.9rem;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.5px;
}

/* Tab panels */
.main-tabs-container {
    position: relative;
}

.main-tab-panel {
    display: none;
    animation: slideUp 0.4s ease-out;
}

.main-tab-panel.active {
    display: block;
}

/* ===== FEATURED vs EXPLORE STYLING ===== */
.featured-card {
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.15), 
        rgba(255, 140, 0, 0.1));
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.15);
}

.featured-card:hover {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 12px 48px rgba(255, 215, 0, 0.25);
    transform: translateY(-8px) scale(1.02);
}

.explore-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    opacity: 0.9;
}

.explore-card:hover {
    opacity: 1;
    background: var(--color-surface-hover);
    transform: translateY(-4px) scale(1.01);
}

/* Grid layouts */
.featured-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.explore-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
    opacity: 0.95;
}

/* ===== MODES SECTION ===== */
.modes-section {
    margin-bottom: var(--space-3xl);
}

.section-heading {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: var(--font-weight-bold);
    text-align: center;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2xl);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--grid-gap);
    max-width: 900px;
    margin: 0 auto;
}

/* ===== MODE CARDS ===== */
.mode-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    
    /* Reset button styles */
    appearance: none;
    background-color: transparent;
    color: inherit;
    font: inherit;
    width: 100%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.08), 
        transparent);
    transition: left 0.6s ease;
}

.mode-card:hover::before {
    left: 100%;
}

.mode-card:hover {
    transform: translateY(-6px) scale(1.02);
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
    box-shadow: var(--shadow-lg);
}

.mode-card:active {
    transform: translateY(-3px) scale(1.01);
}

.mode-card--empty {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
    transition: transform var(--transition-normal);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.mode-card:hover .mode-icon {
    transform: scale(1.1) rotate(5deg);
}

.mode-title {
    font-size: 1.25rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mode-desc {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    max-width: 200px;
}

/* ===== GLASS PANEL ===== */
.glass-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.6s ease-out;
}

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

/* ===== DECISION SECTION ===== */
.decision-section {
    max-width: 600px;
    margin: 0 auto;
}

.back-nav {
    margin-bottom: var(--space-xl);
}

.back-button {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--space-md) var(--space-lg);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    
    /* Reset button styles */
    appearance: none;
    font-family: inherit;
}

.back-button:hover {
    background: var(--color-surface-hover);
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.back-icon {
    transition: transform var(--transition-normal);
}

.back-button:hover .back-icon {
    transform: translateX(-2px);
}

.decision-content {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.decision-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-xl);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== INPUT AREA ===== */
.input-area {
    margin-bottom: var(--space-xl);
    text-align: left;
}

.input-area label {
    display: block;
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-md);
    font-size: 1rem;
}

.input-area input,
.input-area textarea,
.input-area select {
    width: 100%;
    padding: var(--space-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
    margin-bottom: var(--space-lg);
}

/* Fix for select options visibility */
.input-area select option {
    background: #2d3748;
    color: #ffffff;
    padding: 8px;
}

/* Info box styling */
.info-box {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    text-align: center;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.1);
}

.info-box::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.2), rgba(240, 147, 251, 0.1));
    border-radius: var(--radius-lg);
    z-index: -1;
    opacity: 0.5;
}

.info-box p {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    font-weight: var(--font-weight-medium);
}

.info-box .info-icon {
    font-size: 1.2rem;
    margin-right: var(--space-sm);
    opacity: 0.8;
}

.input-area input::placeholder,
.input-area textarea::placeholder {
    color: var(--color-text-tertiary);
}

.input-area input:focus,
.input-area textarea:focus,
.input-area select:focus {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.input-area textarea {
    min-height: 120px;
    resize: vertical;
}

.help-text {
    font-size: 0.85rem;
    color: var(--color-text-tertiary);
    text-align: center;
    margin-top: var(--space-md);
}

/* ===== ACTION BUTTONS ===== */
.action-button {
    position: relative;
    border: none;
    border-radius: var(--radius-full);
    padding: var(--space-lg) var(--space-2xl);
    font-size: 1.1rem;
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 56px;
    overflow: hidden;
}

.primary-action {
    background: linear-gradient(45deg, var(--color-primary), var(--color-accent));
    color: white;
    box-shadow: var(--shadow-md);
    width: 100%;
    margin-bottom: var(--space-md);
}

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

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

.primary-action:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.primary-action:active {
    transform: translateY(-1px) scale(1.01);
}

.button-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--color-primary), var(--color-accent));
    border-radius: var(--radius-full);
    z-index: -1;
    filter: blur(8px);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.primary-action:hover .button-glow {
    opacity: 0.7;
}

.secondary-action {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    color: var(--color-text-primary);
    backdrop-filter: blur(10px);
    padding: var(--space-md) var(--space-xl);
    font-size: 0.95rem;
}

.secondary-action:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== DISABLED BUTTON STYLES ===== */
.action-button:disabled,
.action-button[aria-disabled="true"],
.action-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none;
}

.primary-action:disabled,
.primary-action[aria-disabled="true"],
.primary-action.disabled {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
}

.secondary-action:disabled,
.secondary-action[aria-disabled="true"], 
.secondary-action.disabled {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
}

/* ===== RESULT SECTION ===== */
.result-container {
    animation: slideUp 0.6s ease-out;
}

.result-heading {
    font-size: 1.75rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-xl);
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.result-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: visible;
    box-shadow: var(--shadow-md);
    max-height: none;
}

.result-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--color-primary), 
        var(--color-accent), 
        var(--color-gradient-end));
    display: none;
}

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

.result-box h4 {
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-lg);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Movie title highlight styling */
.movie-title-highlight {
    font-size: 1.8rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-xl);
    text-align: center;
    padding: var(--space-lg);
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.2), 
        rgba(255, 140, 0, 0.15));
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    text-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.movie-title-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 215, 0, 0.2), 
        transparent);
    animation: shimmer-movie 2s ease-in-out infinite;
}

@keyframes shimmer-movie {
    0% { left: -100%; }
    100% { left: 100%; }
}

.result-box .choice {
    font-size: 1.75rem;
    font-weight: var(--font-weight-bold);
    background: linear-gradient(45deg, #ffd700, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background-color: var(--color-surface-hover);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    text-align: center;
}

.result-box .platform,
.result-box .genre {
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-md);
}

.result-box .reasoning {
    color: var(--color-text-secondary);
    font-style: italic;
    line-height: 1.6;
    font-size: 1rem;
}

.ai-response {
    color: var(--color-text-primary);
    line-height: 1.7;
    font-size: 1rem;
    padding: var(--space-lg);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-primary);
    margin-top: var(--space-md);
    backdrop-filter: blur(10px);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
}

/* Custom scrollbar for ai-response */
.ai-response::-webkit-scrollbar {
    width: 6px;
}

.ai-response::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.ai-response::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 3px;
}

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

/* ===== SIMPLE POPUP STYLES ===== */
.simple-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

.popup-content {
    background: white;
    color: #333;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.popup-content h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.popup-content p {
    margin-bottom: 25px;
    line-height: 1.6;
    font-size: 1rem;
}

.popup-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.popup-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    min-width: 120px;
    transition: all 0.2s ease;
}

.btn-accept {
    background: #667eea;
    color: white;
}

.btn-accept:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-privacy {
    background: #f0f0f0;
    color: #333;
    border: 2px solid #ddd;
}

.btn-privacy:hover {
    background: #e0e0e0;
    border-color: #bbb;
}

/* Mobile specific */
@media (max-width: 480px) {
    .popup-content {
        padding: 25px;
        margin: 20px;
    }
    
    .popup-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .popup-buttons button {
        width: 100%;
        min-height: 50px;
        font-size: 1.1rem;
    }
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    overflow-y: auto;
    padding: var(--space-md);
}

.modal-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 500px;
    width: 100%;
    margin: auto;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-xl);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: var(--radius-xl);
    z-index: -1;
    opacity: 0.3;
}

.modal-content h2 {
    color: var(--color-text-primary);
    margin-bottom: var(--space-lg);
    text-align: center;
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
}

.modal-content ul {
    list-style: none;
    margin-bottom: var(--space-xl);
    padding: 0;
}

.modal-content li {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.modal-buttons {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
    flex-wrap: wrap;
}

.modal-buttons button {
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-weight: var(--font-weight-medium);
    transition: var(--transition-normal);
    min-width: 140px;
}

.modal-buttons button:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-buttons button:last-child {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.modal-buttons button:last-child:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
}

/* ===== GLOBAL DISCLAIMER STYLES ===== */
.global-disclaimer {
    font-size: 0.85rem;
    color: #ffa500;
    text-align: center;
    margin: var(--space-2xl) auto;
    padding: var(--space-lg);
    background: rgba(255, 165, 0, 0.1);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 165, 0, 0.3);
    backdrop-filter: blur(10px);
    font-weight: var(--font-weight-medium);
    max-width: 600px;
    box-shadow: 0 4px 16px rgba(255, 165, 0, 0.1);
}

.result-actions {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-lg);
    z-index: 10;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.loading-text {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    text-align: center;
    max-width: 250px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    :root {
        --grid-gap: 12px;
    }
    
    .app-container {
        padding: var(--space-md);
    }
    
    .app-header {
        margin-bottom: var(--space-2xl);
        padding: var(--space-lg) 0;
    }
    
    .app-logo {
        font-size: 3rem;
        padding: var(--space-lg);
    }
    
    .modes-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
    
    .mode-card {
        min-height: 160px;
        padding: var(--space-lg);
    }
    
    .glass-panel {
        padding: var(--space-lg);
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .secondary-action {
        width: 100%;
        max-width: 200px;
    }

    /* Mobile modal improvements */
    .modal-overlay {
        align-items: flex-start;
        padding: var(--space-sm);
        padding-top: var(--space-lg);
    }
    
    .modal-content {
        padding: var(--space-lg);
        max-width: none;
        margin: 0;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: var(--space-md);
        margin-top: var(--space-lg);
        flex-shrink: 0; /* Prevent buttons from shrinking */
    }
    
    .modal-buttons button {
        width: 100%;
        min-height: 48px;
        padding: 14px 24px;
        font-size: 16px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 0;
    }
    
    .modal-buttons button:last-child {
        margin-bottom: 0; /* Remove bottom margin from last button */
    }

    /* Security: Classes for inline styles removal */
.privacy-button {
    min-height: 44px;
    padding: 12px 24px;
    touch-action: manipulation;
}

.help-text {
    font-size: 0.9rem;
    color: var(--color-text-tertiary);
    text-align: center;
    margin-top: 15px;
}

.help-text-small {
    font-size: 0.9rem;
    color: var(--color-text-tertiary);
    text-align: center;
    margin-top: 10px;
}

.browser-unsupported {
    text-align: center;
    padding: 50px;
    background: #667eea;
    color: white;
    font-family: Arial, sans-serif;
}

.browser-unsupported ul {
    list-style: none;
}

/* Mobile tab layouts */
    .main-tabs-navigation {
        max-width: none;
        margin: 0 0 var(--space-xl) 0;
    }
    
    .main-tab-button {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.9rem;
    }
    
    .main-tab-button .tab-label {
        font-size: 0.8rem;
    }
    
    .featured-grid, .explore-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: var(--space-sm);
    }
    
    .modes-grid {
        gap: var(--space-sm);
    }
    
    .mode-card {
        min-height: 140px;
        padding: var(--space-md);
    }
    
    .mode-icon {
        font-size: 2.5rem;
    }
    
    .mode-title {
        font-size: 1.1rem;
    }
    
    .glass-panel {
        padding: var(--space-md);
    }
    
    /* Improved touch targets for mobile */
    button, .mode-card, .main-tab-button {
        min-height: 44px !important; /* iOS recommended minimum */
    }
    
    /* Better text readability on small screens */
    .mode-desc {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }
    
    /* Prevent zoom on form focus */
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Mobile-specific optimizations */
.mobile-device .particle {
    animation-duration: 8s !important; /* Slower animations to save battery */
}

.mobile-device .app-logo {
    animation-duration: 3s !important;
}

.mobile-device .glass-panel {
    backdrop-filter: blur(10px) !important; /* Less blur for better performance */
}

/* Touch-friendly scrollbars on mobile */
.mobile-device ::-webkit-scrollbar {
    width: 8px;
}

.mobile-device ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

/* Prevent text selection on mobile for better UX */
.mobile-device .mode-card,
.mobile-device .main-tab-button,
.mobile-device button {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ===== DYNAMIC OPTIONS SYSTEM ===== */
.options-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.option-group label {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
}

.option-input-group {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.option-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
    transition: var(--transition-normal);
}

.option-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: var(--color-surface-hover);
}

.option-input::placeholder {
    color: var(--color-text-tertiary);
}

.add-option-btn {
    background: linear-gradient(135deg, var(--color-success), #27d084);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin: 0 auto var(--space-md);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.add-option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

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

.remove-option-btn {
    background: var(--color-error);
    color: white;
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: var(--transition-normal);
    flex-shrink: 0;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-option-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .option-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .remove-option-btn {
        align-self: flex-end;
        margin-top: var(--space-xs);
    }
}

/* ===== ACCESSIBLE INFO MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    max-width: 90%;
    width: 400px;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    position: relative;
}

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

.modal-header h3 {
    color: var(--color-text-primary);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    margin: 0;
    flex: 1;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: var(--space-xs);
    transition: var(--transition-normal);
    border-radius: var(--radius-sm);
    margin-left: var(--space-md);
}

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

.modal-body {
    padding: var(--space-lg);
    overflow: hidden;
    max-height: calc(70vh - 140px); /* Account for header and footer */
}

.modal-body p {
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
}

.modal-button {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition-normal);
    min-width: 80px;
}

.modal-button:hover {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-accent));
}

.modal-button:focus {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
}

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

@keyframes slideIn {
    from { 
        transform: translateY(-50px) scale(0.95);
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ===== LINKS SECTION ===== */
.links-section {
    margin-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-md);
}

.links-container h5 {
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.link-buttons {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.link-button {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    min-height: 40px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-accent));
}

.link-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.link-button:focus {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    :root {
        --color-surface: rgba(255, 255, 255, 0.2);
        --color-surface-hover: rgba(255, 255, 255, 0.3);
        --color-border: rgba(255, 255, 255, 0.4);
        --color-border-hover: rgba(255, 255, 255, 0.6);
        --color-text-primary: #ffffff;
        --color-text-secondary: rgba(255, 255, 255, 0.9);
    }
}

/* ===== RANDOM NUMBER INTERFACE ===== */
.range-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.number-range {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.number-range label {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    font-size: 1rem;
    flex: 1;
    min-width: 120px;
}

.number-range input[type="number"] {
    flex: 2;
    min-width: 100px;
    padding: var(--space-md) var(--space-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-size: 1.1rem;
    font-weight: var(--font-weight-medium);
    font-family: inherit;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
    text-align: center;
}

.number-range input[type="number"]:focus {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    outline: none;
}

.number-range input[type="number"]::-webkit-outer-spin-button,
.number-range input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-range input[type="number"] {
    -moz-appearance: textfield;
}

.quick-range-buttons {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-md);
}

.quick-range-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    backdrop-filter: blur(10px);
    min-width: 80px;
    white-space: nowrap;
}

.quick-range-btn:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
    color: var(--color-text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

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

.big-number {
    font-size: 4rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-align: center;
    margin: var(--space-xl) 0;
    padding: var(--space-xl);
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.1), 
        rgba(118, 75, 162, 0.1));
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    text-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.big-number::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    display: none;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Responsive adjustments for random number interface */
@media (max-width: 768px) {
    .number-range {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .number-range label {
        min-width: auto;
        margin-bottom: var(--space-xs);
    }
    
    .number-range input[type="number"] {
        min-width: auto;
    }
    
    .quick-range-buttons {
        justify-content: center;
        gap: var(--space-xs);
    }
    
    .quick-range-btn {
        min-width: 60px;
        font-size: 0.8rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .big-number {
        font-size: 3rem;
        padding: var(--space-lg);
    }
}

@media (max-width: 480px) {
    .big-number {
        font-size: 2.5rem;
    }
    
    .quick-range-buttons {
        flex-direction: column;
        align-items: center;
        gap: var(--space-xs);
    }
    
    .quick-range-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    /* Already optimized for dark backgrounds */
}