:root {
  color-scheme: dark;
  --ink: #090a0c;
  --surface: #111317;
  --surface-raised: #191c21;
  --paper: #f4f0e8;
  --muted: #a9adb5;
  --cyan: #67e8f9;
  --pink: #ff4f9a;
  --red: #ff405f;
  --gold: #d7aa55;
  --line: #30343a;
  --header-height: 64px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 112px;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: 3px;
  background: transparent;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--pink);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: rgb(9 10 12 / 94%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  background: var(--gold);
  font-family: serif;
  font-size: 21px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.menu-button {
  min-width: 64px;
  min-height: 40px;
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.episode-nav {
  position: fixed;
  top: 58px;
  right: 12px;
  z-index: 95;
  display: none;
  width: 168px;
  padding: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgb(0 0 0 / 45%);
}

.episode-nav.open {
  display: grid;
}

.episode-nav a {
  padding: 12px;
  color: var(--muted);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.episode-nav a:hover,
.episode-nav a.active {
  color: var(--paper);
  border-left-color: var(--cyan);
  background: #20242a;
}

.opening {
  position: relative;
  display: grid;
  min-height: min(760px, 82svh);
  max-height: 940px;
  align-items: end;
  overflow: hidden;
  background: #080b10;
}

.opening-art,
.opening-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.opening-art {
  object-fit: cover;
  object-position: 50% 20%;
  opacity: 0.62;
  filter: saturate(0.86) contrast(1.08);
}

.opening-shade {
  background: linear-gradient(to bottom, rgb(9 10 12 / 8%) 20%, rgb(9 10 12 / 96%) 92%);
}

.opening-copy {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  padding: 96px max(22px, env(safe-area-inset-left)) 54px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 20px;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(38px, 10vw, 76px);
  line-height: 1.04;
}

.hook {
  max-width: 580px;
  margin-bottom: 26px;
  color: #e2e4e8;
  font-size: 17px;
  line-height: 1.8;
}

.opening-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
}

.primary-action {
  color: var(--ink);
  background: var(--cyan);
  border: 1px solid var(--cyan);
  font-weight: 800;
}

.secondary-action {
  color: var(--paper);
  background: rgb(9 10 12 / 70%);
  border: 1px solid #777d86;
}

.status-line {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.premise {
  padding: 84px max(24px, calc((100vw - 760px) / 2));
  background: var(--paper);
  color: #17191d;
}

.premise p {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.8;
}

.premise .premise-main {
  margin-bottom: 28px;
  color: #ab174f;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(30px, 8vw, 52px);
  font-weight: 900;
  line-height: 1.2;
}

.episode {
  padding-top: 56px;
  background: #08090b;
}

.episode + .episode {
  border-top: 1px solid var(--line);
}

.episode-heading {
  display: flex;
  width: min(100% - 32px, 760px);
  margin: 0 auto 22px;
  align-items: flex-end;
  gap: 14px;
}

.episode-heading > span {
  color: var(--pink);
  font-family: serif;
  font-size: 46px;
  line-height: 0.85;
}

.episode-heading p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.episode-heading h2 {
  margin-bottom: 0;
  font-size: 26px;
}

.comic-sheet {
  width: min(100%, 760px);
  margin: 0 auto;
  background: #05060a;
}

.comic-sheet img {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
}

.next-episode {
  display: flex;
  width: min(100% - 32px, 760px);
  min-height: 94px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.next-episode span {
  color: var(--muted);
  font-size: 12px;
}

.next-episode strong {
  color: var(--cyan);
}

.cliffhanger {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 42px 24px 74px;
  text-align: center;
  background: #160b12;
  border-top: 2px solid var(--pink);
}

.cliffhanger p,
.cliffhanger span {
  color: var(--muted);
  font-size: 12px;
}

.cliffhanger strong {
  display: block;
  margin: 12px 0 22px;
  color: var(--pink);
  font-size: 24px;
}

.world {
  padding: 86px 0 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.world-intro {
  width: min(100% - 40px, 760px);
  margin: 0 auto 52px;
}

.world-intro h2 {
  max-width: 690px;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(30px, 8vw, 52px);
  line-height: 1.25;
}

.world-intro > p:last-child {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.9;
}

.archive article {
  display: grid;
  grid-template-columns: minmax(140px, 0.35fr) minmax(0, 1fr);
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 28px 20px;
  align-items: start;
  gap: 22px;
  border-top: 1px solid var(--line);
}

.archive article > div {
  position: sticky;
  top: 86px;
}

.archive article span {
  color: var(--gold);
  font-size: 12px;
}

.archive article h3 {
  margin: 8px 0 0;
  font-size: 18px;
}

.archive article img {
  width: 100%;
  background: #080a0e;
  border: 1px solid var(--line);
}

footer {
  padding: 62px 24px calc(62px + env(safe-area-inset-bottom));
  color: var(--muted);
  text-align: center;
  background: #050608;
}

footer p {
  margin-bottom: 8px;
  font-size: 13px;
}

.back-to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  display: none;
  width: 44px;
  height: 44px;
  color: var(--paper);
  background: #20242a;
  border: 1px solid #4b515a;
  border-radius: 50%;
  cursor: pointer;
}

.back-to-top.visible {
  display: block;
}

@media (max-width: 620px) {
  .opening-copy {
    padding-bottom: 38px;
  }

  .archive article {
    grid-template-columns: 1fr;
    padding: 30px 16px 44px;
  }

  .archive article > div {
    position: static;
  }
}

@media (min-width: 900px) {
  .site-header {
    padding-inline: 32px;
  }

  .menu-button {
    display: none;
  }

  .episode-nav {
    position: sticky;
    top: var(--header-height);
    z-index: 85;
    display: flex;
    width: 100%;
    padding: 0;
    justify-content: center;
    background: rgb(17 19 23 / 96%);
    border-width: 0 0 1px;
    box-shadow: none;
  }

  .episode-nav a {
    padding: 13px 24px;
    border-bottom: 3px solid transparent;
    border-left: 0;
  }

  .episode-nav a:hover,
  .episode-nav a.active {
    border-bottom-color: var(--cyan);
    border-left-color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
