* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(25, 118, 210, 0.15);
}

button, a {
    outline: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
    .icon-btn:active {
        transform: scale(0.92);
        opacity: 0.8;
    }

    .nav-buttons button:active {
        transform: scale(0.95);
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #ffffff;
}

.main-wrapper {
    display: flex;
    flex: 1;
    margin-top: 56px;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #ffffff;
    color: #333;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    z-index: 100;
}

/* Desktop sidebar collapse */
@media (min-width: 769px) {
    .sidebar.collapsed { margin-left: -260px; }
}

.sidebar-header {
    padding: 16px 20px;
    background: #f5f5f5;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-section {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}

.nav-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}

.nav-list::-webkit-scrollbar { width: 4px; }
.nav-list::-webkit-scrollbar-track { background: transparent; }
.nav-list::-webkit-scrollbar-thumb { background: #90CAF9; border-radius: 2px; }

.nav-list li { margin: 2px 10px; }

.nav-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: #555;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 450;
}

.nav-list a:hover {
    background: #E3F2FD;
    color: #1976D2;
}

.nav-list a.active {
    background: #1976D2;
    color: #ffffff;
    font-weight: 500;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.2);
}

.nav-list a:active {
    transform: scale(0.98);
    background: #BBDEFB;
}

.nav-list a.active:active {
    background: #1565C0;
}

.nav-list a .material-icons {
    font-size: 16px;
    color: #FFD700;
}

.nav-list a.active .material-icons {
    color: #FFD700;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    min-width: 0;
}

.top-header {
    padding: 10px 16px;
    background: #1976D2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.top-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    text-decoration: none;
}

.icon-btn:hover { background: rgba(255,255,255,0.25); }
.icon-btn .material-icons { font-size: 20px; }
.icon-btn.active { background: rgba(255,255,255,0.35); }
.icon-btn.bookmark-active .material-icons { color: #FFD700; }

.slide-info {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    padding: 0 8px;
}

.clock {
    font-size: 0.9rem;
    color: #ffffff;
    font-weight: 500;
    padding: 6px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    font-family: 'Segoe UI', monospace;
    letter-spacing: 0.5px;
}

.nav-buttons {
    display: flex;
    gap: 6px;
}

.nav-buttons button {
    padding: 6px 14px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-buttons button:hover { background: rgba(255,255,255,0.3); }
.nav-buttons button:disabled {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    cursor: not-allowed;
}

.frame-container {
    flex: 1;
    background: #f8f9fa;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.frame-wrapper {
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.frame-wrapper.scroll-enabled::-webkit-scrollbar { width: 6px; height: 6px; }
.frame-wrapper.scroll-enabled::-webkit-scrollbar-track { background: #f1f1f1; }
.frame-wrapper.scroll-enabled::-webkit-scrollbar-thumb { background: #1976D2; border-radius: 3px; }

.slide-frame {
    border: none;
    width: 1280px;
    height: 720px;
    background: #ffffff;
    transform-origin: top left;
    display: block;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    padding: 4px 8px;
    border-radius: 6px;
}

.zoom-controls button {
    width: 26px;
    height: 26px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-controls button:hover { background: rgba(255,255,255,0.35); }

.zoom-level {
    font-size: 0.75rem;
    color: #ffffff;
    min-width: 40px;
    text-align: center;
    font-weight: 500;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

.modal-close {
    width: 32px; height: 32px;
    border: none;
    background: #f5f5f5;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { background: #e0e0e0; }

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb { background: #1976D2; border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: #1565C0; }

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    padding: 10px 12px;
    background: #e3f2fd;
    border-radius: 8px;
    margin-bottom: 4px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.select-all-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #1976D2;
    cursor: pointer;
}

.select-all-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1976D2;
}

.select-all-group .material-icons {
    font-size: 16px;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f9f9f9;
    border-radius: 8px;
}

.setting-item .slide-num {
    min-width: 60px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.setting-item .controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #666;
    cursor: pointer;
}

.setting-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1976D2;
}

.setting-item .bookmark-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.setting-item .bookmark-btn.bookmarked {
    background: #FFF3CD;
    color: #856404;
}

.setting-item .bookmark-btn:not(.bookmarked) {
    background: #e0e0e0;
    color: #666;
}

.setting-item .bookmark-btn .material-icons {
    font-size: 14px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-footer button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

.btn-cancel { background: #f5f5f5; color: #666; }
.btn-cancel:hover { background: #e0e0e0; }
.btn-save { background: #1976D2; color: #fff; }
.btn-save:hover { background: #1565C0; }

/* Admin indicator */
.admin-badge {
    background: #4CAF50;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-top: 16px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1976D2, #42A5F5);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Search box in sidebar */
.sidebar-search {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.sidebar-search input:focus {
    border-color: #1976D2;
}

.sidebar-search input::placeholder {
    color: #999;
}

/* Jump to slide input */
.jump-to-slide {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    padding: 4px 8px;
    border-radius: 6px;
}

.jump-to-slide input {
    width: 40px;
    padding: 4px 6px;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    text-align: center;
    background: rgba(255,255,255,0.9);
    color: #333;
}

.jump-to-slide input:focus {
    outline: 2px solid rgba(255,255,255,0.5);
}

.jump-to-slide span {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
}

/* Autoplay controls */
.autoplay-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.autoplay-controls select {
    padding: 4px 6px;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.9);
    color: #333;
    cursor: pointer;
}

.icon-btn.playing {
    background: rgba(76, 175, 80, 0.8);
}

.icon-btn.playing:hover {
    background: rgba(76, 175, 80, 0.9);
}

/* Fullscreen styles */
:fullscreen,
:-webkit-full-screen {
    background: #1a1a1a;
}

:fullscreen .frame-container,
:-webkit-full-screen .frame-container {
    background: #1a1a1a;
}

:fullscreen .frame-wrapper,
:-webkit-full-screen .frame-wrapper {
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}

:fullscreen .sidebar,
:-webkit-full-screen .sidebar {
    display: none;
}

:fullscreen .sidebar.collapsed,
:-webkit-full-screen .sidebar.collapsed {
    display: none;
}

/* Nav item hidden by search */
.nav-list li.hidden {
    display: none;
}

/* Drawing Canvas Overlay */
.drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 50;
    display: none;
}

.drawing-canvas.active {
    display: block;
}

/* Keyboard capture overlay - prevents iframe from stealing focus */
.keyboard-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 40;
    cursor: default;
}

.keyboard-overlay.hidden {
    display: none;
}

/* Hide overlays in full page mode to allow interaction with iframe content */
.frame-wrapper.full-page-mode .keyboard-overlay,
.frame-wrapper.full-page-mode .drawing-canvas,
.frame-wrapper.full-page-mode .laser-overlay {
    display: none !important;
    pointer-events: none;
}

/* Laser Pointer */
.laser-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 60;
    display: none;
    cursor: none;
}

.laser-overlay.active {
    display: block;
}

.laser-pointer {
    position: fixed;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,0,0,1) 0%, rgba(255,0,0,0.8) 30%, rgba(255,0,0,0) 70%);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px 8px rgba(255,0,0,0.6);
    will-change: left, top;
}

.laser-pointer.active {
    opacity: 1;
}

/* Drawing Toolbar */
.drawing-toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 12px;
    padding: 8px 12px;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 250;
}

.drawing-toolbar.active {
    display: flex;
}

.drawing-toolbar button {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.drawing-toolbar button:hover {
    background: #e0e0e0;
}

.drawing-toolbar button.active {
    background: #1976D2;
    color: #fff;
}

.drawing-toolbar button .material-icons {
    font-size: 20px;
}

.drawing-toolbar .color-picker {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
}

.drawing-toolbar .separator {
    width: 1px;
    height: 24px;
    background: #ddd;
    margin: 0 4px;
}

.drawing-toolbar .stroke-width {
    width: 60px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 8px;
    font-size: 0.85rem;
}

.icon-btn.tool-active {
    background: rgba(255, 193, 7, 0.8);
}

.icon-btn.tool-active:hover {
    background: rgba(255, 193, 7, 0.9);
}

/* Share Modal */
.share-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 400;
    align-items: center;
    justify-content: center;
}

.share-modal.active {
    display: flex;
}

.share-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.share-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.share-header h2 {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-header h2 .material-icons {
    color: #1976D2;
}

.share-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.share-body::-webkit-scrollbar { width: 6px; }
.share-body::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
.share-body::-webkit-scrollbar-thumb { background: #1976D2; border-radius: 3px; }
.share-body::-webkit-scrollbar-thumb:hover { background: #1565C0; }

.share-section {
    margin-bottom: 24px;
}

.share-section:last-child {
    margin-bottom: 0;
}

.share-section h3 {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.share-section h3 .material-icons {
    font-size: 18px;
    color: #1976D2;
}

.share-input-group {
    display: flex;
    gap: 8px;
}

.share-input-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: monospace;
    background: #f9f9f9;
}

.share-input-group textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: monospace;
    background: #f9f9f9;
    min-height: 80px;
    resize: vertical;
}

.share-input-group button {
    padding: 10px 16px;
    border: none;
    background: #1976D2;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.share-input-group button:hover {
    background: #1565C0;
}

.share-input-group button .material-icons {
    font-size: 18px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.share-btn {
    padding: 10px 16px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.share-btn:hover {
    border-color: #1976D2;
    color: #1976D2;
}

.share-btn .material-icons {
    font-size: 18px;
}

.copy-success {
    color: #4CAF50;
    font-size: 0.8rem;
    margin-top: 6px;
    display: none;
}

.copy-success.show {
    display: block;
}

/* Help Modal */
.help-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 400;
    align-items: center;
    justify-content: center;
}

.help-modal.active {
    display: flex;
}

.help-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.help-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.help-header h2 {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-header h2 .material-icons {
    color: #1976D2;
}

.help-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.help-body::-webkit-scrollbar { width: 6px; }
.help-body::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
.help-body::-webkit-scrollbar-thumb { background: #1976D2; border-radius: 3px; }
.help-body::-webkit-scrollbar-thumb:hover { background: #1565C0; }

.help-section {
    margin-bottom: 20px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    font-size: 0.85rem;
    color: #1976D2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 600;
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-item .action {
    font-size: 0.9rem;
    color: #333;
}

.shortcut-item .keys {
    display: flex;
    gap: 6px;
}

.shortcut-item kbd {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-family: monospace;
    color: #333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 56px;
        height: calc(100vh - 56px);
        width: 280px;
        box-shadow: 2px 0 12px rgba(0,0,0,0.15);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar:not(.collapsed) { transform: translateX(0); }
    .sidebar.collapsed { transform: translateX(-100%); margin-left: 0; }

    .overlay {
        display: none;
        position: fixed;
        top: 56px; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }

    .overlay.active { display: block; }

    .frame-container { padding: 8px; background: #f5f5f5; }
    .frame-wrapper { border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
    .zoom-controls { display: none; }
    .jump-to-slide { display: none; }
    .autoplay-controls select { display: none; }
    .clock { display: none; }

    /* Better touch targets for mobile */
    .nav-list a {
        padding: 14px 16px;
        font-size: 1rem;
        -webkit-tap-highlight-color: rgba(25, 118, 210, 0.2);
    }

    .nav-list a:active {
        background: #BBDEFB;
    }

    .nav-list a.active {
        background: #1976D2;
        color: #fff;
        box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
    }

    /* Drawing toolbar mobile */
    .drawing-toolbar {
        bottom: 10px;
        padding: 6px 10px;
        gap: 6px;
        max-width: 95%;
        overflow-x: auto;
    }

    .drawing-toolbar button {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    /* Share/Help modals mobile */
    .share-content, .help-content, .modal {
        width: 95%;
        max-height: 90vh;
    }
}

@media (max-width: 600px) {
    .main-wrapper { margin-top: 48px; }
    .top-header { padding: 6px 8px; gap: 4px; }
    .top-header h1 { font-size: 0.85rem; max-width: 100px; }
    .icon-btn { width: 34px; height: 34px; }
    .icon-btn .material-icons { font-size: 18px; }
    .nav-buttons button { padding: 6px 12px; font-size: 0.8rem; }
    .nav-buttons button span { display: none; }
    .nav-buttons button::before { font-size: 1.1rem; }
    .nav-buttons button.prev-btn::before { content: '\2190'; }
    .nav-buttons button.next-btn::before { content: '\2192'; }
    .slide-info { display: none; }
    .sidebar { top: 48px; height: calc(100vh - 48px); width: 260px; }
    .overlay { top: 48px; }

    /* Hide some admin buttons on small screens */
    #downloadImagesBtn { display: none; }
}

@media (max-width: 400px) {
    .top-header h1 { display: none; }
    .admin-badge { display: none; }
    .nav-buttons button { padding: 6px 10px; }
    .icon-btn { width: 32px; height: 32px; }
}

/* PDF-Only Mode (chapter with only a PDF, no slides) */
.pdf-only-wrapper {
    margin-top: 56px;
    height: calc(100vh - 56px);
    background: #525659;
}

.pdf-only-frame {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 600px) {
    .pdf-only-wrapper {
        margin-top: 48px;
        height: calc(100vh - 48px);
    }
}

/* PDF Viewer Button */
.icon-btn.pdf-available {
    background: rgba(229, 57, 53, 0.85);
}

.icon-btn.pdf-available:hover {
    background: rgba(229, 57, 53, 1);
}

/* PDF Viewer Modal */
.pdf-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.pdf-modal.active {
    display: flex;
}

.pdf-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 95%;
    max-width: 1100px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    overflow: hidden;
}

.pdf-modal-header {
    padding: 12px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f5f5;
    flex-shrink: 0;
}

.pdf-modal-header h2 {
    font-size: 1rem;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdf-modal-header h2 .material-icons {
    color: #E53935;
    font-size: 22px;
}

.pdf-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #1976D2;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.pdf-download-btn:hover {
    background: #1565C0;
}

.pdf-download-btn .material-icons {
    font-size: 18px;
}

.pdf-modal-body {
    flex: 1;
    overflow: hidden;
}

.pdf-frame {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 768px) {
    .pdf-modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .pdf-download-btn span:not(.material-icons) {
        display: none;
    }

    .pdf-download-btn {
        padding: 8px 12px;
    }
}

/* Full Page Mode Styles */
.frame-wrapper.full-page-mode {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.frame-wrapper.full-page-mode .slide-frame {
    transform: none !important;
    transform-origin: top left;
    border: none;
    display: block;
    pointer-events: auto;
    z-index: 50;
}

/* Full page container adjustments */
.frame-container:has(.full-page-mode) {
    padding: 10px;
}

/* Full page indicator in settings */
.full-page-label {
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
    color: #1976D2;
    font-weight: 500;
}

.full-page-label input:checked + .material-icons {
    color: #1976D2;
}

.full-page-label .material-icons {
    font-size: 16px;
    vertical-align: middle;
}

/* Settings header adjustments for full page option */
.settings-header {
    flex-wrap: wrap;
    gap: 12px;
}

.settings-header .select-all-group {
    white-space: nowrap;
}

/* Disabled scroll checkboxes when full page is active */
.setting-item input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.setting-item input[type="checkbox"]:disabled + span,
.setting-item label:has(input:disabled) {
    opacity: 0.5;
}
