#chapter_reader {
  background-color: #f5f5f5;
  min-height: 100vh;
  transition: background-color 0.3s ease;
}

body.dark-mode #chapter_reader {
  background-color: #0a0a0a;
}

#chapter_reader .main_content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px 40px;
}

.alert-note {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 1px solid rgba(33, 150, 243, 0.3);
  border-radius: 8px;
  padding: 15px 20px;
  margin: 20px 15px;
  text-align: center;
  transition: all 0.3s ease;
}

body.dark-mode .alert-note {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-color: rgba(0, 188, 212, 0.3);
}

.alert-note p {
  color: #424242;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

body.dark-mode .alert-note p {
  color: #e0e0e0;
}

.alert-note strong {
  color: #2196f3;
  font-weight: 700;
}

body.dark-mode .alert-note strong {
  color: #00bcd4;
}

.path-top .breadcrumb {
  list-style: none;
  padding: 15px 0;
  margin: 20px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 14px;
}

.path-top .breadcrumb li {
  display: inline-flex;
  align-items: center;
  color: #757575;
}

body.dark-mode .path-top .breadcrumb li {
  color: #999;
}

.path-top .breadcrumb li + li::before {
  content: "›";
  margin: 0 8px;
  color: #bdbdbd;
  font-size: 16px;
}

body.dark-mode .path-top .breadcrumb li + li::before {
  color: #666;
}

.path-top .breadcrumb a {
  color: #2196f3;
  text-decoration: none;
  transition: color 0.3s ease;
}

body.dark-mode .path-top .breadcrumb a {
  color: #00bcd4;
}

.path-top .breadcrumb a:hover {
  color: #1976d2;
  text-decoration: underline;
}

body.dark-mode .path-top .breadcrumb a:hover {
  color: #00acc1;
}

.path-top .breadcrumb li:last-child {
  color: #212121;
  font-weight: 500;
}

body.dark-mode .path-top .breadcrumb li:last-child {
  color: #e0e0e0;
}

.chapter-header {
  text-align: center;
  padding: 20px 0;
  margin-bottom: 20px;
  background: linear-gradient(
    180deg,
    rgba(33, 150, 243, 0.1) 0%,
    transparent 100%
  );
  border-radius: 8px;
}

body.dark-mode .chapter-header {
  background: linear-gradient(
    180deg,
    rgba(0, 188, 212, 0.1) 0%,
    transparent 100%
  );
}

.chapter-header h1.detail-title {
  font-size: 24px;
  font-weight: 700;
  color: #212121;
  margin: 0 0 10px 0;
  line-height: 1.4;
}

body.dark-mode .chapter-header h1.detail-title {
  color: #fff;
}

.chapter-header h1 a {
  color: #2196f3;
  text-decoration: none;
  transition: color 0.3s ease;
}

body.dark-mode .chapter-header h1 a {
  color: #00bcd4;
}

.chapter-header h1 a:hover {
  color: #1976d2;
  text-decoration: underline;
}

body.dark-mode .chapter-header h1 a:hover {
  color: #00acc1;
}

.chapter-header time {
  display: block;
  font-size: 13px;
  color: #757575;
  font-style: italic;
}

body.dark-mode .chapter-header time {
  color: #999;
}

.chapter-control {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .chapter-control {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chapter-control .alert {
  background: rgba(33, 150, 243, 0.1);
  border: 1px solid rgba(33, 150, 243, 0.3);
  border-radius: 6px;
  padding: 12px 15px;
  margin-bottom: 20px;
  color: #424242;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

body.dark-mode .chapter-control .alert {
  background: rgba(0, 188, 212, 0.1);
  border-color: rgba(0, 188, 212, 0.3);
  color: #e0e0e0;
}

.chapter-control .alert i {
  color: #2196f3;
  font-size: 16px;
}

body.dark-mode .chapter-control .alert i {
  color: #00bcd4;
}

.chapter-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.chapter-navigation .btn {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 25px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.chapter-navigation .btn-info {
  background: #2196f3;
  color: #fff;
}

body.dark-mode .chapter-navigation .btn-info {
  background: #00bcd4;
}

.chapter-navigation .btn-info:hover {
  background: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

body.dark-mode .chapter-navigation .btn-info:hover {
  background: #00acc1;
  box-shadow: 0 6px 16px rgba(0, 188, 212, 0.4);
}

.chapter-navigation .btn-secondary {
  background: rgba(0, 0, 0, 0.1);
  color: #9e9e9e;
  cursor: not-allowed;
}

body.dark-mode .chapter-navigation .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #666;
}

.chapter-navigation .chapter-info {
  font-size: 16px;
  font-weight: 600;
  color: #212121;
  padding: 0 15px;
}

body.dark-mode .chapter-navigation .chapter-info {
  color: #fff;
}

.chapter_content {
  background: transparent;
  padding: 0;
  margin: 30px 0;
}

.chapter-images-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 1000px;
  margin: 0 auto;
}

.page-chapter {
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.page-chapter img.chapter-image {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  border: none;
  background: #f5f5f5;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

body.dark-mode .page-chapter img.chapter-image {
  background: #0a0a0a;
}

.page-chapter img.lazy {
  opacity: 0.5;
  filter: blur(5px);
}

.page-chapter img.loaded {
  opacity: 1;
  filter: blur(0);
}

.no-images-message {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: 8px;
  margin: 40px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .no-images-message {
  background: rgba(255, 255, 255, 0.05);
}

.no-images-message p {
  font-size: 18px;
  color: #757575;
  margin: 0 0 20px 0;
}

body.dark-mode .no-images-message p {
  color: #999;
}

.no-images-message i {
  color: #ff5252;
  font-size: 24px;
  margin-right: 10px;
}

.no-images-message .btn {
  padding: 12px 30px;
  background: #2196f3;
  color: #fff;
  text-decoration: none;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
}

body.dark-mode .no-images-message .btn {
  background: #00bcd4;
}

.no-images-message .btn:hover {
  background: #1976d2;
  transform: translateY(-2px);
}

body.dark-mode .no-images-message .btn:hover {
  background: #00acc1;
}

.bottom-chap {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin: 30px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .bottom-chap {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.bottom-chap .breadcrumb {
  list-style: none;
  padding: 15px 0 0 0;
  margin: 20px 0 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .bottom-chap .breadcrumb {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.bottom-chap .breadcrumb li {
  color: #757575;
}

body.dark-mode .bottom-chap .breadcrumb li {
  color: #999;
}

.bottom-chap .breadcrumb li + li::before {
  content: "›";
  margin: 0 8px;
  color: #bdbdbd;
}

body.dark-mode .bottom-chap .breadcrumb li + li::before {
  color: #666;
}

.bottom-chap .breadcrumb a {
  color: #2196f3;
  text-decoration: none;
}

body.dark-mode .bottom-chap .breadcrumb a {
  color: #00bcd4;
}

.comment-container {
  background: #fff;
  border-radius: 8px;
  padding: 25px;
  margin: 30px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .comment-container {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.comment-container .story-detail-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: #212121;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #2196f3;
}

body.dark-mode .comment-container .story-detail-title {
  color: #fff;
  border-bottom-color: #00bcd4;
}

.comment-container .story-detail-title i {
  color: #2196f3;
}

body.dark-mode .comment-container .story-detail-title i {
  color: #00bcd4;
}

.notify-fanpage {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 6px;
  padding: 12px 15px;
  margin-bottom: 20px;
  text-align: center;
  color: #f57c00;
  font-size: 14px;
}

body.dark-mode .notify-fanpage {
  color: #ffc107;
}

.notify-fanpage a {
  color: #2196f3;
  font-weight: 600;
  text-decoration: none;
}

body.dark-mode .notify-fanpage a {
  color: #00bcd4;
}

.comments-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: #757575;
  font-style: italic;
}

body.dark-mode .comments-placeholder {
  color: #999;
}

.chapter-control-fixed {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  transition: bottom 0.3s ease;
}

body.dark-mode .chapter-control-fixed {
  background: rgba(10, 10, 10, 0.95);
  border-color: rgba(0, 188, 212, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.chapter-control-fixed.visible {
  bottom: 30px;
}

.chapter-control-fixed .control-btn {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(33, 150, 243, 0.1);
  border: 1px solid rgba(33, 150, 243, 0.3);
  border-radius: 50%;
  color: #2196f3;
  font-size: 18px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-mode .chapter-control-fixed .control-btn {
  background: rgba(0, 188, 212, 0.1);
  border-color: rgba(0, 188, 212, 0.3);
  color: #00bcd4;
}

.chapter-control-fixed .control-btn:hover {
  background: #2196f3;
  color: #fff;
  transform: scale(1.1);
}

body.dark-mode .chapter-control-fixed .control-btn:hover {
  background: #00bcd4;
}

.chapter-control-fixed .chapter-list-btn {
  width: auto;
  padding: 0 15px;
  gap: 8px;
  border-radius: 25px;
}

.chapter-control-fixed .chapter-list-btn span {
  font-size: 14px;
  font-weight: 600;
}

.chapter-list-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: none;
}

.chapter-list-popup.active {
  display: block;
}

.chapter-list-popup .popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.chapter-list-popup .popup-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

body.dark-mode .chapter-list-popup .popup-content {
  background: #1a1a1a;
  border-color: rgba(0, 188, 212, 0.3);
}

.chapter-list-popup .popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  background: rgba(33, 150, 243, 0.1);
  border-bottom: 1px solid rgba(33, 150, 243, 0.3);
}

body.dark-mode .chapter-list-popup .popup-header {
  background: rgba(0, 188, 212, 0.1);
  border-bottom-color: rgba(0, 188, 212, 0.3);
}

.chapter-list-popup .popup-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #212121;
  display: flex;
  align-items: center;
  gap: 10px;
}

body.dark-mode .chapter-list-popup .popup-header h3 {
  color: #fff;
}

.chapter-list-popup .popup-header h3 i {
  color: #2196f3;
}

body.dark-mode .chapter-list-popup .popup-header h3 i {
  color: #00bcd4;
}

.chapter-list-popup .close-btn {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 82, 82, 0.2);
  border: 1px solid rgba(255, 82, 82, 0.3);
  border-radius: 50%;
  color: #ff5252;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chapter-list-popup .close-btn:hover {
  background: #ff5252;
  color: #fff;
  transform: rotate(90deg);
}

.chapter-list-popup .popup-body {
  padding: 20px;
  max-height: calc(80vh - 80px);
  overflow-y: auto;
  background: #fafafa;
}

body.dark-mode .chapter-list-popup .popup-body {
  background: #121212;
}

.chapter-list-popup .popup-body::-webkit-scrollbar {
  width: 8px;
}

.chapter-list-popup .popup-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .chapter-list-popup .popup-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.chapter-list-popup .popup-body::-webkit-scrollbar-thumb {
  background: rgba(33, 150, 243, 0.3);
  border-radius: 4px;
}

body.dark-mode .chapter-list-popup .popup-body::-webkit-scrollbar-thumb {
  background: rgba(0, 188, 212, 0.3);
}

.chapter-list-popup .popup-body::-webkit-scrollbar-thumb:hover {
  background: #2196f3;
}

body.dark-mode .chapter-list-popup .popup-body::-webkit-scrollbar-thumb:hover {
  background: #00bcd4;
}

.chapter-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.chapter-list-grid .chapter-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 15px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  color: #424242;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}

body.dark-mode .chapter-list-grid .chapter-item {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

.chapter-list-grid .chapter-item:hover {
  background: rgba(33, 150, 243, 0.1);
  border-color: rgba(33, 150, 243, 0.5);
  color: #2196f3;
  transform: translateY(-2px);
}

body.dark-mode .chapter-list-grid .chapter-item:hover {
  background: rgba(0, 188, 212, 0.1);
  border-color: rgba(0, 188, 212, 0.5);
  color: #00bcd4;
}

.chapter-list-grid .chapter-item.current {
  background: #2196f3;
  border-color: #2196f3;
  color: #fff;
  font-weight: 700;
}

body.dark-mode .chapter-list-grid .chapter-item.current {
  background: #00bcd4;
  border-color: #00bcd4;
}

body.popup-open {
  overflow: hidden;
}

@media (max-width: 1023px) {
  .chapter-header h1.detail-title {
    font-size: 20px;
  }

  .chapter-navigation .btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .chapter-navigation .chapter-info {
    font-size: 15px;
  }

  .chapter-list-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .chapter-control-fixed.visible {
    bottom: 20px;
  }
}

@media (max-width: 767px) {
  #chapter_reader .main_content {
    padding: 0 10px 30px;
  }

  .alert-note {
    margin: 15px 10px;
    padding: 12px 15px;
  }

  .alert-note p {
    font-size: 13px;
  }

  .chapter-header {
    padding: 15px 10px;
  }

  .chapter-header h1.detail-title {
    font-size: 18px;
  }

  .chapter-control {
    padding: 15px;
  }

  .chapter-control .alert {
    font-size: 13px;
    padding: 10px 12px;
  }

  .chapter-navigation {
    gap: 8px;
    width: 100%;
  }

  .chapter-navigation .btn {
    padding: 8px 14px;
    font-size: 13px;
    gap: 5px;
    flex: 0 0 auto;
  }

  .chapter-navigation .btn i {
    font-size: 12px;
  }

  .chapter-navigation .chapter-info {
    font-size: 13px;
    padding: 0 8px;
    font-weight: 700;
    flex-shrink: 0;
  }

  .chapter-control-fixed {
    width: auto;
    max-width: calc(100% - 30px);
    padding: 8px 12px;
    gap: 8px;
    border-radius: 30px;
    left: 50%;
    transform: translateX(-50%);
  }

  .chapter-control-fixed.visible {
    bottom: 15px;
  }

  .chapter-control-fixed .control-btn {
    width: 38px;
    height: 38px;
    font-size: 15px;
    flex-shrink: 0;
  }

  .chapter-control-fixed .chapter-list-btn {
    padding: 0 12px;
    height: 38px;
    min-width: auto;
    white-space: nowrap;
  }

  .chapter-control-fixed .chapter-list-btn span {
    font-size: 13px;
    font-weight: 600;
  }

  .chapter-list-popup .popup-content {
    width: 95%;
    max-height: 85vh;
  }

  .chapter-list-popup .popup-header {
    padding: 15px 20px;
  }

  .chapter-list-popup .popup-header h3 {
    font-size: 18px;
  }

  .chapter-list-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .chapter-list-grid .chapter-item {
    padding: 10px 12px;
    font-size: 13px;
  }

  .comment-container {
    padding: 20px 15px;
  }

  .comment-container .story-detail-title {
    font-size: 18px;
  }
}

@media (max-width: 390px) {
  .chapter-header h1.detail-title {
    font-size: 16px;
  }

  .chapter-navigation .btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .chapter-navigation .chapter-info {
    font-size: 12px;
    padding: 0 6px;
  }

  .chapter-control-fixed {
    gap: 6px;
    padding: 6px 10px;
  }

  .chapter-control-fixed .control-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .chapter-control-fixed .chapter-list-btn {
    padding: 0 10px;
    height: 34px;
  }

  .chapter-control-fixed .chapter-list-btn span {
    font-size: 12px;
  }

  .chapter-list-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media print {
  .chapter-control,
  .chapter-control-fixed,
  .chapter-list-popup,
  .alert-note,
  .comment-container {
    display: none !important;
  }

  .page-chapter img.chapter-image {
    page-break-inside: avoid;
  }
}
