:root {
  color-scheme: light;
  --ink: #17191a;
  --muted: #687076;
  --paper: #f5f5f2;
  --white: #ffffff;
  --line: #d8d8d2;
  --cinnabar: #a52f32;
  --cinnabar-bright: #d14a48;
  --moss: #35594b;
  --night: #181b1c;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

.hero {
  position: relative;
  min-height: 86svh;
  overflow: hidden;
  isolation: isolate;
  color: var(--white);
}

.hero-media,
.hero-shade {
  position: absolute;
  inset: 0;
}

.hero-media {
  z-index: -2;
  overflow: hidden;
  background: #9b2529;
}

.hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.025);
  filter: saturate(0.92) contrast(1.04);
}

.hero-shade {
  z-index: -1;
  background: rgba(13, 15, 16, 0.57);
}

.hero-masthead {
  position: absolute;
  top: 0;
  right: clamp(24px, 5vw, 80px);
  left: clamp(24px, 5vw, 80px);
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

.hero-masthead span:last-child {
  color: rgba(255, 255, 255, 0.75);
}

.hero-content {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding-top: clamp(150px, 22vh, 230px);
}

.edition {
  margin: 0 0 28px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(52px, 7vw, 104px);
  font-weight: 700;
  line-height: 1.08;
}

.motto {
  margin: 28px 0 0;
  color: #f3d2b0;
  font-size: clamp(22px, 2.2vw, 32px);
}

.compiler {
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
}

.hero-foot {
  position: absolute;
  right: clamp(24px, 5vw, 80px);
  bottom: 26px;
  left: clamp(24px, 5vw, 80px);
  display: flex;
  justify-content: space-between;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.content-band {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 112px 0;
}

.section-heading {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: end;
  margin-bottom: 58px;
}

.section-heading > p {
  margin: 0 0 8px;
  color: var(--cinnabar);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(36px, 4vw, 60px);
  font-weight: 700;
  line-height: 1.1;
}

.section-heading > span {
  grid-column: 2;
  margin-top: 14px;
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

.preface-body {
  column-count: 2;
  column-gap: clamp(42px, 6vw, 80px);
  column-rule: 1px solid var(--line);
  font-size: 17px;
  line-height: 2;
  text-align: justify;
}

.preface-body p {
  margin: 0 0 1.45em;
  break-inside: avoid;
}

.preface-body p:first-child::first-letter {
  float: left;
  margin: 0.12em 0.18em 0 0;
  color: var(--cinnabar);
  font-size: 4.6em;
  font-weight: 700;
  line-height: 0.78;
}

.preface-body .signature {
  column-span: all;
  margin: 56px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  color: var(--moss);
  text-align: right;
}

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

.council-list {
  margin: 0;
  border-top: 2px solid var(--ink);
}

.council-list > div {
  display: grid;
  grid-template-columns: minmax(150px, 0.34fr) minmax(0, 1fr);
  gap: 24px;
  padding: 21px 0;
  border-bottom: 1px solid var(--line);
}

.council-list dt {
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

.council-list dd {
  margin: 0;
  font-size: 19px;
  line-height: 1.7;
}

.generation-band {
  background: var(--night);
  color: var(--white);
}

.generation-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 112px 0;
}

.generation-band .section-heading > p {
  color: #ef7672;
}

.generation-intro {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 56px;
  margin-bottom: 64px;
  color: #c8ced0;
  font-size: 17px;
  line-height: 1.9;
}

.generation-intro p {
  margin: 0;
}

.generation-label {
  margin: 0 0 18px;
  color: #8e999e;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

.generation-sequence {
  border-top: 1px solid #485055;
}

.sequence-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  border-bottom: 1px solid #353b3e;
}

.sequence-row span {
  display: grid;
  min-height: 84px;
  place-items: center;
  border-right: 1px solid #353b3e;
  font-size: clamp(22px, 2.4vw, 34px);
}

.sequence-row span:last-child {
  border-right: 0;
}

.sequence-row.current-line {
  color: #f3c4a5;
}

.sequence-row.current-line span:first-child {
  color: #ff7d76;
  font-weight: 700;
}

.entry-footer {
  display: grid;
  min-height: 360px;
  place-content: center;
  justify-items: center;
  gap: 34px;
  padding: 72px 24px;
  background: var(--white);
  text-align: center;
}

.entry-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.icp-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.icp-link:hover,
.icp-link:focus-visible {
  color: var(--cinnabar);
  text-decoration: underline;
}

.enter-button {
  display: inline-flex;
  min-width: 210px;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 0 26px;
  border: 1px solid var(--cinnabar);
  border-radius: 4px;
  background: var(--cinnabar);
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.invite-dialog {
  width: min(460px, calc(100% - 28px));
  padding: 0;
  border: 1px solid rgba(93, 73, 48, 0.3);
  border-radius: 7px;
  background: #fbf8ef;
  color: var(--ink);
  box-shadow: 0 26px 90px rgba(15, 14, 12, 0.34);
}

.invite-dialog::backdrop {
  background: rgba(15, 17, 17, 0.68);
  backdrop-filter: blur(4px);
}

.invite-dialog form {
  position: relative;
  padding: 34px;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 28px;
  line-height: 1;
}

.dialog-eyebrow {
  margin: 0 0 8px;
  color: var(--cinnabar);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 12px;
  font-weight: 750;
}

.invite-dialog h2 {
  margin: 0;
  font-size: 29px;
}

.dialog-copy {
  margin: 10px 0 24px;
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 14px;
}

.invite-dialog label {
  display: grid;
  gap: 7px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.invite-dialog input {
  width: 100%;
  height: 50px;
  padding: 0 13px;
  border: 1px solid #c9c5ba;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.invite-dialog input:focus {
  border-color: var(--cinnabar);
  box-shadow: 0 0 0 3px rgba(165, 47, 50, 0.1);
}

.dialog-submit {
  width: 100%;
  height: 50px;
  margin-top: 14px;
  border: 1px solid #842326;
  border-radius: 4px;
  background: var(--cinnabar);
  color: #fff;
  cursor: pointer;
  font: 700 16px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.dialog-submit:disabled { opacity: 0.55; cursor: wait; }
.dialog-message { min-height: 20px; margin: 11px 0 0; color: #a02f31; font: 13px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.admin-login-link { display: block; margin-top: 8px; color: var(--muted); font: 12px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; text-align: center; }

.enter-button:hover {
  border-color: #842326;
  background: #842326;
  transform: translateY(-2px);
}

.enter-button:focus-visible {
  outline: 3px solid rgba(165, 47, 50, 0.3);
  outline-offset: 4px;
}

@media (max-width: 820px) {
  .hero {
    min-height: 82svh;
  }

  .hero-masthead {
    min-height: 58px;
  }

  .hero-masthead span:last-child {
    display: none;
  }

  .hero-content {
    padding-top: 132px;
  }

  .hero-media img {
    object-position: 42% center;
  }

  .hero h1 {
    font-size: clamp(44px, 13vw, 68px);
  }

  .content-band,
  .generation-inner {
    width: min(100% - 32px, 680px);
    padding: 78px 0;
  }

  .section-heading {
    grid-template-columns: 1fr;
    margin-bottom: 42px;
  }

  .section-heading > p,
  .section-heading h2,
  .section-heading > span {
    grid-column: 1;
  }

  .section-heading > p {
    margin-bottom: 13px;
  }

  .preface-body {
    column-count: 1;
    font-size: 16px;
    line-height: 1.95;
  }

  .preface-body .signature {
    margin-top: 36px;
  }

  .generation-intro {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 46px;
  }

  .sequence-row span {
    min-height: 58px;
    font-size: clamp(18px, 5vw, 26px);
  }

  .entry-footer {
    min-height: 300px;
  }
}

@media (max-width: 520px) {
  .hero-content {
    width: calc(100% - 32px);
  }

  .edition {
    max-width: 290px;
    line-height: 1.7;
  }

  .hero h1 {
    font-size: 45px;
  }

  .motto {
    font-size: 22px;
  }

  .invite-dialog form {
    padding: 30px 20px 24px;
  }

  .compiler {
    max-width: 260px;
    line-height: 1.7;
  }

  .hero-foot span:last-child {
    display: none;
  }

  .council-list > div {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 14px;
    padding: 18px 0;
  }

  .council-list dd {
    font-size: 17px;
  }
}

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

  .enter-button {
    transition: none;
  }
}
