/* 系列文導覽 series-guide */
.sg-box {
  --sg-accent: #2563eb;
  --sg-bg: rgba(37, 99, 235, 0.05);
  --sg-border: rgba(37, 99, 235, 0.25);
  --sg-text: inherit;
  --sg-muted: rgba(100, 116, 139, 1);
  --sg-done: #16a34a;
  box-sizing: border-box;
  margin: 1.5em 0;
  padding: 0.9em 1.1em;
  border: 1px solid var(--sg-border);
  border-left: 4px solid var(--sg-accent);
  border-radius: 8px;
  background: var(--sg-bg);
  color: var(--sg-text);
  font-size: 0.95em;
  line-height: 1.6;
}
@media (prefers-color-scheme: dark) {
  .sg-box { --sg-accent: #60a5fa; --sg-bg: rgba(96, 165, 250, 0.08); --sg-border: rgba(96, 165, 250, 0.3); --sg-muted: #94a3b8; --sg-done: #4ade80; }
}
html.dark .sg-box, html[data-color-scheme="dark"] .sg-box, [data-theme="dark"] .sg-box {
  --sg-accent: #60a5fa; --sg-bg: rgba(96, 165, 250, 0.08); --sg-border: rgba(96, 165, 250, 0.3); --sg-muted: #94a3b8; --sg-done: #4ade80;
}
.sg-box * { box-sizing: border-box; }
.sg-box a { color: var(--sg-accent); text-decoration: none; }
.sg-box a:hover { text-decoration: underline; }

.sg-summary, .sg-nav-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  cursor: default;
}
.sg-summary { cursor: pointer; list-style: none; }
.sg-summary::-webkit-details-marker { display: none; }
.sg-summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--sg-muted);
  transition: transform 0.2s;
}
.sg-details:not([open]) > .sg-summary::after { transform: rotate(-90deg); }

.sg-badge {
  display: inline-block;
  padding: 0 0.55em;
  border-radius: 999px;
  background: var(--sg-accent);
  color: #fff;
  font-size: 0.78em;
  line-height: 1.7;
  white-space: nowrap;
}
.sg-title { font-weight: 700; }
.sg-pos, .sg-progress-text { color: var(--sg-muted); font-size: 0.88em; }
.sg-progress-text:empty { display: none; }

.sg-progress {
  height: 6px;
  margin: 0.6em 0 0.2em;
  border-radius: 999px;
  background: var(--sg-border);
  overflow: hidden;
}
.sg-progress[hidden] { display: none; }
.sg-progress-bar {
  height: 100%;
  width: 0;
  background: var(--sg-done);
  transition: width 0.3s;
}

.sg-box .sg-list {
  margin: 0.6em 0 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
.sg-box .sg-list > .sg-item {
  list-style: none !important;
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  margin: 0;
  padding: 0.25em 0.4em;
  border-radius: 6px;
}
.sg-box .sg-list > .sg-item::before, .sg-box .sg-list > .sg-item::marker { content: none !important; display: none !important; }
.sg-ep {
  flex: none;
  min-width: 1.8em;
  color: var(--sg-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.sg-link { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sg-current { background: var(--sg-border); }
.sg-current .sg-link { font-weight: 700; }
.sg-read-mark { flex: none; color: var(--sg-done); font-size: 0.9em; }
.sg-item.sg-read .sg-read-mark::after { content: "✓ 已讀"; }
.sg-item.sg-read:not(.sg-current) .sg-link { opacity: 0.75; }

.sg-nav-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8em;
  margin-top: 0.8em;
}
.sg-nav-cell { min-width: 0; display: flex; }
.sg-box .sg-br { display: none; }
.sg-nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  padding: 0.7em 0.9em;
  border: 1px solid var(--sg-border);
  border-radius: 8px;
  min-width: 0;
}
.sg-box a.sg-nav-link:hover { text-decoration: none; border-color: var(--sg-accent); }
.sg-next { text-align: right; }
.sg-nav-dir { color: var(--sg-muted); font-size: 0.85em; }
.sg-nav-title { font-weight: 600; overflow-wrap: anywhere; }
.sg-disabled { opacity: 0.55; }
.sg-disabled .sg-nav-title { font-weight: 400; }

.sg-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5em 1em;
  margin-top: 0.7em;
  font-size: 0.9em;
}
.sg-footer[hidden] { display: none; }
.sg-reset {
  border: 0;
  background: none;
  padding: 0;
  color: var(--sg-muted);
  font: inherit;
  cursor: pointer;
}
.sg-reset:hover { text-decoration: underline; }
.sg-empty { color: var(--sg-muted); }

@media (max-width: 600px) {
  .sg-nav-links { grid-template-columns: 1fr; }
  .sg-next { text-align: left; }
}
