/* ============================================
   INTERACTIVE BOOK STYLESHEET
   For "Raumstation Hyama antwortet nicht" - All 35 chapters
   ============================================ */

/* ===========================================
   1. BASE CONTAINER & LAYOUT
   =========================================== */

.story-fullscreen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 9999;
    background: radial-gradient(ellipse at center, #1a1f2e 0%, #0f1419 100%);
    color: #e8e8e8;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.8;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

.story-fullscreen-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.story-content-wrapper {
    max-width: 820px;
    margin: 0 auto;
    background: linear-gradient(145deg, #1e2530, #161a24);
    min-height: 100vh;
    padding: 90px 75px;
    position: relative;
    box-shadow: 0 0 100px rgba(0,0,0,0.5);
}

/* ===========================================
   2. CHAPTER HEADER ELEMENTS
   =========================================== */

.chapter-section {
    text-align: center;
    margin-bottom: 70px;
    position: relative;
}

.chapter-ornament {
    color: #ffa726;
    font-size: 1.5em;
    margin-bottom: 20px;
    letter-spacing: 8px;
}

.chapter-number {
    font-size: 1em;
    color: #ffa726;
    letter-spacing: 3px;
    margin-bottom: 15px;
    font-weight: 300;
}

.chapter-title {
    font-size: 3.5em;
    color: #f5f5f5;
    font-weight: 200;
    letter-spacing: 2px;
    margin-bottom: 30px;
}

.title-word {
    cursor: help;
    transition: color 0.2s ease;
}

.title-word:hover {
    color: #ffa726;
}

.title-underline {
    width: 120px;
    height: 1px;
    background: linear-gradient(to right, transparent, #ffa726, transparent);
    margin: 0 auto;
}

/* ===========================================
   3. STORY TEXT ELEMENTS
   =========================================== */

.narrative-area {
    margin-bottom: 70px;
    position: relative;
}

.story-text {
    font-size: 1.35em;
    font-weight: 300;
    color: #e0e0e0;
    position: relative;
    user-select: none;
}

.story-text .sentence {
    cursor: help;
}

.story-paragraph {
    margin-bottom: 30px;
    text-align: justify;
    position: relative;
}

/* CSS-based initial capital letter - first paragraph only */
.story-paragraph:first-of-type::first-letter {
    font-size: 4.8em;
    line-height: 0.8;
    float: left;
    padding-right: 12px;
    padding-top: 8px;
    color: #ffa726;
    font-weight: 200;
    pointer-events: none; /* Allow touches to pass through on mobile for vocab tooltips */
    user-select: none; /* Prevent text selection on the drop cap */
}

/* Don't apply drop cap to paragraphs inside special boxes */
.computer-message .story-paragraph::first-letter,
.logbook-entry .story-paragraph::first-letter,
.diary-entry .story-paragraph::first-letter {
    font-size: inherit;
    line-height: inherit;
    float: none;
    padding-right: 0;
    padding-top: 0;
    color: inherit;
    font-weight: inherit;
}

/* SVG-based drop cap - MOBILE ONLY - allows tooltips on first word */
.drop-cap-svg {
    display: none; /* Hidden by default (desktop) */
}

@media (max-width: 768px) {
    /* Show SVG drop cap on mobile */
    .drop-cap-svg {
        display: block;
        float: left;
        margin-right: 12px;
        margin-top: 8px;
        pointer-events: none;
        user-select: none;
        width: 76px;  /* Approximately 4.8em at base 16px */
        height: 76px;
    }

    /* Disable CSS ::first-letter on mobile when SVG is present */
    .sentence:first-child::first-letter,
    .story-paragraph:first-of-type .sentence:first-child::first-letter {
        font-size: inherit;
        line-height: inherit;
        float: none;
        padding-right: 0;
        padding-top: 0;
        color: inherit;
        font-weight: inherit;
    }
}

/* Screen reader only - MOBILE ONLY - hidden visually but accessible */
.sr-only {
    /* On desktop: show normally (no hiding) */
}

@media (max-width: 768px) {
    /* On mobile: hide the letter (SVG will show instead) */
    .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border-width: 0;
    }
}

/* ===========================================
   4. COMMUNICATION BOX
   =========================================== */

.communication-box {
    background: linear-gradient(135deg, #263238 0%, #37474f 100%);
    color: #81d4fa;
    padding: 25px 30px;
    margin: 35px 0;
    border-radius: 0 25px 25px 0;
    border-left: 4px solid #ffa726;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 1.05em;
    position: relative;
    font-weight: 400;
}

/* Spacious variant with more padding */
.communication-box-spacious {
    padding: 45px 60px 45px 80px;
    margin: 45px 0;
}

/* Override sentence padding when inside communication box */
.communication-box .sentence {
    padding-left: 8px !important;
    margin-left: 0 !important;
}

.communication-box::before {
    content: '◦ ◦ ◦';
    position: absolute;
    right: 20px;
    top: -8px;
    color: #ffa726;
    font-size: 0.8em;
    letter-spacing: 3px;
}

/* ===========================================
   5. ASSISTANT SECTIONS
   =========================================== */

/* Assistant's voice - orange text same size as story */
.narrator-intro {
    font-style: italic;
    color: #ffa726 !important;
    font-size: 1em; /* Inherits parent size, no multiplication */
}

/* ===========================================
   6. DECISION/CHOICE ELEMENTS
   =========================================== */

.decision-flow {
    margin-top: 60px;
    position: relative;
}

.decision-intro {
    font-size: 1.4em;
    color: #ffa726;
    text-align: center;
    margin-bottom: 50px;
    font-weight: 300;
    font-style: italic;
}

.choice-flow {
    position: relative;
}

.choice-connector {
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, #ffa726, transparent);
    opacity: 0.4;
}

.choice-option {
    display: block;
    margin: 35px 0;
    padding: 25px 30px 25px 50px;
    text-decoration: none;
    color: #e0e0e0;
    font-size: 1.15em;
    font-weight: 300;
    position: relative;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 0 35px 35px 0;
    line-height: 1.6;
}

.choice-option::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border: 2px solid #ffa726;
    border-radius: 50%;
    background: transparent;
    transition: all 0.3s ease;
}

.choice-option::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,167,38,0.05), rgba(255,167,38,0.1));
    border-radius: 0 35px 35px 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.choice-option:hover::before {
    background: #ffa726;
    box-shadow: 0 0 15px rgba(255,167,38,0.5);
}

.choice-option:hover::after {
    opacity: 1;
}

.choice-option:hover {
    color: #f8f8f8;
    transform: translateX(20px);
    text-shadow: 0 0 10px rgba(255,255,255,0.1);
}

.choice-text {
    position: relative;
    z-index: 1;
}

.choice-indicator {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffa726;
    font-size: 1.2em;
    opacity: 0;
    transition: all 0.3s ease;
}

.choice-option:hover .choice-indicator {
    opacity: 1;
    transform: translateY(-50%) translateX(8px);
}

/* ===========================================
   7. AUDIO SENTENCE HIGHLIGHTING - SIMPLIFIED
   =========================================== */

.sentence {
    transition: all 0.4s ease;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    cursor: pointer;
    position: relative;
    display: inline;      /* Use inline, not inline-block */
    vertical-align: baseline;
}

.sentence:hover {
    background: rgba(255,167,38,0.1);
}

/* Add consistent padding to line break cuts */
.sentence.playing {
    background: linear-gradient(90deg, #ffa726 0%, #ff9800 100%) !important;
    color: #222 !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 6px !important;
    padding: 4px 14px !important;
    margin: -4px -14px !important;
    line-height: 1.7 !important;
    display: inline !important;
    position: relative !important;
    z-index: 2 !important;
    box-decoration-break: clone !important;
    -webkit-box-decoration-break: clone !important;
}

/* This ensures narrator intros, choice text, and all nested elements 
   get dark text when highlighted */
.sentence.playing .narrator-intro,
.sentence.playing .choice-link,
.sentence.playing .choice-link *,
.sentence.playing span {
    color: #222 !important;
}

.sentence.completed {
    opacity: 0.7;
}

/* ===========================================
   8. UTILITY CLASSES
   =========================================== */

.closing-flourish {
    text-align: center;
    margin-top: 80px;
    color: #666;
    font-size: 1.2em;
    letter-spacing: 4px;
}

/* ===========================================
   9. FULLSCREEN CONTROL BUTTONS
   =========================================== */

/* Fullscreen entry button (shows when NOT in fullscreen) */
.fullscreen-entry-btn {
    position: fixed;
    top: 20px;
    right: 80px;
    z-index: 10001;
    width: 50px;
    height: 50px;
    background: rgba(30, 37, 48, 0.9);
    border: 2px solid #ffa726;
    border-radius: 50%;
    color: #ffa726;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.fullscreen-entry-btn:hover {
    background: rgba(255, 167, 38, 0.2);
    transform: scale(1.1);
    opacity: 1 !important;
}

.exit-fullscreen-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    width: 50px;
    height: 50px;
    background: rgba(30, 37, 48, 0.9);
    border: 2px solid #ffa726;
    border-radius: 50%;
    color: #ffa726;
    font-size: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.exit-fullscreen-btn:hover {
    background: rgba(255, 167, 38, 0.2);
    transform: scale(1.1);
    opacity: 1 !important;
}

/* ===========================================
   11. CLICKABLE CHOICE OPTIONS
   =========================================== */

/* Make clickable option text WHITE to show it's interactive */
.choice-link .narrator-intro {
    color: #ffffff !important;
    font-style: normal !important;
}

/* ===========================================
   12. CONTINUOUS PLAY INDICATOR - WITH PULSE
   =========================================== */

.continuous-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 10px 20px;
    background: rgba(78, 205, 196, 0.9);
    color: #000;
    border-radius: 20px;
    font-weight: bold;
    display: none;
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.5);
}

.continuous-indicator.active {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Pulse only the icon in the indicator */
.continuous-indicator .indicator-icon {
    animation: pulse-indicator 1.5s ease-in-out infinite;
}

@keyframes pulse-indicator {
    0%, 100% { 
        opacity: 0.7;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.15);
    }
}

/* ===========================================
   13. VOCABULARY TOOLTIP STYLES
   =========================================== */

.vocab-tooltip-hyama {
    position: fixed;
    background: #1a1a1a;
    border: 2px solid #ff6600;
    border-radius: 6px;
    padding: 8px 12px;
    display: none;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(255,102,0,0.3);
    min-width: unset;      /* Remove min-width */
    max-width: 300px;      /* Optional: allow longer translations */
    pointer-events: none;
    width: max-content;    /* Make width fit content */
    text-align: center;    /* Center the text inside */
}

.vocab-translation-hyama {
    color: #ffffff;
    font-size: 0.95em;
    line-height: 1.2;
    font-weight: 500;
}

/* Highlight for separated phrases */
.vocab-highlighted {
    background: rgba(255, 102, 0, 0.25);
    border-radius: 3px;
    padding: 0 2px;
}

/* Computer message styling */
.computer-message {
    background: rgba(78, 205, 196, 0.1);
    border-left: 3px solid rgba(78, 205, 196, 0.5);
    border-radius: 6px;
    padding: 15px 20px;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
}
.computer-message .story-paragraph {
    margin-top: 0;
}

/* Logbook entry styling */
.logbook-entry {
    background: rgba(78, 205, 196, 0.1);
    border-left: 3px solid rgba(78, 205, 196, 0.5);
    border-radius: 6px;
    padding: 15px 20px;
    margin: 20px 0;
}

.logbook-header {
    color: #4ecdc4;
    font-weight: 500;
    font-size: 1.05em;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.logbook-entry .story-paragraph {
    margin-top: 0;
}

/* Diary entry styling (same as logbook) */
.diary-entry {
    background: rgba(78, 205, 196, 0.1);
    border-left: 3px solid rgba(78, 205, 196, 0.5);
    border-radius: 6px;
    padding: 15px 20px;
    margin: 20px 0;
}

.diary-entry .story-paragraph {
    margin-top: 0;
}

/* State indicator overlay - positioned higher */
.state-indicator-overlay {
    position: fixed;
    top: 20%;  /* Position from top */
    left: 50%;
    transform: translateX(-50%);  /* Only center horizontally */
    background: #ffa726;
    color: #1a1f2e;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(255, 167, 38, 0.6);
    pointer-events: none;
    z-index: 100000;
    opacity: 1;
    transition: all 0.3s ease;
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    0% { 
        opacity: 0; 
        transform: translateX(-50%) scale(0.8); 
    }
    100% { 
        opacity: 1; 
        transform: translateX(-50%) scale(1); 
    }
}

   /* ============================================
   16. SPEED CONTROL SYSTEM - FLOATING SIDEBAR
   ============================================ */

/* Floating speed sidebar - moved to right side */
.speed-sidebar {
    position: fixed !important;
    left: calc(50% - 410px) !important;
    top: 60% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    z-index: 99999 !important;
    transition: left 0.3s ease, all 0.3s ease;
    cursor: pointer;
}

/* ============================================
   17. TABLE OF CONTENTS SIDEBAR
   ============================================ */

/* TOC Sidebar */
.toc-sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    width: 300px;
    height: 100vh;
    background: rgba(30, 37, 48, 0.95);
    border-right: 2px solid #ffa726;
    z-index: 99998;
    transition: left 0.3s ease;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.toc-sidebar.show {
    left: 0;
}

.toc-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 167, 38, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(30, 37, 48, 0.98);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.toc-header h3 {
    color: #ffa726;
    font-size: 1.5em;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 300;
    letter-spacing: 1px;
    margin: 0;
}

/* Shortcuts button inside TOC */
.toc-shortcuts-section {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 167, 38, 0.2);
    position: sticky;
    top: 70px;
    background: rgba(30, 37, 48, 0.98);
    z-index: 9;
    backdrop-filter: blur(10px);
}

.shortcuts-info-btn-inline {
    width: 100%;
    padding: 10px 15px;
    background: rgba(78, 205, 196, 0.1);
    border: 1px solid rgba(78, 205, 196, 0.3);
    border-radius: 8px;
    color: #4ecdc4;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.shortcuts-info-btn-inline:hover {
    background: rgba(78, 205, 196, 0.2);
    border-color: #4ecdc4;
}

/* Hide on mobile */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .toc-shortcuts-section {
        display: none !important;
    }
}

.toc-close-btn {
    background: none;
    border: none;
    color: #ffa726;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.toc-close-btn:hover {
    transform: scale(1.2);
}

.toc-content {
    padding: 20px 0;
    padding-bottom: 180px; /* Extra space for install button + browser nav on mobile */
}

.toc-item {
    display: block;
    padding: 14px 20px;
    color: #e0e0e0;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1.1em;
    border-left: 3px solid transparent;
    line-height: 1.4;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 300;
}

.toc-item:hover:not(.disabled) {
    background: rgba(255, 167, 38, 0.1);
    padding-left: 25px;
}

.toc-item.active {
    background: rgba(255, 167, 38, 0.2);
    border-left-color: #ffa726;
    color: #ffa726;
    font-weight: 500;
}

.toc-item.disabled {
    color: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Focused state for keyboard navigation */
.toc-item.toc-focused {
    background: rgba(255, 167, 38, 0.3);
    padding-left: 25px;
    outline: 2px solid #ffa726;
    outline-offset: -2px;
}

/* Install button - floats at bottom of screen when TOC is open */
.toc-install-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 300px;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 20px; /* Match TOC item padding */
    border-top: 1px solid rgba(255, 167, 38, 0.2);
    color: #e0e0e0;
    text-decoration: none;
    font-size: 1.1em;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 300;
    cursor: pointer;
    transition: background 0.2s ease;
    background: rgba(30, 37, 48, 0.98);
    backdrop-filter: blur(10px);
    border-left: none;
    border-right: none;
    border-bottom: none;
    z-index: 99999; /* Above TOC sidebar */
}

.toc-install-btn:hover {
    background: rgba(255, 167, 38, 0.2);
}

/* Show install button ONLY when TOC is open AND button has .show class */
.toc-sidebar.show ~ .toc-install-btn.show {
    display: flex;
}

.toc-install-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* TOC Toggle Button */
.toc-toggle-btn {
    position: fixed;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(30, 37, 48, 0.9);
    border: 2px solid #ffa726;
    border-radius: 50%;
    color: #ffa726;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99997;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 0;
    padding: 0;
    padding-bottom: 2px;
}

.toc-toggle-btn:hover {
    background: rgba(255, 167, 38, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.toc-toggle-btn.active {
    left: 310px;
}

/* ============================================
   18. KEYBOARD SHORTCUTS POPUP
   ============================================ */

/* Shortcuts button moved inside TOC sidebar - old standalone button removed */

/* Shortcuts Popup */
.shortcuts-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(30, 37, 48, 0.98);
    border: 2px solid #4ecdc4;
    border-radius: 15px;
    padding: 30px;
    z-index: 100001;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    min-width: 400px;
    max-width: 500px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.shortcuts-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(78, 205, 196, 0.3);
}

.shortcuts-header h3 {
    color: #4ecdc4;
    font-size: 1.3em;
    font-weight: 400;
    margin: 0;
    letter-spacing: 1px;
}

.shortcuts-close-btn {
    background: none;
    border: none;
    color: #4ecdc4;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.shortcuts-close-btn:hover {
    transform: scale(1.2);
}

.shortcuts-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 0;
    color: #e0e0e0;
    font-size: 0.95em;
}

.shortcut-item kbd {
    background: rgba(78, 205, 196, 0.2);
    border: 1px solid rgba(78, 205, 196, 0.5);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.9em;
    color: #4ecdc4;
    min-width: 80px;
    text-align: center;
    display: inline-block;
}

/* Ensure speed sidebar moves when TOC is open */
.speed-sidebar.collapsed.toc-open {
    left: calc(50% + 410px) !important;
}

/* Also move it in browser mode */
body:not(.in-pwa-mode) .speed-sidebar.collapsed.toc-open {
    left: calc(50% + 410px) !important;
}

.speed-sidebar:hover {
    border-color: #ff8f00;
 }

/* Collapsed state - only shows current speed */
.speed-sidebar.collapsed {
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    left: calc(50% - 412px) !important; /* Moved 10px to the left */
}

/* Align with TOC toggle in browser mode only */
body:not(.in-pwa-mode) .speed-sidebar.collapsed {
    left: 26px !important; /* Aligned with TOC toggle at 30px */
}

.speed-sidebar.collapsed .speed-options {
    display: none !important;
}

.speed-sidebar.collapsed .current-speed {
    display: block !important;
    color: #000 !important;
    background: #ffa726 !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold !important;
    font-size: 0.7em !important;
}

/* Expanded state - shows all options vertically */
.speed-sidebar.expanded {
    width: auto !important;
    height: auto !important;
    padding: 8px !important;
    background: rgba(30, 37, 48, 0.9) !important;
    border: 1px solid rgba(255, 167, 38, 0.2) !important;
    border-radius: 25px !important;
}

.speed-sidebar.expanded .current-speed {
    display: none;
}

.speed-sidebar.expanded .speed-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Speed option buttons */
.speed-option-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(78, 205, 196, 0.1);
    border: 2px solid rgba(78, 205, 196, 0.3);
    color: #4ecdc4;
    font-size: 0.7em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speed-option-btn:hover {
    background: rgba(78, 205, 196, 0.3);
    transform: scale(1.1);
    border-color: #4ecdc4;
}

.speed-option-btn.active {
    background: #ffa726;
    border-color: #ff8f00;
    color: #000;
    box-shadow: 0 0 10px rgba(255, 167, 38, 0.4);
}

/* Speed indicator badge (shows when speed changes) */
.speed-change-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 37, 48, 0.95);
    border: 2px solid #4ecdc4;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    color: #4ecdc4;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 9999;
}

.speed-change-indicator.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* Touch feedback */
.speed-option-btn:active {
    transform: scale(0.95);
}

/* ============================================
   INTERACTION OVERLAY SYSTEM
   ============================================ */

.interaction-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at center, #1a1f2e 0%, #0f1419 100%);
    color: #e8e8e8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.interaction-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.interaction-title {
    font-size: 3em;
    color: #ffa726;
    font-weight: 200;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.interaction-subtitle {
    font-size: 1.3em;
    color: #e0e0e0;
    font-weight: 300;
    margin-bottom: 40px;
    opacity: 0.9;
}

.start-button {
    background: linear-gradient(135deg, #ffa726 0%, #ff8f00 100%);
    border: none;
    color: #1a1f2e;
    font-size: 1.2em;
    font-weight: bold;
    padding: 18px 40px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255, 167, 38, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 167, 38, 0.6);
    background: linear-gradient(135deg, #ff8f00 0%, #ffa726 100%);
}

.start-button:active {
    transform: translateY(-1px);
}

.interaction-instructions {
    margin-top: 30px;
    font-size: 0.9em;
    color: #999;
    line-height: 1.6;
}

/* Mobile install instructions */
.install-instructions {
    background: rgba(255, 167, 38, 0.1);
    border: 2px solid #ffa726;
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.install-instructions h3 {
    color: #ffa726;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.4em;
}

.install-instructions ol {
    color: #e0e0e0;
    margin: 20px 0;
    padding-left: 25px;
    font-size: 1.1em;
    line-height: 1.8;
}

.install-instructions li {
    margin: 10px 0;
}

/* Fullscreen entry button styling */
.fullscreen-entry-btn {
    position: fixed;
    top: 20px;
    right: 80px;
    z-index: 10001;
    width: 50px;
    height: 50px;
    background: rgba(30, 37, 48, 0.9);
    border: 2px solid #ffa726;
    border-radius: 50%;
    color: #ffa726;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.fullscreen-entry-btn:hover {
    background: rgba(255, 167, 38, 0.2);
    transform: scale(1.1);
}

/* Hide buttons for standalone PWA only */
@media (display-mode: standalone) {
    .exit-fullscreen-btn {
        display: none !important;
    }
    
    .fullscreen-entry-btn {
        display: none !important;
    }
    
    .story-fullscreen-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for mobile */
    }
}

/* Ensure full height on iOS PWA */
.standalone .story-fullscreen-container {
    height: 100vh !important;
    height: -webkit-fill-available !important;
}
/* Color-Coded Choice Options - Clean version */
.choice-link {
    display: block !important;
    margin: 20px 0 !important;
    padding: 25px 30px !important;
    text-decoration: none !important;
    color: #fff !important;
    font-size: 1.1em !important;
    border-radius: 12px !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    transform: none !important;
    box-shadow: none !important;
    line-height: 1.6 !important;
}

.choice-link:hover {
    transform: translateX(3px) !important;
}

/* Dangerous choice - Red theme */
.choice-dangerous {
    background: #4a1f1f !important;
    border: 1px solid #ff4444 !important;
}

/* Cautious choice - Teal theme */
.choice-cautious {
    background: #1f3a4a !important;
    border: 1px solid #4ecdc4 !important;
}

/* Bureaucratic choice - Orange theme */
.choice-bureaucratic {
    background: #3a3a1f !important;
    border: 1px solid #ffa726 !important;
}

/* Greedy choice - Gold/yellow theme */
.choice-greedy {
    background: #4a3a10 !important;
    border: 1px solid #ffeb3b !important;
    border-left: 3px solid #ffeb3b !important;

}

/* Hide arrows */
.choice-arrow {
    display: none !important;
}

/* Fix choice link sentence highlighting */
.choice-link .sentence.playing {
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Apply highlighting to text span only inside choice links */
.choice-link .sentence.playing .choice-link-text {
    background: #ffa726 !important;
    color: #222 !important;
    padding: 2px 0 !important;  /* Only vertical padding */
    margin: -2px 0 !important;
    box-shadow: 12px 0 0 #ffa726, -12px 0 0 #ffa726 !important;  /* Fake horizontal padding */
    border-radius: 6px !important;
    display: inline !important;
    box-decoration-break: clone !important;
    -webkit-box-decoration-break: clone !important;
    word-wrap: break-word !important;
    max-width: 78% !important;
}

/* Retreat choice - Blue theme */
.choice-retreat {
  background: #234a7d !important;
  color: #e6f0fa !important;
  border: 1px solid #5b8fd6 !important;
  border-left: 4px solid #5b8fd6 !important;
}

/* Alternate storyline - Purple theme */
.choice-alternate {
  background: #3d2a4a !important;
  color: #f0e6fa !important;
  border: 1px solid #9b59b6 !important;
  border-left: 4px solid #9b59b6 !important;
}

/* ============================================
   MOBILE BROWSER MODE — TOC toggle deeper
   Installed PWA keeps 38px, browser gets 52px
   ============================================ */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  html:not(.standalone) .toc-toggle-btn {
    bottom: 40px !important; /* adjust until visually aligned */
    top: auto !important;
    transform: none !important;
  }
}

/* ============================================
   MOBILE BROWSER MODE – Hide fullscreen button
   Not relevant in browser, users must install
   ============================================ */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  html:not(.standalone) .fullscreen-entry-btn {
    display: none !important;
  }
}

/* ============================================
   HIGHLIGHT FIXES – choice links
   ============================================ */

/* DESKTOP ONLY - COMMENTED OUT, interfering with padding
@media (min-width: 769px) {
  .choice-link .sentence.mobile-selected .choice-link-text,
  .choice-link .sentence.playing,
  .choice-link .sentence.playing .choice-link-text {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}
*/

/* Hide fullscreen buttons when in PWA mode (installed app) */
.in-pwa-mode .fullscreen-entry-btn,
.in-pwa-mode .exit-fullscreen-btn {
    display: none !important;
}

/* ============================================
   DESKTOP CONTROL BAR - Fixed bottom-right
   ============================================ */

.desktop-control-bar {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 12px;
    background: rgba(30, 37, 48, 0.95);
    border: 2px solid #ffa726;
    border-radius: 50px;
    padding: 10px 15px;
    z-index: 99996;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.control-bar-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 167, 38, 0.3);
    background: rgba(78, 205, 196, 0.1);
    color: #4ecdc4;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: bold;
}

.control-bar-btn:hover {
    background: rgba(78, 205, 196, 0.3);
    border-color: #4ecdc4;
    transform: scale(1.1);
}

.control-bar-btn:active {
    transform: scale(0.95);
}

/* Play button special styling */
.play-btn-control {
    background: rgba(255, 167, 38, 0.2);
    border-color: #ffa726;
    color: #ffa726;
    position: relative;
}

.play-btn-control:hover {
    background: rgba(255, 167, 38, 0.4);
    border-color: #ff8f00;
}

/* Single sentence mode indicator (desktop) */
.play-btn-control.play-mode-single::after {
    content: "1";
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ffa726;
    color: #000;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Speed button smaller text */
.speed-btn-control {
    font-size: 14px;
    font-weight: bold;
}

/* Hide on mobile - ONLY based on screen size, not touch capability */
@media (max-width: 768px) {
    .desktop-control-bar {
        display: none !important;
    }
}

/* ============================================
   CUSTOM FONT FACE
   ============================================ */

@font-face {
    font-family: 'Smartergerman';
    src: url('Smartergerman-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

.logo-smartergerman {
    font-family: 'Smartergerman', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    color: #ffa726;
    font-size: 20px;
    font-weight: normal;
    letter-spacing: 1px;
    margin-bottom: 15px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.logo-smartergerman:hover {
    color: #ff8f00;
    text-shadow: 0 0 8px rgba(255, 167, 38, 0.5);
}