:root {
  --ink: #17151b;
  --muted: #6d6878;
  --paper: #fff8ed;
  --panel: #ffffff;
  --line: #eadfce;
  --accent: #e94c4c;
  --accent-soft: #ffe4dc;
  --shadow: 0 16px 40px rgba(27, 21, 30, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.site-header,
.reader-topbar {
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 64px;
  justify-content: space-between;
  padding: 0 clamp(18px, 5vw, 56px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 21, 27, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--shadow);
  max-width: 440px;
  width: 100%;
  padding: 30px 28px;
  text-align: center;
}

.auth-card strong {
  display: block;
  margin-bottom: 14px;
  font-size: 1.4rem;
  color: var(--ink);
}

.auth-card p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 12px;
  text-align: left;
}

.auth-form label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf7f2;
  color: var(--ink);
  font-size: 1rem;
  padding: 14px 16px;
}

.auth-form button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.auth-error {
  min-height: 1.3rem;
  color: #c92a2a;
  font-size: 0.9rem;
}

body.auth-locked > :not(.auth-overlay) {
  filter: blur(1px) brightness(0.88);
  pointer-events: none;
  user-select: none;
}

.brand {
  font-size: 1.1rem;
  font-weight: 800;
}

nav {
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
  font-weight: 700;
}

.home-hero {
  margin: 0 auto;
  max-width: 1120px;
  padding: clamp(54px, 10vw, 110px) clamp(18px, 5vw, 32px) 24px;
}

.home-hero h1,
.detail-copy h1,
.section-header h2 {
  line-height: 1;
  margin: 0;
}

.home-hero h1,
.detail-copy h1 {
  font-size: clamp(3.4rem, 9vw, 7rem);
}

.home-hero p:not(.label),
.detail-copy p,
.section-header p,
footer {
  color: var(--muted);
  line-height: 1.7;
}

.home-hero p:not(.label) {
  max-width: 620px;
}

.label {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.cover-section,
.chapter-section {
  margin: 0 auto;
  max-width: 1120px;
  padding: 28px clamp(18px, 5vw, 32px) 80px;
}

.section-header {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.section-header p {
  margin: 0;
}

.cover-carousel {
  display: grid;
  gap: 18px;
  grid-auto-columns: minmax(210px, 260px);
  grid-auto-flow: column;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 4px 0 18px;
  scroll-snap-type: inline mandatory;
}

.cover-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  padding: 12px;
  scroll-snap-align: start;
}

.cover-card img,
.cover-frame img {
  aspect-ratio: 3 / 4;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
}

.cover-card h3 {
  font-size: 1.05rem;
  line-height: 1.25;
  margin: 0;
}

.cover-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.detail-layout {
  align-items: center;
  display: grid;
  gap: clamp(24px, 5vw, 56px);
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1120px;
  padding: clamp(34px, 7vw, 80px) clamp(18px, 5vw, 32px) 30px;
}

.cover-frame {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px;
  width: 100%;
}

.author-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 14px 10px 10px;
}

.author-card img {
  border-radius: 50%;
  height: 54px;
  width: 54px;
}

.author-card span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.created-date {
  margin-top: 18px;
}

.chapter-list {
  display: grid;
  gap: 12px;
}

.chapter-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  grid-template-columns: auto 1fr auto;
  min-height: 74px;
  padding: 16px 18px;
}

.chapter-row img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
}

.chapter-row strong {
  font-size: 1.02rem;
}

.chapter-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.chapter-row em {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
  font-style: normal;
  font-weight: 800;
  padding: 8px 12px;
}

.reader-topbar {
  justify-content: start;
  gap: 18px;
}

.reader-topbar div {
  display: grid;
  min-width: 0;
}

.language-list {
  margin-left: auto;
  display: flex;
  gap: 18px;
  align-items: center;
}

.language-item {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
}

.language-item.language-jp {
  position: relative;
  color: var(--muted);
  cursor: default;
}

.language-item.language-jp:hover .language-main {
  color: var(--accent);
}

.language-item.language-jp::after {
  content: "coming soon";
  position: absolute;
  top: 100%;
  right: 0;
  transform: translateY(8px);
  white-space: nowrap;
  background: rgba(23, 21, 27, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 10;
}

.language-item.language-jp:hover::after {
  opacity: 1;
  transform: translateY(4px);
}

.language-item.language-jp .language-sub {
  display: none;
}

.language-main {
  color: inherit;
}

.reader-topbar strong,
.reader-topbar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-topbar span {
  color: var(--muted);
  font-size: 0.9rem;
}

.back-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
  padding: 9px 12px;
}

.focused-reader {
  margin: 0 auto;
  max-width: 920px;
  padding: clamp(16px, 4vw, 28px) clamp(10px, 3vw, 24px) 70px;
}

.panel-list {
  display: grid;
  gap: clamp(16px, 4vw, 30px);
}

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: clamp(24px, 4vw, 40px);
  padding-top: 0;
}

.chapter-link {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 700;
}

.chapter-link:hover {
  border-color: var(--accent);
}

.chapter-link .arrow {
  font-size: 1rem;
}

.story-panel {
  background: transparent;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  padding: clamp(28px, 7vw, 76px) 0;
}

/* Remove top padding for the first panel in each chapter */
.panel-list .story-panel:first-child {
  padding-top: 0;
}

.story-panel img {
  height: auto;
  margin: 0 auto;
  mix-blend-mode: multiply;
  width: 100%;
}

.empty-state {
  background: var(--panel);
  border: 2px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.7;
  padding: 28px;
}

footer {
  border-top: 1px solid var(--line);
  padding: 22px clamp(18px, 5vw, 56px);
  text-align: center;
}

footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .site-header,
  .reader-topbar {
    height: 58px;
    padding-inline: 16px;
  }

  nav {
    gap: 14px;
  }

  .cover-carousel {
    grid-auto-columns: minmax(175px, 72vw);
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .cover-frame {
    margin: 0 auto;
    max-width: 340px;
  }

  .section-header {
    align-items: start;
    flex-direction: column;
  }

  .chapter-row {
    align-items: start;
    grid-template-columns: 1fr;
  }
}

@media (min-width: 761px) {
  .story-panel img {
    width: min(100%, 720px);
  }
}

@media (max-width: 420px) {
  nav {
    font-size: 0.86rem;
  }

  .home-hero h1,
  .detail-copy h1 {
    overflow-wrap: anywhere;
  }
}
