:root {
  color-scheme: dark;
  --switcher-height: 50px;
  --ink: #f3f6f8;
  --text: #c4ced8;
  --muted: #8d9aa7;
  --paper: #11161b;
  --panel: #1d252d;
  --panel-strong: #242e38;
  --line: #34424f;
  --green: #00c030;
  --orange: #ff8000;
  --sky: #40bcf4;
  --yellow: #f4c542;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

:root[data-scheme="ember"] {
  --ink: #fff8ec;
  --text: #ead8c5;
  --muted: #ae9a86;
  --paper: #17120f;
  --panel: #261c18;
  --panel-strong: #30241f;
  --line: #4b382f;
  --green: #f05a28;
  --orange: #ffb000;
  --sky: #e87c60;
  --yellow: #f8d66d;
}

:root[data-scheme="paper"] {
  color-scheme: light;
  --ink: #18201d;
  --text: #3f4a46;
  --muted: #75817d;
  --paper: #f1f4ef;
  --panel: #ffffff;
  --panel-strong: #e8eee8;
  --line: #c9d3ce;
  --green: #278d48;
  --orange: #c06024;
  --sky: #317a9f;
  --yellow: #a57c13;
  --shadow: 0 18px 38px rgba(28, 39, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(52, 66, 79, 0.2), transparent 420px),
    var(--paper);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: var(--text);
  text-decoration: none;
}

a:hover {
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.prototype-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  min-height: var(--switcher-height);
  padding: 8px clamp(14px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(16px);
  overflow-x: auto;
}

.prototype-title,
.label,
.eyebrow,
.context-line,
.byline,
.section-heading a,
.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.prototype-links,
.prototype-themes {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.prototype-divider {
  color: var(--muted);
}

.prototype-bar a,
.prototype-themes button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 7px 10px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.prototype-bar a.is-active,
.prototype-themes button.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #061008;
}

.shell {
  width: min(1820px, 100%);
  margin: 0 auto;
}

.masthead {
  position: sticky;
  top: var(--switcher-height);
  z-index: 30;
  display: grid;
  grid-template-columns: max-content minmax(320px, 1fr) minmax(180px, 300px) max-content;
  gap: 22px;
  align-items: center;
  padding: 18px clamp(16px, 4vw, 70px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--paper) 96%, transparent), color-mix(in srgb, var(--paper) 84%, transparent));
  backdrop-filter: blur(18px);
}

.brand,
.person-strip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.brand strong {
  display: block;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1;
}

.brand-dots {
  display: inline-flex;
  isolation: isolate;
}

.brand-dots i {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  margin-right: -5px;
}

.brand-dots i:nth-child(1) {
  background: var(--orange);
}

.brand-dots i:nth-child(2) {
  background: var(--green);
}

.brand-dots i:nth-child(3) {
  background: var(--sky);
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 3vw, 34px);
}

.top-nav a {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.top-nav a.is-active {
  color: var(--ink);
}

.search-box {
  display: grid;
  grid-template-columns: 1fr;
  border: 0;
  border-radius: 999px;
  background: #d5dbe0;
  padding: 9px 15px;
}

.search-box span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #202830;
}

.primary-action,
menu button:last-child {
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #061008;
  padding: 11px 16px;
  font-weight: 950;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 58px);
  align-items: start;
  padding: 10px clamp(16px, 4vw, 70px) 60px;
}

.rail {
  position: sticky;
  top: calc(var(--switcher-height) + 94px);
  display: grid;
  gap: 22px;
}

.feature-panel,
.filters,
.line-card,
.reader-card,
.dialog-panel,
.route-heading,
.article-page,
.profile-detail,
.book-detail {
  border-top: 1px solid var(--line);
}

.feature-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.feature-tile {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 86px;
  border-radius: 4px;
  background: var(--panel-strong);
  padding: 16px;
  color: var(--text);
}

.feature-tile span {
  color: var(--muted);
  font-size: 2rem;
  text-align: center;
}

.feature-tile.is-hot {
  background: var(--green);
  color: #061008;
}

.feature-tile.is-hot span {
  color: #061008;
}

.filters {
  display: grid;
  gap: 18px;
  padding-top: 18px;
}

.control-grid,
.chip-list,
.tag-row,
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-grid button,
.chip-list button,
.tag-row span,
.stat-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.84rem;
  font-weight: 800;
}

.control-grid button.is-active,
.chip-list button.is-active {
  border-color: var(--green);
  color: var(--ink);
}

.main,
.home-view {
  min-width: 0;
}

.home-view {
  display: grid;
  gap: 54px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: clamp(28px, 5vw, 70px);
  align-items: end;
  min-height: 330px;
  padding: 42px 0 22px;
  border-bottom: 1px solid var(--line);
}

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

h1,
h2,
h3 {
  color: var(--ink);
}

h1 {
  max-width: 980px;
  margin-bottom: 16px;
  font-size: clamp(2rem, 4.7vw, 4.8rem);
  line-height: 1.05;
}

.hero-copy,
.lede {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
}

.stats-panel div {
  padding: 18px 12px 18px 0;
  border-bottom: 1px solid var(--line);
}

.stats-panel strong {
  display: block;
  color: var(--ink);
  font-size: 2.2rem;
  line-height: 1;
}

.stats-panel span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(116px, 150px);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-color: var(--line) transparent;
}

.book-tile {
  min-width: 0;
}

.cover-link {
  display: block;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.cover-link img,
.book-detail > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-tile h2 {
  margin: 10px 0 2px;
  font-size: 0.98rem;
  line-height: 1.12;
}

.book-tile p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.score,
.mini-meta {
  display: none;
}

.desk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.95fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.stack,
.index-list,
.essay-grid,
.story-grid,
.reader-grid {
  display: grid;
  gap: 18px;
}

.line-card {
  display: grid;
  gap: 8px;
  padding: 22px 0;
}

.review-card {
  grid-template-columns: 92px minmax(0, 1fr);
  column-gap: 22px;
}

.review-card::before {
  content: "";
  grid-row: 1 / span 5;
  display: block;
  width: 92px;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(255, 128, 0, 0.78), transparent 54%),
    linear-gradient(20deg, rgba(0, 192, 48, 0.6), transparent 48%),
    var(--panel-strong);
}

.line-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2vw, 2.25rem);
  line-height: 1.08;
}

.line-card p {
  margin-bottom: 0;
  color: var(--text);
  font-size: 1.03rem;
}

.profile-link,
.card-footer {
  color: var(--muted);
  font-weight: 850;
}

.card-footer {
  display: flex;
  gap: 16px;
  font-size: 0.9rem;
}

.story-grid .line-card {
  min-height: 260px;
  border: 0;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), color-mix(in srgb, var(--panel) 92%, black)),
    var(--panel);
  padding: 22px;
  box-shadow: var(--shadow);
}

.story-grid .line-card:nth-child(odd) {
  border-top: 5px solid var(--sky);
}

.story-grid .line-card:nth-child(even) {
  border-top: 5px solid var(--orange);
}

.reader-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.reader-card,
.person-strip {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 0;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--ink);
  font-weight: 950;
}

.reader-card h3 {
  margin-bottom: 5px;
  font-size: 1.1rem;
}

.reader-card p {
  margin-bottom: 7px;
  color: var(--muted);
}

.route-view {
  display: grid;
  gap: 36px;
  padding-top: 36px;
}

.route-heading,
.article-page,
.profile-detail,
.book-detail {
  padding-top: 24px;
}

.book-detail,
.profile-detail {
  display: grid;
  grid-template-columns: minmax(150px, 280px) minmax(0, 1fr);
  gap: clamp(22px, 5vw, 58px);
  align-items: start;
}

.book-detail > img {
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.article-page {
  max-width: 900px;
}

.reading-page p:not(.context-line):not(.lede) {
  color: var(--text);
  font-size: 1.08rem;
}

.back-link {
  color: var(--green);
  font-weight: 900;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 22px;
  color: var(--muted);
}

dialog {
  width: min(620px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.dialog-panel {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dialog-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 850;
}

.dialog-panel input,
.dialog-panel select,
.dialog-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 10px;
}

.dialog-panel menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.dialog-panel button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 10px 14px;
}

@media (max-width: 1120px) {
  .masthead {
    grid-template-columns: 1fr max-content;
  }

  .top-nav,
  .search-box {
    grid-column: 1 / -1;
  }

  .layout,
  .hero-grid,
  .desk-grid {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .masthead {
    padding: 14px 16px;
  }

  .brand strong {
    font-size: 1.55rem;
  }

  .top-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .layout {
    padding-inline: 16px;
  }

  .feature-grid,
  .stats-panel,
  .review-card,
  .book-detail,
  .profile-detail {
    grid-template-columns: 1fr;
  }

  .review-card::before {
    display: none;
  }

  .hero-grid {
    min-height: 0;
    padding-top: 28px;
  }

  h1 {
    font-size: 2.25rem;
  }
}
