@layer reset, base, layout, parts, responsive, motion;

/* 像素字体: 字号取 12 的整数倍才不糊 */
@font-face { font-family: "SS Pixel"; src: url(/fonts/title.woff2?h=88d48043) format("woff2"); font-display: swap; }

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
  ol, ul { padding: 0; list-style: none; }
  img, picture { display: block; max-width: 100%; }
  img { height: auto; }
  button { font: inherit; color: inherit; cursor: pointer; }
  [hidden] { display: none !important; }
}

@layer base {
  :root {
    --stone: #16120f;
    --stone-2: #211b16;
    --stone-3: #2d251e;
    --bone: #ddd3c1;
    --bone-2: rgb(221 211 193 / .7);
    --candle: #e2b45b;
    --magic: #a68bff;
    --blood: #9b2a2a;
    --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
    --px: "SS Pixel", "PingFang SC", "Microsoft YaHei", monospace;
    /* 像素切角: 四个角各两级台阶 */
    --notch: polygon(0 8px, 4px 8px, 4px 4px, 8px 4px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 4px, calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px,
      100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px), calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px), calc(100% - 8px) 100%,
      8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0 calc(100% - 8px));
    color-scheme: dark;
    scroll-padding-top: 72px;
  }
  html { background: var(--stone); }
  body { font: 16px/1.8 var(--sans); color: var(--bone); background: var(--stone); -webkit-font-smoothing: antialiased; text-wrap: pretty; }
  h1, h2, h3 { line-height: 1.25; font-weight: 400; }
  .t { font-family: var(--px); -webkit-font-smoothing: none; letter-spacing: .04em; }
  a { color: inherit; }
  :focus-visible { outline: 3px solid var(--candle); outline-offset: 3px; }
  .skip { position: absolute; left: -999px; top: 8px; z-index: 50; padding: 8px 14px; background: var(--candle); color: var(--stone); }
  .skip:focus { left: 12px; }
}

@layer layout {
  .wrap { width: min(1140px, 100% - 48px); margin-inline: auto; }
  main > section { padding-block: clamp(64px, 8vw, 112px); }
  main > .hero { padding: 0; }
  h2.t { font-size: 48px; color: var(--candle); text-shadow: 3px 3px 0 #000; }
  .sub { margin-top: 12px; color: var(--bone-2); max-width: 46em; }
  .story, .play, .req { background:
      radial-gradient(60% 50% at 80% 0%, rgb(226 180 91 / .06), transparent 70%),
      linear-gradient(180deg, var(--stone), var(--stone-2)); }
  .sisters, .shots, .setup { background: var(--stone); }
}

@layer parts {
  .bar { position: fixed; inset: 0 0 auto; z-index: 30; display: flex; align-items: center; gap: 26px; height: 60px; padding-inline: max(24px, (100% - 1140px) / 2);
    background: rgb(22 18 15 / .86); backdrop-filter: blur(8px); border-bottom: 2px solid #000; box-shadow: 0 2px 0 rgb(226 180 91 / .15); }
  .brand { font-size: 24px; text-decoration: none; color: var(--bone); }
  .bar nav { display: flex; gap: 20px; margin-left: auto; font-size: 14px; }
  .bar nav a { text-decoration: none; color: var(--bone-2); }
  .bar nav a:hover { color: var(--candle); }
  .pill { border: 0; padding: 7px 16px; font-size: 14px; font-weight: 700; background: var(--candle); color: var(--stone); clip-path: var(--notch); }

  /* 首屏: 暮色里的村子 */
  .hero { position: relative; min-height: max(620px, 100svh); display: grid; align-items: end; overflow: hidden; isolation: isolate; }
  .scene { position: absolute; inset: 0; z-index: -1; }
  .scene picture, .scene img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 50%; image-rendering: pixelated; }
  .scene::after { content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgb(22 18 15 / .95) 0%, rgb(22 18 15 / .72) 38%, rgb(22 18 15 / .1) 70%), linear-gradient(0deg, var(--stone) 0%, transparent 40%); }
  .hero-in { width: min(1140px, 100% - 48px); margin: 0 auto; padding: 120px 0 72px; max-width: 1140px; }
  .kicker { font-size: 24px; color: var(--magic); }
  .hero h1 { display: grid; gap: 6px; margin: 10px 0 14px; }
  .latin { font-size: clamp(48px, 7.5vw, 96px); line-height: 1; color: var(--bone); text-shadow: 4px 4px 0 #000, 0 0 30px rgb(166 139 255 / .35); }
  .cn { font-size: clamp(24px, 3vw, 36px); color: var(--candle); text-shadow: 3px 3px 0 #000; }
  .lead { max-width: 30em; color: var(--bone-2); font-size: 17px; }
  .slab { display: grid; grid-template-columns: repeat(4, auto); gap: 0; width: fit-content; margin-top: 26px; background: rgb(0 0 0 / .55); clip-path: var(--notch);
    border: 0; padding: 4px; }
  .slab div { padding: 10px 18px; border-right: 2px solid rgb(226 180 91 / .25); }
  .slab div:last-child { border-right: 0; }
  .slab dt { font-size: 12px; color: var(--bone-2); }
  .slab dd { font-weight: 700; }
  .cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
  .dl-btn { display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 14px 34px; font-size: 24px; background: var(--candle); color: #1b130a;
    text-decoration: none; clip-path: var(--notch); box-shadow: inset 0 -4px 0 #a97c2a, inset 0 4px 0 #f6d590; }
  .dl-btn:hover { background: #ecc26e; }
  .ghost { display: inline-flex; align-items: center; border: 2px solid rgb(221 211 193 / .4); padding: 12px 22px; font-size: 15px; text-decoration: none; background: rgb(0 0 0 / .35); }
  .ghost:hover { border-color: var(--bone); }

  /* 故事 */
  .story-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 52px; align-items: center; }
  .story p { margin-top: 18px; font-size: 17px; max-width: 30em; }
  .credit { margin-top: 26px; display: grid; gap: 4px; font-size: 14px; color: var(--bone-2); }
  .credit div { display: grid; grid-template-columns: 84px 1fr; }
  .credit dd { color: var(--bone); }
  .px-frame { padding: 8px; background: #000; clip-path: var(--notch); box-shadow: 0 0 0 4px var(--stone-3); }
  .px-frame img { image-rendering: pixelated; }
  .px-frame figcaption { padding: 8px 6px 2px; font-size: 13px; color: var(--bone-2); }

  /* 修女 */
  .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 30px; }
  .px-card { padding: 26px 28px; background: var(--stone-3); clip-path: var(--notch); box-shadow: inset 0 0 0 4px rgb(0 0 0 / .4); }
  .px-card h3 { font-size: 36px; color: var(--bone); }
  .role { color: var(--magic); font-size: 14px; margin: 2px 0 10px; }
  .px-card p { color: var(--bone-2); }

  /* 玩法 */
  .runes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
  .runes li { padding: 22px 22px 24px; background: rgb(0 0 0 / .35); clip-path: var(--notch); border-top: 4px solid var(--candle); }
  .runes h3 { font-size: 24px; color: var(--candle); margin-bottom: 8px; }
  .runes p { color: var(--bone-2); font-size: 15px; }

  /* 画面 */
  .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
  .grid .wide { grid-column: span 2; }
  .shot { display: block; width: 100%; border: 0; padding: 6px; background: #000; text-align: left; clip-path: var(--notch); }
  .shot picture { aspect-ratio: 16 / 9; overflow: hidden; }
  .shot img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: filter .3s; filter: brightness(.9); }
  .shot:hover img { filter: brightness(1.1); }
  .cap { display: block; padding: 8px 4px 2px; font-size: 13px; color: var(--bone-2); }

  /* 配置 */
  .spec { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 26px; }
  .spec div { padding: 16px 18px; background: rgb(0 0 0 / .35); clip-path: var(--notch); }
  .spec dt { font-size: 13px; color: var(--magic); }
  .spec dd { margin-top: 4px; font-weight: 600; }

  /* 安装 */
  .setup-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 44px; align-items: start; }
  .steps { counter-reset: s; display: grid; gap: 14px; margin-top: 26px; }
  .steps li { counter-increment: s; display: grid; grid-template-columns: 38px 1fr; gap: 10px; }
  .steps li::before { content: counter(s); width: 30px; height: 30px; display: grid; place-items: center; font: 24px/1 var(--px); background: var(--candle); color: #1b130a; clip-path: var(--notch); }
  .file h3 { font-size: 24px; color: var(--candle); margin-bottom: 6px; }
  .file dl div { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 8px 0; border-bottom: 2px solid rgb(0 0 0 / .35); font-size: 14px; }
  .file dt { color: var(--bone-2); }
  .file dd { font-weight: 600; overflow-wrap: anywhere; }
  .file code { font: 500 13px/1.6 ui-monospace, Menlo, Consolas, monospace; }
  .file-act { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
  .file .dl-btn { font-size: 24px; padding: 10px 24px; }
  .fine { margin-top: 12px; font-size: 13px; color: var(--bone-2); }

  /* 问答 */
  .qa { display: grid; gap: 8px; margin-top: 26px; max-width: 840px; }
  .qa details { background: var(--stone-2); clip-path: var(--notch); }
  .qa summary { cursor: pointer; list-style: none; padding: 16px 48px 16px 20px; position: relative; font-weight: 600; }
  .qa summary::-webkit-details-marker { display: none; }
  .qa summary::after { content: "+"; position: absolute; right: 18px; top: 50%; translate: 0 -50%; font: 24px/1 var(--px); color: var(--candle); }
  .qa details[open] summary::after { content: "-"; }
  .qa p { padding: 0 20px 18px; color: var(--bone-2); }

  /* 页脚 */
  .foot { padding: 52px 0 70px; background: #0d0a08; border-top: 2px solid #000; color: var(--bone-2); font-size: 14px; }
  .foot-title { font-size: 36px; color: var(--bone); margin-bottom: 8px; }
  .links { display: flex; gap: 20px; margin-top: 8px; }

  /* 弹窗 */
  dialog { border: 0; padding: 0; color: var(--bone); }
  dialog::backdrop { background: rgb(0 0 0 / .75); }
  .x { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border: 0; background: rgb(255 255 255 / .08); font-size: 22px; line-height: 1; }
  .dlg { width: min(440px, 100% - 32px); padding: 30px 28px 28px; background: var(--stone-3); clip-path: var(--notch); text-align: center; }
  .dlg h2 { font-size: 36px; color: var(--candle); }
  .dlg-file { margin: 6px 0 18px; color: var(--bone-2); font-size: 14px; }
  #ts-box { min-height: 70px; display: grid; place-items: center; }
  #dl-status { margin-top: 14px; font-size: 15px; }
  #dl-link { margin-top: 16px; font-size: 16px; }
  .lb { width: min(1280px, 100% - 24px); max-height: calc(100svh - 24px); padding: 0; background: transparent; overflow: visible; }
  .lb picture img { width: 100%; height: auto; max-height: calc(100svh - 120px); object-fit: contain; background: #000; image-rendering: pixelated; }
  #lb-cap { margin-top: 12px; text-align: center; }
  .lb-nav { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 10px; color: var(--bone-2); }
  .lb-nav button { width: 40px; height: 40px; border: 0; background: var(--stone-3); color: var(--bone); font-size: 22px; clip-path: var(--notch); }
  .lb .x { top: -46px; right: 0; }

  /* 隐私 / 条款 / 404 */
  .doc { max-width: 720px; padding-block: 96px 80px; }
  .doc h1 { font-size: 48px; color: var(--candle); margin: 18px 0 26px; }
  .doc h2 { font-size: 20px; margin: 30px 0 8px; }
  .doc p { margin-top: 10px; color: var(--bone-2); }
  .doc .dl-btn { margin-top: 18px; font-size: 24px; }
  .doc .date { margin-top: 36px; font-size: 14px; }
  .back { color: var(--bone-2); text-decoration: none; }
}

@layer responsive {
  @media (max-width: 1000px) {
    .bar nav { display: none; }
    .bar .pill { margin-left: auto; }
    .story-grid, .setup-grid { grid-template-columns: 1fr; }
    .runes, .spec { grid-template-columns: 1fr 1fr; }
  }
  @media (max-width: 680px) {
    h2.t { font-size: 36px; }
    .pair, .runes, .spec { grid-template-columns: 1fr; }
    .slab { grid-template-columns: 1fr 1fr; }
    .slab div:nth-child(2) { border-right: 0; }
    .grid { grid-template-columns: 1fr; }
    .grid .wide { grid-column: auto; }
  }
  @media (max-width: 520px) {
    .wrap, .hero-in { width: calc(100% - 36px); }
    .hero-in { padding-bottom: 44px; }
    .dl-btn { flex: 1; }
    .scene img { object-position: 64% 50%; }
  }
}

@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .scene img { animation: kindle 2.4s steps(12) both; }
    @keyframes kindle { 0% { filter: brightness(0); } 40% { filter: brightness(.55); } 46% { filter: brightness(.3); } 56% { filter: brightness(.75); } 100% { filter: brightness(1); } }
    .hero-in { animation: rise 1s 1.2s steps(8) both; }
    @keyframes rise { from { opacity: 0; translate: 0 16px; } }
    .qa details::details-content { block-size: 0; overflow: hidden; transition: block-size .25s steps(6), content-visibility .25s allow-discrete; }
    .qa details[open]::details-content { block-size: auto; }
    :root { interpolate-size: allow-keywords; }
  }
}
