:root {
  --bg: #f5f8fb;
  --card: #fff;
  --text: #1a2332;
  --muted: #64748b;
  --accent: #8eb4d4;
  --accent-dark: #6a9bc4;
  --border: #e2e8f0;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(30, 50, 80, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.theme-wrap {
  background: transparent;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  background: linear-gradient(135deg, #8eb4d4, #7aa3c9);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-brand {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.site-nav a {
  color: rgba(255,255,255,0.92);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.site-nav a:hover, .site-nav a.active {
  background: rgba(255,255,255,0.2);
  text-decoration: none;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  padding: 8px 0;
}

.hero-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.home-search-row {
  margin-bottom: 16px;
}

.official-banner {
  display: block;
  padding: 0;
  overflow: hidden;
  margin-bottom: 16px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(135deg, #6a9bc4 0%, #8eb4d4 45%, #b8d4ef 100%);
}

.official-banner:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.official-banner-inner {
  padding: 20px 18px;
  color: #fff;
}

.official-banner-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.official-banner-sub {
  font-size: 13px;
  opacity: 0.92;
  margin-bottom: 10px;
}

.official-banner-cta {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255,255,255,0.22);
  padding: 6px 12px;
  border-radius: 999px;
}

.entry-grid {
  display: grid;
  gap: 12px;
}

.entry-grid-primary {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin-bottom: 16px;
}

.entry-card-accent {
  border: 2px solid rgba(106, 155, 196, 0.35);
  background: linear-gradient(135deg, #fff 0%, #f0f7fc 100%);
}

.entry-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s;
}

.entry-card:hover { transform: translateY(-2px); }

.entry-title { font-size: 16px; font-weight: 600; }
.entry-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.entry-arrow { color: var(--muted); font-size: 18px; }

.entry-grid-tools {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  margin-bottom: 16px;
}

.portal-section {
  margin-bottom: 16px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.portal-card {
  display: block;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s;
}

.portal-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.portal-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.portal-card-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.section-link:hover {
  text-decoration: underline;
}

.ranking-official-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.ranking-official-link:hover {
  text-decoration: underline;
}

.ranking-tag-local {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #d1fae5;
}

.entry-card-sm {
  padding: 12px 14px;
  justify-content: center;
}

.entry-card-sm .entry-title {
  font-size: 14px;
  text-align: center;
}

.search-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.btn:hover { background: var(--accent-dark); }
.btn.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 12px;
  flex-wrap: wrap;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-link {
  font-size: 13px;
  color: var(--accent-dark);
  text-decoration: none;
  white-space: nowrap;
}

.section-link:hover {
  text-decoration: underline;
}

.section-title { font-size: 18px; font-weight: 600; }

/* 首页公告浮标（右上角，默认收起） */
.announcement-float {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  z-index: 200;
}

.announcement-float-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(122, 163, 201, 0.45);
  background: rgba(255, 255, 255, 0.96);
  color: #1e4a7a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.announcement-float-btn:hover {
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.18);
}

.announcement-float-btn:active {
  transform: scale(0.97);
}

.announcement-float.is-open .announcement-float-btn {
  background: linear-gradient(135deg, #7aa3c9, #6b94bd);
  color: #fff;
  border-color: transparent;
}

.announcement-float-icon {
  font-size: 15px;
  line-height: 1;
}

.announcement-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, calc(100vw - 28px));
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.25);
  overflow: hidden;
  transform-origin: top right;
  animation: announcement-panel-in 0.2s ease-out;
}

@keyframes announcement-panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.announcement-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc, #fff);
}

.announcement-panel-head strong {
  font-size: 15px;
  color: #0f172a;
}

.announcement-panel-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.announcement-panel-close:hover {
  background: #e2e8f0;
  color: #334155;
}

.announcement-panel-body {
  padding: 12px 14px 14px;
  max-height: min(50vh, 320px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.announcement-text {
  margin: 0;
  font-size: 14px;
  color: #475569;
  white-space: pre-line;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .announcement-float-label {
    display: none;
  }

  .announcement-float-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
  }
}

.hidden { display: none !important; }

.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.anime-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}

.anime-card:hover { transform: translateY(-3px); }

.anime-cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: #e8eef4;
  display: block;
}

.anime-info { padding: 10px; }
.anime-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.anime-count { font-size: 12px; color: var(--muted); margin-top: 4px; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

/* 作品官图 / 搜索官图：子页固定两列（覆盖旧版 mp-theme 单列 flex） */
body.sub-page .image-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px;
  width: 100%;
}

.image-card {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  width: 100%;
}

.image-card img {
  position: static;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 140px;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
  background: #dbe4ee;
  z-index: auto;
}

.image-actions {
  position: static;
  bottom: auto;
  left: auto;
  right: auto;
  padding: 8px 6px;
  background: #fff;
  display: flex;
  gap: 6px;
  justify-content: center;
  opacity: 1;
  z-index: auto;
  pointer-events: auto;
  border-top: 1px solid var(--border);
}

.image-actions button {
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f8fafc;
  color: #0f172a;
  cursor: pointer;
  font-weight: 600;
  pointer-events: auto;
}

.image-actions button:hover {
  background: #fff;
}

.image-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tab {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.empty, .loading, .error-banner {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.error-banner {
  background: #fef2f2;
  color: var(--danger);
  border-radius: 8px;
  margin-bottom: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox.hidden { display: none !important; }

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  border: none;
  background: rgba(255,255,255, 0.15);
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.news-category-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.news-category-bar .tab {
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 41;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.news-category-bar .tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.ranking-list, .news-list {
  display: grid;
  gap: 16px;
  margin-top: 4px;
}

.ranking-item, .news-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.news-item:hover {
  text-decoration: none;
  border-color: #c5d5e8;
  box-shadow: 0 4px 18px rgba(30, 50, 80, 0.1);
}

.news-item.is-navigating {
  opacity: 0.72;
  pointer-events: none;
}

.ranking-cover, .news-thumb {
  width: 56px;
  height: 76px;
  object-fit: cover;
  border-radius: 6px;
  background: #e8eef4;
}

.news-cat-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.news-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: #64748b;
  font-size: 13px;
  margin-bottom: 14px;
}

.news-detail-meta .badge {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.news-lang-block {
  margin-bottom: 16px;
}

.news-lang-label {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.news-original-block .news-original-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0 0 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.news-original-block .news-original-toggle .news-lang-label {
  margin-bottom: 0;
}

.news-original-toggle-hint {
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
}

.news-original-block.is-collapsed .news-original-content {
  display: none;
}

.news-original-block:not(.is-collapsed) .news-original-toggle-hint {
  color: #64748b;
}

.news-title-zh {
  margin: 0;
  font-size: 22px;
  line-height: 1.4;
}

.news-title-ja {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #64748b;
}

.news-cover {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 8px;
  margin: 8px 0 16px;
  background: #e8eef4;
}

.news-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.news-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #e8eef4;
}

.news-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.news-actions-main {
  margin-top: 8px;
}

.news-actions-main .btn {
  flex: 1;
  min-width: 140px;
}

.news-section {
  margin-bottom: 20px;
}

.news-sub-meta {
  font-size: 13px;
  color: #64748b;
  margin: 8px 0 16px;
}

.news-read-hint {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 16px;
}

.news-body-zh,
.news-body-ja {
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.news-body-ja {
  color: #475569;
  font-size: 14px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.gallery-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
}

.gallery-meta { padding: 10px; font-size: 13px; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 12px;
}

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 600px) {
  .site-nav { font-size: 12px; }
  .anime-grid { grid-template-columns: repeat(2, 1fr); }
}
