:root {
  color-scheme: light;
  --background: #f4f6fa;
  --surface: #fff;
  --text: #253143;
  --muted: #546277;
  --border: #dbe2ed;
  --link: #3b5477;
  --primary: #425e80;
  --primary-hover: #324b6a;
  --tint: #eaf0f8;
  --shell-width: 1180px;
  --page-gutter: clamp(16px, 4vw, 48px);
  --font-body: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-copy: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--background);
  color: var(--text);
  font: var(--font-copy) / 1.6 var(--font-body);
}
h1, h2, h3, p, ul { margin: 0; }
[hidden] { display: none !important; }
:is(a, button):focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page { display: flex; flex-direction: column; height: 100%; }
.shell { width: min(var(--shell-width), 100% - var(--page-gutter) * 2); margin-inline: auto; }
.header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding-block: calc(14px + env(safe-area-inset-top, 0px)) 14px;
  border-bottom: 1px solid var(--border);
}
.header-name { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 700; }
.brand-mark {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #edf1f8;
}
.brand-mark img { display: block; }
.header-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px clamp(14px, 3vw, 32px); }
.section-link { color: var(--link); font-weight: 600; text-decoration: none; }
main { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.content { display: flex; flex-direction: column; gap: clamp(26px, 3vw, 36px); padding-block: 24px calc(32px + env(safe-area-inset-bottom, 0px)); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(22px, 5vw, 76px);
  padding: clamp(24px, 3.6vw, 50px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: radial-gradient(ellipse at 62% 0%, #e6e5f5, transparent 62%), #ebf1f8;
}
.hero-copy { min-width: 0; }
.hero-heading { display: flex; align-items: center; gap: clamp(8px, 1.8vw, 20px); }
h1 {
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 750;
  line-height: 1.16;
}
h1 span { display: block; color: var(--primary); }
.hero-mark {
  display: grid;
  flex: 0 1 clamp(82px, 12vw, 160px);
  place-items: center;
  min-width: 68px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #fafafe 12%, #e0e6f3 69%, #e6e9f500 71%);
}
.hero-mark img { width: 100%; height: auto; filter: drop-shadow(0 6px 6px #27466d29); }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: clamp(17px, 2.3vw, 28px); }
.visit, .hero-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; }
.visit {
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
}
.visit[aria-disabled="true"] { background: #dde5f0; color: var(--muted); }
.visit svg, .hero-link svg { width: 17px; height: 17px; }
.hero-link { padding-inline: 6px; }
.access-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 10px; color: var(--muted); overflow-wrap: anywhere; }
#retry { min-height: 24px; padding: 0 2px; border: 0; background: transparent; color: var(--link); font: inherit; cursor: pointer; }

.promotions { min-width: 0; }
.promotions h2 { margin-bottom: 10px; color: var(--link); font-size: 14px; font-weight: 700; line-height: 1.4; }
.promotion-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.promotion {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 127px;
  padding: 13px clamp(14px, 1.8vw, 22px);
  overflow: hidden;
  isolation: isolate;
  border-radius: 13px;
  background: var(--promotion-background);
  color: #fff;
  text-decoration: none;
}
.promotion--drama {
  --promotion-background: #3e241c;
  --promotion-shade: #3e241cc2;
  --promotion-accent: #ffdda4;
}
.promotion--comics {
  --promotion-background: #302343;
  --promotion-shade: #302343c2;
  --promotion-accent: #eee1ff;
}
.promotion-cover {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: -2;
  width: 68%;
  height: 100%;
  color: transparent;
  object-fit: cover;
}
.promotion::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, var(--promotion-background) 32%, var(--promotion-shade) 48%, transparent 70%);
  content: "";
}
.promotion-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 64%;
  gap: 3px;
}
.promotion-brand { display: flex; align-items: center; gap: 10px; }
.promotion-brand-icon { position: relative; flex: none; }
.promotion-icon {
  display: block;
  padding: 3px;
  border-radius: 8px;
  background: #ffffff26;
  object-fit: contain;
}
.promotion--comics .promotion-icon { padding: 0; }
.promotion-brand-icon::before, .promotion-brand-icon::after {
  position: absolute;
  content: "";
}
.promotion-brand-icon::before {
  right: -4px;
  bottom: -2px;
  width: 17px;
  height: 17px;
  border: 2px solid var(--promotion-background);
  border-radius: 6px;
  background: var(--promotion-accent);
}
.promotion-brand-icon::after {
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 11px;
  background: var(--promotion-background);
  clip-path: polygon(48% 0, 100% 0, 68% 37%, 94% 37%, 25% 100%, 38% 57%, 0 57%);
}
.promotion h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  font-size: clamp(17px, 1.7vw, 23px);
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}
.promotion h3 small {
  padding: 2px 4px;
  border-radius: 4px;
  background: #ffffff21;
  color: var(--promotion-accent);
  font-size: 11px;
  font-weight: 650;
}
.promotion p { color: var(--promotion-accent); font-size: 13px; line-height: 1.45; }
.promotion-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  margin-top: 5px;
  padding-inline: 9px;
  border: 1px solid #ffffff6b;
  border-radius: 16px;
  background: #ffffff0d;
  font-size: 12px;
  font-weight: 650;
}
.promotion-action svg { width: 13px; height: 13px; }

.directory, #sources-title { scroll-margin-block-start: 18px; }
.directory h2, .sources h2 { margin-bottom: 13px; font-size: clamp(20px, 2.2vw, 26px); font-weight: 700; line-height: 1.35; }
.site-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0; list-style: none; }
.site-list li { min-width: 0; }
.site-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  min-height: 80px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 2px 5px #253c5709;
  color: var(--text);
  text-decoration: none;
}
.site-icon {
  --site-icon-size: 46px;
  display: block;
  flex: 0 0 var(--site-icon-size);
  width: var(--site-icon-size);
  height: var(--site-icon-size);
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #f2f5f9;
  object-fit: contain;
}
.site-copy { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.site-copy strong { font-size: calc(var(--font-copy) + 2px); font-weight: 700; line-height: 1.3; }
.site-copy small { padding: 1px 6px; border-radius: 4px; background: var(--tint); color: var(--muted); font-size: 12px; line-height: 1.4; }
.site-corner-label {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  padding: 2px 7px;
  border-start-end-radius: 12px;
  border-end-start-radius: 7px;
  background: #fff0d6;
  color: #7b460e;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}
.site-action {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  height: 28px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--link);
  visibility: hidden;
}
.site-card[href] .site-action { visibility: visible; }
.site-action::before {
  width: 7px;
  height: 7px;
  border-block-start: 1.5px solid var(--link);
  border-inline-end: 1.5px solid var(--link);
  transform: translateX(-1px) rotate(45deg);
  content: "";
}

.sources {
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}
.source-summary {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--tint);
  color: var(--link);
}
.source-summary svg { margin-top: 1px; }
.source-summary strong { color: var(--text); font-weight: 650; }
.source-summary p { margin-top: 2px; }
.source-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 0 0; list-style: none; }
.source-list li { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.source-list li + li { padding-inline-start: 16px; border-inline-start: 1px solid var(--border); }
.source-icon {
  display: grid;
  flex: 0 0 33px;
  place-items: center;
  height: 33px;
  border-radius: 8px;
  background: var(--tint);
  color: var(--link);
}
.source-icon svg { width: 18px; height: 18px; }
.source-copy { min-width: 0; }
.source-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 7px; }
.source-heading h3 { font-size: calc(var(--font-copy) + 1px); font-weight: 700; }
.source-result { color: var(--link); font-size: 12px; font-weight: 550; }
.source-copy p { margin-top: 5px; color: var(--muted); }
.source-copy code { color: var(--link); font-size: .92em; overflow-wrap: anywhere; }

@media (hover: hover) {
  .visit[href]:hover { background: var(--primary-hover); }
  .promotion:hover .promotion-action { border-color: #fff; background: #ffffff29; }
  .site-card[href]:hover { border-color: #adbed8; background: #fafcff; color: var(--link); }
  .site-card[href]:hover .site-action { background: #dce7f6; }
  .section-link:hover, #retry:hover { text-decoration: underline; text-underline-offset: 3px; }
}
@media (prefers-reduced-motion: no-preference) {
  main { scroll-behavior: smooth; }
  .site-card, .visit, .promotion-action { transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
}
@media (max-width: 860px) {
  .source-list { grid-template-columns: 1fr; gap: 0; padding-top: 4px; }
  .source-list li { padding-block: 12px; }
  .source-list li:last-child { padding-block-end: 0; }
  .source-list li + li { padding-inline-start: 0; border-inline-start: 0; border-block-start: 1px solid var(--border); }
}
@media (max-width: 680px) {
  .header { min-height: 60px; padding-block: calc(10px + env(safe-area-inset-top, 0px)) 10px; }
  .header-name { font-size: 15px; gap: 6px; }
  .brand-mark { flex-basis: 34px; width: 34px; height: 34px; border-radius: 9px; }
  .brand-mark img { width: 28px; height: 28px; }
  .header-nav { font-size: 12px; }
  .content { gap: 23px; padding-block: 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .hero { grid-template-columns: 1fr; gap: 20px; padding: 20px; border-radius: 17px; }
  h1 { font-size: clamp(33px, 10vw, 44px); }
  .hero-mark { flex-basis: clamp(68px, 23vw, 106px); }
  .promotion-list { gap: 8px; }
  .promotion { min-height: 112px; padding-block: 10px; }
  .promotion h3 { font-size: 19px; }
  .site-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .site-card { min-height: 70px; gap: 8px; padding: 9px; }
  .site-icon { --site-icon-size: 36px; border-radius: 8px; }
  .site-copy strong { font-size: 14px; }
  .site-action { flex-basis: 20px; height: 20px; }
  .site-action::before { width: 6px; height: 6px; }
}
@media (max-width: 360px) {
  h1 { font-size: 30px; }
  .site-card { min-height: 74px; }
  .site-action { display: none; }
  .site-corner-label { padding-block: 1px; font-size: 10px; line-height: 1.2; }
}
@media (min-width: 1920px) {
  :root { --shell-width: 1440px; --font-copy: 16px; }
  .header { min-height: 86px; }
  .hero { padding: 54px 60px; }
  .site-card { min-height: 90px; padding: 14px 20px; }
  .site-icon { --site-icon-size: 50px; }
}
