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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000;
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Deck List View */
header {
    text-align: center;
    color: #fff;
    margin-bottom: 40px;
    padding: 40px 20px;
    border-bottom: 1px solid #222;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1rem;
    color: #888;
}

.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

.deck-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 4px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.deck-card:hover {
    background: #1a1a1a;
    border-color: #333;
}

.deck-card h3 {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 8px;
    word-break: break-word;
    font-weight: 500;
}

.deck-card p {
    color: #666;
    font-size: 0.9rem;
}

/* PDF Viewer View */
.viewer-header {
    background: #111;
    border: 1px solid #222;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#current-deck-name {
    color: #fff;
    font-size: 1.3rem;
    flex: 1;
    text-align: center;
    word-break: break-word;
    font-weight: 500;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 400;
    background: #111;
    color: #fff;
}

.btn:hover {
    background: #1a1a1a;
    border-color: #444;
}

.btn-primary {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.btn-primary:hover {
    background: #e5e5e5;
}

.btn-secondary {
    background: #111;
    color: #fff;
}

.btn-icon {
    padding: 10px 15px;
}

.btn-icon:disabled {
    background: #0a0a0a;
    color: #444;
    cursor: not-allowed;
    border-color: #1a1a1a;
}

.page-info {
    font-weight: 500;
    color: #fff;
    min-width: 70px;
    text-align: center;
}

/* PDF Container */
.pdf-container {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 4px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 600px;
    position: relative;
}

.pdf-wrapper {
    position: relative;
    display: inline-block;
}

#pdf-canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.pdf-link-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pdf-link {
    position: absolute;
    cursor: pointer;
    pointer-events: all;
    background: transparent;
    border: none;
}

.pdf-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Fullscreen Slideshow */
.slideshow-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 30px;
    border-radius: 4px;
    z-index: 10000;
    border: 1px solid #333;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.slideshow-controls.visible {
    opacity: 1;
    pointer-events: all;
}

.slideshow-controls.hidden {
    display: none;
}

.slideshow-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.slideshow-btn:hover {
    background: #e5e5e5;
}

.slideshow-btn.exit-btn {
    background: #dc2626;
    color: white;
}

.slideshow-btn.exit-btn:hover {
    background: #b91c1c;
}

.slideshow-page-info {
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 80px;
    text-align: center;
}

/* Fullscreen mode */
body.fullscreen-mode {
    overflow: hidden;
    cursor: none;
}

body.fullscreen-mode.show-cursor {
    cursor: default;
}

body.fullscreen-mode .pdf-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    border-radius: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
}

body.fullscreen-mode #pdf-canvas {
    max-height: 100vh;
    max-width: 100vw;
    object-fit: contain;
}

body.fullscreen-mode .viewer-header {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .deck-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .viewer-header {
        flex-direction: column;
    }

    #current-deck-name {
        font-size: 1.1rem;
    }

    .slideshow-controls {
        bottom: 10px;
        padding: 10px 20px;
    }

    .slideshow-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* Loading State */
.loading {
    text-align: center;
    color: #fff;
    font-size: 1.2rem;
    padding: 40px;
}

.error {
    background: #1a0000;
    color: #ff4444;
    padding: 20px;
    border-radius: 4px;
    text-align: center;
    margin: 20px;
    border: 1px solid #330000;
}
