:root {
  --bg: #fff;
  --fg: #1f2328;
  --muted: #656d76;
  --line: #d1d9e0;
  --accent: #1f6feb;
  --card: #f6f8fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header,
.site-footer {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.site-footer {
  border-bottom: none;
  border-top: none;
  background: #f7f7f7;
  color: #999;
  font-size: 13px;
  line-height: 1.9;
  text-align: center;
  padding: 22px 16px 28px;
}
.site-footer p { margin: 0; }
.foot-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 2px;
  margin-top: 16px;
}
.foot-shot {
  margin-right: 14px;
  padding: 5px 16px;
  border: 1px solid #e3e3e3;
  border-radius: 6px;
  background: #f2f2f2;
  color: #888;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}
.foot-links a { color: #4a90e2; margin: 0 6px; }
.foot-links a:hover { text-decoration: underline; }
.foot-links span { color: #ccc; }

.logo { display: flex; align-items: center; }
.logo img { display: block; height: 54px; width: auto; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.site-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.site-nav a {
  flex: none;
  padding: 6px 10px;
  color: var(--muted);
  border-radius: 6px;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--accent);
  text-decoration: none;
}

.site-nav a.is-active { font-weight: 600; }

.tag-cloud {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-cloud a.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.tag-cloud a.is-active:hover {
  color: #fff;
  text-decoration: none;
}

.placeholder { color: var(--muted); }
.container { max-width: 960px; margin: 0 auto; padding: 16px; }

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { color: #fff; }
.btn-danger {
  background: #e53935;
  border-color: #e53935;
  color: #fff;
}
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.shelf-item { min-width: 0; }
.shelf-grid .comic-card img { height: auto; }
.shelf-del {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.shelf-del:hover { color: #e53935; border-color: #e53935; }

.dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}
.dialog-mask[hidden] { display: none; }
.dialog {
  width: 100%;
  max-width: 320px;
  padding: 20px;
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.dialog-msg { margin: 0 0 16px; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
}

.comic-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.comic-card {
  display: block;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  color: inherit;
}

.comic-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: var(--line);
}

.cover-play {
  position: relative;
  display: block;
}
.cover-play::before,
.cover-play::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
}
.cover-play::before {
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}
.cover-play::after {
  width: 0;
  height: 0;
  margin-left: -4px;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent #222;
}
.row-card .cover-play { flex-shrink: 0; }
.row-card .cover-play::before {
  width: 30px;
  height: 30px;
}
.row-card .cover-play::after {
  margin-left: -3px;
  border-width: 5px 0 5px 9px;
}

.comic-card h2,
.comic-card h3 {
  margin: 8px 10px 0;
  font-size: 15px;
  line-height: 1.4;
}

.comic-card p {
  margin: 4px 10px 10px;
  font-size: 13px;
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  align-items: center;
}

.comic-head { display: flex; flex-direction: column; gap: 16px; }
.cover {
  width: 140px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  background: var(--card);
}
.meta h1 { margin: 0 0 8px; font-size: 22px; }
.meta p { margin: 4px 0; color: var(--muted); }
.tag {
  display: inline-block;
  margin: 4px 6px 0 0;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.summary, .chapters { margin-top: 28px; }
.summary h2, .chapters h2, .home h1 { font-size: 18px; }

.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.chapter-list a {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
}

.reader-head h1 { font-size: 20px; margin: 0 0 12px; }
.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 20px;
}
.chapter-nav.bottom { margin-top: 24px; }

.pages img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 800px;
  margin: 0 auto;
}

.player {
  position: relative;
  width: 100%;
  height: min(70dvh, 720px);
  background: #000;
}
.player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.player .preview-note { color: #fff; }

.preview-note {
  text-align: center;
  color: #e02020;
  margin-top: 16px;
  padding: 12px 0;
}
.preview-note a { color: inherit; text-decoration: underline; }

.home-section { margin-top: 28px; }
.home-section:first-child { margin-top: 0; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-icon {
  flex-shrink: 0;
  color: #e53935;
}

.sub-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: -4px 0 16px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.sub-nav a {
  flex: none;
  padding: 8px 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.sub-nav a:hover,
.sub-nav a.is-active {
  color: #e53935;
  text-decoration: none;
}
.sub-nav a.is-active {
  font-weight: 600;
  border-bottom-color: #e53935;
}

.row-list { list-style: none; margin: 0; padding: 0; }
.row-list > li + li { border-top: 1px solid var(--line); }
.row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  color: inherit;
}
.row-card:hover { text-decoration: none; }
.row-cover {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 96px;
}
.row-card img {
  width: 72px;
  height: 96px;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  background: var(--card);
}
.rank-tag {
  position: absolute;
  top: 0px;
  left: 0px;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  color: #fff;
}
.rank-1 { background: #f44336; }
.rank-2 { background: #ff9800; }
.rank-3 { background: #ffc107; }
.rank-n { background: #9e9e9e; }
.row-body { flex: 1; min-width: 0; }
.row-body h2 {
  margin: 0 0 6px;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-ico {
  flex-shrink: 0;
  color: #29b6f6;
}
.row-read {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #29b6f6;
  font-size: 12px;
}
.row-read-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e3f2fd;
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-read-icon .row-ico {
  width: 18px;
  height: 18px;
}

@media (min-width: 768px) {
  .container { padding: 24px; }
  .comic-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .comic-head { flex-direction: row; gap: 24px; }
  .cover { width: 200px; }
  .meta h1 { font-size: 24px; }
  .chapter-list { grid-template-columns: repeat(3, 1fr); }
}
