:root {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-tab: #0f0f1a;
  --text: #fff;
  --text-secondary: rgba(255,255,255,0.55);
  --text-active: rgba(255,255,255,0.9);
  --accent: #e94560;
  --accent-gold: #ffd700;
  --tab-height: 50px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
}
img { display:block; }
a { color:inherit; text-decoration:none; }

/* Bottom Tab Bar */
.tab-bar {
  position: fixed; bottom:0; left:0; right:0;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-tab);
  display: flex; align-items: center; justify-content: space-around;
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 100;
}
.tab-item {
  flex:1; display:flex; flex-direction:column; align-items:center; gap:2px;
  padding: 6px 0; cursor:pointer; transition: color .2s;
  color: var(--text-secondary); font-size: 10px;
}
.tab-item.active { color: var(--accent); }
.tab-item svg { width:22px; height:22px; }

/* Pages */
.page { display:none; min-height:100vh; }
.page.active { display:block; }

/* ===== HOME PAGE ===== */
.home-header {
  position:sticky; top:0; z-index:50;
  background: linear-gradient(180deg, var(--bg) 80%, transparent);
  padding: calc(10px + var(--safe-top)) 12px 0;
}
.home-logo {
  display:flex; align-items:center; gap:8px; margin-bottom:10px;
}
.home-logo .logo-circle {
  width:32px; height:32px; border-radius:50%; background:var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-weight:bold; font-size:11px;
}
.home-logo .logo-text { font-size:18px; font-weight:bold; }
.home-logo .logo-desc { font-size:11px; color:var(--text-secondary); margin-left:4px; }

/* 搜索栏 */
.search-bar {
  position:relative; margin:0 12px 8px; display:flex; align-items:center;
  background:rgba(255,255,255,0.06); border-radius:8px; padding:0 12px;
}
.search-icon { flex-shrink:0; opacity:0.5; }
#searchInput, #comicSearchInput {
  flex:1; background:none; border:none; color:#fff; padding:10px 8px;
  font-size:14px; outline:none;
}
#searchInput::placeholder, #comicSearchInput::placeholder { color:rgba(255,255,255,0.35); }
.search-clear {
  background:none; border:none; color:rgba(255,255,255,0.4); font-size:18px;
  cursor:pointer; padding:0 4px; line-height:1;
}
.search-results {
  position:absolute; top:100%; left:0; right:0; z-index:100;
  background:var(--bg-card); border:1px solid rgba(255,255,255,0.1);
  border-radius:8px; margin-top:4px; max-height:320px; overflow-y:auto;
  box-shadow:0 8px 24px rgba(0,0,0,0.5);
}
.search-result-item {
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 14px; cursor:pointer; border-bottom:1px solid rgba(255,255,255,0.04);
}
.search-result-item:active { background:rgba(255,255,255,0.05); }
.search-tag-name { font-size:14px; }
.search-tag-name mark { color:var(--accent); background:none; }
.search-tag-count { font-size:11px; color:var(--text-secondary); white-space:nowrap; margin-left:8px; }
.search-empty { text-align:center; padding:16px; font-size:13px; color:var(--text-secondary); }

/* 下拉刷新 */
.pull-indicator {
  position:absolute; top:-44px; left:50%; transform:translateX(-50%);
  display:flex; align-items:center; gap:6px;
  font-size:12px; color:var(--text-secondary);
  opacity:0; transition:transform .2s, opacity .2s;
  z-index:5;
}
.pull-indicator.refreshing .pull-spinner {
  animation:pullSpin .8s linear infinite;
}
@keyframes pullSpin { to { transform:rotate(360deg); } }

/* 回到顶部 */
.back-to-top {
  position:fixed; bottom:calc(var(--tab-height) + var(--safe-bottom) + 16px); right:16px;
  z-index:50; width:40px; height:40px; border-radius:50%;
  background:rgba(0,0,0,0.6); border:1px solid rgba(255,255,255,0.15);
  color:#fff; display:flex; align-items:center; justify-content:center;
  cursor:pointer; backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}
.back-to-top:active { transform:scale(0.9); }

/* Category Tabs */
.cat-tabs-shell {
  position:relative;
}
.cat-tabs {
  display:flex; overflow-x:auto; gap:16px; padding: 8px 0;
  scrollbar-width:none; -ms-overflow-style:none;
}
.cat-tabs::-webkit-scrollbar { display:none; }
.cat-tabs-shell.has-overflow::after {
  content:'';
  position:absolute; top:8px; right:0; width:36px; height:24px;
  background: linear-gradient(90deg, rgba(26,26,46,0), rgba(26,26,46,0.95));
  pointer-events:none;
}
.cat-tabs-hint {
  display:none;
  font-size:10px;
  line-height:1.4;
  color:var(--text-secondary);
  text-align:right;
  padding-bottom:6px;
}
.cat-tabs-hint.visible {
  display:block;
}
.cat-tab {
  white-space:nowrap; font-size:14px; color:var(--text-secondary);
  cursor:pointer; padding-bottom:6px; border-bottom:2px solid transparent;
  transition: all .2s; flex-shrink:0;
}
.cat-tab.active {
  color:var(--text-active); border-bottom-color:var(--accent); font-weight:600;
}

/* Video Grid */
.video-grid {
  display:grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:8px; padding:8px 12px 16px;
}
.video-card {
  background: var(--bg-card); border-radius:8px; overflow:hidden;
  cursor:pointer; transition: transform .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.video-card:active,
.video-card.tapped { transform: scale(0.96); opacity: 0.8; }
.video-card .cover-box {
  position:relative; width:100%; padding-top:56.25%; overflow:hidden;
  background: #0d1b2a;
}
.video-card .cover-box img {
  position:absolute; top:0; left:0; width:100%; height:100%; object-fit:cover;
}
.video-card .cover-box .badge {
  position:absolute; top:4px; left:4px;
  font-size:10px; padding:1px 5px; border-radius:3px; font-weight:600;
}
.badge-vip { background:linear-gradient(135deg,#e94560,#ff6b6b); }
.badge-coins { background:linear-gradient(135deg,#f0a500,#ffcc00); color:#1a1a2e; }
.video-card .cover-box .meta-overlay {
  position:absolute; bottom:0; left:0; right:0;
  display:flex; justify-content:space-between; align-items:center;
  padding:3px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  font-size:10px; color:rgba(255,255,255,0.85);
}
.video-card .info-box { padding:6px 8px; }
.video-card .info-box .title {
  font-size:12px; line-height:1.4;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden; word-break:break-all;
}
.video-card .info-box .tag-row {
  display:flex; gap:4px; margin-top:4px; flex-wrap:wrap;
}
.video-card .info-box .tag {
  font-size:10px; color:var(--accent); background:rgba(233,69,96,0.15);
  padding:1px 5px; border-radius:3px;
}
.video-card .info-box .bottom-row {
  display:flex; justify-content:space-between; align-items:center;
  margin-top:4px; font-size:10px; color:var(--text-secondary);
}

@media (min-width: 768px) {
  .home-header {
    padding: 14px 16px 0;
  }

  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap:12px;
  }

  .video-card .info-box {
    padding:8px 10px;
  }

  .video-card .info-box .title {
    font-size:13px;
  }
}

@media (min-width: 1280px) {
  .home-header,
  .video-grid {
    max-width: 1480px;
    margin-left: auto;
    margin-right: auto;
  }

  .video-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-left:16px;
    padding-right:16px;
  }
}

/* ===== DOUYIN PAGE ===== */
#page-douyin { position:relative; overflow:hidden; }
#page-douyin.active { display:flex; flex-direction:column; position:fixed; top:0; left:0; right:0; bottom:0; padding-bottom:0; z-index:10; }
.dy-container {
  position:relative; width:100%; height:calc(100vh - var(--tab-height) - var(--safe-bottom));
  overflow:hidden; background:#000;
}
.dy-top-bar {
  position:absolute; top:0; left:0; right:0; z-index:20;
  display:flex; justify-content:center; align-items:center; gap:24px;
  padding:calc(14px + var(--safe-top)) 0 10px;
  background: linear-gradient(rgba(0,0,0,0.6), transparent);
}
.dy-top-tab {
  font-size:16px; color:rgba(255,255,255,0.5); cursor:pointer;
  padding-bottom:4px; border-bottom:2px solid transparent;
  transition: all .25s; font-weight:500; position:relative;
}
.dy-top-tab.active {
  color:#fff; font-weight:700; font-size:17px;
}
.dy-top-tab.active::after {
  content:''; position:absolute; bottom:-2px; left:50%; transform:translateX(-50%);
  width:20px; height:2px; background:#fff; border-radius:1px;
}
.dy-swipe-viewport {
  position:relative; width:100%; height:100%;
  touch-action: pan-x;
}
.dy-slide {
  position:absolute; top:0; left:0; width:100%; height:100%;
  will-change: transform; transition: transform .35s cubic-bezier(.25,.46,.45,.94);
  background:#000; overflow:hidden;
}
.dy-slide.no-transition { transition:none; }
.dy-slide .sv-media-shell {
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden; background:#000;
}
.dy-slide .sv-backdrop {
  position:absolute; inset:-12%;
  width:124%; height:124%;
  object-fit:cover;
  filter: blur(28px) brightness(0.45);
  opacity:0.55;
  transform:scale(1.08);
}
.dy-slide .sv-cover,
.dy-slide .sv-video {
  position:absolute;
  inset:0;
  margin:auto;
  max-width:100%; max-height:100%;
  width:auto; height:auto;
  object-fit:contain;
  user-select:none; -webkit-user-drag:none; pointer-events:none;
  background:transparent;
}
.dy-slide .sv-cover {
  z-index:1;
  transition: opacity .2s ease;
}
.dy-slide .sv-video {
  z-index:2;
}
.dy-slide.is-landscape .sv-cover,
.dy-slide.is-landscape .sv-video,
.dy-slide.is-square .sv-cover,
.dy-slide.is-square .sv-video {
  width:100%;
  height:auto;
  max-height:100%;
}
.dy-slide.is-portrait .sv-cover,
.dy-slide.is-portrait .sv-video {
  width:auto;
  height:100%;
  max-width:100%;
}
.dy-slide.has-video-frame .sv-cover {
  opacity:0;
}
.dy-slide .sv-overlay {
  position:absolute; bottom:0; left:0; right:60px;
  padding:16px 12px calc(16px + var(--safe-bottom));
  background: linear-gradient(transparent 0%, rgba(0,0,0,0.7) 100%);
  pointer-events:none;
  z-index:2;
}
.dy-slide .sv-publisher {
  display:flex; align-items:center; gap:8px; margin-bottom:8px;
  pointer-events:auto;
}
.dy-slide .sv-avatar {
  width:40px; height:40px; border-radius:50%; object-fit:cover;
  border:2px solid rgba(255,255,255,0.5); flex-shrink:0;
}
.dy-slide .sv-publisher-link {
  display:flex; align-items:center; gap:8px; cursor:pointer;
}
.dy-slide .sv-name { font-size:15px; font-weight:700; text-shadow:0 1px 3px rgba(0,0,0,0.5); }
.dy-slide .sv-follow-btn {
  background:var(--accent); color:#fff; border:none; border-radius:4px;
  font-size:12px; padding:3px 10px; cursor:pointer; font-weight:600;
}
.dy-slide .sv-title {
  font-size:14px; line-height:1.5; text-shadow:0 1px 3px rgba(0,0,0,0.5);
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.dy-slide .sv-tags {
  display:flex; gap:6px; margin-top:6px; flex-wrap:wrap;
}
.dy-slide .sv-tag {
  font-size:12px; color:rgba(255,255,255,0.8); cursor:pointer;
}
.dy-slide .sv-tag::before { content:'#'; }
.dy-slide .sv-music {
  display:flex; align-items:center; gap:6px; margin-top:8px;
  font-size:12px; color:rgba(255,255,255,0.7);
  overflow:hidden; white-space:nowrap;
}
.sv-music-icon { flex-shrink:0; }
.sv-music-text {
  display:inline-block; animation: marquee 8s linear infinite;
}
@keyframes marquee {
  0% { transform:translateX(0); }
  100% { transform:translateX(-50%); }
}

/* Right-side action buttons */
.dy-slide .sv-actions {
  position:absolute; right:8px; bottom:calc(100px + var(--safe-bottom));
  display:flex; flex-direction:column; align-items:center; gap:18px;
  z-index:3;
}
.sv-action-btn {
  display:flex; flex-direction:column; align-items:center; gap:3px;
  font-size:11px; color:#fff; cursor:pointer;
  text-shadow:0 1px 3px rgba(0,0,0,0.5);
}
.sv-action-btn svg { width:30px; height:30px; filter:drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.sv-action-btn.liked svg { fill:var(--accent); stroke:var(--accent); }
/* Avatar + follow badge wrapper */
.sv-action-avatar-wrap {
  position:relative; margin-bottom:10px;
}
.sv-action-avatar {
  cursor:pointer;
}
.sv-action-avatar img {
  width:44px; height:44px; border-radius:50%; object-fit:cover;
  border:2px solid #fff;
}
.sv-action-avatar-wrap .plus-badge {
  position:absolute; bottom:-8px; left:50%; transform:translateX(-50%);
  width:20px; height:20px; background:var(--accent); border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:14px; font-weight:bold; line-height:1;
  cursor:pointer; z-index:2;
  transition: all .3s ease;
}
.sv-action-avatar-wrap .plus-badge:active {
  transform:translateX(-50%) scale(1.2);
}
.sv-action-avatar-wrap .plus-badge.follow-anim {
  background:#22c55e; transform:translateX(-50%) scale(1.4);
  opacity:0; transition: all .5s ease;
}
.sv-action-avatar-wrap .plus-badge.followed-badge {
  background:rgba(255,255,255,0.2); font-size:12px; pointer-events:none;
}
.sv-disc {
  width:40px; height:40px; border-radius:50%;
  background: radial-gradient(circle at center, #333 30%, #111 32%, #222 60%, #111 62%);
  border:2px solid #444;
  animation: spin 3s linear infinite;
  margin-top:4px;
}
@keyframes spin { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }
.dy-slide .sv-play-center {
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%) scale(0);
  width:70px; height:70px; background:rgba(255,255,255,0.15); border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  transition: transform .2s ease-out; pointer-events:none;
  z-index:2;
}
.dy-slide .sv-play-center.show { transform:translate(-50%,-50%) scale(1); }
.dy-slide .sv-play-center svg { width:32px; height:32px; fill:#fff; }
.dy-progress-bar {
  position:absolute; bottom:0; left:0; right:0; height:2px;
  background:rgba(255,255,255,0.15); z-index:15;
}
.dy-progress-fill {
  height:100%; background:#fff; width:0;
  animation: fakeProgress 15s linear infinite;
}
@keyframes fakeProgress { 0%{width:0} 100%{width:100%} }
.dy-swipe-hint {
  position:absolute; bottom:calc(60px + var(--safe-bottom)); left:50%; transform:translateX(-50%);
  color:rgba(255,255,255,0.4); font-size:12px;
  animation: hintBounce 2s ease-in-out infinite;
  pointer-events:none; z-index:10;
}
@keyframes hintBounce {
  0%,100% { transform:translateX(-50%) translateY(0); opacity:0.4; }
  50% { transform:translateX(-50%) translateY(-8px); opacity:0.8; }
}
.dy-swipe-hint.hidden { display:none; }
.dy-pull-hint {
  position:absolute; top:calc(48px + var(--safe-top)); left:50%; transform:translateX(-50%);
  color:rgba(255,255,255,0.7); font-size:12px; z-index:5; opacity:0;
  transition:opacity .15s;
}
.dy-mute-hint {
  position:absolute; top:calc(52px + var(--safe-top)); left:50%; transform:translateX(-50%);
  background:rgba(0,0,0,0.6); color:rgba(255,255,255,0.8); font-size:12px;
  padding:6px 14px; border-radius:16px; white-space:nowrap;
  backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px);
  pointer-events:none; animation: muteFade 4s ease-in-out forwards;
}
@keyframes muteFade {
  0%,70% { opacity:1; }
  100% { opacity:0; }
}

/* ===== MINE PAGE ===== */
.mine-page { background:var(--bg); }
.mine-header {
  padding:calc(20px + var(--safe-top)) 16px 20px; display:flex; align-items:center; gap:12px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.mine-avatar {
  width:56px; height:56px; border-radius:50%;
  background:var(--accent); display:flex; align-items:center; justify-content:center;
  font-size:24px; flex-shrink:0;
}
.mine-info { flex:1; }
.mine-name { font-size:16px; font-weight:600; }
.mine-uid { font-size:12px; color:var(--text-secondary); margin-top:2px; }
.mine-vip-banner {
  margin:12px; padding:12px 16px; border-radius:10px;
  background: linear-gradient(135deg, #2d1b4e 0%, #1a0a2e 100%);
  border:1px solid rgba(233,69,96,0.3);
  display:flex; align-items:center; justify-content:space-between;
}
.mine-vip-banner.vip-active {
  background: linear-gradient(135deg, #1b3a2d 0%, #0a2e1a 100%);
  border-color: rgba(76,175,80,0.3);
}
.mine-vip-left { display:flex; flex-direction:column; gap:4px; }
.mine-vip-title { font-size:14px; font-weight:600; color:var(--accent-gold); }
.mine-vip-desc { font-size:11px; color:var(--text-secondary); }
.mine-vip-btn {
  background: linear-gradient(135deg, var(--accent), #ff6b6b);
  color:#fff; border:none; padding:6px 16px; border-radius:20px;
  font-size:12px; font-weight:600; cursor:pointer; white-space:nowrap;
}
.mine-vip-btn.vip-go {
  background: linear-gradient(135deg, #43a047, #66bb6a);
}
.mine-stats {
  display:flex; justify-content:space-around; padding:16px 12px;
  border-bottom:1px solid rgba(255,255,255,0.06);
}
.mine-stat { text-align:center; }
.mine-stat .num { font-size:18px; font-weight:600; }
.mine-stat .label { font-size:11px; color:var(--text-secondary); margin-top:2px; }
.mine-menu { padding:8px 0; }
.mine-menu-item {
  display:flex; align-items:center; gap:12px;
  padding:14px 16px; cursor:pointer;
  transition: background .15s;
}
.mine-menu-item:active { background:rgba(255,255,255,0.05); }
.mine-menu-item svg { width:20px; height:20px; color:var(--text-secondary); flex-shrink:0; }
.mine-menu-item .menu-text { flex:1; font-size:14px; }
.mine-menu-item .menu-arrow { color:var(--text-secondary); font-size:14px; }
.mine-section-title {
  padding:12px 16px 8px; font-size:13px; color:var(--text-secondary);
  border-top:6px solid rgba(0,0,0,0.3);
}

/* ===== MINE OVERLAY ===== */
.mine-overlay {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:var(--bg); z-index:150;
  display:none; flex-direction:column;
}
.mine-overlay.open { display:flex; }
.mine-overlay-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:calc(12px + var(--safe-top)) 16px 12px; border-bottom:1px solid rgba(255,255,255,0.08);
}
.mine-overlay-back { cursor:pointer; padding:4px; }
.mine-overlay-title { font-size:16px; font-weight:600; }
.mine-overlay-tabs {
  display:flex; gap:0; border-bottom:1px solid rgba(255,255,255,0.08);
}
.overlay-tab {
  flex:1; text-align:center; padding:10px 0; font-size:14px;
  color:var(--text-secondary); cursor:pointer; position:relative;
}
.overlay-tab.active {
  color:var(--text-active); font-weight:600;
}
.overlay-tab.active::after {
  content:''; position:absolute; bottom:0; left:50%; transform:translateX(-50%);
  width:24px; height:2px; background:var(--accent); border-radius:1px;
}
.mine-overlay-body {
  flex:1; overflow-y:auto; padding:8px 0;
}
.mine-empty {
  text-align:center; color:var(--text-secondary); padding:60px 20px; font-size:14px;
}

/* 邀请好友卡片 */
.invite-card {
  max-width:340px; margin:24px auto; padding:28px 24px 24px;
  background: linear-gradient(160deg, #2d2218 0%, #1a1410 50%, #2d2218 100%);
  border:1px solid rgba(212,175,55,0.25); border-radius:16px;
  text-align:center; box-shadow:0 8px 32px rgba(0,0,0,0.4);
}
.invite-icon {
  width:56px; height:56px; margin:0 auto 12px; border-radius:50%;
  background: linear-gradient(135deg, #43a047, #66bb6a);
  display:flex; align-items:center; justify-content:center;
  font-size:16px; font-weight:700; color:#fff; letter-spacing:1px;
}
.invite-title { font-size:18px; font-weight:600; color:var(--accent-gold); margin-bottom:16px; }
.invite-divider {
  border-top:1px dashed rgba(212,175,55,0.3); margin:0 -8px 16px;
}
.invite-tip {
  font-size:13px; color:var(--accent-gold); line-height:1.6;
  margin-bottom:20px; padding:0 4px;
}
.invite-qr {
  display:flex; justify-content:center; padding:12px;
  background:#fff; border-radius:10px; margin:0 auto 12px;
  width:fit-content;
}
.invite-url {
  font-size:11px; color:var(--text-secondary); word-break:break-all;
  margin-bottom:20px; padding:0 8px;
}
.invite-footer {
  font-size:12px; color:var(--text-secondary); line-height:1.8;
}
.invite-footer strong { color:var(--text-primary); }

/* 设置页 */
.settings-list { padding:8px 0; }
.settings-item {
  display:flex; justify-content:space-between; align-items:center;
  padding:14px 20px; cursor:pointer;
  transition: background .15s;
}
.settings-item:active { background:rgba(255,255,255,0.05); }
.settings-item span:first-child { font-size:14px; }
.settings-hint { font-size:12px; color:var(--text-secondary); }
.settings-divider { height:1px; background:rgba(255,255,255,0.06); margin:8px 20px; }
.settings-info { padding:16px 20px; font-size:12px; color:var(--text-secondary); line-height:2; }

/* 帮助页 */
.help-list { padding:12px 0; }
.help-item { padding:14px 20px; border-bottom:1px solid rgba(255,255,255,0.05); }
.help-q { font-size:14px; font-weight:600; margin-bottom:8px; color:var(--text-primary); }
.help-a { font-size:13px; color:var(--text-secondary); line-height:1.7; }
.help-a strong { color:var(--text-primary); }
.help-contact {
  text-align:center; padding:24px 20px; font-size:12px; color:var(--text-secondary);
}

/* 关于页 */
.about-page { text-align:center; padding:40px 24px 24px; }
.about-logo {
  width:72px; height:72px; margin:0 auto 16px; border-radius:18px;
  background:linear-gradient(135deg, var(--accent), #ff6b6b);
  display:flex; align-items:center; justify-content:center;
  font-size:32px; font-weight:700; color:#fff;
}
.about-name { font-size:20px; font-weight:600; margin-bottom:4px; }
.about-version { font-size:12px; color:var(--text-secondary); margin-bottom:20px; }
.about-desc { font-size:13px; color:var(--text-secondary); line-height:1.8; margin-bottom:20px; }
.about-divider { height:1px; background:rgba(255,255,255,0.06); margin:0 -4px 16px; }
.about-section { text-align:left; }
.about-row {
  display:flex; justify-content:space-between; padding:10px 0;
  font-size:13px; border-bottom:1px solid rgba(255,255,255,0.04);
}
.about-row span:first-child { color:var(--text-secondary); }
.about-row span:last-child { color:var(--text-primary); }
.about-footer {
  margin-top:32px; font-size:12px; color:var(--text-secondary);
  padding:12px; background:rgba(255,255,255,0.03); border-radius:8px;
}

/* 头像选择器 */
.avatar-picker {
  display:grid; grid-template-columns:repeat(6,1fr); gap:12px;
  padding:20px;
}
.avatar-option {
  width:100%; aspect-ratio:1; border-radius:50%;
  background:rgba(255,255,255,0.06); display:flex; align-items:center;
  justify-content:center; font-size:28px; cursor:pointer;
  border:2px solid transparent; transition:border-color .15s, transform .15s;
}
.avatar-option:active { transform:scale(0.9); }
.avatar-option.selected { border-color:var(--accent-gold); background:rgba(255,215,0,0.1); }

/* 昵称编辑器 */
.name-editor { padding:24px 20px; }
.name-input {
  width:100%; padding:12px 16px; border:1px solid rgba(255,255,255,0.15);
  border-radius:8px; background:rgba(255,255,255,0.06); color:#fff;
  font-size:16px; outline:none;
}
.name-input:focus { border-color:var(--accent); }
.name-hint { font-size:12px; color:var(--text-secondary); margin-top:8px; }
.name-save-btn {
  margin-top:20px; width:100%; padding:12px; border:none; border-radius:8px;
  background:var(--accent); color:#fff; font-size:14px; font-weight:600;
  cursor:pointer;
}

/* 历史日期分组 */
.history-date-label {
  padding:10px 16px 4px; font-size:12px; color:var(--text-secondary);
  font-weight:600;
}
.history-clear-bar {
  display:flex; justify-content:flex-end; padding:8px 16px 0;
}
.history-clear-btn {
  background:none; border:1px solid rgba(255,255,255,0.15); color:var(--text-secondary);
  padding:4px 12px; border-radius:14px; font-size:11px; cursor:pointer;
}
.history-clear-btn:active { background:rgba(255,255,255,0.08); }

/* Video list item */
.mine-video-item {
  display:flex; gap:10px; padding:8px 16px; cursor:pointer;
  transition: background .15s;
}
.mine-video-item:active { background:rgba(255,255,255,0.05); }
.mine-video-cover {
  position:relative; width:140px; min-width:140px; border-radius:6px; overflow:hidden;
  background:#0d1b2a; aspect-ratio:16/9;
}
.mine-video-cover img {
  width:100%; height:100%; object-fit:cover; display:block;
}
.mine-video-duration {
  position:absolute; bottom:4px; right:4px;
  font-size:10px; background:rgba(0,0,0,0.7); padding:1px 4px; border-radius:2px;
  color:rgba(255,255,255,0.85);
}
.mine-video-info { flex:1; display:flex; flex-direction:column; justify-content:center; gap:6px; }
.mine-video-title {
  font-size:13px; line-height:1.4;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden; word-break:break-all;
}
.mine-video-meta { font-size:11px; color:var(--text-secondary); }

/* Follow list */
.mine-follow-item {
  display:flex; align-items:center; gap:12px; padding:10px 16px;
}
.mine-follow-avatar {
  width:44px; height:44px; border-radius:50%; overflow:hidden; flex-shrink:0;
  background:var(--bg-card);
}
.mine-follow-avatar img { width:100%; height:100%; object-fit:cover; }
.mine-follow-placeholder {
  width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  font-size:20px; background:var(--bg-card);
}
.mine-follow-name { font-size:14px; font-weight:500; }

/* Follow button states */
.sv-follow-btn.followed {
  background:rgba(255,255,255,0.2); color:rgba(255,255,255,0.6);
}

/* ===== VIDEO DETAIL PAGE ===== */
.detail-page {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:var(--bg); z-index:200;
  display:none; flex-direction:column;
}
.detail-page.open { display:flex; }
.detail-back {
  position:absolute; top:calc(10px + var(--safe-top)); left:10px; z-index:10;
  width:40px; height:40px; background:rgba(0,0,0,0.5); border-radius:50%;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  -webkit-tap-highlight-color: transparent;
}
.detail-back svg { width:18px; height:18px; fill:#fff; }
.detail-video-area {
  width:100%; background:#000; position:relative;
}
.detail-video-area img {
  width:100%; aspect-ratio:16/9; object-fit:cover;
}
.detail-video-area .play-btn {
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  width:54px; height:54px; background:rgba(0,0,0,0.6); border-radius:50%;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.detail-video-area .play-btn svg { width:24px; height:24px; fill:#fff; }
.detail-video-area .fullscreen-btn {
  position:absolute; bottom:12px; right:12px; z-index:10;
  width:36px; height:36px; background:rgba(0,0,0,0.5); border-radius:50%;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.detail-video-area .fullscreen-btn svg { width:18px; height:18px; }
/* 倍速栏 */
.detail-speed-bar {
  display:flex; align-items:center; gap:8px; padding:8px 16px;
  background:rgba(0,0,0,0.3);
}
.speed-label { font-size:12px; color:var(--text-secondary); }
.speed-options { display:flex; gap:6px; }
.speed-btn {
  background:rgba(255,255,255,0.08); border:none; color:var(--text-secondary);
  padding:4px 12px; border-radius:12px; font-size:12px; cursor:pointer;
}
.speed-btn.active { background:var(--accent); color:#fff; }

.detail-content {
  flex:1; overflow-y:auto; padding-bottom:20px;
}
.detail-tabs {
  display:flex; gap:20px; padding:10px 16px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  position:sticky; top:0; background:var(--bg); z-index:5;
}
.detail-tab {
  font-size:14px; color:var(--text-secondary); cursor:pointer; padding-bottom:6px;
}
.detail-tab.active { color:var(--text-active); border-bottom:2px solid var(--accent); font-weight:600; }
.detail-intro { padding:12px 16px; }
.detail-title { font-size:15px; font-weight:600; line-height:1.5; }
.detail-tags { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.detail-tags .tag {
  font-size:11px; color:var(--accent); background:rgba(233,69,96,0.15);
  padding:2px 8px; border-radius:4px; cursor:pointer;
}
.detail-actions {
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 16px; margin-top:8px;
}
.detail-actions .left { font-size:12px; color:var(--text-secondary); }
.detail-actions .right { display:flex; gap:16px; }
.detail-action-item {
  display:flex; align-items:center; gap:4px;
  font-size:12px; color:var(--text-secondary); cursor:pointer;
}
.detail-action-item svg { width:18px; height:18px; }
.detail-action-item.active { color:var(--accent); }
.detail-action-item.active svg { fill:var(--accent); stroke:var(--accent); }
.detail-recommend { padding:12px; }
.detail-recommend .section-title {
  font-size:14px; font-weight:600; margin-bottom:10px;
}

/* Comments */
.detail-comments { padding:12px 16px; display:none; }
.comment-item {
  padding:12px 0;
  border-bottom:1px solid rgba(255,255,255,0.06);
}
.comment-header {
  display:flex; align-items:center; gap:8px; margin-bottom:6px;
}
.comment-name {
  font-size:13px; font-weight:600; color:var(--text-active);
}
.comment-meta {
  font-size:11px; color:var(--text-secondary);
}
.comment-content {
  font-size:13px; line-height:1.5; color:var(--text);
}
.comment-likes {
  font-size:11px; color:var(--text-secondary); margin-top:4px;
}
.comment-reply {
  font-size:12px; color:var(--text-secondary); margin-top:6px; padding-left:12px;
  border-left:2px solid rgba(255,255,255,0.1);
}

/* Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.06) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Skeleton cards */
.skeleton-card { pointer-events:none; }
.skeleton-card .cover-box { background:var(--bg-card); }
.skeleton-card .info-box { padding:8px; }

/* Comment skeleton */
.comment-skeleton {
  display:flex; gap:10px; padding:12px 0;
  border-bottom:1px solid rgba(255,255,255,0.06);
}
.comment-sentinel { height:1px; }

/* Tag page overlay grid */
#tagOverlay .video-grid { padding:8px; }
#tagOverlay { z-index:250; }

/* Stats as clickable */
.mine-stat { cursor:pointer; transition: opacity .15s; }
.mine-stat:active { opacity:0.7; }

/* Video type badge */
.mine-video-type {
  position:absolute; top:4px; left:4px;
  font-size:9px; background:var(--accent); padding:1px 4px; border-radius:2px;
  color:#fff; font-weight:600;
}

/* ===== BOTTOM PANEL (share/comment) ===== */
.dy-bottom-panel {
  position:fixed; top:0; left:0; right:0; bottom:0; z-index:300;
  display:flex; flex-direction:column; justify-content:flex-end;
  pointer-events:none; opacity:0; transition: opacity .25s;
}
.dy-bottom-panel.open { pointer-events:auto; opacity:1; }
.dy-panel-mask {
  position:absolute; top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,0.5);
}
.dy-panel-content {
  position:relative; background:var(--bg); border-radius:12px 12px 0 0;
  max-height:50vh; display:flex; flex-direction:column;
  transform:translateY(100%); transition: transform .3s ease-out;
}
.dy-bottom-panel.open .dy-panel-content { transform:translateY(0); }
.dy-panel-tall { max-height:65vh; }
.dy-panel-header {
  display:flex; justify-content:space-between; align-items:center;
  padding:14px 16px; font-size:15px; font-weight:600;
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.dy-panel-close { font-size:22px; cursor:pointer; color:var(--text-secondary); padding:0 4px; }
.dy-panel-body { flex:1; overflow-y:auto; }

/* Comment items */
.dy-comment-item {
  display:flex; gap:10px; padding:12px 0;
  border-bottom:1px solid rgba(255,255,255,0.05);
}
.dy-comment-avatar {
  width:32px; height:32px; border-radius:50%; overflow:hidden; flex-shrink:0;
}
.dy-comment-avatar img { width:100%; height:100%; object-fit:cover; }
.dy-comment-body { flex:1; }
.dy-comment-name { font-size:12px; color:var(--text-secondary); margin-bottom:4px; }
.dy-comment-meta { font-size:11px; color:var(--text-secondary); }
.dy-comment-text { font-size:13px; line-height:1.5; }
.dy-comment-likes { font-size:11px; color:var(--text-secondary); margin-top:4px; }
.dy-comment-input {
  padding:8px 16px; border-top:1px solid rgba(255,255,255,0.08);
}
.dy-comment-input input {
  width:100%; padding:8px 12px; border-radius:20px;
  background:rgba(255,255,255,0.08); border:none; color:var(--text);
  font-size:13px; outline:none;
}
.dy-comment-input input::placeholder { color:var(--text-secondary); }

/* ===== USER PROFILE ===== */
.user-profile { padding-bottom:20px; }
.user-profile-bg {
  height:120px; background:linear-gradient(135deg, #1a1a2e 0%, #2d1b4e 50%, #16213e 100%);
}
.user-profile-header {
  text-align:center; margin-top:-40px;
}
.user-profile-avatar {
  width:80px; height:80px; border-radius:50%; margin:0 auto;
  overflow:hidden; border:3px solid var(--bg);
  background:var(--bg-card);
}
.user-profile-avatar img { width:100%; height:100%; object-fit:cover; }
.user-profile-placeholder {
  width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  font-size:32px; background:var(--bg-card);
}
.user-profile-name { font-size:18px; font-weight:700; margin-top:8px; }
.user-profile-uid { font-size:12px; color:var(--text-secondary); margin-top:4px; }
.user-profile-summary {
  font-size:13px; color:var(--text-secondary); margin:8px 20px 0; line-height:1.5;
}
.user-profile-stats {
  display:flex; justify-content:center; gap:16px; margin-top:10px;
  font-size:12px; color:var(--text-secondary);
}
.user-profile-actions {
  display:flex; justify-content:center; gap:12px; margin-top:16px;
}
.user-profile-follow {
  padding:8px 32px; border-radius:20px; border:none; cursor:pointer;
  font-size:14px; font-weight:600;
  background:var(--accent); color:#fff;
}
.user-profile-follow.followed {
  background:rgba(255,255,255,0.15); color:var(--text-secondary);
}
.user-profile-msg {
  padding:8px 24px; border-radius:20px; cursor:pointer;
  font-size:14px; font-weight:600;
  background:transparent; color:var(--text); border:1px solid rgba(255,255,255,0.2);
}

/* ===== TOAST ===== */
.app-toast {
  position:fixed; bottom:100px; left:50%; transform:translateX(-50%);
  background:rgba(0,0,0,0.85); color:#fff; padding:10px 20px;
  border-radius:8px; font-size:13px; z-index:999;
  opacity:0; transition: opacity .3s; pointer-events:none;
  max-width:80vw; text-align:center;
}
.app-toast.show { opacity:1; }

/* ===== USER PROFILE TABS + GRID ===== */
.user-profile-tabs {
  display:flex; border-bottom:1px solid rgba(255,255,255,0.08); margin-top:16px;
}
.user-profile-tabs .overlay-tab {
  flex:1; text-align:center; padding:10px 0; font-size:13px;
  color:var(--text-secondary); cursor:pointer; position:relative;
}
.user-profile-tabs .overlay-tab.active {
  color:var(--text-active); font-weight:600;
}
.user-profile-tabs .overlay-tab.active::after {
  content:''; position:absolute; bottom:0; left:50%; transform:translateX(-50%);
  width:24px; height:2px; background:var(--accent); border-radius:1px;
}
.user-video-grid {
  display:grid; grid-template-columns:1fr 1fr 1fr; gap:2px; padding:2px;
}
.user-video-card { cursor:pointer; overflow:hidden; }
.user-video-card:active { opacity:0.8; }
.user-video-cover {
  position:relative; width:100%; aspect-ratio:9/16; background:#0d1b2a; overflow:hidden;
}
.user-video-cover img {
  width:100%; height:100%; object-fit:cover; display:block;
}
.user-video-duration {
  position:absolute; bottom:4px; right:4px;
  font-size:10px; background:rgba(0,0,0,0.7); padding:1px 4px; border-radius:2px;
  color:rgba(255,255,255,0.85);
}
.user-video-plays {
  position:absolute; bottom:4px; left:4px;
  font-size:10px; color:rgba(255,255,255,0.75);
}
.user-video-title {
  font-size:11px; padding:4px; line-height:1.3;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}

.user-load-more {
  text-align:center; padding:16px; font-size:13px;
  color:var(--accent); cursor:pointer;
}
.user-load-more:active { opacity:0.7; }

/* Heart animation */
@keyframes heartPop {
  0% { transform:scale(0); opacity:1; }
  50% { transform:scale(1.3); opacity:1; }
  100% { transform:scale(1); opacity:0; }
}

/* ===== COMIC PAGE ===== */
.comic-header {
  position:sticky; top:0; z-index:50;
  background: linear-gradient(180deg, var(--bg) 80%, transparent);
  padding: calc(10px + var(--safe-top)) 12px 0;
}
.comic-source-switcher {
  display:flex; gap:6px; flex-wrap:wrap; padding: 4px 0 6px;
}
.comic-source-btn {
  font-size:12px; padding:6px 12px; border-radius:999px;
  background: var(--bg-card); color: var(--text-secondary);
  border: 1px solid transparent; cursor:pointer; transition: all .15s;
}
.comic-source-btn:hover { color: var(--text-primary); }
.comic-source-btn.active {
  background: linear-gradient(135deg, #ff4d6d, #ff8b5e);
  color:#fff; border-color: rgba(255,255,255,.15);
}
.seo-home-links {
  margin:8px 12px 6px;
  padding:12px;
  background:rgba(255,255,255,0.045);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
}
.seo-source-portals {
  margin:8px 12px 6px;
  padding:12px;
  background:rgba(255,255,255,0.052);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
}
.seo-topic-links {
  margin:8px 12px 6px;
  padding:12px;
  background:rgba(255,255,255,0.048);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
}
.seo-source-portals-head,
.seo-topic-links-head {
  margin-bottom:10px;
}
.seo-source-portals h2,
.seo-topic-links h2 {
  color:var(--text-active);
  font-size:15px;
  line-height:1.3;
}
.seo-source-portals p,
.seo-topic-links p {
  margin-top:3px;
  color:var(--text-secondary);
  font-size:11px;
  line-height:1.45;
}
.seo-source-portals-list,
.seo-topic-links-list {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
}
.seo-source-portal-link,
.seo-topic-link {
  min-width:0;
  padding:9px 10px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:7px;
  background:rgba(0,0,0,0.16);
}
.seo-source-portal-link strong,
.seo-topic-link strong {
  display:block;
  overflow:hidden;
  color:rgba(255,255,255,0.9);
  font-size:12px;
  line-height:1.35;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.seo-source-portal-link span,
.seo-topic-link span {
  display:block;
  margin-top:3px;
  color:var(--text-secondary);
  font-size:10px;
  line-height:1.35;
}
.seo-home-links-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.seo-home-links h2 {
  color:var(--text-active);
  font-size:15px;
  line-height:1.3;
}
.seo-home-links-head a {
  flex:0 0 auto;
  color:rgba(255,255,255,0.78);
  font-size:12px;
  text-decoration:underline;
  text-underline-offset:3px;
}
.seo-home-links ul {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px 12px;
  list-style:none;
}
.seo-home-links li {
  min-width:0;
}
.seo-home-links li a {
  display:block;
  overflow:hidden;
  color:rgba(255,255,255,0.9);
  font-size:12px;
  line-height:1.35;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.seo-home-links li span {
  display:block;
  margin-top:2px;
  color:var(--text-secondary);
  font-size:10px;
  line-height:1.3;
}
.comic-grid {
  display:grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:8px; padding:8px 12px 16px;
}
.comic-card {
  display:block; background: var(--bg-card); border-radius:8px; overflow:hidden;
  color:inherit; text-decoration:none; cursor:pointer; transition: transform .15s;
}
.comic-card:active { transform: scale(0.97); }
.comic-cover {
  position:relative; width:100%; padding-top:133%; overflow:hidden;
  background: #0d1b2a;
}
.comic-cover img {
  position:absolute; top:0; left:0; width:100%; height:100%; object-fit:cover;
}
.comic-status-badge {
  position:absolute; top:4px; left:4px;
  font-size:10px; font-weight:700; padding:2px 6px; border-radius:999px;
  color:#fff; backdrop-filter:blur(6px);
}
.comic-status-badge.is-completed {
  background:rgba(34, 197, 94, 0.86);
}
.comic-status-badge.is-ongoing {
  background:rgba(245, 158, 11, 0.92);
  color:#2a1b00;
}
.comic-episode-badge {
  position:absolute; top:4px; right:4px;
  font-size:10px; font-weight:700; padding:2px 6px; border-radius:999px;
  color:rgba(255,255,255,0.9); background:rgba(0,0,0,0.55);
}
.comic-chapter-badge {
  position:absolute; bottom:4px; right:4px;
  font-size:10px; background:rgba(0,0,0,0.7); padding:1px 5px; border-radius:3px;
  color:rgba(255,255,255,0.85);
}
.comic-card-info { padding:6px 8px; }
.comic-card-title {
  font-size:12px; line-height:1.4;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden; word-break:break-all;
}
.comic-card-meta {
  display:flex; gap:4px; margin-top:4px; flex-wrap:wrap; align-items:center;
  font-size:10px; color:var(--text-secondary);
}
.comic-card-meta .tag {
  font-size:9px; color:var(--accent); background:rgba(233,69,96,0.15);
  padding:1px 4px; border-radius:3px;
}

/* Comic skeleton */
.comic-grid .skeleton-card .comic-cover { background:var(--bg-card); }

@media (min-width: 768px) {
  .comic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap:12px; }
}
@media (min-width: 1280px) {
  .comic-header, .seo-source-portals, .seo-topic-links, .seo-home-links, .comic-grid { max-width:1480px; margin-left:auto; margin-right:auto; }
  .seo-source-portals { margin-top:10px; margin-bottom:8px; }
  .seo-topic-links { margin-top:10px; margin-bottom:8px; }
  .seo-home-links { margin-top:10px; margin-bottom:8px; }
  .seo-source-portals-list { grid-template-columns:repeat(5, minmax(0, 1fr)); }
  .seo-topic-links-list { grid-template-columns:repeat(4, minmax(0, 1fr)); }
  .seo-home-links ul { grid-template-columns:repeat(4, minmax(0, 1fr)); }
  .comic-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); padding:8px 16px 16px; }
}
@media (max-width: 560px) {
  .seo-home-links-head {
    align-items:flex-start;
    flex-direction:column;
  }
  .seo-home-links ul {
    grid-template-columns:1fr;
  }
  .seo-topic-links-list {
    grid-template-columns:1fr;
  }
  .seo-source-portals-list {
    grid-template-columns:1fr;
  }
}

/* ===== COMIC DETAIL ===== */
.comic-detail {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:var(--bg); z-index:200;
  display:none; flex-direction:column;
}
.comic-detail.open { display:flex; }
.comic-detail-back {
  position:absolute; top:calc(10px + var(--safe-top)); left:10px; z-index:10;
  width:40px; height:40px; background:rgba(0,0,0,0.5); border-radius:50%;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.comic-detail-back svg { width:18px; height:18px; }
.comic-detail-body {
  flex:1; overflow-y:auto; padding:calc(16px + var(--safe-top)) 16px 24px;
  display:flex; flex-direction:column; align-items:center;
}
.comic-detail-cover {
  width:200px; border-radius:8px; overflow:hidden; background:#0d1b2a;
  margin-top:40px;
}
.comic-detail-cover img {
  width:100%; aspect-ratio:3/4; object-fit:cover;
}
.comic-detail-info {
  width:100%; max-width:600px; margin-top:16px; text-align:center;
}
.comic-detail-title {
  font-size:18px; font-weight:700; line-height:1.4;
}
.comic-detail-tags {
  display:flex; gap:6px; margin-top:10px; flex-wrap:wrap; justify-content:center;
}
.comic-detail-tags .tag {
  font-size:11px; color:var(--accent); background:rgba(233,69,96,0.15);
  padding:2px 8px; border-radius:4px;
}
.comic-detail-tags .tag.status-tag {
  color:#fff;
  font-weight:700;
}
.comic-detail-tags .tag.status-tag.is-completed {
  background:rgba(34, 197, 94, 0.9);
}
.comic-detail-tags .tag.status-tag.is-ongoing {
  background:rgba(245, 158, 11, 0.92);
  color:#2a1b00;
}
.comic-detail-summary {
  font-size:13px; color:var(--text-secondary); margin-top:10px; line-height:1.5;
}
.comic-detail-stats {
  display:flex; gap:16px; justify-content:center; margin-top:12px;
  font-size:12px; color:var(--text-secondary);
}
.comic-read-btn {
  margin-top:20px; padding:10px 40px; border:none; border-radius:24px;
  background:linear-gradient(135deg, var(--accent), #ff6b6b);
  color:#fff; font-size:15px; font-weight:600; cursor:pointer;
  transition: transform .15s;
}
.comic-read-btn:active { transform:scale(0.95); }
.comic-detail-chapters {
  width:100%; margin-top:18px; text-align:left;
}
.comic-detail-chapters-title {
  font-size:13px; font-weight:700; color:rgba(255,255,255,0.92);
}
.comic-chapter-grid {
  display:grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:8px; margin-top:10px;
}
.comic-chapter-btn {
  border:none; border-radius:10px; padding:10px 12px;
  background:rgba(255,255,255,0.06); color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:space-between; gap:8px;
}
.comic-chapter-btn:active { transform:scale(0.98); }
.comic-chapter-label {
  font-size:12px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.comic-chapter-pages {
  font-size:11px; color:var(--text-secondary); flex-shrink:0;
}

/* ===== COMIC READER ===== */
.comic-reader {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:#000; z-index:300;
  display:none; flex-direction:column;
}
.comic-reader.open { display:flex; }
.comic-reader-header {
  position:fixed; top:0; left:0; right:0; z-index:310;
  display:flex; align-items:center; gap:12px;
  padding:calc(10px + var(--safe-top)) 12px 10px;
  background:linear-gradient(rgba(0,0,0,0.8), transparent);
  transition: opacity .3s;
}
.comic-reader-header.hidden { opacity:0; pointer-events:none; }
.comic-reader-back {
  width:36px; height:36px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0;
}
.comic-reader-back svg { width:18px; height:18px; }
.comic-reader-title {
  flex:1; font-size:14px; font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.comic-reader-page {
  font-size:12px; color:rgba(255,255,255,0.7); flex-shrink:0;
}
.comic-reader-body {
  flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding-bottom:calc(72px + var(--safe-bottom));
}
.comic-reader-page-wrap {
  width:100%; min-height:200px; background:#111;
}
.comic-reader-page-wrap img {
  width:100%; display:block;
}
.comic-reader-footer {
  position:fixed; left:0; right:0; bottom:0; z-index:310;
  display:flex; align-items:center; gap:12px; justify-content:space-between;
  padding:10px 12px calc(10px + var(--safe-bottom));
  background:linear-gradient(transparent, rgba(0,0,0,0.88) 28%);
  transition:opacity .3s;
}
.comic-reader-footer.hidden {
  opacity:0; pointer-events:none;
}
.comic-reader-nav-btn {
  min-width:88px; border:none; border-radius:999px; padding:10px 16px;
  background:rgba(255,255,255,0.12); color:#fff; font-size:13px; font-weight:600;
  cursor:pointer;
}
.comic-reader-nav-btn[disabled] {
  opacity:0.35; cursor:default;
}
.comic-reader-chapter-index {
  font-size:12px; color:rgba(255,255,255,0.72);
}

@media (max-width: 767px) {
  .comic-chapter-grid {
    grid-template-columns: 1fr;
  }
}

/* === PWA 横幅 === */
.pwa-banner {
  position:fixed; left:12px; right:12px; z-index:9999;
  border-radius:12px; padding:14px 16px;
  display:flex; align-items:flex-start; gap:12px;
  transform:translateY(120%); transition:transform .35s cubic-bezier(.16,1,.3,1);
  box-shadow:0 4px 20px rgba(0,0,0,0.5);
}
.pwa-banner.show { transform:translateY(0); }
.pwa-banner-close {
  background:none; border:none; color:rgba(255,255,255,0.6);
  font-size:20px; cursor:pointer; padding:0 2px; flex-shrink:0; line-height:1;
}

/* 安装横幅 — 底部 */
.pwa-banner-install {
  bottom:calc(var(--tab-height) + var(--safe-bottom) + 12px);
  background:linear-gradient(135deg, #1b3a2d, #0a2e1a);
  border:1px solid rgba(76,175,80,0.3); color:#fff;
}
.pwa-banner-main { flex:1; min-width:0; }
.pwa-banner-text { font-size:13px; line-height:1.5; margin-bottom:8px; }
.pwa-banner-text strong { color:var(--accent-gold); }
.pwa-steps {
  display:flex; align-items:center; gap:4px; flex-wrap:wrap;
  font-size:12px; color:rgba(255,255,255,0.7);
}
.pwa-share-icon { flex-shrink:0; vertical-align:middle; }
.pwa-install-btn {
  margin-top:10px; background:linear-gradient(135deg,#43a047,#66bb6a);
  color:#fff; border:none; padding:8px 20px; border-radius:20px;
  font-size:13px; font-weight:600; cursor:pointer;
}

/* 更新横幅 — 顶部 */
.pwa-banner-update {
  top:calc(var(--safe-top) + 12px);
  background:linear-gradient(135deg, #1a237e, #283593);
  border:1px solid rgba(92,107,192,0.4); color:#fff;
  align-items:center;
}
.pwa-banner-update span { font-size:14px; flex:1; }
#pwaBtnUpdate {
  background:#5c6bc0; color:#fff; border:none; padding:6px 16px;
  border-radius:16px; font-size:12px; font-weight:600; cursor:pointer;
  white-space:nowrap;
}

/* ===== Categories tab ===== */
.cat-tabs-shell { display: flex; align-items: center; gap: 8px; }
.cat-tabs-more {
  flex-shrink: 0; font-size: 12px; padding: 6px 10px; border-radius: 999px;
  background: var(--bg-card); color: var(--text-secondary); border: none; cursor: pointer;
}
.cat-tabs-more:hover { color: var(--text-primary); }
.categories-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; padding: 8px 12px 80px;
}
@media (min-width: 700px) {
  .categories-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .categories-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.category-item {
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--bg-card); padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.05); color: var(--text-primary);
  cursor: pointer; transition: transform .12s, border-color .12s;
}
.category-item:active { transform: scale(.97); }
.category-item:hover { border-color: rgba(255,77,109,.45); }
.category-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.category-count { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ===== Ranking page ===== */
.ranking-list {
  list-style: none; padding: 4px 12px 80px; margin: 0;
}
.ranking-item {
  display: flex; gap: 12px; padding: 10px 6px;
  border-bottom: 1px solid rgba(255,255,255,.05); cursor: pointer;
  transition: background .12s;
}
.ranking-item:hover { background: rgba(255,255,255,.03); }
.ranking-item:active { background: rgba(255,255,255,.06); }
.ranking-num {
  flex-shrink: 0; width: 28px; text-align: center; align-self: center;
  font-size: 16px; font-weight: 700; color: var(--text-secondary);
}
.ranking-item.is-top .ranking-num { color: #ff8b5e; }
.ranking-item.is-top-1 .ranking-num { color: #ff4d6d; font-size: 18px; }
.ranking-item.is-top-2 .ranking-num { color: #ff7a3a; }
.ranking-item.is-top-3 .ranking-num { color: #ffb84d; }
.ranking-cover {
  flex-shrink: 0; width: 60px; height: 80px; border-radius: 6px; overflow: hidden;
  background: #0d1b2a;
}
.ranking-cover img { width: 100%; height: 100%; object-fit: cover; }
.ranking-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.ranking-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ranking-meta {
  display: flex; gap: 4px; font-size: 11px; color: var(--text-secondary);
}
.ranking-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.ranking-tags .tag {
  font-size: 10px; padding: 1px 6px; border-radius: 6px;
  background: rgba(255,255,255,.05); color: var(--text-secondary);
}

/* ===== Detail tag clickable ===== */
.tag.tag-link {
  background: rgba(255,77,109,.15); color: #ff7a8a; border: none; cursor: pointer;
  font-size: 12px; padding: 2px 8px;
}
.tag.tag-link:hover { background: rgba(255,77,109,.28); color: #fff; }
.tag.tag-link:active { transform: scale(.96); }

.comic-load-more, .comic-list-count {
  grid-column: 1 / -1;
  margin: 8px auto 28px;
}

.comic-load-more {
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
}

.comic-list-count {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ===== HALLMARK 多站模板系统 =====
 * 每个域名使用不同的宏观结构，而不是仅替换主题色。
 */
:root {
  --text-primary: var(--text);
  --surface: var(--bg-card);
  --line: rgba(255, 255, 255, 0.12);
  --page-gutter: clamp(14px, 3vw, 40px);
}

.template-kicker,
.template-index,
.home-manifesto {
  display: none;
}

html[data-template] body {
  min-width: 320px;
}

html[data-template] .comic-header {
  isolation: isolate;
}

html[data-template] .template-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

html[data-template] .template-swatch {
  width: 42px;
  height: 8px;
  background: var(--accent);
}

html[data-template] .home-manifesto {
  display: block;
  max-width: 42rem;
  font-size: clamp(16px, 2vw, 25px);
  line-height: 1.25;
}

html[data-template] .template-index {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid currentColor;
  padding-top: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

html[data-template] .logo-text {
  margin: 0;
}

html[data-template] .search-bar input {
  min-height: 44px;
}

html[data-template] .cat-tab,
html[data-template] .cat-tabs-more,
html[data-template] .tab-item {
  min-height: 44px;
}

/* hallmark stamp: macrostructure=index-first · theme=Newsprint/custom · type=Georgia + system sans · color=paper/red/ink · mobile=pass */
html[data-template="atlas-index"] {
  --bg: #f1eadc;
  --bg-card: transparent;
  --bg-tab: #f1eadc;
  --text: #211f1a;
  --text-primary: #211f1a;
  --text-secondary: rgba(33, 31, 26, 0.64);
  --text-active: #211f1a;
  --surface: #e7dece;
  --line: rgba(33, 31, 26, 0.3);
}

html[data-template="atlas-index"] body {
  font-family: Arial, "Helvetica Neue", sans-serif;
  background: var(--bg);
}

html[data-template="atlas-index"] .comic-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  grid-template-areas:
    "kicker kicker"
    "logo manifesto"
    "search manifesto"
    "tabs tabs"
    "index index";
  gap: 16px 28px;
  max-width: 1500px;
  margin: 0 auto;
  padding: calc(22px + var(--safe-top)) var(--page-gutter) 12px;
  border-bottom: 2px solid var(--text);
  background: var(--bg);
}

html[data-template="atlas-index"] .template-kicker { grid-area: kicker; }
html[data-template="atlas-index"] .home-logo { grid-area: logo; display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 8px 14px; }
html[data-template="atlas-index"] .logo-circle { grid-row: 1 / 3; width: 68px; height: 68px; border: 2px solid currentColor; border-radius: 0; background: var(--accent); color: #fff8ea; font: 900 23px/1 Georgia, serif; }
html[data-template="atlas-index"] .logo-text { font: 700 clamp(30px, 5vw, 72px)/0.98 Georgia, "Times New Roman", serif; letter-spacing: -0.05em; }
html[data-template="atlas-index"] .logo-desc { max-width: 52rem; margin: 0; font-size: 12px; line-height: 1.4; color: var(--text-secondary); }
html[data-template="atlas-index"] .home-manifesto { grid-area: manifesto; align-self: end; padding-left: 22px; border-left: 1px solid var(--text); font-family: Georgia, "Times New Roman", serif; }
html[data-template="atlas-index"] .search-bar { grid-area: search; border: 1px solid var(--text); border-radius: 0; background: transparent; }
html[data-template="atlas-index"] .cat-tabs-shell { grid-area: tabs; border-top: 1px solid var(--line); }
html[data-template="atlas-index"] .cat-tab { border-radius: 0; background: transparent; border-right: 1px solid var(--line); }
html[data-template="atlas-index"] .cat-tab.active { background: var(--text); color: var(--bg); }
html[data-template="atlas-index"] .cat-tabs-more { border-radius: 0; border: 1px solid currentColor; background: transparent; }
html[data-template="atlas-index"] .template-index { grid-area: index; }
html[data-template="atlas-index"] .comic-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; max-width: 1500px; margin: 0 auto; padding: 24px var(--page-gutter) 40px; }
html[data-template="atlas-index"] .comic-card { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
html[data-template="atlas-index"] .comic-card:first-child { grid-column: span 2; grid-row: span 2; }
html[data-template="atlas-index"] .comic-card:first-child .comic-card-title { font: 700 21px/1.15 Georgia, serif; }
html[data-template="atlas-index"] .comic-cover { background: #d7cebd; }
html[data-template="atlas-index"] .comic-card-info { padding: 10px 10px 14px; }
html[data-template="atlas-index"] .comic-card-title { font-family: Georgia, "Times New Roman", serif; font-size: 14px; }
html[data-template="atlas-index"] .comic-card-meta .tag { border-radius: 0; color: var(--accent); background: transparent; border-bottom: 1px solid currentColor; }
html[data-template="atlas-index"] .tab-bar { border-top: 2px solid var(--text); color: var(--text); }
html[data-template="atlas-index"] .tab-item.active { background: var(--text); color: var(--bg); }
html[data-template="atlas-index"] .seo-source-portals,
html[data-template="atlas-index"] .seo-topic-links,
html[data-template="atlas-index"] .seo-home-links { border-radius: 0; border-color: var(--line); background: transparent; color: var(--text); }

/* hallmark stamp: macrostructure=poster-stack · theme=Riso/custom · type=Arial Black + Kaiti · color=yellow/vermilion/ink · mobile=pass */
html[data-template="riso-stack"] {
  --bg: #f5d93f;
  --bg-card: #fff6d8;
  --bg-tab: #171713;
  --text: #171713;
  --text-primary: #171713;
  --text-secondary: rgba(23, 23, 19, 0.65);
  --text-active: #171713;
  --surface: #fff6d8;
  --line: #171713;
}

html[data-template="riso-stack"] body {
  font-family: "Arial Narrow", Arial, sans-serif;
  background: var(--bg);
}

html[data-template="riso-stack"] .comic-header {
  position: sticky;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  grid-template-areas:
    "kicker index"
    "logo manifesto"
    "search tabs";
  gap: 12px 24px;
  padding: calc(12px + var(--safe-top)) var(--page-gutter) 14px;
  border-bottom: 4px solid var(--text);
  background: var(--bg);
}

html[data-template="riso-stack"] .template-kicker { grid-area: kicker; }
html[data-template="riso-stack"] .template-index { grid-area: index; border-top-width: 3px; }
html[data-template="riso-stack"] .home-logo { grid-area: logo; display: flex; align-items: center; gap: 12px; }
html[data-template="riso-stack"] .logo-circle { width: 58px; height: 58px; border: 3px solid var(--text); border-radius: 50%; background: var(--accent); color: #fff6d8; font-size: 24px; box-shadow: 5px 5px 0 var(--text); }
html[data-template="riso-stack"] .logo-text { font: 900 clamp(30px, 4.5vw, 64px)/1 "Arial Black", Impact, sans-serif; letter-spacing: -0.055em; }
html[data-template="riso-stack"] .logo-desc { display: none; }
html[data-template="riso-stack"] .home-manifesto { grid-area: manifesto; align-self: end; font-family: KaiTi, STKaiti, serif; font-size: clamp(18px, 2.2vw, 30px); }
html[data-template="riso-stack"] .search-bar { grid-area: search; border: 3px solid var(--text); border-radius: 0; background: #fff6d8; box-shadow: 5px 5px 0 var(--text); }
html[data-template="riso-stack"] .cat-tabs-shell { grid-area: tabs; }
html[data-template="riso-stack"] .cat-tab,
html[data-template="riso-stack"] .cat-tabs-more { border: 2px solid var(--text); border-radius: 0; background: transparent; color: var(--text); font-weight: 800; }
html[data-template="riso-stack"] .cat-tab.active { background: var(--accent); color: #fff; }
html[data-template="riso-stack"] .comic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 18px; max-width: 1480px; margin: 0 auto; padding: 28px var(--page-gutter) 50px; }
html[data-template="riso-stack"] .comic-card { overflow: visible; border: 3px solid var(--text); border-radius: 0; background: var(--bg-card); box-shadow: 7px 7px 0 var(--text); }
html[data-template="riso-stack"] .comic-card:nth-child(4n + 2) { transform: translateY(14px) rotate(0.5deg); }
html[data-template="riso-stack"] .comic-card:nth-child(4n + 3) { transform: rotate(-0.45deg); }
html[data-template="riso-stack"] .comic-card:active { transform: translate(4px, 4px); box-shadow: 3px 3px 0 var(--text); }
html[data-template="riso-stack"] .comic-card-info { padding: 10px; border-top: 3px solid var(--text); }
html[data-template="riso-stack"] .comic-card-title { font: 800 15px/1.3 "Arial Narrow", Arial, sans-serif; }
html[data-template="riso-stack"] .comic-card-meta .tag { border: 1px solid var(--text); border-radius: 0; background: var(--bg); color: var(--text); }
html[data-template="riso-stack"] .tab-bar { border-top: 3px solid var(--text); color: #fff6d8; }
html[data-template="riso-stack"] .tab-item.active { color: var(--bg); }

/* hallmark stamp: macrostructure=side-rail catalogue · theme=Specimen/custom · type=Arial Narrow + monospace · color=black/acid · mobile=pass */
html[data-template="specimen-rail"] {
  --bg: #10110f;
  --bg-card: #171914;
  --bg-tab: #10110f;
  --text: #f2f2e9;
  --text-primary: #f2f2e9;
  --text-secondary: rgba(242, 242, 233, 0.58);
  --text-active: #f2f2e9;
  --surface: #171914;
  --line: rgba(242, 242, 233, 0.22);
}

html[data-template="specimen-rail"] body {
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  background: var(--bg);
}

html[data-template="specimen-rail"] .comic-header {
  position: fixed;
  inset: 0 auto 0 0;
  width: 330px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: calc(24px + var(--safe-top)) 24px 96px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

html[data-template="specimen-rail"] .template-kicker { order: 0; }
html[data-template="specimen-rail"] .home-logo { order: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
html[data-template="specimen-rail"] .logo-circle { width: 48px; height: 48px; border: 1px solid var(--accent); border-radius: 0; background: transparent; color: var(--accent); font: 700 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
html[data-template="specimen-rail"] .logo-text { font: 800 42px/1 "Arial Narrow", Arial, sans-serif; letter-spacing: -0.045em; }
html[data-template="specimen-rail"] .logo-desc { margin: 0; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
html[data-template="specimen-rail"] .home-manifesto { order: 2; font-size: 18px; }
html[data-template="specimen-rail"] .search-bar { order: 3; border: 1px solid var(--accent); border-radius: 0; background: transparent; }
html[data-template="specimen-rail"] .cat-tabs-shell { order: 4; display: block; min-height: 0; overflow: auto; }
html[data-template="specimen-rail"] .cat-tabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
html[data-template="specimen-rail"] .cat-tab,
html[data-template="specimen-rail"] .cat-tabs-more { border-radius: 0; border: 1px solid var(--line); background: transparent; color: var(--text); font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
html[data-template="specimen-rail"] .cat-tab.active { background: var(--accent); color: #10110f; }
html[data-template="specimen-rail"] .cat-tabs-more { width: 100%; margin-top: 8px; }
html[data-template="specimen-rail"] .template-index { order: 5; margin-top: auto; color: var(--accent); }
html[data-template="specimen-rail"] #page-comic { padding-left: 330px; }
html[data-template="specimen-rail"] .comic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; padding: 0 0 72px; background: var(--line); }
html[data-template="specimen-rail"] .comic-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); min-height: 160px; border-radius: 0; background: var(--bg); }
html[data-template="specimen-rail"] .comic-cover { height: 160px; padding: 0; }
html[data-template="specimen-rail"] .comic-card-info { display: flex; flex-direction: column; justify-content: space-between; padding: 16px; }
html[data-template="specimen-rail"] .comic-card-title { font-size: 18px; font-weight: 800; }
html[data-template="specimen-rail"] .comic-card-meta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
html[data-template="specimen-rail"] .comic-card-meta .tag { border-radius: 0; background: transparent; color: var(--accent); border-bottom: 1px solid var(--accent); }
html[data-template="specimen-rail"] .tab-bar { left: 0; right: auto; width: 330px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
html[data-template="specimen-rail"] .tab-item.active { color: var(--accent); }

/* hallmark stamp: macrostructure=marquee catalogue · theme=Carnival/custom · type=Impact + system sans · color=acid/blue/black · mobile=pass */
html[data-template="vertical-signal"] {
  --bg: #2447f5;
  --bg-card: #f4f2e8;
  --bg-tab: #090a08;
  --text: #f4f2e8;
  --text-primary: #f4f2e8;
  --text-secondary: rgba(244, 242, 232, 0.7);
  --text-active: #f4f2e8;
  --surface: #f4f2e8;
  --line: #090a08;
}

html[data-template="vertical-signal"] body {
  font-family: Arial, "Helvetica Neue", sans-serif;
  background: var(--bg);
}

html[data-template="vertical-signal"] .comic-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  grid-template-areas:
    "kicker index"
    "logo logo"
    "manifesto search"
    "tabs tabs";
  gap: 14px 30px;
  padding: calc(18px + var(--safe-top)) var(--page-gutter) 18px;
  border-bottom: 5px solid var(--line);
  background: var(--bg);
}

html[data-template="vertical-signal"] .template-kicker { grid-area: kicker; }
html[data-template="vertical-signal"] .template-index { grid-area: index; }
html[data-template="vertical-signal"] .home-logo { grid-area: logo; display: flex; align-items: baseline; gap: 18px; }
html[data-template="vertical-signal"] .logo-circle { width: auto; height: auto; border: 0; border-radius: 0; background: transparent; color: var(--accent); font: 900 clamp(44px, 8vw, 112px)/1 Impact, "Arial Black", sans-serif; }
html[data-template="vertical-signal"] .logo-text { font: 900 clamp(44px, 8vw, 112px)/1 Impact, "Arial Black", sans-serif; letter-spacing: -0.035em; text-transform: uppercase; }
html[data-template="vertical-signal"] .logo-desc { display: none; }
html[data-template="vertical-signal"] .home-manifesto { grid-area: manifesto; align-self: center; max-width: 34rem; font-size: clamp(18px, 2vw, 28px); font-weight: 800; }
html[data-template="vertical-signal"] .search-bar { grid-area: search; border: 3px solid var(--line); border-radius: 0; background: var(--bg-card); color: #090a08; }
html[data-template="vertical-signal"] .search-bar input { color: #090a08; }
html[data-template="vertical-signal"] .cat-tabs-shell { grid-area: tabs; }
html[data-template="vertical-signal"] .cat-tab,
html[data-template="vertical-signal"] .cat-tabs-more { border: 2px solid var(--line); border-radius: 0; background: var(--accent); color: #090a08; font-weight: 900; }
html[data-template="vertical-signal"] .cat-tab.active { background: #090a08; color: var(--accent); }
html[data-template="vertical-signal"] .comic-grid { grid-auto-flow: dense; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-width: 1500px; margin: 0 auto; padding: 6px 6px 56px; background: #090a08; }
html[data-template="vertical-signal"] .comic-card { border: 2px solid #090a08; border-radius: 0; background: var(--bg-card); color: #090a08; }
html[data-template="vertical-signal"] .comic-card:nth-child(10n + 1) { grid-column: span 2; grid-row: span 2; }
html[data-template="vertical-signal"] .comic-card:nth-child(10n + 1) .comic-card-title { font-size: 22px; }
html[data-template="vertical-signal"] .comic-card:nth-child(10n + 4) .comic-cover,
html[data-template="vertical-signal"] .comic-card:nth-child(10n + 7) .comic-cover { padding-top: 172%; }
html[data-template="vertical-signal"] .comic-card-info { padding: 9px 10px 13px; border-top: 2px solid #090a08; }
html[data-template="vertical-signal"] .comic-card-title { font-size: 15px; font-weight: 900; }
html[data-template="vertical-signal"] .comic-card-meta { color: rgba(9, 10, 8, 0.65); }
html[data-template="vertical-signal"] .comic-card-meta .tag { border-radius: 0; background: var(--accent); color: #090a08; }
html[data-template="vertical-signal"] .tab-bar { left: 50%; right: auto; bottom: 10px; width: min(560px, calc(100% - 24px)); transform: translateX(-50%); border: 2px solid var(--accent); }
html[data-template="vertical-signal"] .tab-item.active { color: var(--accent); }

/* hallmark stamp: macrostructure=split-diptych catalogue · theme=Garden/custom · type=Songti + sans · color=ivory/coral/green · mobile=pass */
html[data-template="paper-garden"] {
  --bg: #f6f0e5;
  --bg-card: transparent;
  --bg-tab: rgba(246, 240, 229, 0.96);
  --text: #243b32;
  --text-primary: #243b32;
  --text-secondary: rgba(36, 59, 50, 0.62);
  --text-active: #243b32;
  --surface: #e6ead8;
  --line: rgba(36, 59, 50, 0.24);
}

html[data-template="paper-garden"] body {
  font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
}

html[data-template="paper-garden"] .comic-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  grid-template-areas:
    "kicker kicker"
    "logo manifesto"
    "logo search"
    "index tabs";
  gap: 18px 42px;
  max-width: 1440px;
  margin: 0 auto;
  padding: calc(28px + var(--safe-top)) var(--page-gutter) 24px;
  background: var(--bg);
}

html[data-template="paper-garden"] .template-kicker { grid-area: kicker; color: var(--accent); }
html[data-template="paper-garden"] .home-logo { grid-area: logo; display: grid; grid-template-columns: 72px 1fr; align-content: end; gap: 12px 18px; min-height: 210px; padding: 30px; background: #dce7d6; }
html[data-template="paper-garden"] .logo-circle { grid-row: 1 / 3; width: 72px; height: 72px; border-radius: 50% 50% 8px 50%; background: var(--accent); color: #fff; font: 700 27px/1 "Songti TC", STSong, serif; }
html[data-template="paper-garden"] .logo-text { align-self: end; font: 700 clamp(32px, 5vw, 68px)/1.05 "Songti TC", STSong, serif; letter-spacing: -0.04em; }
html[data-template="paper-garden"] .logo-desc { align-self: start; max-width: 30rem; margin: 0; font-size: 12px; line-height: 1.55; }
html[data-template="paper-garden"] .home-manifesto { grid-area: manifesto; align-self: end; font: 500 clamp(21px, 2.5vw, 34px)/1.35 "Songti TC", STSong, serif; }
html[data-template="paper-garden"] .search-bar { grid-area: search; border: 0; border-bottom: 1px solid var(--text); border-radius: 0; background: transparent; }
html[data-template="paper-garden"] .cat-tabs-shell { grid-area: tabs; }
html[data-template="paper-garden"] .cat-tab { border-radius: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); }
html[data-template="paper-garden"] .cat-tab.active { border-bottom-color: var(--accent); color: var(--accent); }
html[data-template="paper-garden"] .cat-tabs-more { border-radius: 0; background: #dce7d6; color: var(--text); }
html[data-template="paper-garden"] .template-index { grid-area: index; align-self: end; }
html[data-template="paper-garden"] .comic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 42px 24px; max-width: 1440px; margin: 0 auto; padding: 28px var(--page-gutter) 60px; }
html[data-template="paper-garden"] .comic-card { border-radius: 0; background: transparent; }
html[data-template="paper-garden"] .comic-card:nth-child(even) { margin-top: 34px; }
html[data-template="paper-garden"] .comic-cover { border-radius: 48% 48% 8px 8px / 12% 12% 8px 8px; background: #dce7d6; }
html[data-template="paper-garden"] .comic-card-info { padding: 12px 3px; }
html[data-template="paper-garden"] .comic-card-title { font: 600 16px/1.35 "Songti TC", STSong, serif; }
html[data-template="paper-garden"] .comic-card-meta .tag { border-radius: 0; background: transparent; color: var(--accent); }
html[data-template="paper-garden"] .tab-bar { border-top: 1px solid var(--line); color: var(--text); }
html[data-template="paper-garden"] .tab-item.active { color: var(--accent); }

/* hallmark stamp: macrostructure=dossier workbench · theme=Lumen/custom · type=Trebuchet + monospace · color=navy/pink/cyan · mobile=pass */
html[data-template="neon-dossier"] {
  --bg: #090a18;
  --bg-card: #12152b;
  --bg-tab: #0d1022;
  --text: #f7f4ff;
  --text-primary: #f7f4ff;
  --text-secondary: rgba(247, 244, 255, 0.58);
  --text-active: #f7f4ff;
  --surface: #12152b;
  --line: rgba(117, 230, 255, 0.28);
}

html[data-template="neon-dossier"] body {
  font-family: "Trebuchet MS", Arial, sans-serif;
  background: var(--bg);
}

html[data-template="neon-dossier"] .comic-header {
  position: relative;
  display: grid;
  grid-template-columns: 0.65fr 1.1fr 0.85fr;
  grid-template-areas:
    "kicker logo index"
    "manifesto logo search"
    "manifesto logo tabs";
  gap: 18px 30px;
  max-width: 1500px;
  margin: 0 auto;
  padding: calc(24px + var(--safe-top)) var(--page-gutter) 30px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

html[data-template="neon-dossier"] .template-kicker { grid-area: kicker; color: #75e6ff; }
html[data-template="neon-dossier"] .home-logo { grid-area: logo; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 230px; border: 1px solid var(--line); background: rgba(18, 21, 43, 0.78); }
html[data-template="neon-dossier"] .logo-circle { width: 76px; height: 76px; border: 1px solid #75e6ff; border-radius: 0; background: var(--accent); color: #090a18; font: 900 25px/1 ui-monospace, SFMono-Regular, Menlo, monospace; box-shadow: 12px 12px 0 rgba(117, 230, 255, 0.18); }
html[data-template="neon-dossier"] .logo-text { max-width: 10ch; text-align: center; font: 800 clamp(34px, 4.5vw, 64px)/1 "Trebuchet MS", sans-serif; letter-spacing: -0.05em; }
html[data-template="neon-dossier"] .logo-desc { display: none; }
html[data-template="neon-dossier"] .home-manifesto { grid-area: manifesto; align-self: end; font-size: clamp(18px, 2vw, 27px); }
html[data-template="neon-dossier"] .template-index { grid-area: index; color: var(--accent); }
html[data-template="neon-dossier"] .search-bar { grid-area: search; border: 1px solid #75e6ff; border-radius: 0; background: rgba(9, 10, 24, 0.8); }
html[data-template="neon-dossier"] .cat-tabs-shell { grid-area: tabs; }
html[data-template="neon-dossier"] .cat-tab,
html[data-template="neon-dossier"] .cat-tabs-more { border-radius: 0; border: 1px solid var(--line); background: transparent; color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
html[data-template="neon-dossier"] .cat-tab.active { border-color: var(--accent); background: var(--accent); color: #090a18; }
html[data-template="neon-dossier"] .comic-grid { grid-auto-flow: dense; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 1500px; margin: 0 auto; padding: 20px var(--page-gutter) 60px; }
html[data-template="neon-dossier"] .comic-card { border: 1px solid var(--line); border-radius: 0; background: rgba(18, 21, 43, 0.86); }
html[data-template="neon-dossier"] .comic-card:first-child { grid-column: span 2; display: grid; grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1.25fr); }
html[data-template="neon-dossier"] .comic-card:first-child .comic-cover { height: 100%; min-height: 340px; padding: 0; }
html[data-template="neon-dossier"] .comic-card:first-child .comic-card-info { display: flex; flex-direction: column; justify-content: flex-end; padding: 26px; }
html[data-template="neon-dossier"] .comic-card:first-child .comic-card-title { font-size: clamp(24px, 3vw, 42px); }
html[data-template="neon-dossier"] .comic-card-info { padding: 12px; }
html[data-template="neon-dossier"] .comic-card-title { font-size: 16px; font-weight: 800; }
html[data-template="neon-dossier"] .comic-card-meta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
html[data-template="neon-dossier"] .comic-card-meta .tag { border-radius: 0; background: transparent; color: #75e6ff; border-bottom: 1px solid #75e6ff; }
html[data-template="neon-dossier"] .tab-bar { top: 50%; bottom: auto; left: auto; right: 10px; width: 64px; height: auto; padding: 6px; transform: translateY(-50%); flex-direction: column; border: 1px solid var(--line); }
html[data-template="neon-dossier"] .tab-item { width: 52px; min-height: 58px; }
html[data-template="neon-dossier"] .tab-item.active { color: var(--accent); }

/* 六套模板的共同响应式收口。 */
@media (max-width: 900px) {
  html[data-template="atlas-index"] .comic-header,
  html[data-template="riso-stack"] .comic-header,
  html[data-template="vertical-signal"] .comic-header,
  html[data-template="paper-garden"] .comic-header,
  html[data-template="neon-dossier"] .comic-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "kicker"
      "logo"
      "manifesto"
      "search"
      "tabs"
      "index";
    gap: 12px;
  }

  html[data-template="atlas-index"] .home-manifesto { padding: 0; border: 0; }
  html[data-template="riso-stack"] .template-index { border-top-width: 1px; }
  html[data-template="paper-garden"] .home-logo,
  html[data-template="neon-dossier"] .home-logo { min-height: 0; }

  html[data-template="specimen-rail"] .comic-header {
    position: relative;
    inset: auto;
    width: auto;
    padding: calc(18px + var(--safe-top)) var(--page-gutter) 18px;
  }
  html[data-template="specimen-rail"] #page-comic { padding-left: 0; }
  html[data-template="specimen-rail"] .cat-tabs { display: flex; overflow-x: auto; }
  html[data-template="specimen-rail"] .template-index { margin-top: 0; }
  html[data-template="specimen-rail"] .tab-bar { left: 0; right: 0; bottom: 0; width: auto; }

  html[data-template="atlas-index"] .comic-grid,
  html[data-template="riso-stack"] .comic-grid,
  html[data-template="vertical-signal"] .comic-grid,
  html[data-template="paper-garden"] .comic-grid,
  html[data-template="neon-dossier"] .comic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  html[data-template="neon-dossier"] .tab-bar { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: calc(var(--tab-height) + var(--safe-bottom)); padding: 0 0 var(--safe-bottom); transform: none; flex-direction: row; }
  html[data-template="neon-dossier"] .tab-item { width: auto; min-height: 44px; }
}

@media (max-width: 600px) {
  html[data-template] .comic-header { padding-left: 14px; padding-right: 14px; }
  html[data-template] .template-kicker { font-size: 9px; }
  html[data-template] .home-manifesto { font-size: 17px; }
  html[data-template] .template-index { font-size: 9px; }

  html[data-template="atlas-index"] .home-logo { grid-template-columns: 50px 1fr; gap: 6px 10px; }
  html[data-template="atlas-index"] .logo-circle { width: 50px; height: 50px; }
  html[data-template="atlas-index"] .logo-text { font-size: 34px; }
  html[data-template="atlas-index"] .comic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 0; padding-right: 0; }
  html[data-template="atlas-index"] .comic-card:first-child { grid-column: span 2; }

  html[data-template="riso-stack"] .comic-header { position: relative; }
  html[data-template="riso-stack"] .logo-text { font-size: 31px; }
  html[data-template="riso-stack"] .comic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; padding: 18px 12px 44px; }
  html[data-template="riso-stack"] .comic-card:nth-child(4n + 2) { transform: translateY(6px); }
  html[data-template="riso-stack"] .comic-card:nth-child(4n + 3) { transform: none; }

  html[data-template="specimen-rail"] .logo-text { font-size: 34px; }
  html[data-template="specimen-rail"] .comic-grid { grid-template-columns: 1fr; }
  html[data-template="specimen-rail"] .comic-card { grid-template-columns: 100px minmax(0, 1fr); }

  html[data-template="vertical-signal"] .home-logo { gap: 8px; }
  html[data-template="vertical-signal"] .logo-circle,
  html[data-template="vertical-signal"] .logo-text { font-size: 39px; }
  html[data-template="vertical-signal"] .comic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-template="vertical-signal"] .comic-card:nth-child(10n + 1) { grid-column: span 2; grid-row: auto; }
  html[data-template="vertical-signal"] .comic-card:nth-child(10n + 4) .comic-cover,
  html[data-template="vertical-signal"] .comic-card:nth-child(10n + 7) .comic-cover { padding-top: 148%; }

  html[data-template="paper-garden"] .home-logo { grid-template-columns: 54px 1fr; padding: 20px; }
  html[data-template="paper-garden"] .logo-circle { width: 54px; height: 54px; }
  html[data-template="paper-garden"] .logo-text { font-size: 32px; }
  html[data-template="paper-garden"] .comic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; padding: 18px 14px 50px; }
  html[data-template="paper-garden"] .comic-card:nth-child(even) { margin-top: 18px; }

  html[data-template="neon-dossier"] .home-logo { align-items: flex-start; padding: 20px; }
  html[data-template="neon-dossier"] .logo-circle { width: 54px; height: 54px; font-size: 18px; }
  html[data-template="neon-dossier"] .logo-text { max-width: none; text-align: left; font-size: 34px; }
  html[data-template="neon-dossier"] .comic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 10px 50px; }
  html[data-template="neon-dossier"] .comic-card:first-child { grid-column: span 2; display: block; }
  html[data-template="neon-dossier"] .comic-card:first-child .comic-cover { min-height: 0; height: auto; padding-top: 118%; }
  html[data-template="neon-dossier"] .comic-card:first-child .comic-card-info { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-template] *,
  html[data-template] *::before,
  html[data-template] *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* 防止长品牌文案把移动端网格撑出视口。 */
html[data-template] .comic-header,
html[data-template] .comic-header > *,
html[data-template] .home-logo > *,
html[data-template] .search-bar,
html[data-template] .cat-tabs-shell,
html[data-template] .cat-tabs {
  min-width: 0;
}

html[data-template] .logo-text,
html[data-template] .logo-desc,
html[data-template] .home-manifesto,
html[data-template] .template-kicker > span:first-child {
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  html[data-template] .comic-header {
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
}
