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

.hidden {
    display: none !important;
}

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;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    line-height: 1.2;
}

.title-main {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 20px rgba(255, 255, 255, 0.3);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.title-accent {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    text-shadow: 0 2px 20px rgba(255, 215, 0, 0.4);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    position: relative;
}

.title-accent::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    border-radius: 2px;
    opacity: 0.6;
}

header .subtitle {
    opacity: 0.95;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.controls {
    padding: 16px 32px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: fit-content;
}

.control-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #495057;
    margin-bottom: 2px;
    padding-left: 2px;
}

.control-group-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.control-separator {
    width: 1px;
    height: 44px;
    background: linear-gradient(to bottom, transparent 0%, #dee2e6 20%, #dee2e6 80%, transparent 100%);
    margin: 0 8px;
    align-self: center;
    flex-shrink: 0;
}

.file-input-label {
    display: inline-block;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.file-input-label:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.file-input-label:active {
    transform: translateY(0);
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    min-width: 220px;
}

.model-select-btn {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    min-height: 36px;
}

.model-select-btn:hover {
    border-color: #667eea;
}

.model-select-btn:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dropdown-arrow {
    font-size: 10px;
    color: #666;
    transition: transform 0.3s ease;
}

.model-select-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-list {
    padding: 4px;
}

.dropdown-item {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

.dropdown-item-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.dropdown-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dropdown-item:hover .dropdown-item-actions {
    opacity: 1;
}

.dropdown-action-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-action-btn:hover {
    background: #f0f0f0;
}

.dropdown-action-btn.edit-btn:hover {
    background: #e7f3ff;
}

.dropdown-action-btn.delete-btn:hover {
    background: #ffe7e7;
}

.dropdown-action-btn.embed-btn {
    font-family: monospace;
    font-weight: bold;
    color: #667eea;
    font-size: 14px;
    min-width: 28px;
}

.dropdown-action-btn.embed-btn:hover {
    background: #f0f4ff;
    color: #5568d3;
}

.dropdown-item.new-model-item {
    font-weight: 600;
    color: #667eea;
    background: #f0f4ff;
    margin-top: 4px;
}

.dropdown-item.new-model-item:hover {
    background: #e0e8ff;
}

.file-name-display {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #666;
}

.file-name-display.hidden {
    display: none;
}

.upload-progress-container {
    margin-top: 16px;
    margin-bottom: 16px;
}

.upload-progress-container.hidden {
    display: none;
}

.upload-progress-bar {
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.upload-progress-text {
    text-align: center;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.btn {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 13px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
}

.btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(108, 117, 125, 0.2);
}

.btn-primary {
    background: #667eea;
}

.btn-primary:hover {
    background: #5568d3;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn.active {
    background: #28a745;
}

.btn.active:hover {
    background: #218838;
}

#viewer-container {
    position: relative;
    flex: 1;
    background: #ffffff;
    overflow: hidden;
}

#label-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

#viewer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 100;
}

.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 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Database operation loading overlay */
.db-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.db-loading.hidden {
    display: none;
}

.db-loading-content {
    background: white;
    border-radius: 12px;
    padding: 32px 48px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 300px;
}

.db-loading-content .spinner {
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.db-loading-content p {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.error {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc3545;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    z-index: 100;
    max-width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.error.hidden {
    display: none;
}

.info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 16px;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.info.hidden {
    display: none;
}

.info-content h3 {
    margin-bottom: 12px;
    color: #667eea;
    font-size: 1.1rem;
}

.info-content ul {
    list-style: none;
    padding: 0;
}

.info-content li {
    margin-bottom: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.info-content strong {
    color: #764ba2;
}

/* Labels Panel */
.labels-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 300px;
    max-height: 400px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 20;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.labels-panel.hidden {
    display: none;
}

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

.labels-panel-header h3 {
    margin: 0;
    color: #667eea;
    font-size: 1.1rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #f0f0f0;
    color: #333;
}

.labels-list {
    padding: 8px;
    overflow-y: auto;
    max-height: 350px;
}

.label-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.label-item-content {
    flex: 1;
}

.label-item-text {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.label-item-position {
    font-size: 0.75rem;
    color: #666;
}

.label-item-actions {
    display: flex;
    gap: 4px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    background: #6c757d;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: #5a6268;
}

.btn-small.danger {
    background: #dc3545;
}

.btn-small.danger:hover {
    background: #c82333;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-header .btn-close {
    color: white;
}

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

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.form-group input[type="color"] {
    width: 100%;
    height: 50px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 3D Label Styles */
.label-3d {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: white;
    background: rgba(102, 126, 234, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    user-select: none;
    cursor: pointer;
    position: relative;
}

.label-3d:hover {
    z-index: 1000;
}

.label-hover-popup {
    position: absolute;
    top: calc(100% - 2px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 8px;
    display: none;
    flex-direction: row;
    gap: 6px;
    z-index: 1001;
    white-space: nowrap;
    pointer-events: auto;
    margin-top: 2px;
}

.label-hover-popup::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    pointer-events: auto;
}

/* Popup visibility is now controlled by JavaScript for better reliability */

.label-hover-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.label-hover-btn-edit {
    background: #667eea;
    color: white;
}

.label-hover-btn-edit:hover {
    background: #5568d3;
}

.label-hover-btn-toggle {
    background: #6b7280;
    color: white;
    font-size: 14px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.label-hover-btn-toggle:hover {
    background: #4b5563;
}

.label-hover-btn-toggle svg {
    width: 16px;
    height: 16px;
    display: block;
}

.label-hover-btn-delete {
    background: #ef4444;
    color: white;
}

.label-hover-btn-delete:hover {
    background: #dc2626;
}

.question-hover-popup {
    position: absolute;
    top: calc(100% - 2px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 1001;
    min-width: 250px;
    max-width: 350px;
    pointer-events: auto;
    margin-top: 2px;
}

.question-hover-popup::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    pointer-events: auto;
}

/* Popup visibility is now controlled by JavaScript for better reliability */

.question-hover-text {
    font-size: 13px;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.4;
}

.question-hover-buttons {
    display: flex;
    flex-direction: row;
    gap: 6px;
}

.question-hover-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.question-hover-btn-preview {
    background: #10b981;
    color: white;
}

.question-hover-btn-preview:hover {
    background: #059669;
}

.question-hover-btn-edit {
    background: #667eea;
    color: white;
}

.question-hover-btn-edit:hover {
    background: #5568d3;
}

.question-hover-btn-toggle {
    background: #6b7280;
    color: white;
    font-size: 14px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-hover-btn-toggle:hover {
    background: #4b5563;
}

.question-hover-btn-toggle svg {
    width: 16px;
    height: 16px;
    display: block;
}

.question-hover-btn-delete {
    background: #ef4444;
    color: white;
}

.question-hover-btn-delete:hover {
    background: #dc2626;
}

.label-marker {
    width: 12px;
    height: 12px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
}

/* Question and Quiz Styles */
.btn-question {
    background: #28a745;
}

.btn-question:hover {
    background: #218838;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-question.active {
    background: #218838;
}

.btn-quiz {
    background: #ffc107;
    color: #333;
}

.btn-quiz:hover {
    background: #e0a800;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.modal-large {
    max-width: 600px;
}

.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-row input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.option-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.option-input:focus {
    outline: none;
    border-color: #667eea;
}

.form-hint {
    display: block;
    margin-top: 8px;
    color: #666;
    font-size: 0.85rem;
}

/* Quiz Overlay - Side Panel */
.quiz-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

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

.quiz-container {
    background: white;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.quiz-header {
    padding: 16px 20px;
    border-bottom: 2px solid #ffc107;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    flex-shrink: 0;
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.quiz-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.quiz-content h2 {
    color: #333;
    margin-bottom: 24px;
    font-size: 1.5rem;
    line-height: 1.4;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.quiz-option {
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    font-size: 1rem;
}

.quiz-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateX(4px);
}

.quiz-option.selected {
    border-color: #667eea;
    background: #e7edff;
    font-weight: 600;
}

.quiz-option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.quiz-option.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
}

.quiz-feedback {
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-weight: 500;
}

.quiz-feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.quiz-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.quiz-footer {
    padding: 16px 20px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    background: #f8f9fa;
    flex-shrink: 0;
}

.quiz-footer .btn {
    flex: 1;
}

/* Quiz Results */
.results-content {
    text-align: center;
}

.score-display {
    margin-bottom: 24px;
}

.score-display h2 {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 8px;
}

.score-display p {
    font-size: 1.5rem;
    color: #666;
}

.results-summary {
    text-align: left;
    margin-top: 20px;
}

.result-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.result-item.correct {
    background: #d4edda;
    border-left-color: #28a745;
}

.result-item.incorrect {
    background: #f8d7da;
    border-left-color: #dc3545;
}

.result-item-number {
    font-weight: 600;
    margin-bottom: 4px;
}

.result-item-answer {
    font-size: 0.9rem;
    color: #666;
}

/* Camera View Controls */
.btn-camera {
    background: #17a2b8;
    color: white;
}

.btn-camera:hover {
    background: #138496;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.btn-camera.saved {
    background: #28a745;
}

.btn-camera.saved:hover {
    background: #218838;
}

.camera-view-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.camera-view-status {
    font-size: 0.9rem;
    color: #666;
}

.camera-view-status.saved {
    color: #28a745;
    font-weight: 500;
}

/* Camera Adjustment Overlay */
.camera-adjustment-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 20px;
    pointer-events: none;
}

.camera-adjustment-overlay.hidden {
    display: none;
}

.camera-adjustment-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    max-width: 320px;
    text-align: left;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.camera-adjustment-content h3 {
    margin: 0 0 12px 0;
    color: #667eea;
    font-size: 1.2rem;
}

.camera-adjustment-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

.camera-adjustment-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.camera-adjustment-actions .btn {
    width: 100%;
}

/* Login Modal */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-modal.hidden {
    display: none;
}

.login-modal-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h2 {
    font-size: 1.75rem;
    color: #667eea;
    margin-bottom: 8px;
    font-weight: 700;
}

.login-header p {
    color: #6c757d;
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #fcc;
}

/* Logout Button */
.logout-btn {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 10000 !important;
}

.logout-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.logout-btn:active {
    transform: translateY(0) scale(1);
}

.logout-btn svg {
    stroke: white;
}

@media (max-width: 768px) {
    .quiz-overlay {
        width: 100%;
        height: 50%;
        bottom: 0;
        top: auto;
    }
}

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

    header h1 {
        font-size: 1.5rem;
    }

    .info {
        position: relative;
        top: 0;
        right: 0;
        max-width: 100%;
        margin: 16px;
    }
}
