/*ab-style.css*/

.book-cover{
	position: relative;
}
.book-loading{
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 100vh;
}

.book-nav{
	position: absolute;
	bottom:10px;
	z-index: 100;
}

.audio-book {
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
    -khtml-user-select: none; /* Konqueror HTML */
    -moz-user-select: none; /* Old versions of Firefox */
    -ms-user-select: none; /* Internet Explorer/Edge */
    user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
    /*font-family: ZenKurenaido;*//*'Arial', sans-serif;*/
    background-color: #f4f4f9;
    margin: 0;
    padding: 2px;
    line-height: 1.2;
    max-width: 800px;
    margin: 5px auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    
    /* Add scrolling behavior */
    max-height: 80vh; /* book height */
    overflow: auto;
    position: relative;
	
	
}

/* Default (horizontal reading) */
.audio-navigation {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  padding: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* When in vertical mode */
.vertical-text ~ .audio-navigation,
.vertical-text .audio-navigation {
  position: sticky;
  top: auto;
  inset-inline-start: 0;  /* For logical directions */
  writing-mode: horizontal-tb;
}

.audio-book .gloss{
	color:#42413f;
}

.audio-book .gloss:hover {
    /*width: fit-content;
    max-width: 20em;*/
	/*color: #F2F2F0;*/
	background-color: #D9D8D7;
}

/*
.audio-book .custom-tooltip{
	font-size: 0.7em;
	line-height: 0.8em;
	
	bottom: 160%;
	line-height: 1.05em;
}*/
/*min-width: fit-content;
    max-width: 20em;*/
/*
.gloss .custom-tooltip {
  position: absolute;
  bottom: 100%; 
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #aaa;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  white-space: nowrap;
  display: none;
  z-index: 100;
}

.gloss:hover .custom-tooltip {
  display: block;
}
*/


/* Optional arrow */
/*.gloss .custom-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #aaa transparent transparent transparent;
}*/

.audio-paragraph {
    margin-top: 10px;
	font-size: 1.2em;
	line-height:1.4;
}
.audio-book h3 {
    font-size: 2em !important;
    font-weight: bold;
    margin-top: 20px;
}
.audio-paragraph h3 ruby{
    font-size: 2.5em !important;
    font-weight: bold;
    margin-top: 20px;
}
/*.audio-segment.highlight {
    background-color: hsla(102, 62%, 85%, 0.5);
	border-radius: 15px;
	
}*/
.audio-book-main-image img {
    max-width: 100%;
	margin-top: 5px;
    margin-bottom: 5px;
}

.audio-inline-image {
    max-width: 150px;
    float: right;
    margin: 0 0 10px 10px;
}
/*NEW*/
.audio-segment {
    display: inline-block; /* ensures background highlight works even with ruby */
    padding: 0 3px;        /* a little breathing room */
    border-radius: 0.3em;  /* so highlight bubble wraps nicely */
    transition: background-color 0.3s;
}

.audio-segment.highlight {
    background-color: hsla(102, 62%, 85%, 0.5);
	border-radius: 15px;
}

/*GLOSS POP-UP*/
/* Tooltip styling */
/*
.gloss {
    position: relative;
    cursor: help;
    color: #BFBBB4;
}

.custom-tooltip {
    background-color: #E5EAF2; 
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    position: absolute;
    bottom: 100%;
    left: 5%;
    transform: translateX(-5%);
    min-width: 15em;
    max-width: fit-content;
    white-space: normal;
    font-family: NotoSansJP-VariableFont_wght;
    font-size: 0.9em;
    z-index: 10;
}
*/

/* Tooltip content styling */
/*
.custom-tooltip .entry-header {
    font-weight: bold;
    font-size: 1em;
    color: #1565D8;
	min-width: fit-content;
}

.custom-tooltip .entry-reading {
    font-size: 0.9em;
    color: #2C354A;
}

.custom-tooltip .dic-content {
	width: 10em;
    font-size: 0.85em;
    color: #2C354A;
}
*/

/* Optional styles for future HTML tags in the translation content */
.custom-tooltip .dic-content ul {
    padding-left: 15px;
}

.custom-tooltip .dic-content li {
    list-style-type: disc;
    margin-left: 10px;
}

/*GLOSS POP-UP*/




/*YOKO - TATE -YOMI*/
/* === Text Orientation Toggle === */

/* Vertical (縦読み) mode */
.vertical-container {
  display: flex;
  justify-content: flex-end; /* start columns from the right */
  align-items: flex-start; /* start content from the top */
  /*direction: rtl; right to left column flow */
  overflow-x: auto; /* allow horizontal scroll for long books */
  overflow-y: hidden;
  writing-mode: vertical-rl;
  background-color: #fff;
  height: 80vh;
  scroll-behavior: smooth;
  max-height: 90vh;
}

.vertical-text {
  text-orientation: upright;
  white-space: normal;
  line-height: 1.3;
  column-gap: 1.5em;
  padding: 1em;
  border: 1px solid #ccc;
}

.vertical-text p,
.vertical-text h3 {
  display: inline-block;
  vertical-align: top;
  margin: 0;
}
.vertical-container .custom-tooltip{
	writing-mode: horizontal-tb;
}

/* Hide default browser audio controls */
.audio-navigation audio {
  display: none;
}

/*book settings*/
.audio-navigation button{
	width: 40px;
	height: auto;
	background: none;
    border: none;
    padding: 0;
    cursor: pointer;
	padding: 0px;
	
}

.audio-navigation  button.audio-back-10, .audio-navigation  button.audio-skip-10{
	width: 30px;
	height: auto;
}


.audio-navigation button:hover{
		background: none !important;
    opacity: 0.8;
}

/*BOOK CONTROLS*/
.audio-navigation{
	display:flex;
	row-gap: 0px;
	column-gap: 0px;
}
.player{
	width: 50%;
	display:flex;
	justify-content: flex-end;
	
}
.reader{
	width: 50%;
}
/* Progress bar */
.audio-progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.progress-slider {
  width: 70%;
  height: 6px;
  background: #E4E9F1;
  border-radius: 5px;
  appearance: none;
  outline: none;
  cursor: pointer;
}

.progress-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  background: #F6CE4E;
  border-radius: 50%;
  cursor: pointer;
}

.audio-time-display {
  color: #1D3356;
  font-size: 0.7rem;
  min-width: 80px;
  text-align: right;
}


/* === Controls Hide/Show === */
.book-controls {
  transition: opacity 0.4s ease, max-height 0.4s ease;
  overflow: hidden;
  /* position: sticky !important;  */
  /* top: 100px; */
}

.book-controls.hidden {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
}


.toggle-controls-btn {
  background: none !important;
  cursor: pointer;
}

.toggle-controls-btn:hover{
  background: none !important;
}

/* Make button fixed for mobile for convenience */
@media (max-width: 768px) {
  .toggle-controls-btn {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 99;
    opacity: 0.8;
    font-size: 0.8rem;
  }
}

.display-hide{
	display: none !important;
}

.max-book{
	margin:0px !important;
		
}
.max-book .audio-book{
	max-height: 95vh !important;
}

.min-book{
	margin-top:5px !important;
	margin-bottom:5px !important;
}

.sticky{
	position: sticky !important; 
	top: 0;
}

/*tippy.js*/
.tippy-box[data-theme~='light-border'] {
  background-color: #fff;
  color: #333;
  border: 1px solid #ccc;
  max-width: 300px;
}
.custom-tooltip ul {
  margin: 4px 0 0 12px;
  padding: 0;
}

.custom-tooltip {
  text-align: left;
  padding: 4px;
}

.custom-tooltip .entry-header {
  font-weight: bold;
  font-size: 1.1em;
  color: #2a6ebd; /* accent color */
}

.custom-tooltip .entry-reading {
  color: #888;
  font-size: 0.9em;
}

.custom-tooltip .dic-content {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.custom-tooltip .dic-content li {
  margin: 2px 0;
}