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

@font-face {
  font-family: "WenKai";
  src: url("/fonts/wenkai.woff2?h=4a52b9e6") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@property --p {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; interpolate-size: allow-keywords; }
  body { margin: 0; }
  img, video, picture { display: block; max-width: 100%; }
  img { height: auto; }
  [hidden] { display: none !important; }
  button { font: inherit; color: inherit; }
}

@layer base {
  :root {
    --sky: oklch(0.83 0.075 232);
    --sky-deep: oklch(0.62 0.13 240);
    --air: oklch(0.975 0.012 228);
    --paper: oklch(0.995 0.004 95);
    --ink: oklch(0.31 0.05 265);
    --ink-soft: oklch(0.48 0.04 262);
    --line: oklch(0.89 0.02 235);
    --grid: oklch(0.86 0.05 158);
    --rule: oklch(0.70 0.08 158);
    --sun: oklch(0.85 0.165 86);
    --sun-deep: oklch(0.67 0.14 72);
    --hanko: oklch(0.56 0.19 29);
    --wood: oklch(0.47 0.075 55);
    --wood-deep: oklch(0.39 0.065 52);
    --shadow: 0 1px 1px oklch(0.3 0.05 265 / .06), 0 22px 48px -22px oklch(0.3 0.08 255 / .55);
    --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif;
    --kai: "WenKai", "Kaiti SC", "STKaiti", "KaiTi", serif;
    --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .28 0 0 0 0 .22 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  body {
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.85;
    color: var(--ink);
    background: var(--air);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }

  body:has(dialog[open]) { overflow: hidden; }

  .wk { font-family: var(--kai); font-weight: 500; }
  h1, h2, h3 { text-wrap: balance; }
  p { text-wrap: pretty; line-break: strict; }
  a { color: var(--sky-deep); text-underline-offset: 3px; }
  :focus-visible { outline: 3px solid var(--sky-deep); outline-offset: 3px; border-radius: 4px; }
  code { font-size: .9em; padding: 1px 6px; border-radius: 5px; background: oklch(0.93 0.02 230); }

  .skip {
    position: fixed; left: 12px; top: -60px; z-index: 50;
    padding: 8px 14px; border-radius: 8px; background: var(--ink); color: #fff; text-decoration: none;
    &:focus { top: 12px; }
  }
}

/* ===================== 顶栏 ===================== */
@layer layout {
  .topbar {
    position: fixed; inset: 0 0 auto; z-index: 20;
    display: flex; align-items: center; gap: 28px;
    height: 64px; padding: 0 max(20px, calc((100vw - 1240px) / 2));
    background: oklch(1 0 0 / .32);
    backdrop-filter: blur(14px) saturate(1.3);
    border-bottom: 1px solid oklch(1 0 0 / .45);
    transition: background-color .3s;
  }

  .brand {
    display: flex; align-items: center; gap: 8px;
    color: var(--ink); text-decoration: none; font-size: 21px; white-space: nowrap;
    .flower { width: 26px; height: 26px; }
  }

  .nav {
    display: flex; gap: 22px; margin-left: auto;
    a { color: var(--ink); text-decoration: none; font-size: 15px; padding: 4px 0; background: linear-gradient(var(--sun), var(--sun)) 0 100% / 0 2px no-repeat; transition: background-size .25s; }
    a:hover { background-size: 100% 2px; }
  }

  .topbar.solid { background: oklch(1 0 0 / .9); border-bottom-color: var(--line); }

  .pill {
    flex: none; border: 0; cursor: pointer;
    padding: 8px 18px; border-radius: 999px;
    background: var(--sun); color: var(--ink); font-weight: 700; font-size: 15px;
    box-shadow: inset 0 -2px 0 oklch(0.4 0.08 60 / .25);
  }
}

/* ===================== 首屏 ===================== */
@layer layout {
  .hero {
    position: relative; isolation: isolate;
    min-height: min(100svh, 940px);
    padding: 104px 20px 72px;
    display: grid; align-items: center;
    overflow: clip;
  }

  .sky {
    position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(oklch(0.66 0.12 238), var(--sky) 55%, var(--air));
    picture, img { width: 100%; height: 100%; }
    img { object-fit: cover; object-position: 50% 30%; opacity: .92; }
    &::after { content: ""; position: absolute; inset: auto 0 0; height: 34%; background: linear-gradient(oklch(0.975 0.012 228 / 0), var(--air)); }
  }

  .sunglow {
    position: absolute; left: 8%; top: -18%; width: 52vw; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(closest-side, oklch(1 0.03 95 / .95), oklch(1 0.05 95 / .45) 38%, transparent 72%);
    mix-blend-mode: screen; pointer-events: none;
  }

  .cloud {
    position: absolute; border-radius: 50%; pointer-events: none;
    background: radial-gradient(closest-side, oklch(1 0 0 / .9), oklch(1 0 0 / 0));
    filter: blur(6px);
    &.c1 { width: 420px; height: 120px; left: 46%; top: 16%; }
    &.c2 { width: 300px; height: 90px; left: 6%; top: 58%; opacity: .8; }
    &.c3 { width: 520px; height: 150px; left: 64%; top: 64%; opacity: .7; }
  }

  .hero-inner {
    width: min(1240px, 100%); margin: 0 auto;
    display: grid; grid-template-columns: minmax(0, 640px) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px);
    align-items: center;
  }
}

@layer parts {
  /* 绘日记那一页 */
  .diary {
    position: relative;
    padding: 26px 30px 30px;
    background: var(--paper-grain), var(--paper);
    border-radius: 3px;
    box-shadow: var(--shadow);
    rotate: -0.8deg;

    &::before, &::after {
      content: ""; position: absolute; top: -14px; width: 112px; height: 30px;
      background: repeating-linear-gradient(135deg, oklch(0.88 0.08 86 / .78) 0 8px, oklch(0.94 0.05 86 / .78) 8px 16px);
      box-shadow: 0 1px 2px oklch(0.3 0.05 60 / .12);
    }
    &::before { left: 26px; rotate: -4deg; }
    &::after { right: 30px; rotate: 5deg; background: repeating-linear-gradient(135deg, oklch(0.86 0.06 200 / .75) 0 8px, oklch(0.94 0.03 200 / .75) 8px 16px); }
  }

  .date {
    display: flex; align-items: center; gap: 2px;
    margin: 0 0 12px; font-size: 19px; color: var(--ink-soft);
    .weather { width: 22px; height: 22px; margin: 0 2px 0 6px; fill: none; stroke: var(--sun-deep); stroke-width: 1.8; stroke-linecap: round; }
  }

  .diary-head {
    display: grid; grid-template-columns: 1fr 1.45fr 1fr 1.05fr;
    margin: 0 0 20px; border: 1.5px solid var(--rule);
    div { padding: 6px 12px 8px; }
    div + div { border-left: 1.5px solid var(--rule); }
    dt { font-size: 12px; line-height: 1.4; color: var(--ink-soft); }
    dd { margin: 0; font-size: 20px; line-height: 1.3; white-space: nowrap; }
  }

  .diary-body {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 26px; align-items: start;
  }

  .title-block {
    grid-column: 2; grid-row: 1;
    writing-mode: vertical-rl; margin: 0;
    > * + * { margin-block-start: 8px; }
    h1 { margin: 0; font-size: clamp(56px, 6vw, 78px); line-height: 1.02; letter-spacing: .1em; }
    .subtitle { margin: 0; padding-top: 2.4em; font-size: 22px; line-height: 1.2; letter-spacing: .16em; color: var(--ink-soft); }
    .latin { margin: 0; padding-top: 6.6em; font-size: 12px; line-height: 1; letter-spacing: .2em; color: var(--ink-soft); }
  }

  /* 方格稿纸: 字号 + 字距 = 格宽, 外层画格子、内层写字 */
  .gaozhi {
    --c: 30px; --fs: 22px; --g: 10px; --n: 15;
    grid-column: 1; grid-row: 1;
    width: calc(var(--c) * var(--n) + 1px);
    margin: 4px 0 0;
    font-size: var(--fs);
    line-height: calc(var(--c) + var(--g));
    letter-spacing: calc(var(--c) - var(--fs));
    line-break: strict;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='40'%3E%3Crect x='.5' y='5.5' width='30' height='30' fill='none' stroke='%23BFE0CB'/%3E%3C/svg%3E");
    background-size: var(--c) calc(var(--c) + var(--g));
    min-height: calc((var(--c) + var(--g)) * var(--rows, 10));
    .ink { display: block; width: calc(var(--c) * var(--n)); margin-left: calc((var(--c) - var(--fs)) / 2); }
  }

  .cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 26px; }
  .cta-note { margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); }

  .dl-btn {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 56px; padding: 10px 28px 12px 18px;
    border: 0; border-radius: 16px; cursor: pointer;
    background: linear-gradient(oklch(0.89 0.15 92), var(--sun));
    color: var(--ink); font: 700 18px/1.2 var(--sans); text-decoration: none;
    box-shadow: inset 0 -3px 0 oklch(0.45 0.09 60 / .25), 0 10px 22px -8px oklch(0.62 0.15 72 / .75);
    transition: translate .15s, box-shadow .15s;
    .flower { width: 32px; height: 32px; flex: none; transition: rotate .6s cubic-bezier(.3, 1.4, .5, 1); }
    &:hover { translate: 0 -1px; box-shadow: inset 0 -3px 0 oklch(0.45 0.09 60 / .25), 0 14px 26px -8px oklch(0.62 0.15 72 / .8); .flower { rotate: 90deg; } }
    &:active { translate: 0 1px; }
  }

  .ghost {
    color: var(--ink); font-size: 16px; text-decoration: none; padding: 6px 2px;
    border-bottom: 1.5px dashed var(--rule);
    &:hover { border-bottom-style: solid; }
  }

  .hanko {
    position: absolute; right: -18px; bottom: 74px;
    display: grid; place-content: center; gap: 0;
    width: 76px; height: 76px; border-radius: 50%;
    border: 3px solid var(--hanko); color: var(--hanko);
    font-size: 20px; line-height: 1.05; text-align: center;
    rotate: 12deg; opacity: .88; mix-blend-mode: multiply;
    background: radial-gradient(oklch(0.56 0.19 29 / .05), transparent 70%);
  }

  /* 右边贴的两张照片 */
  .photos { position: relative; min-height: 520px; }

  .photo {
    position: absolute; margin: 0;
    padding: 10px 10px 0; background: #fff;
    box-shadow: var(--shadow);
    figcaption { padding: 6px 4px 10px; font-size: 17px; color: var(--ink-soft); text-align: center; }
    &::before {
      content: ""; position: absolute; top: -12px; left: 50%; width: 92px; height: 26px; translate: -50% 0;
      background: repeating-linear-gradient(135deg, oklch(0.9 0.07 150 / .75) 0 7px, oklch(0.96 0.03 150 / .75) 7px 14px);
    }
  }

  .photo-a { width: min(540px, 96%); top: 0; left: 0; rotate: -2.4deg; figcaption { text-align: left; padding-left: 8px; } &::before { rotate: -3deg; } }
  .photo-b { width: min(290px, 54%); right: 0; top: 250px; rotate: 4deg; &::before { rotate: 4deg; } }
}

/* ===================== 正文 ===================== */
@layer layout {
  main { width: min(1160px, 100% - 40px); margin: 0 auto; }
  main > section { margin-top: clamp(72px, 10vw, 128px); }

  h2 { margin: 0 0 22px; font-size: clamp(30px, 3.4vw, 40px); line-height: 1.25; }
  main p { margin: 0 0 1em; max-width: 34em; }
}

@layer parts {
  .story {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
    gap: clamp(32px, 6vw, 88px); align-items: center;
  }

  .tagline {
    margin-top: 28px !important; padding-left: 18px;
    font-size: clamp(22px, 2.4vw, 28px); line-height: 1.5;
    border-left: 4px solid var(--sun);
  }

  .polaroid {
    position: relative; margin: 0; padding: 12px 12px 0; background: #fff;
    rotate: 1.8deg; box-shadow: var(--shadow);
    figcaption { padding: 8px 6px 14px; font-family: var(--kai); font-size: 17px; color: var(--ink-soft); text-align: center; }
    &::before {
      content: ""; position: absolute; top: -12px; left: 18%; width: 96px; height: 26px; rotate: -6deg;
      background: repeating-linear-gradient(135deg, oklch(0.88 0.08 86 / .78) 0 8px, oklch(0.94 0.05 86 / .78) 8px 16px);
    }
  }

  /* 角色 */
  .cast-list {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 3vw, 36px);
    margin: 0; padding: 0; list-style: none;
  }

  .card {
    container-type: inline-size;
    position: relative;
    .card-pic { padding: 10px 10px 0; background: #fff; box-shadow: var(--shadow); transition: rotate .3s, translate .3s; }
    .card-pic img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
    &:nth-child(1) .card-pic { rotate: -1.6deg; }
    &:nth-child(2) .card-pic { rotate: 1.2deg; }
    &:nth-child(3) .card-pic { rotate: -0.6deg; }
    &:hover .card-pic { rotate: 0deg; translate: 0 -4px; }
    .card-text { padding: 22px 6px 0; }
    h3 { margin: 0; font-size: 30px; line-height: 1.2; }
    .romaji { font-family: var(--sans); font-size: 14px; letter-spacing: .08em; color: var(--ink-soft); margin-left: 6px; }
    .role { display: inline-block; margin: 8px 0 6px; padding: 1px 10px; border-radius: 999px; font-size: 14px; background: oklch(0.93 0.05 158); color: oklch(0.38 0.07 158); }
    p { margin: 0 0 4px; }
    .cv { font-size: 14px; color: var(--ink-soft); }
  }

  @container (min-width: 420px) {
    .card { display: grid; grid-template-columns: 180px 1fr; gap: 22px; align-items: center; }
    .card .card-text { padding: 0; }
  }

  /* 预告片 */
  .screen {
    position: relative; margin: 0;
    padding: 12px; border-radius: 18px;
    background: linear-gradient(oklch(0.38 0.05 255), oklch(0.27 0.05 260));
    box-shadow: var(--shadow), inset 0 1px 0 oklch(1 0 0 / .15);
    video { width: 100%; height: auto; aspect-ratio: 1280 / 548; border-radius: 9px; background: #0d1a2c; }
    figcaption { margin-top: 10px; font-size: 14px; color: oklch(0.86 0.02 240); padding: 0 4px; }
  }

  .play-btn {
    position: absolute; inset: 12px 12px auto; aspect-ratio: 1280 / 548;
    display: grid; place-content: center; justify-items: center; gap: 10px;
    border: 0; border-radius: 9px; cursor: pointer; color: #fff; font-size: 16px; font-weight: 600;
    background: radial-gradient(oklch(0.2 0.04 260 / .25), oklch(0.2 0.04 260 / .5));
    .flower { width: 84px; height: 84px; filter: drop-shadow(0 6px 14px oklch(0.2 0.05 260 / .5)); transition: rotate .8s cubic-bezier(.3, 1.4, .5, 1), scale .3s; }
    &:hover .flower { rotate: 120deg; scale: 1.06; }
  }

  /* 玩法：八月日历 */
  .month { display: flex; align-items: center; gap: 16px; margin: 0 0 34px; }
  .month-name { margin: 0; font-size: 26px; flex: none; }
  .days {
    --p: 1;
    display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 3px;
    flex: 1; margin: 0; padding: 0; list-style: none;
    li {
      display: grid; place-items: center; aspect-ratio: 1;
      font: 500 13px/1 var(--kai); color: var(--ink-soft);
      --on: clamp(0, var(--p) - var(--d) + 1, 1);
      border: 1px solid var(--line); border-radius: 5px;
      background: color-mix(in oklch, oklch(0.93 0.11 92) calc(var(--on) * 100%), #fff);
      &.sat { color: var(--sky-deep); }
      &.sun { color: var(--hanko); }
      &.today { border-color: var(--sun-deep); box-shadow: inset 0 0 0 2px var(--sun); color: var(--ink); }
    }
  }

  .features {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 44px;
    margin: 0; padding: 0; list-style: none;
    li { grid-column: span 2; padding: 22px 0 18px; border-top: 1.5px dashed var(--grid); }
    li:nth-child(4) { grid-column: 2 / span 2; }
    svg { width: 30px; height: 30px; fill: none; stroke: var(--sky-deep); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
    h3 { margin: 10px 0 6px; font-size: 22px; line-height: 1.35; }
    p { margin: 0; font-size: 16px; }
  }

  /* 截图：横滑 */
  .shots { timeline-scope: --reel; }
  .shots-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
  .shots-ctl { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
  .count { font: 500 18px/1 var(--kai); color: var(--ink-soft); min-width: 3.4em; text-align: right; }
  .arrow {
    display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
    border: 1px solid var(--line); background: #fff;
    svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    &:hover { border-color: var(--sky-deep); }
  }

  .reel {
    display: grid; grid-auto-flow: column; grid-auto-columns: min(76%, 860px); gap: 20px;
    margin: 0 -20px; padding: 6px 20px 18px; list-style: none;
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: 20px;
    scrollbar-width: none;
    scroll-timeline: --reel x;
    &::-webkit-scrollbar { display: none; }
    li { scroll-snap-align: start; }
  }

  .shot {
    display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
    border-radius: 12px; overflow: hidden; background: var(--sky);
    box-shadow: 0 12px 30px -18px oklch(0.3 0.08 255 / .6);
    img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: scale .4s; }
    &:hover img { scale: 1.025; }
  }

  .reel-track {
    height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 4px;
    i { display: block; height: 100%; width: 100%; background: var(--sun-deep); transform-origin: 0 50%; scale: .11 1; }
  }

  /* 配置与安装 */
  .setup {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 5vw, 72px);
    .file { grid-column: 1 / -1; }
  }

  .req-list { margin: 0;
    div { display: grid; grid-template-columns: 4.6em 1fr; padding: 10px 0; border-bottom: 1px solid var(--line); }
    dt { color: var(--ink-soft); }
    dd { margin: 0; }
  }

  .steps {
    counter-reset: step; margin: 0; padding: 0; list-style: none;
    li { counter-increment: step; position: relative; padding: 0 0 18px 52px; max-width: 30em; }
    li::before {
      content: counter(step);
      position: absolute; left: 0; top: 1px; width: 36px; height: 36px;
      border: 1.5px solid var(--rule); background: #fff;
      font: 500 21px/33px var(--kai); text-align: center; color: var(--ink);
    }
  }

  .file {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px;
    padding: 22px 26px; border-radius: 14px; background: #fff; box-shadow: 0 14px 34px -24px oklch(0.3 0.08 255 / .55);
    dl { margin: 0; display: grid; gap: 6px; min-width: 0; flex: 1 1 520px; }
    div { display: grid; grid-template-columns: 5.4em minmax(0, 1fr); align-items: baseline; }
    dt { color: var(--ink-soft); font-size: 15px; }
    dd { margin: 0; min-width: 0; }
    .hash dd { display: flex; align-items: center; gap: 10px; }
    .hash code { overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.5; }
    .copy { flex: none; padding: 3px 10px; border-radius: 7px; border: 1px solid var(--line); background: #fff; font-size: 13px; cursor: pointer; }
  }

  /* 常见问题 */
  .faq details { max-width: 48em; border-bottom: 1px solid var(--line); }
  .faq summary {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 2px; font-weight: 600; cursor: pointer; list-style: none;
    &::-webkit-details-marker { display: none; }
    &::after { content: ""; flex: none; width: 10px; height: 10px; border: solid var(--sky-deep); border-width: 0 2px 2px 0; rotate: 45deg; translate: 0 -3px; transition: rotate .25s, translate .25s; }
  }
  .faq details[open] summary::after { rotate: 225deg; translate: 0 3px; }
  .faq details p { margin: 0 0 18px; color: var(--ink-soft); }
  .faq details::details-content { block-size: 0; overflow: clip; transition: block-size .3s ease, content-visibility .3s allow-discrete; }
  .faq details[open]::details-content { block-size: auto; }

  /* 页脚：檐廊 + 风铃 */
  .veranda {
    position: relative;
    margin-top: clamp(80px, 11vw, 140px);
    padding: 44px 20px 46px; text-align: center; font-size: 14px; color: oklch(0.95 0.02 75);
    background:
      linear-gradient(oklch(0 0 0 / .16), oklch(0 0 0 / 0) 16px),
      repeating-linear-gradient(90deg, var(--wood) 0 142px, var(--wood-deep) 142px 144px);
    p { margin: 0 0 6px; }
    .links { display: flex; justify-content: center; gap: 26px; }
    a { color: oklch(0.92 0.09 88); }
  }

  .chime {
    position: absolute; left: max(24px, calc((100vw - 1160px) / 2)); top: -2px; width: 56px; height: 140px; overflow: visible;
    .chime-swing { transform-origin: 30px 0; }
    .chime-string { stroke: oklch(0.9 0.02 80); stroke-width: 1; fill: none; }
    .chime-glass { fill: oklch(0.93 0.04 220 / .82); stroke: oklch(0.82 0.05 220); stroke-width: 1; }
    .chime-band { stroke: oklch(0.56 0.19 29); stroke-width: 2; }
    .chime-dot { fill: oklch(0.6 0.14 160); }
    .chime-paper { fill: oklch(0.97 0.02 95); stroke: oklch(0.85 0.03 90); stroke-width: .8; }
    .chime-text { font: 13px var(--kai); fill: var(--hanko); }
  }

  /* 弹窗 */
  dialog { border: 0; padding: 0; color: var(--ink); }
  dialog::backdrop { background: oklch(0.22 0.05 255 / .55); backdrop-filter: blur(3px); }

  .sheet {
    width: min(440px, calc(100vw - 32px)); padding: 28px 26px 28px;
    border-radius: 16px; background: var(--paper-grain), var(--paper);
    box-shadow: 0 30px 70px -24px oklch(0.2 0.05 255 / .7);
    h2 { font-size: 25px; margin: 0 0 4px; }
  }
  .sheet-meta { margin: 0 0 18px; font-size: 14px; color: var(--ink-soft); }
  .sheet-close { position: absolute; top: 14px; right: 14px; }
  .sheet-close button, .lb-bar button {
    min-height: 36px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 14px; cursor: pointer;
  }
  .ts-box { min-height: 72px; }
  .dl-status { margin: 12px 0 16px; font-size: 14px; color: var(--ink-soft); }

  .lightbox {
    width: min(1280px, 96vw); max-height: 96vh; border-radius: 12px; overflow: hidden; background: oklch(0.22 0.04 255);
    img { width: 100%; max-height: calc(96vh - 64px); object-fit: contain; }
  }
  .lb-bar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; color: oklch(0.88 0.02 240); font-size: 14px; form { margin-left: 12px; } }
}

/* ===================== 动效（系统要求少动效时全关） ===================== */
@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .gaozhi .ink span { animation: write .5s calc(700ms + var(--i) * 55ms) both; }
    @keyframes write { from { opacity: 0; filter: blur(2px); translate: 0 3px; } }

    .diary { animation: drop .7s cubic-bezier(.2, .8, .2, 1) both; }
    .photo-a { animation: drop .8s .15s cubic-bezier(.2, .8, .2, 1) both; }
    .photo-b { animation: drop .8s .3s cubic-bezier(.2, .8, .2, 1) both; }
    .hanko { animation: stamp .35s 3.4s cubic-bezier(.3, 1.6, .5, 1) both; }
    @keyframes drop { from { opacity: 0; translate: 0 18px; } }
    @keyframes stamp { from { opacity: 0; scale: 1.8; } }

    .cloud { animation: drift 46s ease-in-out infinite alternate; }
    .cloud.c2 { animation-duration: 58s; animation-direction: alternate-reverse; }
    .cloud.c3 { animation-duration: 70s; }
    @keyframes drift { to { translate: 9vw 0; } }

    .chime-swing { animation: swing 4.6s ease-in-out infinite alternate; }
    @keyframes swing { from { rotate: -6deg; } to { rotate: 7deg; } }

    @supports (animation-timeline: scroll()) {
      .topbar { animation: solid linear both; animation-timeline: scroll(root); animation-range: 0 220px; }
      @keyframes solid { to { background-color: oklch(1 0 0 / .9); border-bottom-color: var(--line); } }

      .photos { animation: lift linear both; animation-timeline: scroll(root); animation-range: 0 100svh; }
      @keyframes lift { to { translate: 0 -70px; } }
      .sky picture { animation: sink linear both; animation-timeline: scroll(root); animation-range: 0 100svh; }
      @keyframes sink { to { translate: 0 90px; scale: 1.06; } }

      .days { animation: month linear both; animation-timeline: view(); animation-range: entry 60% cover 60%; }
      @keyframes month { from { --p: 1; } to { --p: 31.5; } }

      .reel-track i { animation: reel linear both; animation-timeline: --reel; }
      @keyframes reel { from { scale: .11 1; } to { scale: 1 1; } }
    }

    dialog[open] { animation: pop .28s cubic-bezier(.2, .9, .3, 1.15); }
    dialog[open]::backdrop { animation: fade .25s ease-out; }
    @keyframes pop { from { opacity: 0; scale: .94; translate: 0 12px; } }
    @keyframes fade { from { opacity: 0; } }
  }

  ::view-transition-group(shot) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
}

/* ===================== 窄屏 ===================== */
@layer responsive {
  @media (max-width: 1100px) {
    .nav { display: none; }
    .brand { margin-right: auto; }
    .hero-inner { grid-template-columns: minmax(0, 620px); justify-content: center; }
    .photos { min-height: 0; order: -1; height: 300px; }
    .photo-a { width: min(470px, 78%); }
    .photo-b { width: min(240px, 42%); top: 120px; }
    .story { grid-template-columns: 1fr; }
    .features { grid-template-columns: repeat(2, minmax(0, 1fr)); li, li:nth-child(4) { grid-column: auto; } li:last-child { grid-column: 1 / -1; } }
    .cast-list { grid-template-columns: 1fr; max-width: 640px; }
  }

  @media (max-width: 760px) {
    body { font-size: 16px; }
    .topbar { height: 56px; gap: 12px; padding: 0 14px; }
    .brand { font-size: 19px; }
    html { scroll-padding-top: 66px; }
    .hero { padding: 76px 14px 48px; }
    .photos { height: 236px; }
    .photo-a { width: 84%; }
    .photo-b { width: 42%; top: 104px; }
    .photo figcaption { font-size: 14px; padding-bottom: 8px; }
    .diary { padding: 22px 16px 22px; rotate: 0deg; }
    .diary::before { left: 18px; width: 86px; }
    .diary::after { right: 20px; width: 86px; }
    .diary-head { grid-template-columns: 1fr 1fr; div:nth-child(3) { border-left: 0; } div:nth-child(n+3) { border-top: 1.5px solid var(--rule); } dd { font-size: 17px; } }
    .diary-body { grid-template-columns: 1fr; gap: 14px; }
    .title-block { grid-column: 1; grid-row: 1; writing-mode: horizontal-tb; > * + * { margin-block-start: 2px; } h1 { font-size: 46px; letter-spacing: .06em; } .subtitle, .latin { padding-top: 0; } }
    .gaozhi { --c: 24px; --fs: 18px; --g: 8px; --n: 13; --rows: 5; grid-row: 2;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='32'%3E%3Crect x='.5' y='4.5' width='24' height='24' fill='none' stroke='%23BFE0CB'/%3E%3C/svg%3E"); }
    .hanko { right: 12px; bottom: auto; top: 196px; width: 60px; height: 60px; font-size: 15px; }
    .dl-btn { min-height: 52px; font-size: 17px; }
    .month { flex-direction: column; align-items: start; gap: 10px; }
    .days { width: 100%; grid-template-columns: repeat(16, minmax(0, 1fr)); }
    .features { grid-template-columns: 1fr; li:last-child { grid-column: auto; } }
    .reel { grid-auto-columns: 86%; gap: 12px; margin: 0 -14px; padding-inline: 14px; scroll-padding-inline: 14px; }
    .setup { grid-template-columns: 1fr; }
    .file { padding: 18px; }
    .chime { left: 14px; width: 40px; height: 100px; }
    .veranda { padding-top: 112px; }
    .cast-list { gap: 26px; }
    .card { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 18px; align-items: center; }
    .card .card-pic { padding: 7px 7px 0; }
    .card .card-text { padding: 0; }
    .card h3 { font-size: 26px; }
  }

  @media (max-width: 379px) {
    .gaozhi { --n: 11; }
  }
}

/* 隐私 / 条款 / 404 */
@layer parts {
  .doc-main { width: min(720px, 100% - 40px); margin: 0 auto; padding: 48px 0 80px; }
  .doc-main h1 { font-size: 34px; line-height: 1.3; margin: 12px 0 20px; }
  .doc-main h2 { font-size: 22px; margin: 28px 0 8px; }
  .doc-main p { max-width: 36em; }
}
