html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: #0f172a;
    color: #0f172a;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}
body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
.viewer-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 12px;
    background: #334155;
    position: relative;
    -webkit-overflow-scrolling: touch;
}
.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto;
    padding: 4px;
}
#pdf-canvas {
    display: block;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    z-index: 20;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    background: #0284c7;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
    user-select: none;
}
.toolbar button#previous {
    background: #334155;
    color: #f1f5f9;
    box-shadow: none;
}
.toolbar button#previous:hover:not(:disabled) {
    background: #475569;
}
.toolbar button:hover:not(:disabled) {
    background: #0369a1;
    transform: translateY(-1px);
}
.toolbar button:active:not(:disabled) {
    transform: scale(0.95);
}
.toolbar button:disabled {
    background: #1e293b;
    color: #475569;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.5;
}
.toolbar button .btn-icon {
    width: 16px;
    height: 16px;
}
.toolbar button.btn-reset {
    background: #334155;
    color: #cbd5e1;
    padding: 6px 10px;
    font-size: 11px;
}
.toolbar button.btn-reset:hover:not(:disabled) {
    background: #475569;
    color: #ffffff;
}
.page-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1e293b;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
}
.page-input {
    width: 34px;
    background: #0f172a;
    border: 1px solid #334155;
    color: #38bdf8;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 0;
    outline: none;
}
.page-input:focus {
    border-color: #38bdf8;
    background: #1e293b;
}
/* Hide input number arrows */
.page-input::-webkit-outer-spin-button,
.page-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.page-input[type=number] {
    -moz-appearance: textfield;
}
.zoom-level {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    min-width: 40px;
    text-align: center;
}
@media (max-width: 640px) {
    .toolbar {
        padding: 6px 8px;
        gap: 6px;
    }
    .toolbar button {
        padding: 7px 10px;
        font-size: 12px;
    }
    .btn-label {
        display: inline;
        font-size: 11px;
    }
    .zoom-group {
        gap: 4px;
    }
}