* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    color: white;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    outline: none;
    caret-color: transparent;
}

/* Chapter Browser Styles */
.chapter-browser-tab {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgb(67 67 67 / 80%);
    backdrop-filter: blur(8px);
    padding: 8px 24px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    z-index: 110;
    transition: bottom 0.3s ease;
    color: antiquewhite;
    border: none;
}

.chapter-browser-tab:hover {
    background-color: rgba(38, 38, 38, 0.9);
}

.chapter-browser {
    position: fixed;
    bottom: -20vh; /* Start hidden */
    left: 0;
    right: 0;
    height: 20vh;
    background-color: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(8px);
    transition: bottom 0.3s ease;
    z-index: 100;
    padding: 16px;
}

.chapter-browser.open {
    bottom: 0;
}

.chapter-browser.open + .chapter-browser-tab {
    bottom: 20vh;
}

.thumbnails-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    height: 100%;
    padding: 8px;
    scroll-behavior: smooth;
}

/* Customize scrollbar for thumbnails */
.thumbnails-container::-webkit-scrollbar {
    height: 8px;
}

.thumbnails-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.thumbnails-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.thumbnails-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.thumbnail {
    height: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.thumbnail:hover {
    transform: translateY(-5px);
    opacity: 1;
}

.thumbnail.current {
    border-color: #66b3ff;
    box-shadow: 0 0 8px rgba(102, 179, 255, 0.5);
    opacity: 1;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background-color: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    gap: 2rem;
}

/*------------------ TEST BLACKHOLE --------------------*/
.home-button {
    position: relative;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: rgb(10, 10, 15);
    /* box-shadow: 0 0 30px 5px rgba(0, 78, 255, 0.4); */
    box-shadow: 0 0 0 0.3em rgba(0, 78, 255, 0.1), 0 0 0 0.6em rgba(0, 78, 255, 0.1), 0 0 0 1.2em rgba(0, 78, 255, 0.1);
    cursor: pointer;
    z-index: 1;
    transition: box-shadow 0.3s linear;
    align-self: center;
    border: solid 1px rgba(60, 185, 158, 0.8);
  }

  .home-button:hover {
    /* box-shadow: 0 0 30px 5px rgb(60 185 158); */
    box-shadow: 0 0 0 0.1em rgba(60, 185, 158, 0.2), 0 0 0 0.2em rgba(60, 185, 158, 0.15), 0 0 0 0.3em rgba(60, 185, 158, 0.1), 0 0 0 0.4em rgba(60, 185, 158, 0.1), 0 0 0 0.5em rgba(60, 185, 158, 0.1), 0 0 0 0.5em rgba(60, 185, 158, 0.1);
  }

.home-button-text {
    font-family: 'Demo', Arial, sans-serif;
    margin: 0 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color:#c7c7c7; /* #2c3e50;*/
    font-size: 14px;
    letter-spacing: 1px;
    font-weight: 500;
}
/*------------------------------------------------------*/

.header > a {
    text-decoration: none;
}

.header a:hover .navigator, 
.breadcrumb a:hover {
    color: #66b3ff;
}

.breadcrumb {
    margin-left: 16px;
    display: flex;
    gap: 8px;
    font-size: 14px;
    color: antiquewhite;
}

.breadcrumb a {
    text-decoration: underline;
    color: rgba(60, 185, 158, 0.8);
    text-transform: uppercase;
}

.breadcrumb span {
    align-self: center;
}

.separator {
	visibility: visibile;
	display: inline-block;
}

.navigator-border {
    display: inline-block;
    position: relative;
    width: 79px;
    height: 34px;
    background-color: #40868b;
    padding: 5px 5px;
    display: flex;
    align-items: center;
    opacity: 1;
    font-size: 14px;
    clip-path: polygon(10% 0, 
    90% 0, 100% 20%, 
    100% 80%, 90% 100%, 
    10% 100%, 0 80%, 
    0 20%);
}

.navigator {
    position: absolute;
    background-color: #0d1a29;
    top: 1px;
    left: 1px;
    width: 77px;
    height: 32px;
    padding: 5px 5px;
    display: flex;
    align-items: center;
    opacity: 1;
    color: antiquewhite;
    font-size: 14px;
    clip-path: polygon(10% 0, 
    90% 0, 100% 20%, 
    100% 80%, 90% 100%, 
    10% 100%, 0 80%, 
    0 20%);
}

/* Description text that appears at the end of reading */
/*--------------- test prompt message ----------------------*/
.navigator-footer {
    position: fixed;
    top: 50px;
    left: 20px;
    /* background-color: rgba(19, 34, 64, 0.9); */
    background-color: #0d1a29;
    padding: 15px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.5s ease;
    /* border: 1px solid rgba(0, 198, 255, 0.3); */
    border: 1px solid #40868b;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 900;
}

.navigator-footer.show {
    transform: translateY(0);
    opacity: 1;
}

.footer-icon {
    /* color: #00c6ff; */
    color: #3bd8a9;
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.footer-text {
    /* color: #e1e1e6; */
    color: antiquewhite;
    font-size: 14px;
    max-width: 220px;
}

.close-footer {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 18px;
    margin-left: 10px;
    transition: color 0.3s ease;
}

.close-footer:hover {
    color: #ffffff;
}
/* ----------------------------------------------------------- */

.reader-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 48px;
    position: relative;
    overflow: hidden;
    background-color: #000;
}

/* Overlay when chapter browser is open */
.reader-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    pointer-events: none;
    transition: background-color 0.3s ease;
    z-index: 5;
}

/* Apply overlay when chapter browser is open */
body:has(.chapter-browser.open) .reader-container::before {
    background-color: rgba(0, 0, 0, 0.7);
    pointer-events: auto;
}

.pages-container {
    max-height: calc(100vh - 96px);
    max-width: fit-content;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min-content;
    place-content: center;
    place-items: center;
    gap: 0;
    padding: 0 48px;
    margin: 0 auto;
}

.page-img {
    max-height: calc(100vh - 96px);
    max-width: calc(100vw - 96px); /* Account for padding and nav buttons */
    width: auto;
    height: auto;
    object-fit: contain;
}

/* For double page layout */
.pages-container:has(.page-img + .page-img) {
    grid-template-columns: repeat(2, min-content);
}

.pages-container:has(.page-img + .page-img) .page-img {
    max-height: calc(100vh - 96px);
    max-width: calc((100vw - 96px) / 2); /* Half width minus padding for each page */
    width: auto;
    height: auto;
}

.nav-button {
    position: fixed;
    background: none;
    border: none;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.nav-button:hover {
    opacity: 1;
}

.nav-button svg {
    width: 24px;
    height: 24px;
    stroke: white;
    stroke-width: 2;
}

/* Chapter navigation */
.prev-chapter {
    left: 16px;
    top: 100px;
    transform: translateY(-50%);
}

.next-chapter {
    right: 16px;
    top: 100px;
    transform: translateY(-50%);
}

/* Page navigation */
.prev-page {
    left: 16px;
    top: 50%;
}

.next-page {
    right: 16px;
    top: 50%;
}

.thumbnails-container.mobile-touch .thumbnail {
    margin: 0 8px; /* Increase spacing for easier touch targets */
    min-width: 60px; /* Ensure minimum touch target size */
}

.thumbnails-container.mobile-touch .thumbnail-link {
    padding: 5px; /* Add padding for better touch targets */
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.thumbnails-container.mobile-touch .thumbnail-link:active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Improve scrollbar visibility on mobile */
.thumbnails-container.mobile-touch::-webkit-scrollbar {
    height: 12px;
}

.thumbnails-container.mobile-touch::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
}

/* Responsive design */
@media (max-width: 768px) { 
	.breadcrumb {
		flex-direction: column;
		top: 0;
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
		width: 100%;
		padding-top: 10px;
	}
	
	.separator {
		visibility: hidden;
		display: none;
	}
	
	.header {
		height: 85px;
	}
	
	.next-chapter,
	.prev-chapter	{
		top: 120px;
	}
	
	.next-page {
		right: 0;		
	}
	
	.prev-page {
		left: 0;
	}
}