.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tier-ss {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    color: white;
    border: 1px solid #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.7), 0 0 5px rgba(255, 105, 180, 0.5);
    animation: gradientBG 5s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.toast-notification.show {
    opacity: 1;
}
:root {
            --primary-pink: #ff69b4;
            --dark-pink: #ff1493;
            --bg-dark: #1a0a1a;
            --bg-light: #2a0f2a;
            --text-light: #fff0f5;
            --text-dim: #e0b0ff;
            --blue-team: #3498db;
            --red-team: #e74c3c;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Quicksand', sans-serif;
        }
        
        body {
            background-color: var(--bg-dark);
            color: var(--text-light);
            background-image: 
                radial-gradient(circle at 10% 20%, rgba(255, 105, 180, 0.1) 0%, transparent 20%),
                radial-gradient(circle at 90% 80%, rgba(255, 20, 147, 0.1) 0%, transparent 20%);
            position: relative;
            overflow-x: hidden;
            min-height: 100vh;
        }
        
        /* Animated Background Elements */
        .magic-star {
            position: fixed;
            width: 3px;
            height: 3px;
            background-color: var(--primary-pink);
            border-radius: 50%;
            box-shadow: 0 0 10px 2px var(--primary-pink);
            animation: twinkle 5s infinite ease-in-out;
            z-index: -1;
        }
        
        .magic-bubble {
            position: fixed;
            width: 15px;
            height: 15px;
            border: 1px solid rgba(255, 105, 180, 0.5);
            border-radius: 50%;
            animation: float 15s infinite linear;
            z-index: -1;
            opacity: 0.6;
        }
        
        @keyframes twinkle {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 1; }
        }
        
        @keyframes float {
            0% { transform: translateY(0) translateX(0); opacity: 0; }
            10% { opacity: 0.6; }
            90% { opacity: 0.6; }
            100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
        }
        
        .header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(90deg, rgba(26, 10, 26, 0.9) 0%, rgba(42, 15, 42, 0.95) 100%);
    border-bottom: 1px solid var(--primary-pink);
    box-shadow: 0 4px 20px rgba(255, 20, 147, 0.2);
}

/* Logo Styles */
.logo-container {
    margin-bottom: 0.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Pacifico', cursive;
    font-size: 1.5rem;
    color: var(--text-light);
    text-shadow: 0 0 8px var(--primary-pink);
}

.logo i {
    color: var(--primary-pink);
    font-size: 1.3rem;
    text-shadow: 0 0 10px var(--primary-pink);
}

/* Navigation Styles */
.main-nav {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    width: 100%;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    background: rgba(255, 105, 180, 0.08);
    border: 1px solid rgba(255, 105, 180, 0.3);
    color: var(--text-dim);
    text-decoration: none;
    transition: all 0.3s ease;
    width: 80px;
    text-align: center;
}

.nav-btn i {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    color: var(--primary-pink);
}

.nav-btn span {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-btn:hover {
    background: rgba(255, 105, 180, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.3);
    color: var(--text-light);
}

.nav-btn.active {
    background: rgba(255, 105, 180, 0.3);
    border-color: var(--primary-pink);
    color: white;
}

@media (max-width: 768px) {
    /* --- General Layout & Spacing --- */
    body {
        /* Reduce padding to give content more space */
        padding: 15px; 
    }

    .container {
        padding: 0;
    }

    /* --- Typography --- */
    h1 {
        /* More appropriate font size for mobile headers */
        font-size: 2.2rem; 
        letter-spacing: 1px;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    /* --- Main Panels & Grids --- */
    .builder-container {
        /* Switch to a single column layout */
        grid-template-columns: 1fr; 
        gap: 20px; /* Reduce gap between panels */
    }

    .panel, .feedback-panel, .synergy-section {
        /* Reduce padding inside panels */
        padding: 20px; 
        /* Remove hover effect on mobile for better performance */
        transform: none !important;
        box-shadow: var(--ui-shadow) !important;
    }
    
    .panel:hover {
        /* Disable hover effects on touch devices */
        transform: none;
    }

    .panel-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }

    /* --- Item & Stat Grids (More Compact Layout) --- */
    .items-grid {
        /* Use 3 columns to save vertical space; icons are small enough */
        grid-template-columns: repeat(3, 1fr); 
        gap: 12px;
    }

    .substitutes {
        /* Single column is best for these */
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .item-slot .item-name {
        font-size: 0.75rem; /* Slightly smaller font for item names */
    }

    .stats-grid {
        /* Use 3 columns to make the stats section more compact */
        grid-template-columns: repeat(3, 1fr); 
        gap: 10px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
    .stat-name {
        font-size: 0.7rem;
    }

    /* --- Emblem Section --- */
    .emblem-set {
        /* Single column is good, reduce gap */
        grid-template-columns: 1fr; 
        gap: 15px;
    }

    /* --- Action Buttons --- */
    .buttons {
        /* Stack buttons vertically */
        flex-direction: column; 
        gap: 15px;
    }
    .btn {
        width: 100%; /* Make buttons full-width */
    }

    /* --- Item Selector Modal --- */
    .item-selector-content {
        width: 95%; /* Use more of the screen width */
        max-height: 90vh; /* Allow a bit more vertical space */
    }

    .item-selector-title {
        font-size: 1.5rem;
    }

    .items-list {
        /* Make the grid more flexible to fit 2 or 3 items per row */
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); 
        padding: 15px;
        gap: 15px;
    }

    .item-option-icon {
        width: 60px;
        height: 60px;
    }
    .item-option-name {
        font-size: 0.85rem;
    }

    /* --- Footer --- */
    .footer-links {
        gap: 20px;
    }
}




@media (max-width: 480px) {
    .main-nav {
        gap: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.4rem 0.6rem;
        width: 65px;
    }
}

        /* Header Styles */
        header {
            background: linear-gradient(90deg, rgba(26, 10, 26, 0.9) 0%, rgba(42, 15, 42, 0.95) 100%);
            backdrop-filter: blur(10px);
            padding: 1rem 2rem;
            position: sticky;
            top: 0;
            z-index: 100;
            border-bottom: 1px solid var(--dark-pink);
            box-shadow: 0 0 20px rgba(255, 20, 147, 0.3);
        }
        
        .header-content {
            max-width: 1400px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
        }
        
        .logo {
            font-family: 'Pacifico', cursive;
            font-size: 2rem;
            color: var(--primary-pink);
            text-shadow: 0 0 10px var(--primary-pink);
            background: linear-gradient(to right, var(--primary-pink), var(--dark-pink));
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .logo i {
            font-size: 1.8rem;
        }
        
        /* Search and Filter */
        .controls {
            display: flex;
            gap: 1rem;
            align-items: center;
            flex-wrap: wrap;
        }
        
        .search-box {
            position: relative;
        }
        
        .search-box input {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid var(--primary-pink);
            border-radius: 50px;
            padding: 0.5rem 1rem 0.5rem 2.5rem;
            color: var(--text-light);
            font-size: 0.9rem;
            width: 200px;
            transition: all 0.3s ease;
        }
        
        .search-box input:focus {
            outline: none;
            border-color: var(--dark-pink);
            box-shadow: 0 0 10px rgba(255, 20, 147, 0.5);
            width: 250px;
        }
        
        .search-box i {
            position: absolute;
            left: 1rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--primary-pink);
        }
        
        .filter-dropdown {
            position: relative;
        }
        
        .filter-dropdown select {
            background: rgba(255, 255, 255, 0.9);
            border: 1px solid var(--primary-pink);
            border-radius: 50px;
            padding: 0.5rem 1.5rem 0.5rem 1rem;
            color: #000;
            font-size: 0.9rem;
            font-weight: 600;
            appearance: none;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .filter-dropdown select:focus {
            outline: none;
            border-color: var(--dark-pink);
            box-shadow: 0 0 10px rgba(255, 20, 147, 0.5);
        }
        
        .filter-dropdown::after {
            content: '\f078';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            position: absolute;
            right: 1rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--primary-pink);
            pointer-events: none;
        }
        
        /* Main Content */
        main {
            max-width: 1400px;
            margin: 2rem auto;
            padding: 0 2rem;
        }
        
        /* Stats Grid */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
            gap: 1.5rem;
            margin-top: 1.5rem;
        }
        
    
        
        /* Hero Card */
        .hero-card {
            background: linear-gradient(135deg, rgba(42, 15, 42, 0.8) 0%, rgba(26, 10, 26, 0.9) 100%);
            border-radius: 15px;
            padding: 1.5rem;
            border: 1px solid rgba(255, 105, 180, 0.3);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            min-height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        
        .hero-card:hover {
            transform: translateY(-5px);
            border-color: var(--primary-pink);
            box-shadow: 0 10px 25px rgba(255, 20, 147, 0.4);
        }
        
        .hero-card::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255, 105, 180, 0.1) 0%, transparent 70%);
            transform: rotate(30deg);
            pointer-events: none;
        }
        
        .hero-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid rgba(255, 105, 180, 0.2);
        }
        
        .hero-name {
            font-size: 1.3rem;
            font-weight: 600;
            color: var(--primary-pink);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .hero-role {
            background: rgba(255, 105, 180, 0.2);
            color: var(--text-light);
            padding: 0.25rem 0.75rem;
            border-radius: 50px;
            font-size: 0.8rem;
            font-weight: 600;
            border: 1px solid var(--primary-pink);
        }
        
        .hero-tier {
            font-weight: 700;
            font-size: 0.9rem;
            padding: 0.25rem 0.75rem;
            border-radius: 50px;
            text-transform: uppercase;
        }
        
        .tier-s { background: rgba(255, 215, 0, 0.2); color: gold; border: 1px solid gold; }
        .tier-a { background: rgba(255, 105, 180, 0.2); color: var(--primary-pink); border: 1px solid var(--primary-pink); }
        .tier-b { background: rgba(100, 149, 237, 0.2); color: cornflowerblue; border: 1px solid cornflowerblue; }
        .tier-c { background: rgba(144, 238, 144, 0.2); color: lightgreen; border: 1px solid lightgreen; }
        .tier-d { background: rgba(255, 165, 0, 0.2); color: orange; border: 1px solid orange; }
        
        /* Stats Bars */
        .stat-item {
            margin-bottom: 1rem;
        }
        
        .stat-label {
            display: flex;
            justify-content: space-between;
            margin-bottom: 0.3rem;
            font-size: 0.9rem;
            color: var(--text-dim);
        }
        
        .stat-value {
            font-weight: 600;
            color: var(--text-light);
        }
        
        .stat-bar-container {
            height: 10px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 5px;
            overflow: hidden;
        }
        
        .stat-bar {
            height: 100%;
            border-radius: 5px;
            background: linear-gradient(90deg, var(--primary-pink), var(--dark-pink));
            position: relative;
            transition: width 1.5s ease-out;
            width: 0;
        }
        
        .stat-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shine 2.5s infinite;
    transform: translateX(-100%);
}
        
        @keyframes shine {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(100%); }
        }
        
        /* Hero Image */
        .hero-image {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid var(--primary-pink);
            margin-right: 0.75rem;
            box-shadow: 0 0 15px rgba(255, 105, 180, 0.5);
        }
        
        /* KDA and Matches */
        .hero-details {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            margin-top: 1.5rem;
            font-size: 0.9rem;
        }
        
        .detail-item {
            background: rgba(255, 255, 255, 0.05);
            padding: 0.5rem;
            border-radius: 8px;
            text-align: center;
        }
        
        .detail-label {
            color: var(--text-dim);
            margin-bottom: 0.3rem;
        }
        
        .detail-value {
            font-weight: 600;
            color: var(--text-light);
        }
        
        .kda-value {
            color: var(--primary-pink);
            font-weight: 700;
        }
        
        /* Loading Spinner */
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(26, 10, 26, 0.9);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            backdrop-filter: blur(5px);
        }
        
        .spinner {
            width: 70px;
            height: 70px;
            border: 5px solid rgba(255, 105, 180, 0.3);
            border-radius: 50%;
            border-top-color: var(--primary-pink);
            animation: spin 1s ease-in-out infinite;
            margin-bottom: 1.5rem;
        }
        
        .loading-text {
            font-family: 'Pacifico', cursive;
            color: var(--primary-pink);
            font-size: 1.5rem;
            text-shadow: 0 0 10px var(--primary-pink);
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        
        /* View Toggle */
        .view-toggle {
            display: flex;
            justify-content: flex-end;
            margin-bottom: 1rem;
        }
        
        .toggle-btn {
            background: rgba(255, 105, 180, 0.2);
            border: 1px solid var(--primary-pink);
            color: var(--text-light);
            padding: 0.5rem 1rem;
            border-radius: 50px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .toggle-btn:first-child {
            border-top-right-radius: 0;
            border-bottom-right-radius: 0;
        }
        
        .toggle-btn:last-child {
            border-top-left-radius: 0;
            border-bottom-left-radius: 0;
        }
        
        .toggle-btn.active {
            background: var(--primary-pink);
            color: var(--bg-dark);
            font-weight: 600;
        }
        
        .toggle-btn:hover {
            background: rgba(255, 105, 180, 0.4);
        }
        
        /* Compact View */
        .compact-view .hero-card {
            padding: 1rem;
        }
        
        .compact-view .hero-header {
            margin-bottom: 0.5rem;
        }
        
        .compact-view .hero-name {
            font-size: 1.1rem;
        }
        
        .compact-view .hero-details {
            display: none;
        }
        
        .compact-view .stats-grid {
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 1rem;
        }
        
        /* Tooltip */
        .tooltip {
            position: relative;
            display: inline-block;
        }
        
        .tooltip .tooltip-text {
            visibility: hidden;
            width: 200px;
            background-color: var(--bg-light);
            color: var(--text-light);
            text-align: center;
            border-radius: 6px;
            padding: 0.5rem;
            position: absolute;
            z-index: 1;
            bottom: 125%;
            left: 50%;
            transform: translateX(-50%);
            opacity: 0;
            transition: opacity 0.3s;
            border: 1px solid var(--primary-pink);
            box-shadow: 0 0 15px rgba(255, 20, 147, 0.3);
            font-size: 0.8rem;
        }
        
        .tooltip:hover .tooltip-text {
            visibility: visible;
            opacity: 1;
        }
        
        /* Meta Pick Badge */
        .meta-badge {
            position: absolute;
            top: -10px;
            right: -10px;
            background: gold;
            color: var(--bg-dark);
            font-weight: bold;
            padding: 0.25rem 0.5rem;
            border-radius: 50px;
            font-size: 0.7rem;
            transform: rotate(15deg);
            box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
            z-index: 2;
        }
        
        /* Card Entrance Animation */
        @keyframes fadeUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .hero-card {
            animation: fadeUp 0.5s ease-out forwards;
            opacity: 0;
        }
        
        /* Item Card Specific Styles */
        .item-card {
            background: linear-gradient(135deg, rgba(42, 15, 42, 0.8) 0%, rgba(26, 10, 26, 0.9) 100%);
            border-radius: 15px;
            padding: 1.5rem;
            border: 1px solid rgba(255, 105, 180, 0.3);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            animation: fadeUp 0.5s ease-out forwards;
            opacity: 0;
        }
        
        .item-card:hover {
            transform: translateY(-5px);
            border-color: var(--primary-pink);
            box-shadow: 0 10px 25px rgba(255, 20, 147, 0.4);
        }
        
        .item-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }
        
        .item-name {
            font-size: 1.2rem;
            font-weight: 600;
            color: var(--primary-pink);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .item-image {
            width: 50px;
            height: 50px;
            border-radius: 8px;
            object-fit: cover;
            border: 2px solid var(--primary-pink);
            margin-right: 0.75rem;
            box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
        }
        
        .item-type {
            background: rgba(255, 20, 147, 0.2);
            color: var(--text-light);
            padding: 0.25rem 0.75rem;
            border-radius: 50px;
            font-size: 0.8rem;
            font-weight: 600;
            border: 1px solid var(--dark-pink);
        }
        
        .item-price {
            font-weight: 700;
            color: gold;
        }
        
        .item-stats {
            margin-top: 1rem;
        }
        
        .item-stat {
            margin-bottom: 0.5rem;
            font-size: 0.9rem;
        }
        
        .stat-icon {
            margin-right: 0.3rem;
            color: var(--primary-pink);
        }
        
        .recommended-roles {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-top: 1rem;
        }
        
        .role-badge {
            background: rgba(255, 105, 180, 0.2);
            color: var(--text-light);
            padding: 0.25rem 0.5rem;
            border-radius: 50px;
            font-size: 0.7rem;
            border: 1px solid var(--primary-pink);
        }
        
        .no-items {
            grid-column: 1 / -1;
            text-align: center;
            padding: 2rem;
            color: var(--text-dim);
            font-size: 1.2rem;
        }
        
        /* Items Filter Controls */
        .items-filter-controls {
            display: flex;
            gap: 1rem;
            align-items: center;
            flex-wrap: wrap;
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 1px solid rgba(255, 105, 180, 0.2);
        }
        
      

        /* Available Heroes */
        .available-heroes {
            margin-top: 1.5rem;
        }

        .available-heroes h3 {
            margin-bottom: 1rem;
            color: var(--primary-pink);
            padding-bottom: 0.5rem;
            border-bottom: 1px solid rgba(255, 105, 180, 0.2);
        }



/* Mid Game Meter Bar (add if not existing) */
.meter-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 10px;
    margin: 5px 0;
    position: relative;
}

.meter-bar {
    height: 20px;
    border-radius: 10px;
    position: relative;
    transition: width 0.5s ease;
}

.meter-bar.blue {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.meter-bar.red {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.meter-bar span {
    position: absolute;
    height: 100%;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.3);
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px;
  margin: auto;
}

.video-card {
  background: linear-gradient(135deg, rgba(42, 15, 42, 0.9), rgba(26, 10, 26, 0.95));
  border-radius: 15px;
  padding: 1rem;
  border: 1px solid rgba(255, 105, 180, 0.3);
  box-shadow: 0 5px 15px rgba(255, 105, 180, 0.2);
  transition: transform 0.3s ease;
}

.video-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-pink);
  box-shadow: 0 10px 25px rgba(255, 105, 180, 0.5);
}

.video-card iframe {
  width: 100%;
  border-radius: 10px;
  border: none;
}

.video-title {
  margin-top: 0.75rem;
  font-size: 1.1rem;
  color: var(--primary-pink);
  font-weight: bold;
}

.video-meta {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #9c399c;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(60, 201, 90, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast-notification.show {
    opacity: 1;
}

@media (max-width: 360px) {
    h1 {
        font-size: 1.8rem;
    }
    .subtitle {
        font-size: 0.9rem;
    }
    .items-grid {
        /* Fall back to 2 columns on very narrow devices */
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-grid {
        /* Fall back to 2 columns for readability */
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Additional small screen tweaks - Full mobile optimization */
@media (max-width: 768px) {
    /* --- General Layout & Spacing --- */
    body {
        /* Reduce padding to give content more space */
        padding: 15px; 
    }

    .container {
        padding: 0;
    }

    /* --- Typography --- */
    h1 {
        /* More appropriate font size for mobile headers */
        font-size: 2.2rem; 
        letter-spacing: 1px;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    /* --- Main Panels & Grids --- */
    .builder-container {
        /* Switch to a single column layout */
        grid-template-columns: 1fr; 
        gap: 20px; /* Reduce gap between panels */
    }

    .panel, .feedback-panel, .synergy-section {
        /* Reduce padding inside panels */
        padding: 20px; 
        /* Remove hover effect on mobile for better performance */
        transform: none !important;
        box-shadow: var(--ui-shadow) !important;
    }
    
    .panel:hover {
        /* Disable hover effects on touch devices */
        transform: none;
    }

    .panel-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }

    /* --- Item & Stat Grids (More Compact Layout) --- */
    .items-grid {
        /* Use 3 columns to save vertical space; icons are small enough */
        grid-template-columns: repeat(3, 1fr); 
        gap: 12px;
    }

    .substitutes {
        /* Single column is best for these */
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .item-slot .item-name {
        font-size: 0.75rem; /* Slightly smaller font for item names */
    }

    .stats-grid {
        /* Use 3 columns to make the stats section more compact */
        grid-template-columns: repeat(3, 1fr); 
        gap: 10px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
    .stat-name {
        font-size: 0.7rem;
    }

    /* --- Emblem Section --- */
    .emblem-set {
        /* Single column is good, reduce gap */
        grid-template-columns: 1fr; 
        gap: 15px;
    }

    /* --- Action Buttons --- */
    .buttons {
        /* Stack buttons vertically */
        flex-direction: column; 
        gap: 15px;
    }
    .btn {
        width: 100%; /* Make buttons full-width */
    }

    /* --- Item Selector Modal --- */
    .item-selector-content {
        width: 95%; /* Use more of the screen width */
        max-height: 90vh; /* Allow a bit more vertical space */
    }

    .item-selector-title {
        font-size: 1.5rem;
    }

    .items-list {
        /* Make the grid more flexible to fit 2 or 3 items per row */
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); 
        padding: 15px;
        gap: 15px;
    }

    .item-option-icon {
        width: 60px;
        height: 60px;
    }
    .item-option-name {
        font-size: 0.85rem;
    }

    /* --- Footer --- */
    .footer-links {
        gap: 20px;
    }
}


@media (min-width: 361px) and (max-width: 480px) {
    /* Base adjustments */
    body {
        font-size: 12px;
    }
    
    main {
        padding: 0 0.5rem;
    }

    /* Header reorganization - stacked layout */
    .header-content {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    /* Navigation Row - Single horizontal line */
    .nav-buttons {
        display: flex;
        justify-content: space-between;
        width: 100%;
        gap: 0.3rem;
        flex: 1;
        text-align: center;
        padding: 0.5rem 0.1rem;
        background: rgba(255, 105, 180, 0.1);
        border-radius: 8px;
        font-weight: 600;
        font-size: 0.6rem;
        color: var(--text-light);
        border: 1px solid rgba(255, 105, 180, 0.3);
        transition: all 0.2s ease;
    }

    /* Filters Row - Single horizontal line below nav */
    .filter-options-row {
        display: flex;
        justify-content: space-between;
        width: 100%;
        gap: 0.3rem;
        margin-top: 0.2rem;
    }

    .stat-item {
            margin-bottom: 0.1rem;
        }
        

    .filter-dropdown {
        flex: 1;
        min-width: 0;
    }

    .filter-dropdown select {
        width: 100%;
        padding: 0.5rem 0.3rem;
        font-size: 0.7rem;
        border-radius: 6px;
    }

    /* Search Bar - Full width below filters */
    .search-box {
        width: 100%;
        margin-top: 0.3rem;
    }

    .search-box input {
        padding: 0.4rem 0.8rem 0.4rem 2rem;
        font-size: 0.7rem;
    }

    .search-box i {
        left: 0.7rem;
        font-size: 0.8rem;
    }

    /* Logo adjustments */
    .logo {
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
        gap: 0.3rem;
    }

    .logo i {
        font-size: 1.3rem;
    }

    /* Hero grid - 2 columns with adjusted spacing */
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.4rem;
    }

    .stat-item {
        margin-bottom: 0.5rem; /* Adjust this value as needed */
    }

    .compact-view .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.2rem;
        padding: 0.3rem;
    }

    /* Detailed view cards - simplified */
    .hero-card:not(.compact-view) {
        aspect-ratio: 1/1.1;
        padding: 0.4rem;
        border-radius: 15px;
            
        
    }

    .hero-card:not(.compact-view) .hero-name {
        font-size: 0.8rem;
    }

    .hero-card:not(.compact-view) .hero-image {
        width: 35px;
        height: 35px;
    }

    .hero-card:not(.compact-view) .stat-label,
    .hero-card:not(.compact-view) .stat-value {
        font-size: 0.6rem;
    }


    /* Compact view cards - minimal design */
    .compact-view .hero-card {
        aspect-ratio: 1/1;
        padding: 0.3rem;
    }

    .compact-view .hero-name {
        font-size: 0.2rem;
    }

    .compact-view .hero-role,
    .compact-view .hero-tier {
        font-size: 0.5rem;
        padding: 0.2rem 0.3rem;
    }

    /* View toggle - stacked buttons */
    .view-toggle {
        gap: 0.3rem;
        margin: 0.5rem 0;
    }

    .toggle-btn {
        padding: 0.5rem;
        font-size: 0.7rem;
    }

    /* Video grid - single column */
    .video-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    /* Toast notification - smaller */
    .toast-notification {
        width: 80%;
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        bottom: 10px;
    }

    /* Meter bars - adjusted */
    .meter-bar {
        height: 14px;
    }

    /* Stat bars - thinner */
    .stat-bar-container {
        height: 3px;
    }

    .compact-view .stat-bar-container {
        height: 4px;
    }

    /* Tooltips */
    .tooltip .tooltip-text {
        font-size: 0.7rem;
        width: 150px;
    }

    /* Hero role and tier badges */
    .hero-role,
    .hero-tier {
        padding: 0.2rem 0.4rem;
        font-size: 0.5rem;
    }
    
    /* Hero name adjustments */
    .hero-name {
        font-size: 0.9rem;
        gap: 0.2rem;
    }

    /* Item cards */
    .item-card {
        padding: 0.8rem;
    }

    .item-name {
        font-size: 1rem;
    }

    .item-image {
        width: 40px;
        height: 40px;
    }

    /* Loading spinner */
    .spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }

    .loading-text {
        font-size: 1.2rem;
    }
}