:root {
  --bg: oklch(90% 0.02 70);
  --card-bg: oklch(98% 0.012 70);
  --text: oklch(28% 0.02 280);
  --text-dim: oklch(45% 0.02 280);
  --text-dim2: oklch(50% 0.02 280);
  --text-dim3: oklch(48% 0.02 280);
  --text-dim4: oklch(58% 0.02 280);
  --accent-blue: oklch(55% 0.14 250);
  --accent-blue-bg: oklch(94% 0.02 250);
  --accent-purple-bg: oklch(93% 0.03 300 / 0.5);
  --accent-purple-text: oklch(40% 0.1 300);
  --accent-blue-name: oklch(48% 0.16 250);
  --accent-purple-name: oklch(42% 0.13 300);
  --border: oklch(90% 0.02 70);
  --border2: oklch(92% 0.015 70);
  --badge-bg: oklch(96% 0.015 70);
  --explain-text: oklch(32% 0.02 280);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text);
  display: flex;
  justify-content: center;
}

a { color: inherit; }

.app { width: 100%; max-width: 480px; min-height: 100vh; background: var(--card-bg); box-shadow: 0 0 50px rgba(0, 0, 0, 0.10); position: relative; padding-bottom: 48px; }

.heading { font-family: 'Zen Maru Gothic', sans-serif; }

/* header (icon) button, shared by share/back buttons */
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--accent-blue-bg); color: var(--accent-blue);
  font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}

/* ── hero (home) ── */
.hero { padding: 36px 24px 28px; text-align: center; background: linear-gradient(180deg, var(--accent-blue-bg), var(--card-bg) 80%); position: relative; }
.hero .icon-btn { position: absolute; top: 16px; right: 16px; }
.hero-avatars { display: flex; justify-content: center; margin-bottom: 16px; }
.hero-avatars img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; object-position: top; border: 3px solid var(--card-bg); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12); position: relative; }
.hero-avatars img:first-child { margin-right: -14px; z-index: 2; }
.hero-avatars img:last-child { z-index: 1; }
.hero-title { font-weight: 900; font-size: 26px; line-height: 1.4; letter-spacing: 0.02em; }
.hero-tagline { margin-top: 10px; font-size: 13px; color: var(--text-dim); line-height: 1.7; }

/* ── sub-page header bar ── */
.header-bar { display: flex; align-items: center; gap: 12px; padding: 16px 20px; position: sticky; top: 0; background: oklch(98% 0.012 70 / 0.95); backdrop-filter: blur(6px); z-index: 10; border-bottom: 1px solid var(--border); }
.header-bar .icon-btn:first-child { font-size: 18px; }
.header-title { font-weight: 700; font-size: 17px; flex: 1; }

/* ── episode list ── */
.ep-list { padding: 8px 20px 0; }
.ep-item { display: flex; gap: 14px; align-items: stretch; padding: 14px 0; border-bottom: 1px solid var(--border2); cursor: pointer; text-decoration: none; color: inherit; }
.ep-thumb { width: 76px; height: 114px; object-fit: cover; object-position: top; border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10); flex-shrink: 0; }
.ep-body { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.ep-meta-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ep-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-blue); color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.ep-date { font-size: 11px; color: var(--text-dim2); }
.ep-title { font-weight: 700; font-size: 15px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ep-blurb { font-size: 12px; color: var(--text-dim3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.5; }

/* ── characters CTA card (home) ── */
.char-cta { margin: 22px 20px 0; padding: 16px; border-radius: 16px; background: linear-gradient(120deg, var(--accent-blue-bg), var(--accent-purple-bg)); display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.char-cta-avatars { display: flex; }
.char-cta-avatars img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid var(--card-bg); }
.char-cta-avatars img:first-child { margin-right: -10px; }
.char-cta-text { flex: 1; }
.char-cta-text-title { font-weight: 700; font-size: 14px; }
.char-cta-text-sub { font-size: 11px; color: var(--text-dim3); margin-top: 2px; }
.char-cta-arrow { color: var(--text-dim2); }

.footer-note { text-align: center; font-size: 11px; color: var(--text-dim4); margin-top: 32px; padding: 0 20px 8px; }

/* ── episode detail ── */
.ep-cover { width: 100%; display: block; aspect-ratio: 2 / 3; object-fit: cover; }
.ep-detail-body { padding: 20px 20px 0; }
.ep-detail-title { font-weight: 900; font-size: 20px; line-height: 1.5; }
.ep-detail-blurb { font-size: 13px; color: var(--text-dim); margin-top: 8px; line-height: 1.7; white-space: pre-line; }
.x-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; padding: 9px 18px; border-radius: 999px; background: oklch(20% 0.01 280); color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; }
.explain-box { margin-top: 22px; padding: 16px; border-radius: 14px; background: var(--accent-purple-bg); }
.explain-title { font-weight: 700; font-size: 13px; color: var(--accent-purple-text); margin-bottom: 6px; }
.explain-text { font-size: 13px; line-height: 1.8; color: var(--explain-text); }

.nav-buttons { display: flex; gap: 10px; padding: 24px 20px 0; }
.nav-btn { flex: 1; padding: 12px; border-radius: 12px; font-size: 12px; text-align: center; text-decoration: none; cursor: pointer; }
.nav-btn-prev { border: 1px solid oklch(88% 0.02 70); background: #fff; color: var(--text-dim); }
.nav-btn-next { border: none; background: var(--accent-blue); color: #fff; font-weight: 700; }

/* ── characters page ── */
.char-list { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 20px; }
.char-card { border-radius: 18px; background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06); overflow: hidden; }
.char-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: top; display: block; }
.char-card-body { padding: 16px 18px 18px; }
.char-name-row { display: flex; align-items: baseline; gap: 8px; }
.char-name { font-weight: 900; font-size: 18px; }
.char-name.codie { color: var(--accent-blue-name); }
.char-name.fixia { color: var(--accent-purple-name); }
.char-role { font-size: 11px; color: var(--text-dim2); }
.char-personality { font-size: 13px; margin-top: 8px; line-height: 1.8; color: var(--explain-text); }
.char-quote { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--badge-bg); font-size: 12px; color: oklch(38% 0.02 280); line-height: 1.7; }

/* ── toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: oklch(20% 0.01 280); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 12px; z-index: 50; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); display: none; }
.toast.show { display: block; }
