html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1E3C72 0%, #2A5298 100%);
    min-height: 100vh;
    color: #333;
}

body.flipped {
    transform: rotate(180deg);
    transition: transform 0.6s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* XP SECTION */
#xp-container {
    position: fixed;
    bottom: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 10px 15px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 200px;
    z-index: 999;
}

#xp-bar {
    background: #e2e8f0;
    height: 8px;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
}

#xp-fill {
    background: linear-gradient(90deg, #38bdf8, #0ea5e9);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

/* Header Section */
.header {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.profile-pic {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.header-info {
    flex: 1;
}

.header-info h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.header-info .title {
    font-size: 1.2rem;
    color: #667eea;
    margin-bottom: 1rem;
    font-weight: 500;
}

.contact-info {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4a5568;
    font-size: 0.95rem;
}

.contact-item svg {
    width: 18px;
    height: 18px;
}

.contact-item span,
.contact-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.contact-item a {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Navigation Breadcrumb */
.breadcrumb {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #4a5568;
    cursor: pointer;
    transition: color 0.2s;
}

.breadcrumb-item:hover {
    color: #667eea;
}

.breadcrumb-separator {
    color: #a0aec0;
}

/* Content Area */
.content-area {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

/* Folders Grid */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2rem;
    animation: fadeIn 0.4s ease;
}

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

.folder {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.folder:hover {
    background: #edf2f7;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.folder-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.folder:hover .folder-icon {
    transform: scale(1.1);
}

.folder-name {
    font-weight: 600;
    color: #2d3748;
    text-align: center;
    font-size: 1rem;
}

/* Folder Content */
.folder-content {
    animation: none !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
    position: relative !important;
}

.folder-content h2 {
    color: #2d3748;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #667eea;
}

.folder-content p {
    line-height: 1.8;
    color: #4a5568;
    margin-bottom: 1rem;
}

.folders-grid, .project-card {
    pointer-events: auto;
}

.project-card {
    display: block;
    text-decoration: none;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    isolation: isolate;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(30, 22, 22, 0.1);
    z-index: 2;
}

.project-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    margin-bottom: 10px;
    display: block;
}

.project-card h3 {
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.tag {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #667eea;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: #5568d3;
    transform: translateX(-3px);
}

/* Secret Button */
.secret-button {
    position: fixed;
    bottom: 5px;
    right: 10px;
    background: #dc2626;
    color: white;
    border: none;
    padding: 2px 6px;
    font-size: 8px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.secret-button:hover {
    opacity: 1;
}

/* Inverted Page Mode */
body.inverted {
    filter: invert(1) hue-rotate(180deg);
    transition: filter 0.5s ease;
}

.xp-toast {
    position: fixed;
    bottom: 80px;
    left: 30px;
    background: #38bdf8;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    animation: xpPop 1.2s ease forwards;
}

@keyframes xpPop {
    0% { opacity: 0; transform: translateY(10px); }
    20% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* ========== MOBILE STYLES ========== */
@media screen and (max-width: 768px) {
    /* Force everything to stay within viewport */
    body {
        overflow-x: hidden;
        width: 100vw;
    }

    /* Container padding */
    .container {
        padding: 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Header Section - Stack vertically on mobile */
    .header {
        flex-direction: column;
        padding: 1rem;
        text-align: center;
        gap: 0.75rem;
        overflow: hidden;
        max-width: 100%;
        box-sizing: border-box;
    }

    .profile-pic {
        width: 70px;
        height: 70px;
    }

    .header-info {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 0;
    }

    .header-info h1 {
        font-size: 1.25rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.2;
        margin-bottom: 0.25rem;
    }

    .header-info .title {
        font-size: 0.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
        padding: 0;
        margin-bottom: 0.5rem;
    }

    /* Contact info - stack vertically with abbreviated labels */
    .contact-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    .contact-item {
        font-size: 0.7rem;
        justify-content: flex-start;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 0.25rem;
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }

    .contact-item svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    /* Hide full text, show only icons and short labels on mobile */
    .contact-item span,
    .contact-item .contact-text {
        display: none;
    }

    /* Show abbreviated versions for mobile */
    .contact-item:nth-child(1)::after {
        content: "Email";
        font-size: 0.75rem;
        color: #4a5568;
    }

    .contact-item:nth-child(2)::after {
        content: "LinkedIn";
        font-size: 0.75rem;
        color: #4a5568;
    }

    .contact-item:nth-child(3)::after {
        content: "GitHub";
        font-size: 0.75rem;
        color: #4a5568;
    }

    .contact-item:nth-child(4)::after {
        content: "San Diego, CA";
        font-size: 0.75rem;
        color: #4a5568;
    }

    /* Breadcrumb */
    .breadcrumb {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Content Area */
    .content-area {
        padding: 1rem;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Folders Grid - 2 columns on mobile */
    .folders-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .folder {
        padding: 1rem;
    }

    .folder-icon {
        width: 50px;
        height: 50px;
    }

    .folder-name {
        font-size: 0.85rem;
    }

    /* Folder Content */
    .folder-content {
        max-width: 100%;
        overflow-x: hidden;
    }

    .folder-content h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        word-wrap: break-word;
    }

    .folder-content p {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Images in content - make them responsive */
    .folder-content img {
        max-width: 100% !important;
        height: auto !important;
        width: 100% !important;
        border-radius: 10px;
    }

    /* Project Cards */
    .project-card {
        padding: 1rem;
        margin-bottom: 1rem;
        max-width: 100%;
        overflow: hidden;
        word-wrap: break-word;
    }

    .project-card h3 {
        font-size: 1rem;
        word-wrap: break-word;
    }

    .project-card p {
        font-size: 0.85rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Project Tags */
    .project-tags {
        gap: 0.3rem;
        flex-wrap: wrap;
    }

    .tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    /* Back Button */
    .back-button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* XP Container */
    #xp-container {
        bottom: 10px;
        left: 10px;
        width: 140px;
        padding: 6px 10px;
        font-size: 11px;
    }

    #xp-label {
        font-size: 11px;
    }

    /* Secret Button - make it smaller */
    .secret-button {
        padding: 3px 8px;
        font-size: 7px;
        bottom: 10px;
        right: 10px;
    }
}

/* Very small screens (phones in portrait) */
@media screen and (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }

    .header {
        padding: 0.75rem 0.5rem;
    }

    .profile-pic {
        width: 60px;
        height: 60px;
    }

    .header-info h1 {
        font-size: 1.1rem;
        line-height: 1.1;
    }

    .header-info .title {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .contact-item {
        font-size: 0.65rem;
    }

    .contact-item svg {
        width: 14px;
        height: 14px;
    }

    .contact-item::after {
        font-size: 0.7rem !important;
    }

    /* Single column folders on very small screens */
    .folders-grid {
        grid-template-columns: 1fr;
    }

    .folder-content h2 {
        font-size: 1.1rem;
    }

    /* Make lists in experience section more readable */
    .project-card ul {
        padding-left: 1rem;
    }

    .project-card li {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
        word-wrap: break-word;
    }
}

/* Landscape phones */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .folders-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .header-info .title {
        font-size: 0.8rem;
    }
}