:root {
  color-scheme: light;
  --bg: #f7f4f6;
  --surface: #ffffff;
  --surface-strong: #fff7fb;
  --text: #241820;
  --muted: #74636d;
  --line: #e7dce4;
  --brand: #c93f8d;
  --brand-dark: #8b275e;
  --accent: #177c86;
  --shadow: 0 14px 35px rgba(75, 41, 65, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 36px clamp(18px, 4vw, 56px) 24px;
  background: linear-gradient(135deg, #fff, #fff0f7);
  border-bottom: 1px solid var(--line);
}

.site-header-main {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
}

.site-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.result-bar,
.tags span {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 36px) 44px;
}

.tdk-band {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tdk-grid {
  display: grid;
  gap: 8px;
}

.tdk-item {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 18px 16px 34px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 248, 252, 0.95));
  position: relative;
  z-index: 3;
}

.friend-links-wrap {
  width: 100%;
  margin-bottom: 8px;
}

.friend-links {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.friend-link-item {
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.friend-link-item strong {
  color: var(--brand-dark);
  font-size: 14px;
}

.friend-link-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.footer-link {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.footer-meta a {
  color: inherit;
  text-decoration: none;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, auto);
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar-group {
  display: grid;
  gap: 7px;
  align-content: start;
}

.toolbar-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.column-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.column-chip {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
}

.column-chip.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.section-title {
  margin-bottom: 10px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.category-strip {
  margin: 6px 0 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.category-strip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
  padding-bottom: 4px;
}

.category-chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
}

.category-chip.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(201, 63, 141, 0.12);
}

.result-bar {
  display: inline-flex;
  gap: 5px;
  margin: 4px 0 18px;
}

.page-skeleton {
  margin-bottom: 12px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(var(--card-columns, 5), minmax(0, 1fr));
  gap: 16px;
}

.skeleton-card {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.skeleton-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f2e7ed 0%, #ffffff 45%, #f2e7ed 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.25s linear infinite;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 72px;
  border-radius: 8px;
  background:
    linear-gradient(#e9dce4 0 0) 0 0 / 68% 14px no-repeat,
    linear-gradient(#eee3ea 0 0) 0 22px / 44% 12px no-repeat,
    linear-gradient(#eee3ea 0 0) 0 44px / 80% 12px no-repeat,
    linear-gradient(#eee3ea 0 0) 0 66px / 58% 12px no-repeat;
  opacity: 0.95;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

body:not(.app-ready) #grid,
body:not(.app-ready) #pagination {
  display: none;
}

body.app-ready .page-skeleton {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--card-columns, 5), minmax(0, 1fr));
  gap: 16px;
}

.card {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(75, 41, 65, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(201, 63, 141, 0.45);
  box-shadow: var(--shadow);
}

.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #eee2e9;
}

.poster img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 11px 12px 13px;
}

.card h2 {
  display: -webkit-box;
  min-height: 44px;
  margin: 0 0 9px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 15px;
  line-height: 1.45;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
}

.pagination button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.pagination button[aria-current="page"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

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

.empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.modal.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 12, 20, 0.64);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: stretch;
  grid-template-columns: minmax(300px, 42%) minmax(0, 1fr);
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  margin: 18px auto;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.modal-media {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 0;
  padding: 0;
  background: #111016;
  overflow: hidden;
}

.modal-media img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: center;
}

.modal-body {
  overflow: auto;
  max-height: calc(100vh - 36px);
  padding: 24px 24px 28px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.tags span {
  background: var(--surface-strong);
  color: var(--brand-dark);
}

.modal h2 {
  margin: 0 0 10px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.25;
}

.modal-meta {
  margin: 0 0 18px;
  color: var(--muted);
}

.modal-ads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.text-ad {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #eadce4;
  border-radius: 8px;
  background: #fffafc;
}

.ad-title {
  margin-bottom: 4px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.ad-text {
  margin-bottom: 8px;
  color: #483441;
  font-size: 13px;
  line-height: 1.7;
}

.ad-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.modal-content {
  color: #3c2c36;
  font-size: 16px;
  line-height: 1.8;
}

.modal-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.access-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.access-intro {
  color: #3c2c36;
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 10px;
}

.access-tutorial {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.access-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.access-field span {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.access-field input {
  min-height: 42px;
}

.access-actions {
  display: flex;
  justify-content: flex-start;
}

.access-submit {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

.access-status {
  margin-top: 10px;
  color: var(--brand-dark);
  font-size: 13px;
}

.info-panel {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 28px));
  margin: 18px auto;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.info-body {
  padding: 26px;
  background: #ffffff !important;
}

.info-content {
  color: #3c2c36;
  font-size: 15px;
  line-height: 1.85;
}

.info-content p {
  margin: 0 0 12px;
}

@media (max-width: 760px) {
  .site-header {
    display: grid;
    align-items: start;
  }

  .site-header-main {
    gap: 12px;
  }

  .stats {
    justify-content: flex-start;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .column-chips {
    gap: 6px;
  }

  .grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .skeleton-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .skeleton-card {
    min-height: 250px;
  }

  .card h2 {
    font-size: 14px;
  }

  .modal-panel {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 20px);
    overflow: auto;
  }

  .modal-media img {
    max-height: 46vh;
  }

  .modal-media {
    position: relative;
    height: auto;
    padding: 0;
  }

  .modal-body {
    max-height: none;
    padding: 20px;
  }

  .modal-ads {
    grid-template-columns: 1fr;
  }

  .friend-links {
    grid-template-columns: 1fr;
  }
}
