/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #9b2948 0%, #ff7251 100%);
}

/* ==================== CANVAS ==================== */
canvas {
    position: absolute;
    z-index: 1 !important;
    pointer-events: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

/* ==================== UI ELEMENTS ==================== */
#hint, #controls, #loading, #section-info {
    position: fixed !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
}

#hint {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffedbf;
    background: rgba(155, 41, 72, 0.85);
    padding: 10px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 237, 191, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

#controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: #ffedbf;
    z-index: 100;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ==================== DOWNLOAD BUTTON (IN PANEL) ==================== */
.download-resume-btn {
    display: inline-block;
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff7251 0%, #ff5251 100%);
    color: #ffedbf;
    border: 2px solid rgba(255, 237, 191, 0.3);
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 114, 81, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    margin-top: 15px;
}

.download-resume-btn:hover {
    background: linear-gradient(135deg, #ff5251 0%, #ff3251 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 114, 81, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: #ffedbf !important;
    border-bottom: none !important;
}

.download-resume-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 114, 81, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ==================== LOADING SCREEN ==================== */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #9b2948 0%, #ff7251 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ffedbf;
    font-size: 24px;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 237, 191, 0.3);
    border-radius: 50%;
    border-top-color: #ffcd74;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== INTERACTION INDICATOR ==================== */
#interaction-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffedbf;
    background: rgba(155, 41, 72, 0.95);
    padding: 15px 30px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 205, 116, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 20px rgba(255, 205, 116, 0.3);
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    z-index: 200;
    animation: indicatorPulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

#interaction-indicator strong {
    color: #ffcd74;
    font-size: 22px;
    padding: 2px 8px;
    background: rgba(255, 205, 116, 0.2);
    border-radius: 6px;
    margin: 0 4px;
}

@keyframes indicatorPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                    0 0 20px rgba(255, 205, 116, 0.3);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                    0 0 40px rgba(255, 205, 116, 0.5);
    }
}

/* ==================== SECTION INFO PANEL ==================== */
#section-info {
    position: fixed;
    top: 20px;
    right: -400px;
    left: auto; /* Ensure left is auto by default */
    width: 350px;
    color: #ffedbf;
    background: rgba(155, 41, 72, 0.98);
    padding: 20px;
    border-radius: 12px;
    z-index: 9999;
    max-height: 80vh;
    overflow-y: auto;
    display: block;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 237, 191, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: none; /* Disable CSS transition, using JS animation */
    opacity: 1;
    pointer-events: auto;
    transform: none; /* Ensure no transform by default */
}

#section-info.panel-show {
    right: 20px;
    left: auto; /* Ensure left is auto when showing */
    top: 20px;
    transform: none;
    opacity: 1;
}

/* Panel fly-in animation state */
#section-info.panel-flying {
    transition: none;
    pointer-events: none;
}

#section-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#section-content > * {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.section-content-animate > * {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.section-content-animate > *:nth-child(1) { animation-delay: 0.1s; }
.section-content-animate > *:nth-child(2) { animation-delay: 0.2s; }
.section-content-animate > *:nth-child(3) { animation-delay: 0.3s; }
.section-content-animate > *:nth-child(4) { animation-delay: 0.4s; }
.section-content-animate > *:nth-child(5) { animation-delay: 0.5s; }
.section-content-animate > *:nth-child(6) { animation-delay: 0.6s; }
.section-content-animate > *:nth-child(7) { animation-delay: 0.7s; }
.section-content-animate > *:nth-child(8) { animation-delay: 0.8s; }
.section-content-animate > *:nth-child(9) { animation-delay: 0.9s; }
.section-content-animate > *:nth-child(10) { animation-delay: 1.0s; }

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

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(155, 41, 72, 0.9);
    border: 2px solid #ffedbf;
    color: #ffedbf;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.close-btn:hover {
    background: #ff7251;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(255, 114, 81, 0.5);
}

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

/* ==================== SECTION CONTENT STYLES ==================== */
.section-title {
    color: #ffcd74;
    margin-bottom: 15px;
    font-size: 1.6em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.project-item {
    background: rgba(255, 114, 81, 0.4);
    padding: 12px 15px;
    margin: 12px 0;
    border-radius: 8px;
    border-left: 4px solid #ffcd74;
    transition: transform 0.3s ease, background 0.3s ease;
}

.project-item:hover {
    background: rgba(255, 114, 81, 0.6);
    transform: translateX(5px);
}

.project-item h4 {
    color: #ffedbf;
    margin-bottom: 5px;
}

.project-item p {
    color: #ffca7b;
    font-size: 0.95em;
    margin-bottom: 5px;
}

.project-item small {
    color: rgba(255, 237, 191, 0.7);
    font-size: 0.85em;
}

.contact-info {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 8px;
    background: rgba(255, 114, 81, 0.3);
    border-radius: 6px;
}

.contact-icon {
    font-size: 20px;
    margin-right: 10px;
    width: 30px;
    text-align: center;
}

.contact-detail {
    flex: 1;
}

.section-info a:hover {
    color: #ffedbf !important;
    border-bottom: 1px solid #ffedbf !important;
    transition: all 0.2s ease;
}

.skill-category {
    margin-bottom: 15px;
}

.skill-category h4 {
    color: #ffcd74;
    margin-bottom: 8px;
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-tag {
    background: rgba(255, 114, 81, 0.4);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9em;
    border: 1px solid rgba(255, 237, 191, 0.2);
}

.profile-photo {
    width: 100%;
    max-width: 250px;
    border-radius: 10px;
    margin: 15px auto;
    display: block;
    border: 3px solid #ffcd74;
}

/* ==================== MOBILE SECTION BUTTON ==================== */
#mobile-section-btn {
    position: fixed;
    bottom: 140px;
    right: 50%;
    transform: translateX(50%) translateY(50px);
    z-index: 150;
    padding: 15px 30px;
    background: linear-gradient(135deg, #ff7251 0%, #9b2948 100%);
    border: 3px solid #ffedbf;
    border-radius: 25px;
    color: #ffedbf;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(155, 41, 72, 0.5),
                inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    opacity: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#mobile-section-btn.show {
    transform: translateX(50%) translateY(0);
    pointer-events: auto;
    opacity: 1;
}

#mobile-section-btn:active {
    transform: translateX(50%) translateY(0) scale(0.95);
    box-shadow: 0 2px 10px rgba(155, 41, 72, 0.3),
                inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

#mobile-section-btn::before {
    content: '👆';
    margin-right: 8px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* ==================== MOBILE CIRCULAR CONTROLS (SMASH BANDITS STYLE) ==================== */
#mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    pointer-events: none;
    display: none;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 1px;
}

#circular-control-container {
    position: relative;
    pointer-events: auto;
    touch-action: none;
}

.control-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    background: transparent;
    border: 1px solid rgba(255, 237, 191, 0.2);
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    transform: scale(0.7);
}

.control-ring.active {
    border-color: rgba(255, 205, 116, 0.4);
    box-shadow: none;
}

.control-ring::after {
    content: '';
    position: absolute;
    width: var(--track-diameter, 80%);
    height: var(--track-diameter, 80%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px dashed rgba(255, 237, 191, 0.15);
    pointer-events: none;
}

.control-ring.active::after {
    border-color: rgba(255, 205, 116, 0.25);
}

.control-ring-inner {
    position: absolute;
    display: none;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: 1px solid rgba(255, 237, 191, 0.15);
    box-shadow: none;
    pointer-events: none;
}

.control-thumb {
    width: 55px;
    height: 55px;
    background: transparent;
    border: 0 solid #ffedbf;
    opacity: 70%;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: grab;
    z-index: 10;
    touch-action: none;
}

.control-thumb::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: radial-gradient(circle at 50% 50%,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    top: 6px;
    left: 8px;
}

.control-thumb.active {
    cursor: grabbing;
    border-color: #ffffff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.6),
                inset 0 2px 4px rgba(255, 255, 255, 0.5),
                0 0 40px rgba(255, 205, 116, 0.7),
                0 0 80px rgba(255, 205, 116, 0.3);
}

.direction-indicator {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.control-ring::before {
    display: none;
}

/* ==================== MOBILE RESPONSIVE ==================== */
@media (max-width: 768px) {
    #interaction-indicator {
        display: none !important; /* Hide on mobile, use button instead */
    }

    #section-info {
        width: 90%;
        max-width: 350px;
        right: -100%;
        top: 10px;
        max-height: 70vh;
        font-size: 14px;
    }

    #mobile-section-btn {
        bottom: 120px;
        padding: 12px 25px;
        font-size: 14px;
    }

    #section-info.panel_show {
        right: 5%;
    }

    .section-title {
        font-size: 1.3em;
    }

    .project-item {
        padding: 10px 12px;
        font-size: 0.9em;
    }

    #hint {
        font-size: 14px;
        padding: 8px 15px;
        top: 10px;
    }

    #controls {
        display: none;
    }

    .close-btn {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .download-resume-btn {
        font-size: 14px;
        padding: 10px 20px;
    }

    #mobile-controls {
        padding-bottom: 5px;
    }
}

@media (max-width: 480px) {
    #mobile-section-btn {
        bottom: 100px;
        padding: 10px 20px;
        font-size: 13px;
        border-width: 2px;
    }

    #mobile-controls {
        padding-bottom: 0px;
    }
    
    .control-ring {
        border-width: 2px;
    }
    
    .control-thumb {
        border-width: 3px;
    }
}

/* Prevent text selection on mobile */
@media (hover: none) and (pointer: coarse) {
    body {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
}