:root {
    --bg-dark: #050507; 
    --bg-card: rgba(15, 15, 20, 0.6); 
    --text-main: #ffffff;
    --text-muted: #8b92a5;
    --accent-primary: #00e5ff;
    --accent-primary-dim: rgba(0, 229, 255, 0.2);
    --accent-secondary: #b07cff;
    --accent-secondary-dim: rgba(176, 124, 255, 0.2);
    --border-glass: rgba(255, 255, 255, 0.08);
}

/* App Body with Studio Lighting Effect */
.app-body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(0, 229, 255, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(176, 124, 255, 0.04) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    /* CRITICAL FIX: Allow vertical scroll on mobile, hide horizontal overflow */
    overflow-x: hidden; 
    overflow-y: auto;
}

/* Upgraded CodeVelly Watermark */
.brand-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(8rem, 15vw, 24rem);
    font-weight: 900;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.03);
    z-index: 0;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    letter-spacing: -0.05em;
}

/* Minimal Navbar */
.app-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    position: relative;
    z-index: 10;
    animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Logo Fixes */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

.logo-img {
    aspect-ratio: 1/1;
    width: 36px;
    object-fit: contain;
    border-radius: 8px; 
}

.back-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
}

.back-btn:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(-4px); 
}

/* Main Selection Area */
.select-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 5% 2rem 5%; 
    position: relative;
    z-index: 10;
    width: 100%;
    margin: 0 auto;
    margin-top: -6vh; /* Pulls everything up slightly */
}

.select-header {
    text-align: center;
    margin-bottom: 2rem; /* Reduced from 3rem */
    animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.select-title {
    font-size: clamp(1.8rem, 4vw, 3.5rem); /* Scaled down slightly */
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
    font-weight: 800;
}

/* Animated Gradient Text */
.gradient-text {
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shine 4s linear infinite;
}

.select-subtitle {
    color: var(--text-muted);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    font-weight: 300;
}

/* Hover Spotlight Grid Layout */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 2rem; /* Reduced gap */
    width: 100%;
    max-width: 850px; /* Constrains the cards from getting too wide */
    margin: 0 auto;
    perspective: 1000px; 
}

/* The Cards - Glassmorphism Base */
.tool-card {
    background-color: var(--border-glass); 
    border-radius: 20px; /* Slightly tighter border radius */
    position: relative;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3); /* Softer shadow for smaller cards */
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
    padding: 1px; 
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* The Magic Spotlight Border effect */
.tool-card::before {
    background: radial-gradient(
        800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
        rgba(255, 255, 255, 0.1),
        transparent 40%
    );
    border-radius: inherit;
    content: "";
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 1;
    opacity: 0;
    transition: opacity 500ms;
}

.tool-card:hover::before { opacity: 1; }

/* Gradient Border Mask */
.card-border {
    background: radial-gradient(
        400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
        rgba(0, 229, 255, 0.8), 
        transparent 40%
    );
    border-radius: inherit;
    content: "";
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 2;
    opacity: 0;
    transition: opacity 500ms;
}

.tool-card:nth-child(2) .card-border {
    background: radial-gradient(
        400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
        rgba(176, 124, 255, 0.8), 
        transparent 40%
    );
}

.tool-grid:hover .card-border { opacity: 1; }

/* Inner Card Content - The Glass Pane */
.card-content {
    background-color: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 19px; 
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 2.2rem 1.8rem; /* Scaled down padding */
    position: relative; 
    z-index: 3;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.02);
    height: 100%;
}

/* Icons with Breathing Animation */
.tool-icon {
    width: 55px; /* Scaled down from 70px */
    height: 55px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem; /* Reduced margin */
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ensure SVGs fit the smaller box */
.tool-icon svg {
    width: 28px;
    height: 28px;
}

.audio-icon {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(0, 229, 255, 0.02));
    color: var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-primary-dim);
}

.tts-icon {
    background: linear-gradient(135deg, rgba(176, 124, 255, 0.1), rgba(176, 124, 255, 0.02));
    color: var(--accent-secondary);
    box-shadow: 0 0 20px var(--accent-secondary-dim);
}

.tool-card:hover .tool-icon { transform: translateY(-5px) scale(1.05); }
.tool-card:nth-child(1):hover .audio-icon { box-shadow: 0 10px 25px rgba(0, 229, 255, 0.3); }
.tool-card:nth-child(2):hover .tts-icon { box-shadow: 0 10px 25px rgba(176, 124, 255, 0.3); }

.card-content h2 {
    font-size: 1.5rem; /* Scaled down */
    margin-bottom: 0.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.card-content p {
    color: var(--text-muted);
    margin-bottom: 2rem; /* Reduced margin */
    flex-grow: 1;
    font-size: 0.95rem; /* Scaled down */
    line-height: 1.5;
}

/* Dynamic Launch Text */
.launch-text {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tool-card:nth-child(2) .launch-text { color: var(--accent-secondary); }

.tool-card:hover .launch-text {
    opacity: 1;
    gap: 1rem; 
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Animations */
@keyframes shine { to { background-position: 200% center; } }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- MOBILE POLISH --- */
@media (max-width: 768px) {
    .app-navbar {
        padding: 1rem 1.5rem;
    }
    
    .select-wrapper {
        padding: 1rem;
        margin-top: 0; /* Reset pulling up on small screens */
    }

    .select-header {
        margin-bottom: 1.5rem;
    }

    .tool-grid {
        gap: 1.25rem;
    }

    .tool-card {
        min-height: auto; 
    }

    .card-content {
        padding: 1.8rem 1.5rem; 
    }

    .tool-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 1.25rem;
    }
    
    .tool-icon svg {
        width: 24px;
        height: 24px;
    }

    .brand-watermark {
        font-size: 20vw; 
    }
