
#mrp-slide {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999990;
}

#mrp-slide.on {
  display: flex;
}

#mrp-slide img {
  max-width: 90%;
  max-height: 90vh;
  display: block;
  margin: auto;
}

#readerbar.slide-mode .rb-inline{
  display: none;
}

#rb-chapters{
  width: 12vw;
  max-width: 160px;
}

#open-slide{
  background: #444;
  color: #fff;
  transition: .2s;
}

#open-slide.active{
  background: #ffce00;  
  color: #000;
}

#rb-actions{
  display: flex;
  gap: 8px;
  margin-right: auto;   
  margin-left: 0;
}
#open-slide:hover{
  background: #666;
}

#mrp-prev,
#mrp-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.5);
  color: #fff;
  border: none;
  font-size: 30px;
  padding: 10px;
  cursor: pointer;
  z-index: 2;
}

#mrp-prev { left: 10px; }
#mrp-next { right: 10px; }

#mrp-count {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  
  background: rgba(0,0,0,.7);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;

  z-index: 2;
}

.mrp-stage {
  position: relative;
  max-width: 1000px;
  width: 100%;
  text-align: center;
}

#mrp-img {
  max-width: 100%;
  max-height: 95vh;
}


.rb-inline{
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

#readerbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  overflow-x: auto;
  background: black;
  z-index: 999999;
  padding: 8px 2px;
}

#readerbar.hidden{
  display:none;
}

#rb-hamburger{
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999999;

  width: 42px;
  height: 42px;

  display: none;
  align-items: center;
  justify-content: center;

  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);

  color: #fff;

  padding: 0;
  line-height: 0;
}

#rb-hamburger svg{
  display: block;
  margin: auto;
  color:#533e3e;
}

#mrp-slide.on{
  display:flex;
}

.rb-btn, .rb-icon-btn{
  flex-shrink: 0;
}

#mrp-images {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 60px;
  z-index: 1;
  position: relative;
}
#mrp-images{
  width: 100%;
}

#mrp-images img.mrp-img{
  display:block;
  width: var(--mrp-size, 70%);
  max-width: 100%;
  margin: 0 auto 20px;
}

#mrp-images img {
  display: block;
  width: var(--mrp-size, 70%);
  height: auto;
  max-width: 100%;
  opacity: 1;
  visibility: visible;
}

#mrp-reader-overlay {
  position: fixed;
  inset: 0;
  background: #111;
  z-index: 999999;
  overflow-y: auto;
  display: none;
}

#mrp-reader-overlay.on {
  display: block;
}

#mrp-reader-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 20px;
}

.rotate-icon {
  display: inline-block;
  transform: rotate(90deg);
}

/* Autonext (checkbox label) wide; hide button to the end */
  .rb-autonext{ grid-column: 1 / span 2; }
  #rb-hide{ justify-self: end; }

  /* Compact comment sheet spacing on mobile */
  #mrp-cmt-sheet{ width: 100vw; }
  #mrp-cmt-list{ padding: 10px; }
  .mrp-cmt-item{ padding: 10px 6px; }
  .mrp-cmt-meta{ font-size: 12px; opacity: .85; }
  .mrp-cmt-content{ font-size: 14px; line-height: 1.55; }

  /* Compact form controls */
  #mrp-cmt-form input,
  #mrp-cmt-form textarea,
  #mrp-cmt-form button{
    font-size: 13px;
  }
  #mrp-cmt-form input,
  #mrp-cmt-form textarea{
    padding: 8px 10px;
  }
  
#mrp-cmt[hidden]{ display:none !important; }
#mrp-cmt{
  position: fixed; inset: 0;
  z-index: 1000060;
  display: grid; grid-template-columns: 1fr;
}
#mrp-cmt.on{ display: grid; }

#mrp-cmt-overlay{
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
}
#mrp-cmt-sheet{
  position: relative;
  margin: 0;
  height: 100%;
  width: min(720px, 92vw);
  background:#0e1117; color:#e9eef7;
  overflow:hidden; 
  box-shadow: -24px 0 48px rgba(0,0,0,.4);
  display:flex; flex-direction:column;
}

#mrp-cmt-head, #mrp-cmt-foot{
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
/* Footer row stays at the bottom */
.mrp-cmt-foot{
  border-top:1px solid rgba(255,255,255,.06);
  border-bottom:0;
  margin-top:0;               /* keep attached to form when it’s open */
  padding:10px 12px;
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:space-between;
}

#mrp-cmt-list{
  flex:1 1 auto;
  overflow:auto;
  padding:12px;
  min-height: 0;
  max-height:unset;           /* ensure it can grow */
}
#mrp-cmt-form{
  overflow:auto;
  min-height: 0;
  /*max-height:0;*/
  padding:0 12px;             /* no vertical padding when collapsed */
  border-top:1px solid rgba(255,255,255,.06);
  background:#0b0e13;
  transition:max-height .25s ease, padding .25s ease;
}

#mrp-cmt-close{
  margin-inline-start:auto;
  border:0; background:#2a2f3a; color:#e9eef7;
  border-radius:8px; height:36px; cursor:pointer;
}

/* When open, give it modest space */
#mrp-cmt-sheet.form-open #mrp-cmt-form{
  max-height:calc(100dvh - 160px);   /* ~6–8 inputs on mobile */
  padding:12px;
}

#mrp-cmt-sheet ol.commentlist{ list-style:none; margin:0; padding:0; }
#mrp-cmt-sheet .comment{ padding:10px 0; border-bottom:1px solid rgba(255,255,255,.06); }

.mrp-cmt-item{ padding:10px 8px; border-bottom:1px solid rgba(255,255,255,.06); }
.mrp-cmt-meta{ font-size:12px; opacity:.8; margin-bottom:6px; }
.mrp-cmt-content{ font-size:14px; line-height:1.5; }

/* Header layout: put close on the left (in RTL) */
.mrp-cmt-head{ display:flex; align-items:center; gap:8px; padding: 8px 16px;}
#mrp-cmt-title{ flex:1; }
#mrp-cmt-close{ margin-inline-end:auto; }


.my-chapter-list-ui {
    list-style: none;
    margin: 0;
    padding: 0;
}

.my-chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 10px 12px;
    margin-bottom: 8px;

    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;

    transition: 0.2s;
}

.my-chapter-item:hover {
    background: #f7f7f7;
}

.my-chapter-info small {
    display: block;
    color: #888;
    font-size: 12px;
}

.my-delete-chapter {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #d00;
}

.my-delete-chapter:hover {
    transform: scale(1.2);
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width:100%;
}

.chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px 14px;
  border-radius: 12px;

  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  border: 1px solid rgba(255,255,255,0.06);

  cursor: pointer;
  transition: 0.2s ease;
}

.chapter-row:hover {
  background: rgba(40, 40, 40, 0.7);
  transform: translateY(-1px);
}

.chapter-main {
  flex: 1;
}

.chapter-title {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

/* progress bar */
.chapter-progress {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  margin-top: 6px;
  overflow: hidden;
}

.chapter-progress .bar {
  height: 100%;
  background: linear-gradient(90deg, #6c5ce7, #00cec9);
  width: 0%;
}

/* percent */
.chapter-meta {
  font-size: 12px;
  opacity: 0.6;
  margin-right: 10px;
  min-width: 40px;
  text-align: right;
}

/* arrow */
.chapter-action {
  opacity: 0;
  transform: translateX(-6px);
  transition: 0.2s ease;
}

.chapter-row:hover .chapter-action {
  opacity: 1;
  transform: translateX(0);
}

.arrow {
  font-size: 18px;
  color: rgba(255,255,255,0.5);
}

.chapter-icon {
  width: 20px;
  height: 20px;
  stroke: #555;
  stroke-width: 2;
  fill: none;
}

@media (max-width: 768px){

  #readerbar{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }

  #rb-chapters{
    flex: 1 1 100%;
    max-width: 100%;
  }

  .rb-inline{
    flex: 1 1 100%;
    justify-content: space-between;
  }

  #rb-actions{
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 6px;
  }

  #rb-actions .rb-btn,
  #rb-actions .rb-icon-btn{
    flex: 1;
    height: 40px;
  }

  #rb-hide{
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
  }
}

.rb-right-actions{
  display: flex;
  gap: 6px;
  margin-right: auto;
}

.rb-right-actions .rb-icon-btn{
  width: 36px;
  height: 36px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
}