* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 24px;
    margin-bottom: 15px;
    font-weight: 600;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 300px;
}

#fileInput {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-label {
    display: block;
    padding: 12px 24px;
    background: white;
    color: #667eea;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.file-label:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pdf-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-container.hidden {
    display: none;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    min-width: 80px;
}

.btn:active {
    transform: scale(0.95);
    background: #5568d3;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.page-info {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    flex: 1;
    text-align: center;
}

.zoom-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    min-width: 44px;
}

.btn-small:active {
    transform: scale(0.95);
    background: #5568d3;
}

.zoom-info {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    min-width: 50px;
    text-align: center;
}

.pdf-viewer {
    flex: 1;
    overflow: auto;
    background: #525252;
    position: relative;
    -webkit-overflow-scrolling: touch;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

#pdfCanvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    background: white;
    display: block;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 10;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.welcome {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    text-align: center;
}

.welcome.hidden {
    display: none;
}

.welcome-content {
    color: #666;
}

.welcome-content p {
    font-size: 18px;
    margin-bottom: 10px;
}

.hint {
    font-size: 14px;
    color: #999;
    margin-top: 10px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    header h1 {
        font-size: 20px;
    }

    .toolbar {
        padding: 12px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
        min-width: 70px;
    }

    .page-info {
        font-size: 13px;
    }

    .zoom-controls {
        padding: 8px 12px;
    }

    .btn-small {
        padding: 6px 12px;
        font-size: 14px;
    }

    .pdf-viewer {
        padding: 10px;
    }
}

/* Prevent text selection on buttons */
.btn, .btn-small, .file-label {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}