:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #272a31;
  --muted: #85878d;
  --line: #e1e1e1;
  --blue: #1676ba;
  --blue-dark: #0f5f99;
  --tab-dark: #535355;
  --pill: #eeeeef;
  --star: #ffd400;
}

:root.dark {
  color-scheme: dark;
  --bg: #121417;
  --surface: #181b20;
  --ink: #f0f2f5;
  --muted: #a9adb5;
  --line: #30343b;
  --blue: #3194dc;
  --blue-dark: #64b4eb;
  --tab-dark: #64666b;
  --pill: #262b32;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
input,
select {
  font: inherit;
}

button,
.top-nav a,
.back-button,
.outline-button {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.site-header {
  min-height: 64px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(28px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 58px);
  min-width: 0;
}

.top-nav a,
.nav-link {
  padding: 0;
  color: #5f6269;
  font-size: 1.04rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.top-nav a:hover,
.nav-link:hover {
  color: var(--blue);
}

.more-link::after {
  content: "  >";
  font-size: 0.88em;
}

.auth-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.outline-button,
button.ghost {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #606165;
  border-radius: 999px;
  padding: 0 24px;
  color: #5f6268;
  font-weight: 800;
  white-space: nowrap;
}

.outline-button:hover,
button.ghost:hover {
  border-color: var(--blue);
  color: var(--blue);
}

main {
  width: min(1720px, calc(100% - 110px));
  margin: 0 auto;
  padding: 16px 0 56px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar {
  display: none;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 500px);
  gap: clamp(34px, 4vw, 72px);
  align-items: start;
}

.release-heading {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 28px;
  border-bottom: 2px solid var(--line);
}

.heading-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  font-size: 1.42rem;
  line-height: 1;
  clip-path: polygon(0 0, 82% 0, 82% 28%, 100% 50%, 82% 72%, 82% 100%, 0 100%);
}

.release-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.38rem, 2vw, 1.72rem);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status {
  color: var(--muted);
  padding: 20px 0;
}

.release-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(36px, 4vw, 62px);
}

.release-card {
  min-height: 258px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 28px;
  border-bottom: 1px solid var(--line);
  padding: 54px 0;
}

.cover-wrap {
  position: relative;
  width: 150px;
  height: 200px;
  align-self: start;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(135deg, #2b3648, var(--blue));
}

.cover,
.detail-cover,
.ranking-cover {
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #2b3648, var(--blue));
}

.cover {
  width: 150px;
  height: 200px;
}

.cover-wrap span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  background: rgba(75, 78, 82, 0.88);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.release-copy {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
}

.release-copy h2 {
  margin: 0;
  max-width: 360px;
  color: var(--ink);
  font-size: clamp(1.28rem, 1.75vw, 1.56rem);
  line-height: 1.12;
  letter-spacing: 0;
  cursor: pointer;
}

.release-copy h2:hover,
.ranking-item h3:hover {
  color: var(--blue);
}

.rating-line {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stars {
  color: var(--star);
  font-size: 1.45rem;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.rating-line strong {
  color: var(--ink);
  font-size: 1.62rem;
  line-height: 1;
}

.chapter-links {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 14px 44px;
  align-items: center;
}

.chapter-pill {
  width: max-content;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  color: #65686e;
  padding: 0 18px;
  font-size: 0.98rem;
  font-weight: 800;
  text-transform: none;
}

.chapter-pill:hover {
  color: var(--blue);
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.ranking-panel {
  align-self: start;
  padding-top: 14px;
}

.ranking-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 0 10px 24px;
  background: color-mix(in srgb, var(--pill) 64%, transparent);
}

.ranking-tabs button {
  min-height: 50px;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 1.08rem;
}

.ranking-tabs button.active {
  background: var(--tab-dark);
}

.ranking-list {
  display: grid;
}

.ranking-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 28px;
  border-bottom: 1px solid var(--line);
  padding: 30px 0;
  cursor: pointer;
}

.ranking-cover {
  width: 96px;
  height: 136px;
}

.ranking-item h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.18;
}

.ranking-chapters {
  display: grid;
  gap: 10px;
}

.ranking-chapter-line {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: center;
  gap: 20px;
}

.ranking-chapter-line span {
  justify-self: end;
  color: var(--muted);
  font-size: 0.96rem;
}

.back-button {
  margin-bottom: 20px;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
}

.detail-layout,
.chapter-panel,
.reader-sidebar,
.reader-page {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 42px);
  margin-top: 18px;
  padding: 26px;
  align-items: start;
}

.detail-cover {
  width: 100%;
}

.detail-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(2.1rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.detail-copy p {
  line-height: 1.75;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.pill {
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--pill);
  font-size: 0.86rem;
  font-weight: 800;
}

.chapter-panel {
  margin-top: 24px;
  padding: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
}

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

.chapter-row {
  border-radius: 7px;
  background: var(--pill);
  color: var(--ink);
  padding: 14px 16px;
  text-align: left;
  justify-content: space-between;
}

.chapter-row:hover {
  color: var(--blue);
}

.reader-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(18px, 4vw, 52px);
  align-items: start;
}

.reader-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.reader-page {
  min-height: 72vh;
  padding: clamp(24px, 6vw, 78px);
}

.reader-page h1 {
  margin: 0 0 24px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.reader-text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: var(--reader-size, 20px);
  line-height: 1.85;
  color: var(--ink);
  max-width: 760px;
}

.reader-text p {
  margin: 0 0 1.2em;
}

.reader-controls,
.reader-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.reader-nav {
  grid-template-columns: 1fr;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(520px, calc(100% - 32px));
  border-radius: 7px;
  background: var(--ink);
  color: var(--surface);
  padding: 12px 16px;
}

@media (max-width: 1280px) {
  main {
    width: min(100% - 48px, 1720px);
  }

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

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .top-nav {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px 22px;
  }

  .auth-nav {
    justify-content: flex-start;
  }

  .release-grid,
  .detail-layout,
  .reader-shell {
    grid-template-columns: 1fr;
  }

  .release-card {
    max-width: 720px;
  }

  .reader-sidebar {
    position: static;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 24px, 1720px);
    padding-top: 8px;
  }

  .release-heading {
    gap: 14px;
  }

  .release-card,
  .ranking-item {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    padding: 24px 0;
  }

  .cover-wrap,
  .cover {
    width: 92px;
    height: 132px;
  }

  .cover-wrap span {
    font-size: 0.72rem;
  }

  .chapter-links,
  .ranking-chapter-line {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ranking-chapter-line span {
    justify-self: start;
  }

  .ranking-tabs {
    grid-template-columns: 1fr;
  }
}
