

/* ------------------------ main page look -----------------------------*/   
        body {
            margin: 0;
            padding: 10px; 
            background-color: #0A0A29 !important; 
            color: white; 
            display: flex;
            flex-direction: column;
            align-items: center; 
            min-height: 95vh; 
            width: 100%;
            box-sizing: border-box; 
        }


*, *:before, *:after {
    box-sizing: border-box !important;
}
       
      html, body {
           overflow-x: hidden;
           width: 100%;    
           scroll-behavior: auto !important;
} 

p {
            text-align: justify;
            max-width: 100% !important;

        }

a { 
            text-align: justify;
            max-width: 100% !important;
}

/* ---- Specific Font Classes----- */
#bookContent.font-andika {
    font-family: 'Andika', sans-serif !important;
}

#bookContent.font-serif {
    font-family: 'Georgia', serif !important;
}


.top-nav { 
/* makes room above for the settings dropdown menu */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    display: flex;
    flex: 0 0 40px; 
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}



/*  ------------------------------image styling  ---------------------------------------------- */
     
   img {
            padding: 0px;
            justify-content: center;
            max-width: 100%;
            height: auto; 
            display: block;
            }

.cover-img {   /* this works, don't touch! */
    display: block !important;
    max-height: 100% !important; 
    max-width: 90% !important;
    margin: 0 auto !important;
    padding-top: 7vh !important; 
    break-after: column !important;
    -webkit-column-break-after: column !important; 
    object-fit: contain !important;
}      

     
           
/* --------------------the ereader --------------------------------*/
/* the nested order of div classes is: .background-image .reader-container #book-viewport #bookContent */

.background-image {  /*applies to both desktop and mobile versions*/

            width: 100%;
            height: 100%;
            background-image: url("images/galaxy3.png");  
            background-attachment: fixed;
            background-repeat: no-repeat;
            background-size: 94% auto;
            background-position: top center;
            display: flex;
            flex-direction: column; 
            align-items: center; 

        }

.reader-container {

    display: block !important;
    width: 40vw !important; 
    height: 95vh !important;
    margin: 0 auto !important;
    overflow: hidden !important; 
    position: relative !important;
    background-color: rgba(10, 10, 41, 0.85);
    box-sizing: border-box;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    min-width: 40vw !important;
    max-width: 1200px;
    transition: none !important;
    transform: none !important;
    animation: none !important;
 
       }


#book-viewport {

    margin-top: 50px;
    height: calc(100vh - 70px);
    overflow: hidden !important;
    position: relative;
    width: 40 vw !important;    
    min-width: 100% !important;
    max-width: 100vw;  
    display: block !important;
    overscroll-behavior-x: none; /* Stops the "bounce" effect on mobile swipes */
    touch-action: pan-y;  /* Allows vertical scrolling for menus but takes over horizontal */
    }


#bookContent {

    width: 100%;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 100% !important;
    max-height: 85% !important; 
    gap: 0 !important; 
    text-align: left !important;
    column-gap: 0; 
    column-rule: 0px none transparent;
    column-fill: auto;   
    column-width: 40vw !important;
    transform: translateX(0);
    break-before: column !important;
    -webkit-column-break-before: always !important;
    scroll-margin-top: 5vh;  
    box-sizing: border-box !important;
    text-rendering: optimizeSpeed; 
    backface-visibility: hidden;
    overflow-wrap: break-word;
    scroll-snap-align: start !important;
    scroll-snap-stop: always !important;
    text-rendering: optimizeLegibility !important;
    overflow: visible !important;

    }

#bookContent h1, #bookContent p {
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    width: 100%; 

}


html, body, .reader-container, #bookContent {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}


.title-page-anchor { /* allows the intro pages to have different settings from the book pages */
    display: flex !important;
    flex-direction: column !important; 
    justify-content: center !important; 
    align-items: center !important;     
    height: 70vh !important; 
    width: 100% !important;
    min-height:10px;   
    break-before: avoid !important;
    break-after: avoid !important;
    overflow: hidden !important; 
    margin: 0 auto !important;

}


.title-page-anchor, .title-page-anchor * {
    font-family: inherit !important;
    font-size: inherit !important;
}

.title-page-anchor p {
    font-size: 0.85rem !important; 
    line-height: 1.5 !important;
    color: #777 !important;
    max-width: 100% !important;
    margin: 5px 0 !important;

}

     

/* ---------------------------------------ebook look ----------------------------------*/

/*----------- title/intro page anchor elements ---------------------------*/
  
.book-title {
    
    font-size: 3rem !important; 
    font-family: "Georgia", serif !important;
    font-weight: bold !important;
    color: #FFFFFF !important;
    text-align: center;
    line-height: 1.1 !important; 
  }

.book-author {
    
    display: block !important;
    width: 50% !important;
    font-size: 1.5rem !important;
    font-family: "Georgia", serif !important;
    font-style: italic !important;
    color: #FFFFFF !important;
    text-align: center;
    line-height: 1.2 !important;  
    padding: 15px 0 !important; 
    margin: 0 auto !important;
    margin-bottom: 10rem !important;
    break-inside: avoid-column !important;
    box-sizing: border-box !important;
}

.book-info {
    display: block !important;
    max-width: 100% !important;
    text-align: center;
    line-height: 1.2 !important;  
    padding: 15px 0 !important;               
}

.book-info p {
    display: block !important;
    max-width: 100% !important;
    text-align: center;
    font-weight: bold !important;
    font-family: "Georgia", serif !important;
    font-size: 1.2rem !important;
    line-height: 1.2 !important;
    margin-top 40px  !important;               
}


.legal-text {
    margin-top: 30px; 
    max-width: 80% !important;
}


.legal-text p {
    font-size: 0.85rem !important; /* Smaller text for legalities */
    line-height: 1.5 !important;
    color: #777;
    max-width: 100% !important;
    margin: 5px 0 !important;
}


/*  -----------------rest of book -------------------------- */

.chapter-title { 
    
    display: block !important;
    text-align: center !important;
    font-weight: bold !important;    
    font-family: "Georgia", serif !important;
    font-size: 1.5rem !important;
    line-height: 1.2 !important;      
    width: 100% !important;
    margin-bottom: 10rem !important; 
    break-before: column !important;
    -webkit-column-break-before: always !important;
    break-after: avoid !important; 
    margin-top: 0 !important; 
    max-width: 100% !important;
}

.mobile-force-redraw {
    letter-spacing: 0.01px !important;
    opacity: 0.99 !important;
}

.contents-title {  /* for non chapter pages */
    
    break-before: column !important;
    -webkit-column-break-before: always !important;
    break-after: avoid !important; 
    display: block !important;
    text-align: center !important;
    font-weight: bold !important;
    font-family: "Georgia", serif !important;
    font-size: 1.5rem !important;
    line-height: 1.2 !important;
    color: #FFFFFF !important;
    width: 100% !important;
    break-before: column !important;
    
    }

P .chlink {
    display: block;
    font-family: "Arial", serif;
    font-size: 0.83333em;
    margin-bottom: 0;
    width: 100%
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0
    }
    
#bookContent .text_block {
    display: block !important;
    width: 100% !important;
    margin-top: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    padding: 0 40px !important;  
    max-width: 100% !important;
    line-height: 1.7;
margin-bottom: 1.2em !important; /* adjusts spacing between paragraphs */
    hyphens: auto;
    text-align: justify;
    break-inside: avoid-column;
    orphans: 2;
    widows: 2;
    font-size: inherit !important;
   -webkit-text-size-adjust: none !important;
}



#bookContent .text_block p {
    padding: 0 !important;
    box-sizing: border-box !important;

}

/* --Paragraph formatting -- */

p {
            text-align: justify;

        }

.page-break {
    break-after: column !important;
    display: block;
    max-width: 50%; !important;
}

.andscene {  /* ---scene breaks-- */
   
    display: block !important;
    text-align: center !important;
    margin: 1em 0 !important;
    font-family: "Georgia", serif !important;
    font-size: 1.2rem !important;
    letter-spacing: 0.7em !important; /* Spreads the asterisks out */
    color: #FFFFFF !important;
    width: 100% !important;
    clear: both !important;
    break-inside: avoid !important;
    -webkit-column-break-inside: avoid !important;
  
    }

    

/*------------------------------navigation buttons --------------------------------------------------------- */
       
#backButton, #nextButton {
    position: fixed;
    top: 50%;
    width: 60px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(64, 70, 92, 0.02);
    color: rgba(64, 70, 92, 0.2);
    border: 1px solid rgba(64, 70, 92, 0.1);
    border-radius: 12px;
    transition: none !important;
    transform: translate(-50%, -50%);
    pointer-events: auto !important; /* Forces clickability */
    cursor: pointer !important; 
}


#backButton {
    /* Pushes button to center, then back 20vw */
    left: calc(50% - 20vw); 
    right: auto; 
}

#nextButton {
    /* Pushes button to center, then forward 20vw */
    left: calc(50% + 20vw);
    right: auto;
}

#backButton:hover, #nextButton:hover {
    background-color: rgba(64, 70, 92, 0.6) !important; 
    color: white !important;
    transform: translate(-50%, -50%) !important;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

/* ----------page counter --------------- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    top: 15px !important;
    padding: 10px 20px;
    }

#page-progress {
    font-family: sans-serif; 
    font-weight: bold;

font-size: 0.9rem;
    color: #72727c; /* Match your nav-button color */
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums; /* Prevents numbers from 'wiggling' when they change */
    opacity: 0.8;
}
/* ----------extra pages --------------- */

.insert-page { /*for bookinserts.html, author page and more works */
    /* Use 'break-before' to ensure it starts on a fresh page in e-readers */
    break-before: page; 
    padding: 10% 0;
    min-height: 80vh; /* Ensures it feels like a full page */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.author-quote {
    font-family: sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    border: none;
    margin-bottom: 2rem;
}

.insert-text {
    font-family: sans-serif;
    max-width: 600px; /* Keeps line length readable in the center */
    line-height: 1.6;
}


/* ------------------------------------settings menu ----------------------------*/
  

 #settingsToggle {
    position: fixed !important;
    top: 15px !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    right: 20px !important;
    z-index: 1000 !important;
    color: #72727c !important; /* color cog */
    font-size: 24px !important;
    cursor: pointer !important;
    transition: none !important;
    transform: none !important;
}

#settingsToggle:hover i,
#settingsToggle i {
    transform: none !important;
    transition: none !important;
}

#settings-sidebar {
    position: fixed !important;
    top: 60px !important;
    right: 20px !important;
    width: 210px !important;
    height: auto !important;
    background-color: #1b1648 !important;
    z-index: 9999 !important;
    border-radius: 8px !important;
    /* Remove all animations/transitions */
    display: none !important; 
    box-shadow: 0 10px 30px rgba (0,0,0,0.5) !important;
    overflow-y: auto !important;
    overflow: visible !important;
    padding: 20px !important;
    display: none;
    transition: none !important;
    }


#settings-sidebar.open {
    display: block !important;
}

#settings-sidebar button:not(.cog-icon) {
    font-size: 14px;       
    padding: 15px 25px;    
    margin-bottom: 10px;   
    width: 90%;            
    cursor: pointer;
}


#settingsToggle .fa-times {
    color: #ff4d4d; 

}

    .font-controls { 
            text-align: center;
            margin-top: 20px;
            margin-bottom: 20px; 
            position: fixed;
            top: 60px; 
            right: 20px;
            width: 280px;
            padding: 20px;
            border: 1px solid #ccc;
            box-shadow: -5px 5px 15px rgba(0,0,0,0.2);
            display: none; /* Controlled by settingsToggle JS */
            z-index: 1000;
        }
  
        .font-controls div { 
            display: flex;
            justify-content: center;
            gap: 5px; 
            margin-top: 10px; 
        }

        .font-controls button { 
            /*padding: 8px 15px; */
            margin: 0 15px;
            cursor: pointer;
            background-color: #40465C; 
            color: white; 
            border: none;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }

      .font-controls button:hover {
            background-color: #555c7a; 
        }

.home-link {
    display: flex !important;
    justify-content: space-between !important; 
    align-items: center !important;
    width: 100% !important;
    white-space: nowrap !important;
    padding: 8px 20px;
    text-decoration: none;
    justify-content: center !important;
    text-align: center;
    background-color: #40465c; 
    color: white !important;
    border: 1px solid #000;
    border-radius: 5px;
    margin-bottom: 10px;
    font-weight: bold;
    box-sizing: border-box;
    
}

.home-link:hover {
    background-color: #2c3143;
}

.centered-image { 
            display: block;
            margin: 20px auto; 
            max-width: 80%;
            max-height: 80%; 
            height: auto; 
            object-fit: contain; 
            border-radius: 5px; 
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); 
        }

#tocButton {
    width: 100%;
    margin-top: 10px;
    background-color: #f0f0f0; 
    border: 1px solid #ccc;
    padding: 8px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#tocButton:hover {
    background-color: #e0e0e0;
}

#tocToggle {
    display: flex !important;
    justify-content: space-between !important; 
    align-items: center !important;
    white-space: nowrap !important;
    width: auto !important;
    padding: 8px 15px;
}

#tocChevron {
    font-size: 0.8em; 
    transition: none !important; 
}

.reset-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #bdc3c7; /* Subtle grey */
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
    /*padding: 5px 0;*/
}

.reset-link:hover {
    color: #e74c3c; /* Turns red when hovering to signal 'Reset' */
}

#toc-panel {
    position: absolute;
     right: 0;  /*  Aligns the right edge with the button */
    top: 100%;    /* Sits exactly below the button */
    width: 350px !important; /* 350 Set your preferred width here */
   box-sizing: border-box;
 max-width: 85vw;
    max-height: 300px;  /* Adds scrolling */
    left: auto;
    display: none;
    overflow-y: auto;

    display: none;
    background-color: rgba(15, 15, 50, 0.95); /* Matches your night theme */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    z-index: 10000;      /* Ensures it floats above everything else */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

#toc-panel.open {
    display: block !important;
}


#toc-panel:not(.open) {
    display: none;
}
#toc-panel ul {
    list-style: none;
    padding: 0;
}

#toc-panel li {
    margin: 10px 0;
}

.cog-icon {
   
    width: auto !important; 
    height: auto !important;
    margin: 0 !important;
    padding: 20px !important;
    z-index: 1100 !important; 
    position: fixed;
    top: 10px;
    right: 10px;
    background: transparent !important;
    box-sizing: border-box;
    border: none !important;
    font-size: 26px !important;    
    cursor: pointer;
}

#settings-sidebar h3, #settings-sidebar label {
    display: block;
    margin-top: 20px;
    text-align: center !important;
    font-weight: bold;
    color: inherit;        
}

.toc-submenu {
    display: none; 
    margin-top: 10px;
    padding-left: 10px;
    border-left: 1px solid #2ecc71;
}

.toc-submenu.active {
    display: block;

}

#toc-submenu a {
    padding-left: 30px !important; 
    font-size: 0.9em;        
      }


.control-group {
width: 95%;
margin: 10px;
box-sizing: border-box;
}


.toc-item {
    font-size: 0.9rem;
    padding: 8px;
    color: #bbb;
    display: block;
    text-decoration: none;
}

.toc-item:hover {
    color: #2ecc71;
}


.control-button.open #tocChevron {
    display: inline-block;
   /* position: fixed !important;*/
   /* top: 20px !important;  */       
   /* bottom: auto !important;   */   
   /* right: 10px !important;   */    
    z-index: 10001 !important;    
    padding: 10px 15px;
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    font-weight: bold;
}

.toc-ghost {
    display: none !important;
    visibility: hidden;
    height: 1px;
    width: 0;
    margin: 0;
    padding: 0;
    position: absolute;
}


.control-button {
    display: flex;
    justify-content: center;
    align-items: center !important;
    width: 100%;
    background: #0A0A29;
    color: white;
    border: 1px solid #000;
    cursor: pointer;
    text-align: center;
    border-radius: 4px;
    z-index: 1000 !important;
    position: relative; 
    touch-action: manipulation; 
    margin: 15px 0;
    box-sizing: border-box;

}

.control-button:hover {
    background: #444;
    }

.button-stack {
position: relative;
display: flex !important;
}

/* This handles the ROW container for any 2-button setup */
.button-stack, .button-stack2 { 
    
display: flex !important;
    flex-direction: row !important; 
    width: 100% !important;
    gap: 10px !important;         /* Consistent gap between buttons */
    margin-bottom: 10px !important;
    box-sizing: border-box !important;
    justify-content: center !important;
}

/* This handles the BUTTONS inside those rows */
.button-stack .control-button, 
.button-stack .home-link,
.button-stack2 .control-button {
    flex: 1 !important;           /* They share the space 50/50 */
    display: flex !important;      
    justify-content: center !important;
    align-items: center !important;   
    white-space: nowrap !important; /* Prevents text from jumping to a second line */
    
    padding: 10px 5px !important;  /* Balanced padding */
    border: 1px solid #000;
    border-radius: 4px;
    background: #0A0A29;           /* Matches your theme */
    color: white !important;
    text-decoration: none !important;
    margin: 0 !important;          /* Let 'gap' do the work */
    box-sizing: border-box !important;
}
.settings-icon {
    position: fixed !important; 
    top: 20px !important;             
    right: 20px !important;        
    left: auto !important;         
    z-index: 10001;               
    padding: 10px 10px;
    background: #000000;              
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 4px 4px rgba(0,0,0,0.3);
}

#toc-list {
    max-height: 300px; 
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px;
}

/* Sidebar TOC Buttons */
.toc-main-title {
    background: none;
    border: none;
    color: #5f4b32;
    font-weight: bold;
    text-align: left;
    padding: 10px 5px;
    font-size: 1.1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(95, 75, 50, 0.2);
}

.toc-chapter-sub {
    background: none;
    border: none;
    color: #5f4b32;
    text-align: left;
    padding: 5px 5px 5px 20px; /* Indent the sub-chapters */
    font-size: 0.95rem;
    font-style: italic;
    cursor: pointer;
    opacity: 0.8;
}

.toc-main-title:hover, .toc-chapter-sub:hover {
    opacity: 1;
    text-decoration: underline;
}

.toc-entry {
    display: block;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 5px;
    text-align: left;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.toc-entry:hover {
    background: rgba(255,255,255,0.1);
}

/* Remove the border from the very last item for a cleaner look */
.toc-entry:last-child {
    border-bottom: none;
}

/* ------------------------------ end settings menu ----------------------------------- */
/* ---------for in story text message scenes ----*/
.dialog {
    display: flex;
    flex-direction: column;
    width: 88%;
    max-width: 650px;
    margin: 35px auto;
    border: 1px solid rgba(128, 128, 128, 0.25); 
    border-radius: 8px; /* Slightly rounded corners for a clean look */
    padding: 15px 5px;
    background-color: rgba(128, 128, 128, 0.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);      
    break-inside: avoid;
    break-inside: auto !important;
    -webkit-column-break-inside: auto !important;
}

.line {
    display: grid;
    grid-template-columns: 85px 1fr; /* px is the width of the first column */
    gap: 12px;
    padding: 5px 15px;
    align-items: start;
    font-family: sans-serif;
    font-size: 0.85em; 
    line-height: 1.4;
    letter-spacing: 0.2px;
}

/* The Zebra Stripe */
.line:nth-child(even) {
    background-color: rgba(128, 128, 128, 0.08); /* Very subtle tint */
    border-radius: 4px;
}

.line b {
    text-align: right;
    font-size: 0.75em; /* Names slightly smaller than the speech */
    text-transform: uppercase;
    opacity: 0.65;
    font-weight: 700;
    padding-top: 2px; /* Aligns visually with the dialogue text */
}

.chat-header-banner {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-family: sans-serif;   
     opacity: 0.65;
    font-weight: 700;
     padding: 10px;
    text-transform: uppercase;
    text-align: center;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px auto;
    width: 90%;
    font-style: italic;
}

.more-books-banner {    
    text-align: center;
    font-family: sans-serif;
    font-size: 0.9rem;
   font-weight: 900;
margin-bottom: 10px !important;

    letter-spacing: 1px;
    text-transform: uppercase;
    background: rgba(25, 25, 30);     
    padding: 6px 12px;
    width: 100%; 
    opacity: 0.8;
    border: 1px solid rgba(25, 25, 30);
}

.chat-banner-row {
    /* If your .line uses grid, this makes the banner fill the whole row */
    grid-column: 1 / span 2; 
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: rgba(25, 25, 30);     
    padding: 6px 10px;
    width: 100%; 
    opacity: 0.8;
    border: 1px solid rgba(25, 25, 30);
}

.song-lyrics {
    display: block !important;
    margin: 2rem auto !important;
    width: 80%;               /* Indents it from the main text */
    font-style: italic;       /* Makes everything italics automatically */
    line-height: 1.6;
    color: inherit;           /* Keeps the theme's color (sepia/white) */
    
    /* THE IMPORTANT PART FOR YOUR PAGINATION: */
    break-inside: auto !important; 
    page-break-inside: auto !important;
}
 /* ------------------------------adjustments for MOBILE screens ----------------------------------*/
     
@media (max-width: 1024px) {


  .reader-container {
        width: 100vw !important;
        height: 100vh !important; 
        
        margin: 0 !important;
       left: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
 
#book-viewport {
    display: block !important;
    overflow: hidden !important;
    margin-top: 50px !important;
    width: 100vw !important;

    height: calc(100% - 30px) !important;
    column-count: 1 !important;
    column-gap: 0 !important;
    min-width: 100vw !important;  
    height: 95vh !important;
    position: relative !important;
    contain: paint;
}
     #bookContent {
        display: block !important;
        width: 100% !important; /* Must match reader-container */
        column-width: 95vw !important;  /* Must match width exactly */
        column-gap: 0px !important;
        margin: 0 !important;
        padding: 0 !important;
        height: 95vh !important;
        box-sizing: border-box !important;

                }

  #bookContent p, #bookContent .text_block, #bookContent .text_block p {
        width: 100% !important;
        max-width: 100% !important;
padding: 0 25px !important;
line-height: 1.8;

          }     

#bookContent .text_block {
break-inside: auto !important;
-webkit-column-break-inside: auto !important;
    
    /* Ensure there's no fixed height on the block itself */
    height: auto !important;

}

 .title-page-anchor {
        max-width: 100% !important;
        width: 100vw !important;
        height: 85vh !important;
    }
    
    .title-page-anchor .book-title, .book-author {
       max-width: 100% !important; 
       text-align: center;
          }
.dialog {
    /* If your dialogue boxes are jumping to the next page: */
    break-inside: auto !important;
    -webkit-column-break-inside: auto !important;
}

     .title-page-anchor .book-info {
        max-width: 100% !important;
        text-align: center; !important;
         }
    
            .font-controls {
                margin-top: 15px;
                margin-bottom: 15px;
            }

            .font-controls button {
                padding: 6px 12px;
                font-size: 0.9em;
            }

#backButton, #nextButton {
        /* Standardizing size for a better thumb-tap target */
        width: 50px !important; 
        height: 100px !important;
        position: fixed !important;
        top: 50% !important;
        z-index: 99999 !important;    
        transform: translate(0, -50%) !important; 
        padding: 0 !important;
        margin: 0 !important;
        -webkit-tap-highlight-color: transparent;
    }

#backButton {
        left: 2vw !important;
        right: auto !important;    
        transform: translate(0, -50%) !important;
    }

    #nextButton {
        right: 2vw !important;
        left: auto !important;
        transform: translate(0, -50%) !important;
    }

    
    #backButton:hover, #nextButton:hover {
        transform: translate(0, -50%) !important;
        background-color: rgba(64, 70, 92, 0.4) !important;
    }

#settingsToggle {
        right: 1px !important;
        transform: none;
        top: 0px !important;
        width: 60px !important;
        height: 50px !important;
        display: flex !important;
        justify-content: flex-end !important; /* Pushes the Cog to the right */
        align-items: center !important;      /* Keeps it vertically centered */
        background: transparent !important;
        border: none !important;
opacity: 0.4; /* Faded out */
    transition: opacity 0.3s ease; /* Smooth fade-in */
    }


.andscene {
  
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    text-indent: 0 !important;     
    padding-top: 1.2 rem !important;
    padding-bottom: 1.0 rem !important;
    break-inside: avoid !important;
    -webkit-column-break-inside: avoid !important;
    font-weight: bold !important;
    letter-spacing: 0.5em !important; 
    }

chlink {
  
        max-width: 100% !important;
    }

.chapter-title {
margin-bottom: 50px !important;
max-width: 100% !important;
}

.line {
       grid-template-columns: 65px 1fr; /* px is the width of the first column */
    }


.settings-icon {
    position: fixed !important; 
    top: 5px !important;        
    right: 5px !important;        
    left: auto !important;         
    z-index: 10001;         
  }
}
/* Sideways Mobile/Tablet Override */
@media screen and (max-width: 1024px) and (orientation: landscape) {
    .reader-container {
        width: 100vw !important;
       padding: 0 !important;
margin: 0 !important;
               left: 0 !important;
display: flex !important;
        flex-direction: row !important;
        width: 100vw !important;
        height: 100vh !important;
    }

    #book-viewport {
        width: 100vw !important;
        margin-top: 20px !important; /* Shorter margin for landscape */
margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100vw !important;
flex: 1 !important; /* Takes up the remaining space on the left */
        height: 100vh !important;
        margin: 0 !important;
    }

    #bookContent {
       column-width: 100vw !important; 
        width: 100% !important;
        column-gap: 0 !important;
padding: 0 !important;
    }

/* Put the "visual" margins here so the text doesn't touch the edges */
    #bookContent p, .text_block p {
        padding-left: 5vw !important;
        padding-right: 5vw !important;
        width: 90vw !important; /* This keeps the text centered within the column */
    }



}
/* -----------------------------------end mobile adjustments ---------------------------------*/


