/* Shared styles for entertainment news templates (home, category, detail) */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #f0f2f5;
  --text: #111827;
  --text-muted: #4b5563;
  --text-subtle: #6b7280;
  --border: #e5e7eb;
  --card-shadow: 0 14px 40px rgba(0, 0, 0, 0.06);
  --primary: #1d4ed8;
  --primary-strong: #1e40af;
  --primary-soft: #e0e7ff;
  --accent: #10b981;
  --tag-bg: #eef2ff;
  --quote-bar: rgba(29, 78, 216, 0.2);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #111827;
  --surface-muted: #0b1220;
  --text: #e5e7eb;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  --border: #1f2937;
  --card-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  --primary: #60a5fa;
  --primary-strong: #93c5fd;
  --primary-soft: #1e293b;
  --accent: #22d3ee;
  --tag-bg: #1e293b;
  --quote-bar: rgba(96, 165, 250, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size:14px;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--primary);
}

img {
  max-width: 100%;
  display: block;
  border-radius: 5px;
}

/* Inputs */
input,
textarea,
select {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: transparent;
  box-shadow: none;
  background: rgba(29, 78, 216, 0.08);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  background: rgba(96, 165, 250, 0.14);
}

/* Lazy image fade-in */
.lazy-img {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lazy-img.loaded {
  opacity: 1;
}

.container {
  width: min(1280px, 96vw);
  margin: 0 auto;
}

header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--primary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav a {
  padding: 10px 14px;
  border-radius: 12px;
  background: transparent;
  font-weight: 600;
  color: var(--text-muted);
}

.nav a.active,
.nav a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

@media (min-width: 821px) {
  .nav-toggle {
    display: none !important;
  }
  .nav {
    display: flex !important;
    position: static;
    transform: none;
    opacity: 1;
  }
}

.nav-toggle {
  display: none;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
}

.search .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 14px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--primary);
  color: #fff;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--primary-strong);
}

.btn.ghost:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
}

.layout-grid {
  display: grid;
  grid-template-columns: 3fr 1.1fr;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.card-body {
  padding: 16px;
}

.meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text-subtle);
  font-size: 13px;
}

.meta .dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.hero {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
  margin: 20px 0 10px;
}

.hero-main {
  position: relative;
  overflow: hidden;
  min-height: 200px;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.hero-slide.active {
  opacity: 1;
  z-index: 2;
}

.hero-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-main .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.6) 90%);
}

.hero-main .content {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  color: #fff;
}

.hero-main .title {
  font-size: 25px;
  font-weight: 800;
  margin: 6px 0 4px;
}

.slider-dots {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 8px;
  z-index: 3;
}

.slider-dots button {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #fff;
  background: rgba(255,255,255,0.35);
  cursor: pointer;
}

.slider-dots button.active {
  background: #fff;
}

.hero-side {
  display: grid;
  gap: 8px;
}

.h-card {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 8px 10px;
}

.h-card img {
  height: 68px;
  width: 100%;
  object-fit: cover;
}
.h-card h3 {
  margin: 0 0 2px;
  font-size: 14px;
  line-height: 1.35;
}

.section {
  margin: 24px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  gap: 10px;
  margin-bottom:1rem;
  align-items: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.card-vertical {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card-vertical:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(0,0,0,0.12);
}

.card-vertical img {
  height: 160px;
  object-fit: cover;
}

.card-vertical .content {
  padding: 10px 10px 12px;
  display: grid;
  gap: 6px;
}

.card-vertical h3 {
  margin: 0;
  font-size: 0.8rem;
}

.card-vertical .meta {
  margin-top: 2px;
}

.link-card {
  color: inherit;
  text-decoration: none;
}

.sidebar {
  display: grid;
  gap: 14px;
}

.list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.list-item:last-child {
  border-bottom: none;
}

.rank {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--primary);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
}

/* Detail page extras */
.pn-links { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.pn-item { flex:1 1 45%; min-width:240px; }
.pn-item .pn-link { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:inherit; }
.recommend-grid { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:16px; align-items:stretch; }
@media (max-width: 900px) { .recommend-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .recommend-grid { grid-template-columns:repeat(1, minmax(0, 1fr)); } }
.recommend-grid .card-vertical img { width:100%; height:140px; object-fit:cover; border-radius:6px; display:block; }

/* Topic detail wrapper alignment with theme */
.topic-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 2.5rem 2rem;
  margin: 2rem 0;
  border: 1px solid var(--border);
  transition: background 0.3s, color 0.3s;
}

/* Breadcrumb & header styling for topic view */
.topic-breadcrumb {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  width: 100%;
  text-align: center;
}

.topic-breadcrumb .breadcrumb-link {
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.topic-breadcrumb .breadcrumb-label {
  font-weight: 600;
  color: var(--text-subtle);
}

.topic-breadcrumb .breadcrumb-label.active {
  color: var(--text);
}

.topic-breadcrumb .breadcrumb-separator {
  color: var(--border);
}

.topic-header {
  text-align: center;
  margin: 0 auto 1.5rem;
  padding: 0;
  position: relative;
  border:none;
}

.topic-title {
  margin: 0;
  font-size: clamp(1.4rem, 1.6vw + 0.2rem, 1.8rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  border:none;
}

.topic-header::after {
  content: none;
}

@media (max-width: 640px) {
  .topic-content-wrapper {
    padding: 1.2rem 0.7rem;
    margin: 1rem 0;
  }

  .topic-title {
    font-size: clamp(1.5rem, 2vw + 0.2rem, 1.9rem);
  }
}

/* Back to top */
.float-tools { position: fixed; right: 20px; bottom: 50px; display: flex; flex-direction: column; gap: 10px; z-index: 999; }
.float-btn { width: 40px; height: 40px; border: none; background: rgba(47,107,255,0.9); color: #fff; font-size: 20px; cursor: pointer; box-shadow: 0 10px 24px rgba(47,107,255,0.3); transition: opacity .2s ease, transform .2s ease, background .2s ease; opacity: 1; position: relative; display:flex; align-items:center; justify-content:center; }
.float-btn svg { width: 26px; height: 26px; }
.back-to-top { opacity: 0; pointer-events: none; }
.back-to-top.show { opacity: 1; pointer-events: auto; }
.float-btn:hover { background: rgba(47,107,255,1); transform: translateY(-2px); }
.qr-btn { display: flex; align-items: center; justify-content: center; }
.rocket-body { fill: #f8fbff; }
.rocket-window { fill: #2f6bff; }
.rocket-fin { fill: #e4ebff; }
.rocket-tail { fill: #dbe5ff; }
.rocket-flame { fill: #ff9f43; opacity: 0; transform-origin: 32px 52px; }
.rocket-icon { transition: transform .2s ease; }
.back-to-top.launch .rocket-icon { transform: translateY(-4px); }
.back-to-top.launch .rocket-flame { opacity: 1; animation: rocket-flame .4s infinite ease-in-out; }
.wechat-bubble { fill: #f8fbff; }
.wechat-dot { fill: #2f6bff; }
.qr-pop { position: absolute; right: 54px; bottom: 0; background: #fff; padding: 10px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.15); width: 150px; opacity: 0; pointer-events: none; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; }
.qr-btn:hover .qr-pop { opacity: 1; pointer-events: auto; transform: translateY(0); }
.qr-pop img { width: 100%; height: auto; display: block; border-radius: 6px; }
.qr-title { font-weight: 600; margin-top: 6px; font-size: 13px; color: #333; }
.qr-desc { font-size: 12px; color: #666; margin-top: 2px; line-height: 1.4; }

@keyframes rocket-flame {
  0% { transform: translateY(0) scaleY(1); opacity: 1; }
  50% { transform: translateY(3px) scaleY(0.85); opacity: 0.75; }
  100% { transform: translateY(0) scaleY(1); opacity: 1; }
}

.tag:hover,
.tag.active {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-subtle);
  padding: 10px 0;
}

.breadcrumb a,
.breadcrumb-link {
  color: var(--text-muted);
  font-weight: 600;
}

.breadcrumb a:hover,
.breadcrumb-link:hover {
  color: var(--primary);
}

.breadcrumb-label {
  color: var(--text-subtle);
  font-weight: 600;
}

.breadcrumb-label.active {
  color: var(--text);
}

.breadcrumb-separator {
  color: var(--border);
}

/* Category page */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sorter {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.list-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  align-items: stretch;
  margin-bottom: 12px;
}

.list-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--surface-muted);
}

.list-card > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.list-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.35;
}

.list-card .multiline-ellipsis-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; /* ��ʾ 3 �� */
    overflow: hidden;
}
.list-card a.img{
    display:flex;
}
.inline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  vertical-align: middle;
  margin-right: 6px;
}

.list-card p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.list-card .meta {
  margin-top: auto;
  font-size: 13px;
}

.list-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.pagination {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.pagination .page {
  padding: 0px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.pagination .page.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Detail page */
.article-head {
  display: grid;
  gap: 12px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-subtle);
}

.article-cover {
  margin: 10px 0 18px;
  overflow: hidden;
  border-radius: 16px;
}

.article-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.article-body h2 {
  margin: 20px 0 12px;
  font-size: 22px;
}

.article-body h3 {
  margin: 16px 0 10px;
  font-size: 18px;
}

.article-body p {
  color: var(--text-muted);
  margin: 10px 0;
}

.article-body blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--quote-bar);
  background: var(--surface-muted);
  border-radius: 10px;
  color: var(--text);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.toolbar .pill {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.recommend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.comment-box,
.comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.comment-box textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-muted);
  color: var(--text);
}
.comment-body { white-space: pre-wrap; margin-top: 6px; }
.comment-actions { display: flex; gap: 12px; margin-top: 8px; }
.comment-action { border: none; background: transparent; color: var(--text-subtle); cursor: pointer; padding: 0; font-weight: 600; }
.comment-action:hover { color: var(--primary); }
.comment-children { margin-left: 16px; border-left: 1px solid var(--border); padding-left: 12px; margin-top: 10px; display: grid; gap: 8px; }

.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.footer {
  margin-top: 26px;
  padding: 18px 0 28px;
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 16px;
}
.footer-grid h4 {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--text);
}
.footer-desc { margin: 0; }
.footer-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}
.footer-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.footer-meta { color: var(--text-muted); }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* Responsive */
@media (max-width: 1080px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-main img {
    min-height: 260px;
  }
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 820px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--surface);
    padding: 10px 0 14px;
    z-index: 20;
    transform-origin: top;
    transform: scaleY(0.9);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
    border-bottom: none;
    box-shadow: 0 12px 30px rgba(0,0,0,0.16);
  }
  .nav.open {
    display: flex;
    transform: scaleY(1);
    opacity: 1;
  }
  .nav a {
    width: 100%;
    padding: 12px 16px;
    border-radius: 0;
  }
  .actions {
    width: 100%;
    justify-content: flex-start;
  }
  .layout-grid,
  .grid {
    gap: 12px;
  }
  .list-card {
    grid-template-columns: 1fr;
  }
  .list-card img {
    height: 180px;
  }
  .hero-main .title {
    font-size: 22px;
  }
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }
  .nav {
    width: 100%;
    overflow-x: auto;
  }
  .hero-main img {
    min-height: 220px;
  }
  .card-vertical img {
    height: 150px;
  }
  .toolbar {
    flex-direction: column;
  }
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
