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

:root {
  --sky: #2E86D1;
  --sky-pale: #CFEBFA;
  --air: #EEF6FB;
  --paper: #FFFFFF;
  --grid: #BFE0CB;
  --rule: #7DB896;
  --ink: #22304E;
  --ink-soft: #4E5B78;
  --sun: #FFBE0B;
  --sun-deep: #C98A00;
  --wood: #8B5A35;
  --wood-deep: #6E4527;
  --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;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--air);
}

img { display: block; max-width: 100%; height: auto; }

[hidden] { display: none !important; }

.wk { font-family: var(--kai); font-weight: 500; }

a { color: var(--sky); }

:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

/* ---------- 首屏：天空 + 绘日记 ---------- */

.sky {
  position: relative;
  padding: clamp(28px, 6vw, 72px) 16px 0;
}

.sky-art {
  position: absolute;
  inset: 0 0 auto 0;
  height: clamp(380px, 46vw, 620px);
  overflow: hidden;
  background: linear-gradient(var(--sky), var(--sky-pale));
}

.sky-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 30%;
}

.sky-art::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(rgba(238, 246, 251, 0), var(--air));
}

.diary {
  position: relative;
  width: min(780px, 100%);
  margin: 0 auto 0 max(0px, calc((100% - 1180px) / 2));
  padding: 22px 30px 30px;
  background: var(--paper);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(34, 48, 78, .06), 0 18px 40px -12px rgba(34, 48, 78, .35);
  animation: settle .55s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes settle {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.diary-head {
  display: grid;
  grid-template-columns: 1.1fr 1.5fr 1.1fr 1.1fr;
  margin: 0 0 18px;
  border: 1.5px solid var(--rule);
}

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

.diary-picture {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: start;
}

.drawing {
  margin: 0;
  padding: 6px;
  border: 1.5px solid var(--rule);
}

.title-block {
  writing-mode: vertical-rl;
  margin: 0;
  padding-top: 4px;
}

.title-block > * + * { margin-block-start: 10px; }

.title-block h1 {
  margin: 0;
  font-size: clamp(54px, 6.2vw, 76px);
  line-height: 1.05;
  letter-spacing: .1em;
}

.title-block .subtitle {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: .14em;
  padding-top: 1.6em;
  color: var(--ink-soft);
}

.title-block .latin {
  margin: 0;
  font-size: 13px;
  line-height: 1;
  letter-spacing: .18em;
  padding-top: 4.2em;
  color: var(--ink-soft);
}

/* 方格稿纸：每个字占一格，字号 + 字距 = 格宽 */
.gaozhi {
  --c: 30px;
  --fs: 22px;
  --g: 10px;
  --n: 22;
  width: calc(var(--c) * var(--n) + 1px);
  margin: 22px 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));
}

.gaozhi > span {
  display: block;
  width: calc(var(--c) * var(--n));
  margin-left: calc((var(--c) - var(--fs)) / 2);
}

.get {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 24px;
}

.get-note { margin: 0; font-size: 14px; color: var(--ink-soft); }

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 26px 12px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--sun);
  color: var(--ink);
  font: 700 18px/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(110, 69, 39, .22), 0 8px 18px -6px rgba(201, 138, 0, .55);
  transition: transform .15s ease, box-shadow .15s ease;
}

.dl-btn:hover { transform: translateY(-1px); box-shadow: inset 0 -3px 0 rgba(110, 69, 39, .22), 0 11px 22px -6px rgba(201, 138, 0, .6); }
.dl-btn:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgba(110, 69, 39, .22), 0 4px 10px -4px rgba(201, 138, 0, .5); }
.dl-btn .sunflower { width: 30px; height: 30px; flex: none; }
.dl-btn-small { min-height: 46px; padding: 8px 22px 10px; font-size: 16px; margin-top: 8px; }

/* ---------- 正文 ---------- */

main {
  width: min(1060px, 100% - 40px);
  margin: 0 auto;
}

main section { margin-top: clamp(56px, 8vw, 96px); }

h2 {
  margin: 0 0 18px;
  font-size: 30px;
  line-height: 1.3;
}

main p { margin: 0 0 1em; max-width: 34em; }

.story {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 470px);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

.story-pic { margin: 0; }
.story-pic img { border-radius: 6px; box-shadow: 0 10px 28px -14px rgba(34, 48, 78, .5); }
.story-pic figcaption { margin-top: 10px; font-size: 14px; color: var(--ink-soft); }

.play-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 48px;
  margin: 0;
}

.play-list div {
  padding: 18px 0 16px;
  border-top: 1.5px dashed var(--grid);
}

.play-list dt { font-size: 22px; line-height: 1.4; margin-bottom: 4px; }
.play-list dd { margin: 0; max-width: 30em; }

.shot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shot-grid button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--sky-pale);
  cursor: zoom-in;
}

.shot-grid img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform .25s ease;
}

.shot-grid button:hover img { transform: scale(1.03); }

.setup {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 5vw, 64px);
}

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

.steps {
  counter-reset: step;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 16px 50px;
  max-width: 30em;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--rule);
  font-family: var(--kai);
  font-size: 20px;
  line-height: 31px;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
}

.faq details { border-bottom: 1px solid #D7E6EF; max-width: 46em; }
.faq summary { padding: 14px 0; font-weight: 600; cursor: pointer; }
.faq summary::marker { color: var(--sky); }
.faq details p { margin: 0 0 16px; color: var(--ink-soft); }

code { font-size: .92em; padding: 1px 6px; border-radius: 4px; background: #E3EEF5; }

/* ---------- 页脚：檐廊木板 ---------- */

.veranda {
  margin-top: clamp(64px, 9vw, 110px);
  padding: 36px 20px 40px;
  text-align: center;
  font-size: 14px;
  color: #F6EADB;
  background:
    linear-gradient(rgba(0, 0, 0, .12), rgba(0, 0, 0, 0) 14px),
    repeating-linear-gradient(90deg, var(--wood) 0 136px, var(--wood-deep) 136px 138px);
}

.veranda p { margin: 0 0 6px; }
.veranda .links { display: flex; justify-content: center; gap: 24px; }
.veranda a { color: #FFE3A3; }

/* ---------- 弹窗 ---------- */

dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(16, 34, 58, .55); backdrop-filter: blur(2px); }

.sheet {
  width: min(440px, calc(100vw - 32px));
  padding: 26px 26px 28px;
  border-radius: 10px;
  box-shadow: 0 24px 60px -18px rgba(16, 34, 58, .6);
}

.sheet h2 { font-size: 24px; margin: 0 0 4px; }
.sheet-meta { margin: 0 0 16px; font-size: 14px; color: var(--ink-soft); }
.sheet-close { position: absolute; top: 12px; right: 12px; }
.sheet-close button, .lb-bar button {
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid #C9D9E4;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: 14px/1.2 var(--sans);
  cursor: pointer;
}

.ts-box { min-height: 72px; }
.dl-status { margin: 12px 0 14px; font-size: 14px; color: var(--ink-soft); }

.lightbox {
  width: min(1280px, 96vw);
  max-height: 96vh;
  background: #10223A;
  border-radius: 8px;
  overflow: hidden;
}

.lightbox 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: #CFE1EE; font-size: 14px; }
.lb-bar form { margin-left: 12px; }

/* ---------- 窄屏 ---------- */

@media (max-width: 860px) {
  .diary { margin: 0 auto; }
  .story, .setup { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .diary { padding: 16px 16px 22px; }
  .diary-head { grid-template-columns: 1fr 1fr; }
  .diary-head div:nth-child(3) { border-left: 0; }
  .diary-head div:nth-child(n+3) { border-top: 1.5px solid var(--rule); }
  .diary-head dd { font-size: 17px; }
  .diary-picture { grid-template-columns: 1fr; gap: 14px; }
  .title-block { writing-mode: horizontal-tb; order: -1; }
  .title-block > * + * { margin-block-start: 2px; }
  .title-block h1 { font-size: 44px; letter-spacing: .06em; }
  .title-block .subtitle, .title-block .latin { padding-top: 0; }
  .title-block .latin { margin-top: 4px; }
  .gaozhi { --c: 24px; --fs: 18px; --g: 8px; --n: 13; background-size: var(--c) calc(var(--c) + var(--g));
    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"); }
  .play-list { grid-template-columns: 1fr; }
  .shot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  h2 { font-size: 26px; }
  body { font-size: 16px; }
}

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

@media (min-width: 761px) and (max-width: 860px) {
  .gaozhi { --n: 20; }
}

@media (prefers-reduced-motion: reduce) {
  .diary { animation: none; }
  .dl-btn, .shot-grid img { transition: none; }
}

/* ---------- 隐私 / 条款 / 404 ---------- */

.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; }
