body.ebk-body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f5f7fa;
  color: #1f2937;
}

body.ebk-body.has-bottom-nav {
  padding-bottom: 62px;
}

a {
  color: inherit;
  text-decoration: none;
}

.market-page,
.detail-page,
.reader-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
}

.reader-page.needs-access-check .reader-media-card,
.reader-page.needs-access-check .reader-content-card,
.reader-page.needs-access-check .reader-nav {
  visibility: hidden;
}

.access-checking {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #eef6ff;
  color: #1d4f91;
  text-align: center;
  font-size: 14px;
}

.market-header h1 {
  margin: 0 0 14px;
  font-size: 24px;
}

.market-search input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  margin-bottom: 14px;
}

.market-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.market-filters button {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.market-filters button.is-active {
  background: #1d7ce8;
  border-color: #1d7ce8;
  color: #fff;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.book-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.card-link {
  display: block;
}

.book-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #f3f4f6;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  background: rgba(245, 158, 11, 0.9);
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  padding: 3px 8px;
}

.book-info {
  padding: 10px;
}

.book-info h3 {
  margin: 0 0 8px;
  font-size: 14px;
  min-height: 38px;
}

.book-meta {
  color: #6b7280;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

.book-price {
  margin-top: 8px;
  color: #c62828;
  font-size: 18px;
  font-weight: 700;
}

.empty-state {
  margin-top: 20px;
  color: #6b7280;
}

.detail-header,
.reader-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.btn-back {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-content {
  padding-bottom: 86px;
}

.detail-book-info,
.detail-toc,
.reader-media-card,
.reader-content-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
  margin-bottom: 14px;
}

.detail-book-info {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 16px;
}

.detail-cover img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.detail-meta h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.btn-trial {
  margin-left: 10px;
  background: #e6f1ff;
  color: #1d7ce8;
  border-radius: 999px;
  font-size: 12px;
  padding: 5px 10px;
  vertical-align: middle;
}

.desc p {
  margin: 8px 0 0;
  color: #4b5563;
  line-height: 1.7;
}

.chapter-list {
  display: grid;
  gap: 8px;
}

.chapter-item {
  display: grid;
  grid-template-columns: 30px 1fr 52px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border-radius: 8px;
  background: #f9fafb;
}

.chapter-num {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #1d7ce8;
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chapter-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chapter-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-sub {
  color: #6b7280;
  font-size: 12px;
}

.chapter-preview {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  justify-self: end;
  background: #eef2f7;
}

.chapter-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chapter-preview-empty {
  opacity: 0;
}

.chapter-item-locked {
  position: relative;
  cursor: not-allowed;
  opacity: 0.92;
}

.chapter-lock-tip {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #ef4444;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 999px;
  padding: 2px 8px;
}

.purchase-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 50px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
  z-index: 20;
}

.purchase-bar[hidden] {
  display: none !important;
}

.price-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.price {
  font-size: 26px;
  font-weight: 700;
  color: #ef4444;
}

.old-price {
  color: #9ca3af;
  text-decoration: line-through;
}

#purchaseBtn,
.btn-buy,
.reader-nav button,
.jump-form button,
.btn-play,
.btn-sentence-play {
  border: 0;
  border-radius: 8px;
  background: #1d7ce8;
  color: #fff;
  cursor: pointer;
}

#purchaseBtn,
.btn-buy {
  padding: 12px 20px;
}

.reader-header h2 {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: 18px;
}

.page-info {
  color: #6b7280;
  font-size: 14px;
}

.page-image-wrap {
  background: #f3f4f6;
  border-radius: 10px;
  overflow: hidden;
}

.page-image {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.page-title-wrap {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.page-title-wrap > div {
  text-align: center;
}

.page-title-wrap h3 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}

.page-title-wrap p {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 22px;
}

.btn-play {
  padding: 10px 14px;
}

.reader-content-card {
  position: relative;
}

.sentence-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.sentence-item {
  background: #f9fafb;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sentence-item.is-active {
  background: #e8f0ff;
  border-left: 4px solid #1d7ce8;
}

.sentence-text {
  font-size: 17px;
  line-height: 1.7;
}

.btn-sentence-play {
  padding: 8px 12px;
  white-space: nowrap;
}

.purchase-mask {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(4px);
  background: rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.purchase-mask-inner {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.purchase-mask-inner h4 {
  margin: 0 0 6px;
}

.purchase-mask-inner p {
  margin: 0 0 12px;
  color: #6b7280;
}

.reader-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.nav-btn {
  padding: 9px 14px;
  border-radius: 8px;
  background: #1d7ce8;
  color: #fff;
}

.nav-btn.is-disabled {
  pointer-events: none;
  background: #9ca3af;
}

.jump-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jump-form input {
  width: 70px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px;
}

.jump-form button {
  padding: 8px 12px;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
  z-index: 40;
}

.bottom-nav .nav-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  color: #6b7280;
  font-size: 12px;
  line-height: 1;
  gap: 3px;
}

.bottom-nav .nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav .nav-item .nav-icon svg {
  width: 20px;
  height: 20px;
}

.bottom-nav .nav-item.active {
  color: #1d7ce8;
}

/* Keep bottom tabs full width like original behavior */

@media (max-width: 768px) {
  .market-page,
  .detail-page,
  .reader-page {
    padding: 14px;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-book-info {
    grid-template-columns: 1fr;
  }

  .detail-cover {
    max-width: 220px;
  }

  .reader-nav {
    flex-wrap: wrap;
  }

  .jump-form {
    order: -1;
    width: 100%;
    justify-content: center;
  }
}

.badge-purchased {
  background: rgba(40, 167, 69, 0.9);
}

.login-tip {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pdf-fab-btn {
  position: fixed;
  right: 16px;
  bottom: 64px;
  background: #16a34a;
  color: #fff;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 35;
}

.bookshelf-page,
.user-page,
.hotnews-page,
.news-detail-page,
.pdf-page,
.pay-result-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
}

.user-card,
.orders-card,
.pay-card,
.pay-result-card,
.news-detail-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
  margin-bottom: 14px;
}

.avatar-circle {
  width: 70px;
  height: 70px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 24px;
  margin: 0 auto 10px;
}

.user-card {
  text-align: center;
}

.muted {
  color: #6b7280;
}

.btn-primary,
.btn-danger {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  cursor: pointer;
}

.btn-primary { background: #1d7ce8; }
.btn-danger { background: #dc2626; }

.icon-inline {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-inline svg {
  width: 100%;
  height: 100%;
}

.orders-wrap {
  display: grid;
  gap: 10px;
}

.order-row {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

.modal[hidden] {
  display: none !important;
}

.modal-card {
  width: min(90vw, 420px);
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.modal-card input,
.hotnews-tools input,
.hotnews-tools select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 10px;
}

.input-icon-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 10px;
}

.input-icon-wrap input {
  border: 0;
  width: 100%;
  padding: 9px 0;
}

.code-row,
.modal-actions {
  display: flex;
  gap: 8px;
}

.user-menu .menu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #eef2f7;
}

.user-menu .menu-row:last-child {
  border-bottom: 0;
}

.hotnews-head {
  text-align: center;
  margin-bottom: 14px;
}

.hotnews-tools {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  margin-bottom: 14px;
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
}

.news-item h3 {
  margin: 0 0 8px;
}

.news-item p {
  margin: 0;
  line-height: 1.7;
  color: #4b5563;
}

.news-meta {
  margin-top: 8px;
  color: #6b7280;
  display: flex;
  justify-content: space-between;
}

.news-detail-card h1 {
  margin-top: 0;
  text-align: center;
}

.content-centered,
.content-centered p {
  font-size: 18px;
  line-height: 1.9;
  text-align: center;
}

.content-centered img {
  max-width: 100%;
  display: block;
  margin: 14px auto;
}

.pdf-list {
  display: grid;
  gap: 10px;
}

.pdf-card {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  align-items: center;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
}

.pdf-card img,
.pay-book img {
  width: 70px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
}

.pdf-price {
  color: #c62828;
  font-weight: 700;
}

.pay-book {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.pay-result-card {
  text-align: center;
}

.result-pan-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px;
  margin: 12px 0;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.result-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 8px;
}

.result-icon.ok {
  color: #67c23a;
}

.result-icon.fail {
  color: #f56c6c;
}

@media (max-width: 768px) {
  .bookshelf-page,
  .user-page,
  .hotnews-page,
  .news-detail-page,
  .pdf-page,
  .pay-result-page {
    padding: 14px;
  }

  .hotnews-tools {
    grid-template-columns: 1fr;
  }

  .pdf-card {
    grid-template-columns: 60px 1fr;
  }

  .pdf-card > div:last-child {
    grid-column: 1 / -1;
  }
}

/* ===== 1:1 style alignment pass (legacy EBK) ===== */
.hotnews-page {
  max-width: 1200px;
}

.dailyenglish-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ecfdf5 0%, #dbeafe 100%);
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.09);
  cursor: pointer;
}

.dailyenglish-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.dailyenglish-title-row h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.dailyenglish-title-row .badge {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #2563eb;
  color: #f9fafb;
}

.dailyenglish-desc {
  margin: 0 0 6px;
  font-size: 13px;
  color: #374151;
}

.dailyenglish-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: #0369a1;
}

.dailyenglish-tags span {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.08);
}

.dailyenglish-button {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  background: #2563eb;
  color: #f9fafb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.news-item {
  background: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.2s ease;
}

.news-item:hover {
  border-color: #409eff;
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1);
}

.news-item h3 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.35;
}

.news-item p {
  margin: 0;
  color: #666;
  line-height: 1.65;
}

.news-detail-card {
  max-width: 860px;
  margin: 0 auto 16px;
}

.news-detail-card .news-content {
  margin-top: 10px;
}

.news-detail-card .news-content p,
.news-detail-card .news-content li {
  font-size: 18px;
  line-height: 1.85;
}

.news-detail-card .news-content h2,
.news-detail-card .news-content h3 {
  margin: 18px 0 10px;
}

.user-page .user-card {
  padding: 30px 20px;
}

.user-page .orders-card h3 {
  margin: 0 0 10px;
}

#loginBtn,
#logoutBtn {
  min-width: 120px;
  margin-top: 6px;
}

.modal-card {
  border-radius: 14px;
  padding: 22px;
}

.modal-card h3 {
  margin: 0;
}

#sendCodeBtn,
#cancelLoginBtn,
#confirmLoginBtn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

#confirmLoginBtn {
  background: #1d7ce8;
  border-color: #1d7ce8;
  color: #fff;
}

#sendCodeBtn {
  white-space: nowrap;
}

.reader-page {
  max-width: 900px;
}

.reader-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f5f7fa;
  padding-top: 4px;
}

.reader-content-card {
  background: #fff;
}

.sentence-item {
  background: #f3f4f6;
}

.payment-page,
.pdf-page,
.pay-result-page {
  max-width: 900px;
  margin: 0 auto;
}

.payment-page .pay-card {
  max-width: 760px;
  margin: 12px auto 0;
}

.payment-page .pay-book {
  align-items: center;
}

.payment-page #createPaymentBtn {
  display: inline-flex;
  margin: 10px auto 0;
}

@media (max-width: 768px) {
  .dailyenglish-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .dailyenglish-button {
    width: 100%;
  }

  .news-item h3 {
    font-size: 17px;
  }

  .news-detail-card .news-content p,
  .news-detail-card .news-content li {
    font-size: 16px;
    line-height: 1.75;
  }
}

/* ===== Final alignment pass by screenshots ===== */
.hotnews-desktop-wrap {
  display: flex;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.hotnews-main {
  flex: 1;
  min-width: 0;
}

.ad-sidebar {
  width: 160px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  height: fit-content;
}

.ad-sidebar .ad-container {
  background: #f8f9fa;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  padding: 10px;
}

.ad-sidebar ins.adsbygoogle {
  display: block;
  width: 160px;
  min-height: 600px;
}

.news-detail-card .news-content {
  text-align: left !important;
  color: #1f2937;
}

.news-detail-card .news-content * {
  text-align: inherit;
}

.news-detail-card .news-content p,
.news-detail-card .news-content li {
  font-size: 17px;
  line-height: 1.9;
}

.news-detail-card .news-content ul,
.news-detail-card .news-content ol {
  padding-left: 26px;
}

.news-detail-card .news-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
}

.icon-play-btn {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: #409eff;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-play-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.icon-play-btn .play-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.icon-play-btn .play-icon svg {
  width: 18px;
  height: 18px;
}

.full-audio-btn {
  width: 52px;
  height: 52px;
}

.full-audio-btn .play-icon,
.full-audio-btn .play-icon svg {
  width: 20px;
  height: 20px;
}

.reader-content-card.is-locked-all .sentence-list,
.reader-content-card.is-locked-all .sentence-item,
.page-title-wrap.is-locked-blur {
  filter: blur(3px);
  user-select: none;
}

.reader-content-card.is-locked-all .sentence-item,
.reader-content-card.is-locked-all .sentence-text {
  pointer-events: none;
}

.purchase-mask {
  backdrop-filter: blur(6px);
  background: rgba(255, 255, 255, 0.48);
}

.purchase-mask[hidden] {
  display: none !important;
}

.purchase-mask-inner {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
}

.detail-page .purchase-bar .price {
  font-size: 34px;
}

@media (max-width: 1200px) {
  .hotnews-desktop-wrap {
    display: block;
    max-width: 860px;
  }

  .ad-sidebar {
    display: none;
  }
}
