:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e0e0e6;
  --text: #1a1a1f;
  --text-muted: #5b5b66;
  --accent: #4f46e5;
  --accent-weak: #eef0ff;
  --success: #157a3d;
  --fail: #b3261e;
  --code-bg: #f0f0f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14141a;
    --surface: #1d1d24;
    --border: #33333e;
    --text: #eeeef2;
    --text-muted: #a3a3b0;
    --accent: #a5b4fc;
    --accent-weak: #262646;
    --success: #4ade80;
    --fail: #f87171;
    --code-bg: #26262f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

header {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.5rem 1rem;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.lede {
  color: var(--text-muted);
  font-size: 0.95rem;
}

nav.tabs {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
  white-space: nowrap;
}

th, td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--accent-weak);
  color: var(--text);
  font-weight: 600;
  position: sticky;
  top: 0;
}

tbody tr:last-child td {
  border-bottom: none;
}

.caption {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.9rem;
}

.loading {
  padding: 1rem;
  color: var(--text-muted);
}

.select-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

select#episode-select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  margin-bottom: 1.25rem;
}

#episode-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

#episode-detail h3 {
  margin-top: 0;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.success {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}

.badge.fail {
  background: color-mix(in srgb, var(--fail) 18%, transparent);
  color: var(--fail);
}

.kv {
  margin: 0.9rem 0;
  font-size: 0.9rem;
}

.kv dt {
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.kv dd {
  margin: 0.1rem 0 0;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
}

code {
  background: var(--code-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
}

pre code {
  background: none;
  padding: 0;
}

.note {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0.75rem 0;
}

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.shots img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

a {
  color: var(--accent);
}

section#tab-about p {
  max-width: 720px;
}
