a {
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.resource-container {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px 48px;
}

.resource-title {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.resource-cover img,
.preview-still img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 4px;
  background: #111;
}

.preview-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.preview-gallery .preview-still img {
  max-height: 240px;
  width: 100%;
}

.resource-description {
  margin: 16px 0;
  line-height: 1.6;
}

.media-panel {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 12px;
  margin: 20px 0;
}

.media-player {
  width: 100%;
  max-height: 540px;
  background: #000;
  display: block;
}

.player-status {
  color: #bbb;
  font-size: 0.85rem;
  margin: 10px 4px;
}

.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  background: #555;
  color: #fff;
  font-size: 0.95rem;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary { background: #2980b9; color: #fff; }
.btn-secondary { background: #16a085; color: #fff; }
.btn-buy { background: #c0392b; color: #fff; }

.owned-badge {
  align-self: center;
  color: #2ecc71;
  font-weight: 600;
}

.back-button {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 20px;
  background: #2c3e50;
  color: #fff !important;
  border-radius: 6px;
  text-decoration: none !important;
  font-weight: 600;
}

.back-button:hover {
  background: #1a252f;
  color: #fff !important;
}

.content-item {
  text-decoration: none !important;
  color: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-item .item-title,
.content-item .item-description,
.content-item .item-meta {
  color: inherit;
  text-decoration: none;
}

.content-item .item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
}

.content-item .item-description {
  opacity: 0.85;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.page-heading {
  margin-bottom: 16px;
  grid-column: 1 / -1;
}

.list-toolbar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sort-bar.in-footer a.layout-btn {
  padding: 6px 12px;
  border-radius: 4px;
  background: #ecf0f1;
  color: #2c3e50 !important;
  text-decoration: none !important;
}

.sort-bar.in-footer a.layout-btn.active {
  background: #2980b9;
  color: #fff !important;
  font-weight: 600;
}

.left-content.layout-row {
  grid-template-columns: 1fr;
}

.left-content.layout-row .content-item {
  flex-direction: row;
  align-items: stretch;
}

.left-content.layout-row .item-image {
  width: 38%;
  min-width: 140px;
  max-width: 260px;
  height: auto;
  min-height: 120px;
  flex-shrink: 0;
}

.left-content.layout-row .item-image img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

.left-content.layout-row .item-text {
  flex: 1;
  height: auto;
  min-height: 120px;
}

.left-content.layout-row .play-badge {
  width: 40px;
  height: 40px;
}

.no-results {
  grid-column: 1 / -1;
  padding: 24px;
  color: #666;
}

.list-footer {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 24px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.pagination.always-on {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0;
}

.page-link {
  padding: 6px 12px;
  background: #3498db;
  color: #fff !important;
  border-radius: 4px;
  text-decoration: none !important;
}

.page-link.disabled {
  background: #bdc3c7;
  color: #fff !important;
  cursor: default;
}

.page-info {
  color: #555;
  font-size: 0.95rem;
}

.sort-bar.in-footer {
  display: flex;
  gap: 10px;
  margin: 0;
}

.sort-bar.in-footer a {
  padding: 6px 12px;
  border-radius: 4px;
  background: #ecf0f1;
  color: #2c3e50 !important;
  text-decoration: none !important;
}

.sort-bar.in-footer a.active {
  background: #2980b9;
  color: #fff !important;
  font-weight: 600;
}

/* Tag sidebar */
.tag-sidebar .sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.tag-sidebar .sidebar-section + .sidebar-section {
  margin-top: 22px;
}

.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  border: none;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  display: inline-block;
  position: relative;
}

.tag-pill .tag-count-tip {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  background: #2c3e50;
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  z-index: 30;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.tag-pill:hover .tag-count-tip,
.tag-pill:focus-visible .tag-count-tip {
  opacity: 1;
  visibility: visible;
}

.sidebar-partner {
  display: flex;
  justify-content: center;
}

.sidebar-partner iframe {
  display: block;
  max-width: 100%;
}

.tag-pill.tag-subject {
  background: #d6eaf8;
  color: #1a5276;
}

.tag-pill.tag-style {
  background: #f5e6ff;
  color: #6c3483;
}

.tag-pill.selected {
  box-shadow: 0 0 0 2px currentColor;
  font-weight: 700;
  transform: translateY(-1px);
}

.tag-hint {
  color: #95a5a6;
  font-size: 0.85rem;
}

.resource-tag-bar {
  margin: 14px 0 12px;
  padding: 12px 14px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
}

.resource-tag-bar .sidebar-section + .sidebar-section {
  margin-top: 12px;
}

.resource-tag-bar .sidebar-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
  color: #555;
}

.comic-panel {
  padding: 0 0 12px;
  background: #111;
}

.comic-reader {
  max-width: 820px;
  margin: 0 auto;
}

.comic-page {
  margin: 0;
  position: relative;
  min-height: 48vh;
  background: #1a1a1a;
}

.comic-page.is-loading::before {
  content: '长图加载中…';
  position: absolute;
  left: 0;
  right: 0;
  top: 28%;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 1;
}

.comic-page.is-error::before {
  content: '加载失败，点击重试';
  color: #e74c3c;
}

.comic-page img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  opacity: 1;
}

.comic-page.is-loading img {
  opacity: 0;
  min-height: 48vh;
}

.comic-page figcaption {
  display: none;
}

.comic-paywall {
  margin: 0;
  padding: 28px 16px 20px;
  text-align: center;
  color: #ddd;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), #1a1a1a);
  font-size: 0.95rem;
}

.comic-panel .media-actions {
  padding: 0 12px;
}

@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }

  .right-content.tag-sidebar {
    order: 1;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
  }

  .left-content {
    order: 2;
    width: 100%;
  }

  .list-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .left-content.layout-row .item-image {
    width: 34%;
    min-width: 110px;
    max-width: 160px;
    min-height: 96px;
  }
}
