/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    line-height: 1.6;
    font-weight: 400;
}

/* ScannerVerse color palette */
:root {
    --primary-purple: #7977c5;
    --primary-purple-light: #9b99d1;
    --primary-purple-dark: #5a58a0;
    --accent-purple: #8b89d4;
    --neutral-gray: #6b7280;
    --neutral-gray-light: #f9fafb;
    --neutral-gray-dark: #374151;
    --white: #ffffff;
    --black: #000000;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.15);
}

/* App container with flexbox for sticky footer */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
.header {
    background: var(--white);
    color: var(--text-primary);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px var(--shadow-light);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.header-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin: 0;
    color: var(--primary-purple);
    letter-spacing: -0.02em;
}

/* Main content area */
.main-content {
    flex: 1;
    background: var(--white);
    padding: 2rem 0;
}

.content-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Footer styles */
.footer {
    background: var(--primary-purple);
    color: var(--white);
    padding: 3rem 0 2rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Story content styles */
#scene-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

#cutscene-text {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    line-height: 1.7;
    color: var(--text-primary);
    font-weight: 400;
}

#cutscene-media img,
#cutscene-media video {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-light);
}

/* Responsive video wrapper for both YouTube and Vimeo */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    margin: 2rem 0;
    box-shadow: 0 4px 20px var(--shadow-light);
}

.video-wrapper iframe,
.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Ensure video controls are visible and styled */
.video-wrapper video {
    object-fit: contain;
    background: #000;
}

/*
.video-wrapper video::-webkit-media-controls {
    background: rgba(0, 0, 0, 0.3);
}

.video-wrapper video::-webkit-media-controls-panel {
    background: rgba(0, 0, 0, 0.3);
}
*/

/* HTML content styling */
.pre-html-content,
.post-html-content {
    margin: 1rem 0;
    line-height: 1.6;
}

.pre-html-content {
    margin-bottom: 1.5rem;
}

.post-html-content {
    margin-top: 1.5rem;
}

.video-load-error {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color, #e5e7eb);
    background-color: #fff7ed;
    color: var(--neutral-gray-dark, #374151);
    line-height: 1.5;
}

.video-load-error code {
    font-size: 0.9em;
}

/* Triggered scene unlock notice (scene type: triggered) */
.triggered-scene-unlock-notice {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color, #e5e7eb);
    line-height: 1.5;
    background-color: var(--neutral-gray-light, #f9fafb);
    color: inherit;
}

.triggered-scene-unlock-notice--repeat {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.triggered-scene-unlock-footer {
    margin: 1.5rem 0 2rem;
}

a.triggered-scene-unlock-button {
    display: block;
    width: 100%;
    max-width: 28rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    box-sizing: border-box;
    background-color: var(--primary-purple);
    color: var(--white);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

a.triggered-scene-unlock-button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.debug {
    margin-top: 3rem;
    color: #777;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

/* Tablet styles */
@media (min-width: 768px) {
    .header-title {
        font-size: 1.8rem;
    }
    
    .content-wrapper {
        padding: 2rem;
    }
    
    #scene-title {
        font-size: 1.8rem;
    }
    
    #cutscene-text {
        font-size: 1.2rem;
    }
}

/* Desktop styles */
@media (min-width: 1024px) {
    .main-content {
        background: white;
        padding: 2rem;
    }
    
    .content-wrapper {
        padding: 2rem 3rem;
    }
    
    .header-title {
        font-size: 2rem;
    }
    
    #scene-title {
        font-size: 2rem;
    }
    
    #cutscene-text {
        font-size: 1.3rem;
    }
}

/* Large desktop styles */
@media (min-width: 1440px) {
    .content-wrapper {
        padding: 3rem;
    }
}

/* Header Buttons Container */
.header-buttons {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Button styles */
.btn-primary {
    background: var(--primary-purple);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary:hover {
    background: var(--primary-purple-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px var(--shadow-light);
}

.btn-primary-outline {
    background: transparent;
    color: var(--primary-purple);
    border: 2px solid var(--primary-purple);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary-outline:hover {
    background: var(--primary-purple);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

/* Journal Button Styles */
.journal-button {
    background: transparent;
    border: 2px solid var(--primary-purple);
    color: var(--primary-purple);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
}

.journal-button:hover {
    background: var(--primary-purple);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

.journal-button:active {
    transform: translateY(0);
}

.journal-icon {
    width: 20px;
    height: 20px;
    display: block;
}

/* Replay Menu Styles */
.replay-menu {
    position: relative;
}

.replay-button {
    background: transparent;
    border: 2px solid var(--primary-purple);
    color: var(--primary-purple);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none; /* Hidden by default, shown when replay scenes are available */
}

.replay-button:hover {
    background: var(--primary-purple);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

.replay-button:active {
    transform: translateY(0);
}

.replay-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.replay-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-dark);
    border: 1px solid var(--border-color);
    min-width: 280px;
    max-width: 320px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.replay-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.replay-dropdown-content {
    padding: 0.5rem 0;
    max-height: 400px;
    overflow-y: auto;
}

.replay-story-section {
    margin-bottom: 0.5rem;
}

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

.replay-story-title {
    padding: 0.75rem 1rem 0.5rem;
    font-weight: 600;
    color: var(--primary-purple);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
}

.replay-scene-list {
    padding: 0 0.5rem;
}

.replay-scene-item {
    display: block;
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.15s ease;
    font-size: 0.9rem;
    line-height: 1.3;
}

.replay-scene-item:hover {
    background: var(--neutral-gray-light);
    color: var(--primary-purple);
    transform: translateX(4px);
}

.replay-scene-item:active {
    background: var(--primary-purple);
    color: var(--white);
}

/* Custom scrollbar for dropdown */
.replay-dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.replay-dropdown-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.replay-dropdown-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.replay-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Mobile adjustments for header buttons */
@media (max-width: 768px) {
    .header-buttons {
        right: 0.75rem;
        gap: 0.5rem;
    }
    
    .replay-dropdown {
        min-width: 260px;
        max-width: calc(100vw - 2rem);
        right: -0.5rem;
    }
    
    .replay-icon {
        width: 18px;
        height: 18px;
    }
    
    .replay-button {
        padding: 0.4rem;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
    .replay-dropdown {
        min-width: 300px;
    }
}

/* Desktop adjustments */
@media (min-width: 1024px) {
    .header-buttons {
        right: 2rem;
        gap: 1rem;
    }
    
    .replay-dropdown {
        min-width: 320px;
    }
    
    .replay-icon {
        width: 22px;
        height: 22px;
    }
    
    .replay-button {
        padding: 0.6rem;
    }
}

/* Journal Dialog Styles */
.journal-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 1rem;
}

.journal-dialog.show {
    display: flex;
}

.journal-dialog-content {
    background: var(--white);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px var(--shadow-dark);
    border: 1px solid var(--border-color);
}

.journal-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.journal-dialog-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.journal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.journal-close:hover {
    background: var(--neutral-gray-light);
    color: var(--text-primary);
}

.journal-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.journal-entry {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.journal-entry:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.journal-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.journal-entry-scene {
    font-weight: 600;
    color: var(--primary-purple);
    font-size: 0.9rem;
}

.journal-replay-link {
    color: var(--primary-purple);
    text-decoration: none;
    transition: all 0.2s ease;
}

.journal-replay-link:hover {
    color: var(--primary-purple-light);
    text-decoration: underline;
}

.journal-entry-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.journal-entry-content {
    color: var(--text-primary);
    line-height: 1.6;
}

.journal-entry-content p {
    margin-bottom: 0.5rem;
}

.journal-entry-content p:last-child {
    margin-bottom: 0;
}

.journal-empty,
.journal-loading {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
}

/* Mobile adjustments for journal dialog */
@media (max-width: 768px) {
    .journal-dialog {
        padding: 0.5rem;
    }
    
    .journal-dialog-content {
        max-height: 90vh;
    }
    
    .journal-dialog-header {
        padding: 1rem;
    }
    
    .journal-dialog-header h2 {
        font-size: 1.3rem;
    }
    
    .journal-content {
        padding: 1rem;
    }
    
    .journal-entry {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
}

/* Reset Story Button Styles */
.reset-story-container {
    background: transparent;
    border: 2px solid #dc3545;
    border-radius: 12px;
    padding: 2rem;
    margin: 10rem 0;
    text-align: center;
    box-shadow: 0 4px 20px var(--shadow-light);
}

.reset-story-button {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-story-button:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.reset-story-button:active {
    background-color: #bd2130;
    transform: translateY(0);
}

/* Reset Confirmation Modal */
.reset-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.reset-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.reset-modal-content {
    background-color: var(--white);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px var(--shadow-dark);
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.3s ease-out;
}

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

.reset-modal h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
}

.reset-modal p {
    margin: 0 0 2rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.reset-modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.reset-modal-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.reset-modal-button.yes {
    background-color: #dc3545;
    color: white;
}

.reset-modal-button.yes:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.reset-modal-button.no {
    background-color: var(--neutral-gray);
    color: white;
}

.reset-modal-button.no:hover {
    background-color: var(--neutral-gray-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

/* Mobile adjustments for reset modal */
@media (max-width: 768px) {
    .reset-modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .reset-modal h3 {
        font-size: 1.2rem;
    }
    
    .reset-modal-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .reset-modal-button {
        width: 100%;
    }
}

/* Additional utility classes for HTML styling */
.navbar-brand-custom {
    color: var(--primary-purple);
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.nav-link-custom {
    color: var(--text-primary);
}

.hero-section-custom {
    background: linear-gradient(135deg, var(--neutral-gray-light) 0%, var(--white) 100%);
}

.hero-title {
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.hero-icon-container {
    background: var(--primary-purple);
    border-radius: 20px;
    padding: 3rem;
    display: inline-block;
    box-shadow: 0 8px 32px var(--shadow-light);
}

.hero-icon {
    font-size: 4rem;
    color: var(--white);
}

/* Mobile adjustments for hero section */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0 !important;
    }
    
    .hero-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-icon-container {
        padding: 2rem;
        margin-top: 2rem;
    }
    
    .hero-icon {
        font-size: 3rem;
    }
    
    .min-vh-50 {
        min-height: auto !important;
    }
    
    .hero-section .container {
        padding: 0 1rem;
    }
    
    .hero-section .row {
        margin: 0;
    }
    
    .hero-section .col-md-6 {
        padding: 0;
        margin-bottom: 1rem;
    }
    
    .hero-section .col-md-6:last-child {
        margin-bottom: 0;
        text-align: center;
    }
}

/* Tablet adjustments for hero section */
@media (min-width: 769px) and (max-width: 1023px) {
    .hero-section {
        padding: 3rem 0;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-icon-container {
        padding: 2.5rem;
    }
    
    .hero-icon {
        font-size: 3.5rem;
    }
}

/* Mobile adjustments for featured section */
@media (max-width: 768px) {
    .section-white {
        padding: 2rem 0 !important;
    }
    
    .section-white .container {
        padding: 0 1rem;
    }
    
    .section-white .row {
        margin: 0;
    }
    
    .section-white .col-md-6 {
        padding: 0;
    }
    
    .section-white .col-md-6.order-1 {
        margin-bottom: 2rem;
    }
    
    .feature-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .feature-text-primary {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .image-custom {
        max-width: 100%;
        height: auto;
    }
}

.section-white {
    background: var(--white);
}

.section-gray {
    background: var(--neutral-gray-light);
}

.section-title {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.feature-title {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.feature-text {
    color: var(--text-secondary);
}

.feature-text-primary {
    color: var(--text-primary);
}

.feature-text-large {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.feature-icon-container {
    width: 80px;
    height: 80px;
    background: var(--primary-purple);
}

.feature-icon {
    color: var(--white);
}

.card-custom {
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-light);
}

.card-image-custom {
    height: 200px;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
}

.card-title-custom {
    color: var(--text-primary);
    font-weight: 600;
}

.card-text-custom {
    color: var(--text-secondary);
}

.card-icon-container {
    height: 200px;
    border-radius: 16px 16px 0 0;
}

.card-icon-container-primary {
    background: var(--primary-purple);
}

.card-icon-container-accent {
    background: var(--accent-purple);
}

.card-icon {
    font-size: 4rem;
    color: var(--white);
}

.footer-custom {
    background: var(--primary-purple);
    color: var(--white);
}

.footer-title {
    color: var(--white);
    font-weight: 700;
    margin-bottom: 1rem;
}

.footer-text {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0;
}

.image-custom {
    border-radius: 16px !important;
    box-shadow: 0 8px 32px var(--shadow-dark) !important;
}

/* Leader Guide Styles */
.leader-guide-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--white);
    min-height: 100vh;
}

.leader-guide-header {
    margin-bottom: 2rem;
    text-align: center;
}

.leader-guide-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.story-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.mode-description {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    background: var(--neutral-gray-light);
    border-radius: 8px;
    border-left: 4px solid var(--primary-purple);
    color: var(--text-primary);
}

.mode-description li {
    margin-bottom: 0.5rem;
}

/* Removed unused leader guide table styles - table has been removed */

.back-button {
    background: var(--neutral-gray);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: var(--neutral-gray-dark);
    transform: translateY(-1px);
}

.loading {
    text-align: center;
    padding: 3rem;
    background: var(--white);
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.loading h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error {
    text-align: center;
    padding: 3rem;
    max-width: 600px;
    margin: 0 auto;
    background: var(--white);
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.error h2 {
    color: #dc2626;
    margin-bottom: 1rem;
}

.error p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.error code {
    background: var(--neutral-gray-light);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

/* Mobile Responsive Design */
@media screen and (max-width: 768px) {
    .leader-guide-container {
        padding: 1rem;
    }
    
    .leader-guide-header h2 {
        font-size: 2rem;
    }
    
    .mode-description {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Make table cells block-level for stacking */
    .qr-cell, .scene-cell {
        display: block;
        width: 100%;
        padding: 0.5rem;
    }
    
    /* Remove QR cell space on mobile */
    .qr-cell {
        display: none;
    }
    
    /* Hide QR codes on mobile */
    .qr-code, .qr-placeholder {
        display: none !important;
    }
    
    /* Move buttons from QR cell to scene cell on mobile */
    .qr-cell .qr-button-container {
        display: none; /* Hide buttons in QR cell */
    }
    
    /* Stack buttons vertically below thumbnails in scene cell */
    .scene-container {
        display: flex;
        flex-direction: column;
    }
    
    /* Add buttons after scene content using CSS content */
    .scene-cell::after {
        content: '';
        display: block;
        margin-top: 1rem;
    }
    
    /* Hide QR Code header on mobile only */
    .qr-code-table thead .qr-column {
        display: none;
    }
    
    /* Adjust scene row height */
    .scene-row {
        height: auto;
    }
    
    .qr-preview-button,
    .qr-story-button {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        min-width: 100px;
    }
}

/* Print Instructions Styles */
.print-instructions {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--neutral-gray-light);
    border-radius: 12px;
    border-left: 4px solid var(--primary-purple);
    margin-bottom: 2rem;
}

.print-instructions h2 {
    color: var(--primary-purple);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.print-instructions p {
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.print-instructions p:last-of-type {
    margin-bottom: 0;
}

.print-instructions img {
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Printable QR Code Table Styles */
.printable-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.printable-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.printable-section-header h2 {
    color: var(--primary-purple);
    font-size: 1.5rem;
    margin: 0;
}

.print-button {
    background: var(--primary-purple);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.print-button:hover {
    background: var(--primary-purple-dark);
}

.printable-qr-table {
    background: var(--white);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow-light);
}

.qr-code-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.qr-code-table thead {
    background: var(--primary-purple);
    color: var(--white);
}

.qr-code-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
}

.qr-column {
  width: 50%;
}

.scene-column {
  width: 50%;
}

.qr-code-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.qr-code-table tbody tr:last-child {
    border-bottom: none;
}

.group-heading-row {
    background: var(--neutral-gray-light);
}

.group-heading {
    padding: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-purple);
    text-align: center;
}

.scene-row {
    height: 200px;
}

.qr-cell, .scene-cell {
    padding: 1rem;
    vertical-align: top;
}

.qr-container {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 150px;
}

.qr-code {
  max-width: 3in;
  max-height: 3in;
  width: auto;
  height: auto;
  border-radius: 0.25rem;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 200px;
    height: 200px;
    border: 2px dashed var(--neutral-gray);
    border-radius: 0.5rem;
    background: var(--neutral-gray-light);
    color: var(--neutral-gray);
    text-align: center;
}

.qr-placeholder-text {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.qr-placeholder-url {
    font-size: 0.8rem;
    font-family: monospace;
}


.visible-icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.scene-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.scene-thumbnail {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 0.25rem;
  object-fit: contain;
}

.scene-title-container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.scene-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}

.scene-group-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.25rem;
  display: none; /* Hidden on screen, shown only when printing */
}

/* QR Code Button Styles */
.qr-button-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.qr-variant-previews {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.25rem;
}

.qr-variant-preview-button {
  min-width: unset;
  width: 100%;
  box-sizing: border-box;
}

.qr-preview-button,
.qr-story-button {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  text-align: center;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  min-width: 120px;
}

.qr-preview-button {
  background: var(--primary-purple);
  color: var(--white);
  border-color: var(--primary-purple);
}

.qr-preview-button:hover {
  background: var(--primary-purple-dark);
  border-color: var(--primary-purple-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(121, 119, 197, 0.3);
}

.qr-story-button {
  background: var(--white);
  color: var(--primary-purple);
  border-color: var(--primary-purple);
}

.qr-story-button:hover {
  background: var(--primary-purple);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(121, 119, 197, 0.3);
}

.placement-hint-hide-well {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #92400e;
  background: #fef3c7;
  border-radius: 4px;
  vertical-align: middle;
}

/* Triggered scenes: on-screen only (no print) */
.leader-triggered-panel {
  max-width: 1200px;
  margin: 2rem auto 2rem;
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
  border-left: 4px solid #0284c7;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.leader-triggered-heading {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0c4a6e;
}

.leader-triggered-intro {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.5;
}

.leader-triggered-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.leader-triggered-card {
  position: relative;
  padding: 0.85rem 1rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  border-left: 3px solid #0369a1;
}

.leader-triggered-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0369a1;
  background: #e0f2fe;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.leader-triggered-card-body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
  padding-right: 4.5rem;
}

.leader-triggered-thumbnail {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.leader-triggered-text {
  flex: 1;
  min-width: 0;
}

.leader-triggered-title {
  font-weight: 600;
  font-size: 1rem;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.leader-triggered-scene-id {
  font-size: 0.8rem;
  font-family: ui-monospace, monospace;
  color: #64748b;
  margin-bottom: 0.6rem;
}

.leader-triggered-preview-button {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  background: #0284c7;
  color: #ffffff;
  border: 2px solid #0284c7;
  transition: background 0.2s, transform 0.2s;
}

.leader-triggered-preview-button:hover {
  background: #0369a1;
  border-color: #0369a1;
  transform: translateY(-1px);
}

/* Print Media Query */
@media print {
    /* Hide all non-printable elements */
    .header,
    .footer,
    .leader-guide-header,
    .leader-guide-table-container,
    .printable-section-header,
    .print-button {
        display: none !important;
    }

    .leader-triggered-panel {
        display: none !important;
    }
    
    /* Show print instructions and printable QR table */
    .print-instructions {
        display: block !important;
        margin: 0 !important;
        padding: 0.5in !important;
        background: white !important;
        border: none !important;
        border-radius: 0 !important;
        page-break-after: always;
        break-after: always;
    }
    
    .print-instructions h2 {
        font-size: 14pt;
        font-weight: bold;
        margin-bottom: 0.3in;
        color: black;
    }
    
    .print-instructions p {
        font-size: 12pt;
        margin-bottom: 0.2in;
        color: black;
        line-height: 1.4;
    }
    
    .print-instructions img {
        width: 0.2in;
        height: 0.2in;
        margin-left: 0.1in;
    }
    
    .printable-qr-table {
        display: block !important;
    }
    
    /* Hide buttons and story description in print mode */
    .qr-button-container {
        display: none !important;
    }
    
    .story-description {
        display: none !important;
    }
    
    /* Page setup */
    @page {
        size: 8.5in 11in portrait;
        margin: 0.25in;
    }
    
    /* Reset all containers to remove blank pages */
    body {
        font-size: 12pt;
        line-height: 1.2;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .app-container {
        margin: 0 !important;
        padding: 0 !important;
        min-height: auto !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .content-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
    }
    
    .printable-section {
        margin: 0 !important;
        padding: 0 !important;
        border-top: none !important;
    }
    
    .printable-qr-table {
        margin: 0 !important;
        padding: 0 !important;
        page-break-inside: avoid;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    
    .qr-code-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 10pt;
        margin: 0;
        padding: 0;
        border-spacing: 0;
    }
    
    .qr-code-table tbody {
        margin: 0;
        padding: 0;
    }
    
    .qr-code-table thead {
        display: none;
    }
    
    .qr-code-table tbody tr {
        height: 4.25in;
        page-break-inside: avoid;
        margin: 0;
        padding: 0;
    }
    
    /* Force page breaks using explicit class added by JavaScript */
    .qr-code-table tbody tr.scene-row.page-break-after {
        page-break-after: always;
        break-after: always;
    }
    
    .qr-code-table tbody tr.scene-row:not(.page-break-after) {
        page-break-after: auto;
        break-after: auto;
    }
    
    .qr-code-table tbody tr:last-child {
        page-break-after: auto;
        break-after: auto;
    }
    
    .group-heading-row {
        display: none !important; /* Hide group headings when printing */
    }
    
    .qr-cell {
      width: 50%;
      text-align: center;
      vertical-align: middle;
    }
    
    .scene-cell {
      width: 50%;
      vertical-align: middle;
      padding-left: 0.3in;
    }
    
    .qr-container {
        height: 4.25in;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        position: relative;
        padding-top: 0.25in;
    }
    
    .qr-container .qr-code {
        align-self: flex-start;
        margin-top: 0;
    }
    
    .qr-code {
      max-width: 3in;
      max-height: 3in;
      width: auto;
      height: auto;
    }
    
    .qr-placeholder {
        width: 3in;
        height: 3in;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        border: 2px solid #000;
        font-size: 10pt;
    }
    
    .scene-group-name {
        font-size: 10pt;
        color: #666;
        font-weight: normal;
        margin-top: 0.1in;
        display: block !important; /* Show group names when printing */
    }
    
    .visible-icon {
        width: 0.3in;
        height: 0.3in;
        margin-left: 0.1in;
    }
    
    .scene-container {
        height: 4.25in;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 0.2in;
        padding-top: 0.25in;
    }
    
    .scene-thumbnail {
      max-width: 100%;
      max-height: 100%;
      width: auto;
      height: auto;
      object-fit: contain;
    }
    
    .scene-title {
        font-size: 12pt;
        font-weight: bold;
        line-height: 1.2;
    }
}