/* ===== CSS Variables ===== */
:root {
    --primary-coral: #FF6B6B;
    --primary-teal: #4ECDC4;
    --primary-blue: #45B7D1;
    --accent-gold: #FFE66D;
    --accent-purple: #A06CD5;
    
    --bg-dark: #0D1117;
    --bg-card: #161B22;
    --bg-elevated: #21262D;
    
    --text-primary: #F0F6FC;
    --text-secondary: #8B949E;
    --text-muted: #484F58;
    
    --gradient-main: linear-gradient(135deg, var(--primary-coral) 0%, var(--primary-teal) 50%, var(--primary-blue) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-purple) 0%, var(--primary-coral) 100%);
    
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(78, 205, 196, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===== Screen Transitions ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* ===== Upload Screen ===== */
#upload-screen {
    background: var(--bg-dark);
    overflow: hidden;
}

.background-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 107, 107, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(78, 205, 196, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(69, 183, 209, 0.05) 0%, transparent 60%);
    animation: patternFloat 20s ease-in-out infinite;
}

@keyframes patternFloat {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

.upload-container {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px;
    animation: fadeInUp 0.8s ease-out;
}

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

/* ===== Logo ===== */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    animation: logoFloat 3s ease-in-out infinite;
}

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

.logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
}

.logo h1 span {
    font-size: 2.5rem;
    opacity: 0.8;
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 48px;
    font-weight: 300;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* ===== Drop Zone ===== */
.drop-zone {
    position: relative;
    width: 500px;
    max-width: 90vw;
    height: 280px;
    border: 2px dashed var(--text-muted);
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition-smooth);
    overflow: hidden;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.drop-zone:hover {
    border-color: var(--primary-teal);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-glow);
    transform: translateY(-4px);
}

.drop-zone.drag-over {
    border-color: var(--primary-coral);
    background: rgba(255, 107, 107, 0.1);
    transform: scale(1.02);
}

.drop-zone-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.drop-zone.drag-over .drop-zone-content {
    opacity: 0;
    transform: scale(0.9);
}

.upload-icon {
    width: 64px;
    height: 64px;
    fill: var(--text-muted);
    margin-bottom: 20px;
    transition: var(--transition-smooth);
}

.drop-zone:hover .upload-icon {
    fill: var(--primary-teal);
    transform: translateY(-8px);
}

.drop-text {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.drop-subtext {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.drop-zone-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(1.1);
    transition: var(--transition-smooth);
}

.drop-zone.drag-over .drop-zone-hover {
    opacity: 1;
    transform: scale(1);
}

.drop-zone-hover svg {
    width: 72px;
    height: 72px;
    fill: var(--primary-coral);
    margin-bottom: 16px;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.drop-zone-hover p {
    font-size: 1.25rem;
    color: var(--primary-coral);
    font-weight: 500;
}

/* ===== Features ===== */
.features {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 48px;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.feature:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
    transform: translateY(-2px);
}

.feature svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* ===== Loading Screen ===== */
#loading-screen {
    background: var(--bg-dark);
}

.loading-container {
    text-align: center;
}

.loading-spinner {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 32px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--primary-coral);
    animation: spin 1.2s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-right-color: var(--primary-teal);
    animation: spin 1.5s linear infinite reverse;
}

.spinner-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-bottom-color: var(--primary-blue);
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.progress-bar {
    width: 300px;
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    margin: 0 auto 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-main);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== Presentation Screen ===== */
#presentation-screen {
    background: #000;
    flex-direction: column;
}

.presentation-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#presentation-screen:hover .presentation-header,
#presentation-screen.controls-visible .presentation-header {
    opacity: 1;
}

.header-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.header-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.header-controls {
    display: flex;
    gap: 12px;
}

.page-indicator {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: white;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.page-indicator .separator {
    color: var(--text-muted);
    font-size: 1.2rem;
}

#total-pages {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* ===== Slides Container ===== */
.slides-container {
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
}

.slide canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.slide.active canvas {
    animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== Navigation Controls ===== */
.nav-controls {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
}

#presentation-screen:hover .nav-controls,
#presentation-screen.controls-visible .nav-controls {
    opacity: 1;
}

.nav-btn {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* ===== Slide Dots ===== */
.slide-dots {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
    max-width: 80vw;
    overflow-x: auto;
}

.slide-dots::-webkit-scrollbar {
    display: none;
}

#presentation-screen:hover .slide-dots,
#presentation-screen.controls-visible .slide-dots {
    opacity: 1;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

.dot.active {
    background: var(--primary-teal);
    box-shadow: 0 0 10px var(--primary-teal);
    transform: scale(1.2);
}

/* ===== Grid View ===== */
.grid-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 200;
    overflow-y: auto;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.grid-view.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.grid-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 40px;
    background: linear-gradient(to bottom, var(--bg-dark), transparent);
    z-index: 10;
}

.grid-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-grid {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.close-grid:hover {
    background: var(--primary-coral);
}

.close-grid svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 24px 40px 60px;
}

.grid-item {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-smooth);
    aspect-ratio: 16/9;
}

.grid-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-glow);
}

.grid-item canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.grid-item-number {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    font-size: 0.85rem;
    color: white;
}

/* ===== Fullscreen Styles ===== */
:fullscreen {
    background: #000;
}

:fullscreen .slide {
    padding: 40px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .logo-icon {
        width: 60px;
        height: 60px;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .drop-zone {
        width: 100%;
        height: 220px;
    }
    
    .features {
        flex-direction: column;
        gap: 12px;
    }
    
    .feature {
        justify-content: center;
    }
    
    .slide {
        padding: 20px;
    }
    
    .nav-btn {
        width: 48px;
        height: 48px;
    }
    
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
        padding: 16px 20px;
    }
    
    .grid-header {
        padding: 16px 20px;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== Selection ===== */
::selection {
    background: var(--primary-teal);
    color: var(--bg-dark);
}

