:root {
  --ink: #173f3c;
  --muted: #667873;
  --gold: #b7924f;
  --paper: #f6f3e9;
  --line: #c9cebb;
  --red: #9d493a;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #dce4db;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  background: linear-gradient(180deg, #e9eee4c9, #edf0e5a8 50%, #9cb5aa70);
  overflow-wrap: anywhere;
}
button,
input {
  font: inherit;
}
button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
h1:focus {
  outline: none;
}
button {
  min-height: 48px;
}
a {
  color: inherit;
  text-decoration: none;
}
.landscape {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(#d5e3db, #f0eddf 52%, #b8cec2);
}
.moon {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: #fff7d5;
  top: 13%;
  left: calc(50% + 75px);
  box-shadow: 0 0 100px #fff6d1a6;
  opacity: 0.85;
}
.mountain {
  position: absolute;
  left: -10%;
  width: 120%;
  height: 55%;
  bottom: 0;
  clip-path: polygon(
    0 95%,
    0 45%,
    9% 57%,
    20% 6%,
    27% 32%,
    34% 25%,
    45% 72%,
    54% 38%,
    64% 8%,
    70% 28%,
    77% 18%,
    89% 60%,
    100% 35%,
    100% 100%,
    0 100%
  );
}
.far {
  bottom: 10%;
  background: linear-gradient(110deg, #588b8059, #a4bbaa99);
  filter: blur(1px);
}
.near {
  background: linear-gradient(125deg, #205449aa, #66948880);
  transform: scaleX(-1);
  height: 39%;
}
.mist {
  position: absolute;
  inset: 45% -30% -20%;
  background: radial-gradient(ellipse at 50% 40%, #f4f1e7d9, transparent 67%);
  filter: blur(18px);
}
.topbar {
  max-width: 1160px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  gap: 12px;
}
.topbar a {
  font-family: "Songti SC", "SimSun", serif;
  font-size: 23px;
  font-weight: bold;
  letter-spacing: 3px;
}
.topbar a span {
  font-weight: normal;
}
.topbar small {
  display: block;
  font-family: serif;
  font-size: 8px;
  letter-spacing: 2px;
  margin-top: 5px;
  color: var(--muted);
}
.quiet {
  background: none;
  border: 0;
  color: var(--ink);
  padding: 8px 12px;
  font-size: 13px;
}
.quiet span {
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
}
main {
  width: min(100% - 32px, 680px);
  margin: 0 auto;
}
.hero {
  text-align: center;
  padding: 26px 0 10px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 5px;
  font-size: 11px;
  color: #5e776c;
}
.title-mark {
  position: relative;
  width: 280px;
  margin: 28px auto 26px;
  display: flex;
  justify-content: center;
}
.title-mark h1 {
  font-family: "STKaiti", "KaiTi", "Songti SC", "SimSun", serif;
  font-size: 88px;
  font-weight: normal;
  line-height: 1.18;
  margin: 0;
  letter-spacing: 10px;
  text-shadow: 2px 4px 0 #fff4;
}
.title-mark em {
  font-style: normal;
  margin-left: 28px;
}
.vertical {
  writing-mode: vertical-rl;
  position: absolute;
  left: 28px;
  top: 18px;
  font-family: serif;
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--muted);
}
.stamp {
  position: absolute;
  right: 7px;
  bottom: 10px;
  writing-mode: vertical-rl;
  border: 1px solid var(--red);
  padding: 6px 3px;
  color: var(--red);
  font-family: serif;
  font-size: 12px;
  letter-spacing: 2px;
}
.tagline {
  font-family: "Songti SC", "SimSun", serif;
  font-size: 18px;
  letter-spacing: 1px;
}
.intro {
  font-size: 13px;
  line-height: 2;
  color: var(--muted);
  margin: 20px auto 26px;
}
.start-panel {
  width: min(100%, 320px);
  margin: auto;
  display: grid;
  gap: 12px;
}
.start-panel label {
  font-size: 11px;
  letter-spacing: 2px;
}
.start-panel input {
  background: #f7f7ed87;
  border: 1px solid #9caf9b;
  padding: 13px 16px;
  border-radius: 3px;
  text-align: center;
  color: var(--ink);
  width: 100%;
  min-height: 48px;
  font-size: 16px;
}
.primary,
.secondary {
  display: block;
  width: 100%;
  border-radius: 3px;
  padding: 15px 18px;
  letter-spacing: 2px;
  line-height: 1.5;
}
.primary {
  background: var(--ink);
  color: #f6ead0;
  border: 1px solid var(--ink);
  box-shadow: 0 6px 16px #1c44341c;
}
.primary span {
  float: right;
}
.primary:hover {
  background: #245852;
}
.secondary {
  background: #f6f3e9b3;
  border: 1px solid #a4b4a0;
  color: var(--ink);
  margin-top: 8px;
}
.meta {
  font-size: 11px;
  color: #62756b;
  margin: 24px 0;
  letter-spacing: 1px;
  line-height: 1.8;
}
footer {
  text-align: center;
  color: #516f61;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 25px 12px max(24px, env(safe-area-inset-bottom));
}
footer span {
  padding: 0 8px;
}
.play {
  padding-top: 16px;
}
.stage-track {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 18px;
  font-size: 11px;
  color: #7c8b7e;
}
.stage-track span {
  padding-bottom: 10px;
  border-bottom: 1px solid #a9b8a7;
  flex: 1;
  text-align: center;
  white-space: nowrap;
}
.stage-track .active {
  color: var(--ink);
  border-bottom: 2px solid var(--gold);
}
.stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 18px;
  font-size: 11px;
  color: var(--muted);
}
.stats b {
  font:
    20px Georgia,
    serif;
  color: var(--ink);
  padding-left: 5px;
}
.story-card {
  background: linear-gradient(120deg, #fcf9f0f5, #f0efe4f5);
  border: 1px solid #c5cbb8;
  border-radius: 4px;
  box-shadow: 0 12px 42px #183d2d0e;
  padding: 30px;
  position: relative;
}
.story-card:before {
  content: "";
  position: absolute;
  top: 0;
  left: 25%;
  width: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #b79c61, transparent);
}
.chapter-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: #7b806b;
  letter-spacing: 1px;
}
.story-card h1 {
  font-family: "Songti SC", "SimSun", serif;
  font-weight: 500;
  font-size: 30px;
  letter-spacing: 3px;
  margin: 22px 0;
}
.rule {
  height: 1px;
  background: linear-gradient(90deg, #b7aa80, transparent);
  width: 96px;
  margin-bottom: 22px;
}
.prose {
  font-family: "Songti SC", "SimSun", serif;
  font-size: 17px;
  line-height: 2.05;
  color: #314a43;
}
.prose p {
  margin: 0 0 20px;
}
.feedback {
  font-size: 12px;
  line-height: 1.8;
  color: #536a59;
  background: #e7ebdd;
  border-left: 2px solid #a3b18e;
  padding: 10px 12px;
  margin-bottom: 20px;
}
.feedback span {
  display: block;
  font-size: 10px;
  color: #899171;
  letter-spacing: 2px;
  margin-bottom: 3px;
}
.choices {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}
.choice {
  border: 1px solid #bcc5b1;
  background: #fafaf0b3;
  color: var(--ink);
  border-radius: 3px;
  display: grid;
  grid-template-columns: 24px 1fr 14px;
  gap: 9px;
  align-items: center;
  text-align: left;
  min-height: 66px;
  padding: 13px;
  font-size: 14px;
  line-height: 1.6;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.choice:not(:disabled):hover {
  background: #e6eddf;
  border-color: #75987c;
}
.choice-number {
  font-family: Georgia, serif;
  color: #9a8b5d;
  font-size: 12px;
}
.choice small {
  display: block;
  font-family: inherit;
  font-size: 10px;
  line-height: 1.7;
  color: #6b7b6a;
  margin-top: 4px;
}
.choice:disabled {
  background: #e9e9df;
  color: #7a8376;
  border-style: dashed;
}
.choice:disabled small {
  color: #7a8376;
}
.inventory {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 18px 2px;
  color: #667962;
  font-size: 11px;
}
.inventory span {
  border: 1px solid #aebb9d;
  background: #eef1e0a6;
  padding: 5px 9px;
  border-radius: 2px;
}
.play-tools {
  display: flex;
  justify-content: space-between;
}
.save-note {
  font-size: 10px;
  color: #607465;
  text-align: center;
  line-height: 1.8;
}
.echo {
  border-top: 1px solid #d5d5bc;
  padding-top: 15px;
  color: #788065;
  font-size: 12px;
  line-height: 1.9;
}
.ending {
  text-align: center;
  padding: 32px 0 0;
}
.ending-seal {
  margin: 30px auto 18px;
  border: 1px solid #aa8a4d;
  outline: 1px solid #aa8a4d;
  outline-offset: 5px;
  width: 64px;
  height: 78px;
  display: grid;
  place-items: center;
  font-family: serif;
  font-size: 40px;
  color: #91723e;
}
.ending > h1 {
  font:
    38px "Songti SC",
    "SimSun",
    serif;
  letter-spacing: 5px;
}
.ending-line {
  font-family: serif;
  font-size: 15px;
  line-height: 1.9;
  margin: 0 10px 28px;
}
.ending .story-card {
  text-align: left;
}
.ending h2 {
  font-size: 14px;
  font-weight: normal;
  letter-spacing: 3px;
  margin-top: 28px;
}
.recap {
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.8;
}
.recap li {
  margin: 16px 0;
  padding-left: 5px;
}
.recap strong {
  font-weight: 500;
  color: var(--ink);
}
.recap span {
  display: block;
  color: #75806c;
  margin-top: 4px;
}
#end-actions {
  max-width: 350px;
  margin: auto;
}
dialog {
  border: 1px solid #a0af98;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  width: min(680px, calc(100% - 28px));
  max-height: 85svh;
  padding: 22px;
  box-shadow: 0 24px 100px #0c281d55;
}
dialog::backdrop {
  background: #112c287d;
  backdrop-filter: blur(5px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.dialog-head h2 {
  font: 22px serif;
  margin: 0;
}
.book-intro {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}
.book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ending-tile {
  border: 1px solid #d0d1bf;
  padding: 16px;
  color: #7f8875;
}
.ending-tile > span {
  font: 26px serif;
}
.ending-tile h3 {
  font-size: 14px;
  font-weight: normal;
}
.ending-tile p {
  font-size: 11px;
  line-height: 1.9;
}
.ending-tile.unlocked {
  border-color: #bca36b;
  background: #ede7d4;
  color: var(--ink);
}
summary {
  font-size: 11px;
  cursor: pointer;
  padding: 10px 0;
  min-height: 44px;
}
.warning {
  font-size: 12px;
  line-height: 1.8;
  color: #8c422d;
  background: #fff1dc;
  max-width: 680px;
  margin: 15px auto;
  padding: 12px;
}
.warning:empty {
  display: none;
}
@media (max-width: 480px) {
  .topbar {
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
  }
  .topbar a {
    font-size: 20px;
  }
  .hero {
    padding-top: 14px;
  }
  .title-mark {
    margin-top: 22px;
    margin-bottom: 24px;
  }
  .title-mark h1 {
    font-size: 82px;
  }
  .story-card {
    padding: 23px 20px;
  }
  .story-card h1 {
    font-size: 27px;
  }
  .prose {
    font-size: 16px;
    line-height: 2;
  }
  .stage-track {
    gap: 6px;
    font-size: 10px;
  }
  .chapter-label {
    font-size: 10px;
    letter-spacing: 0;
  }
  .book-grid {
    gap: 8px;
  }
  .ending-tile {
    padding: 12px;
  }
  .tagline {
    font-size: 16px;
  }
  .ending {
    padding-top: 18px;
  }
}
@media (min-width: 900px) {
  .hero {
    padding-top: 35px;
  }
  .title-mark h1 {
    font-size: 104px;
  }
  .title-mark {
    width: 320px;
  }
  .play {
    padding-top: 30px;
  }
  .story-card {
    padding: 38px 42px;
  }
  .prose {
    font-size: 18px;
  }
  .moon {
    left: calc(50% + 150px);
    width: 280px;
    height: 280px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
