* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --accent-blue: #58a6ff;
    --accent-blue-hover: #79c0ff;
    --accent-purple: #bc8cff;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --border-color: #30363d;
    --success: #3fb950;
    --error: #f85149;
    --warning: #d29922;
    --glass-bg: rgba(22, 27, 34, 0.6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0d1117 0%, #1a1f2e 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(88, 166, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(188, 140, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to   { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 300;
}

.search-container {
    max-width: 700px;
    margin: 0 auto 3rem;
    animation: fadeInUp 0.8s ease 0.2s both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.search-form {
    display: flex;
    gap: 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 0.75rem;
    border-radius: 16px;
    border: 1px solid rgba(88, 166, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.search-form:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 8px 32px rgba(88, 166, 255, 0.2);
}

.search-input {
    flex: 1;
    background: rgba(33, 38, 45, 0.8);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.search-btn::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 ease;
}

.search-btn:hover::before { left: 100%; }
.search-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(88, 166, 255, 0.4); }
.search-btn:active { transform: translateY(0); }
.search-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.controls-bar {
    display: none;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.controls-bar.active { display: flex; }

.filter-input {
    flex: 1;
    min-width: 250px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.sort-dropdown {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sort-dropdown:hover { border-color: var(--accent-blue); }
.sort-dropdown:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1); }

.profile-section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(88, 166, 255, 0.2);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.profile-section.active { display: block; }

.profile-header {
    display: flex;
    gap: 2.5rem;
    align-items: start;
    flex-wrap: wrap;
}

.profile-avatar-container { position: relative; }

.profile-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 4px solid var(--accent-blue);
    box-shadow: 0 12px 40px rgba(88, 166, 255, 0.3);
    transition: all 0.4s ease;
    cursor: pointer;
    display: block;
}

.profile-avatar:hover {
    transform: scale(1.05) rotate(5deg);
    box-shadow: 0 16px 48px rgba(88, 166, 255, 0.5);
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-username {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.profile-bio {
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 1.05rem;
}

.profile-location {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.stat {
    text-align: center;
    padding: 1.25rem;
    background: rgba(33, 38, 45, 0.5);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat:hover {
    border-color: var(--accent-blue);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(88, 166, 255, 0.2);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.github-link::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.5s ease;
}

.github-link:hover::before { left: 100%; }
.github-link:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(88, 166, 255, 0.4); }

.repos-section {
    display: none;
    animation: fadeInUp 0.8s ease;
}

.repos-section.active { display: block; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.repo-count-badge {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.repos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

.repo-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(88, 166, 255, 0.15);
    border-radius: 20px;
    padding: 1.75rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.repo-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.05), rgba(188, 140, 255, 0.05));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.repo-card:hover::before { opacity: 1; }
.repo-card:hover { border-color: var(--accent-blue); transform: translateY(-8px); box-shadow: 0 16px 48px rgba(88, 166, 255, 0.2); }

.repo-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.repo-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-blue);
    flex: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.repo-name:hover { color: var(--accent-purple); text-decoration: underline; }

.repo-link {
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 8px;
}

.repo-link:hover { color: var(--accent-blue); background: rgba(88, 166, 255, 0.1); transform: scale(1.1) rotate(12deg); }

.repo-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    flex: 1;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.repo-language-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.repo-language-tag:hover { background: rgba(88, 166, 255, 0.2); transform: scale(1.05); }

.repo-meta {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.meta-item { display: flex; align-items: center; gap: 0.4rem; transition: all 0.3s ease; }
.meta-item:hover { color: var(--accent-blue); }

.language-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }

.updated-date { margin-left: auto; font-size: 0.8rem; }

.repo-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.topic-tag {
    display: inline-block;
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.2);
    color: var(--accent-blue);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.topic-tag:hover { background: rgba(88, 166, 255, 0.15); border-color: var(--accent-blue); transform: scale(1.05); }

.repo-size { color: var(--text-secondary); font-size: 0.8rem; margin-top: 0.5rem; display: flex; align-items: center; gap: 0.25rem; }

.loading { display: none; text-align: center; padding: 4rem 2rem; }
.loading.active { display: block; }

.spinner {
    border: 4px solid rgba(88, 166, 255, 0.2);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    width: 60px; height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text { font-size: 1.125rem; color: var(--text-secondary); font-weight: 500; }

.error-message {
    display: none;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--error);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    color: var(--error);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-10px); }
    75%       { transform: translateX(10px); }
}

.error-message.active { display: block; }
.error-icon { font-size: 3rem; margin-bottom: 1rem; }

.github-icon { width: 20px; height: 20px; fill: currentColor; transition: all 0.3s ease; }
.icon-lg { width: 24px; height: 24px; }

.no-results { text-align: center; padding: 3rem; color: var(--text-secondary); font-size: 1.125rem; }

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-blue); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue-hover); }

/* ================================================================
   RESPONSIVE — these are the ONLY changes from the original
   ================================================================ */

/* Tablet: ≤ 900px */
@media (max-width: 900px) {
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .repos-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* Mobile: ≤ 640px */
@media (max-width: 640px) {
    .container {
        padding: 1.25rem 0.875rem;
    }

    h1 {
        font-size: clamp(1.75rem, 7vw, 2.5rem);
    }

    .subtitle {
        font-size: 1rem;
    }

    /* Search stacks vertically */
    .search-form {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    /* Profile stacks and centers */
    .profile-section {
        padding: 1.5rem;
    }

    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
    }

    .profile-info {
        min-width: 0;
        width: 100%;
    }

    .profile-avatar {
        width: 130px;
        height: 130px;
    }

    .profile-name {
        font-size: 1.75rem;
    }

    .profile-username {
        font-size: 1rem;
    }

    .profile-location {
        justify-content: center;
    }

    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin: 1.25rem 0;
    }

    .stat {
        padding: 1rem 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .github-link {
        width: 100%;
        justify-content: center;
    }

    /* Controls stack */
    .controls-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-input {
        min-width: 0;
        width: 100%;
    }

    .sort-dropdown {
        width: 100%;
    }

    /* Section header */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* Single column cards */
    .repos-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .repo-card {
        padding: 1.25rem;
    }
}

/* Very small screens: ≤ 380px */
@media (max-width: 380px) {
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat {
        padding: 0.75rem 0.5rem;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
