/* ==========================================================================
   ONE LIFE — responsive
   手机端不是把三栏等比缩小，而是重新组织信息层级：
     固定顶栏（年龄/年份） → 折叠档案 → 故事 → 时间线 → 固定控制栏
   ========================================================================== */

/* ---------- 平板：收窄三栏 ---------- */
@media (max-width: 1180px) {
  .life {
    grid-template-columns: 232px minmax(0, 1fr) 236px;
  }
  .life__aside {
    padding: 70px 20px 24px;
  }
  .life__rail {
    padding: 70px 16px 24px;
  }
  .life__main {
    padding: 70px 32px 48px;
  }
}

/* ---------- 中小屏：隐藏右侧时间线，改为故事下方 ---------- */
@media (max-width: 980px) {
  .life {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .life__rail {
    display: none;
  }
  .life__main {
    padding: 70px 28px 56px;
  }
  .epi__stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   手机端：<= 820px
   ========================================================================== */
@media (max-width: 820px) {
  :root {
    --pad-x: 20px;
    --reading: 100%;
  }

  body {
    font-size: 15.5px;
    line-height: 1.8;
  }

  /* ---------- 顶栏 ---------- */
  .topbar {
    padding: 14px 20px;
    background: rgba(243, 238, 224, 0.97);
    border-bottom: 1px solid var(--line-soft);
  }
  .topbar__brand {
    letter-spacing: 0.4em;
  }
  .topbar__right {
    gap: 14px;
  }

  /* ---------- 首页 ---------- */
  .home__center {
    padding: 92px 20px 32px;
    align-items: flex-start;
  }
  .home__title {
    font-size: clamp(2rem, 9vw, 2.9rem);
    max-width: 100%;
    line-height: 1.12;
  }
  .home__title-zh {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    margin-bottom: 26px;
  }
  .home__intro {
    font-size: 0.9rem;
    line-height: 1.95;
    margin-bottom: 36px;
  }
  .home__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 36px;
  }
  .home__actions .btn {
    width: 100%;
  }
  .home__links {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-top: 20px;
  }
  .home__links .btn--ghost {
    padding: 10px 0;
  }
  .home__foot {
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px 26px;
  }

  /* ---------- 出生仪式 ---------- */
  .birth {
    padding: 84px 20px 56px;
    align-items: flex-start;
  }
  .birth__progress {
    margin-bottom: 36px;
    gap: 4px;
  }
  .birth__title {
    font-size: 1.55rem;
    line-height: 1.35;
    max-width: 100%;
  }
  .birth__body {
    font-size: 0.93rem;
    line-height: 1.95;
    max-width: 100%;
  }
  .reveal {
    grid-template-columns: 1fr 1fr;
  }
  .reveal__cell {
    padding: 18px 16px;
  }
  .reveal__value {
    font-size: 1rem;
  }
  .birth__nav {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
    margin-top: 32px;
  }
  .birth__nav .btn {
    width: 100%;
  }
  .birth__nav-right {
    margin-left: 0;
  }
  .archive__row {
    flex-direction: column;
    gap: 3px;
    padding: 11px 0;
  }
  .archive__val {
    text-align: left;
  }

  /* ---------- 档案 ---------- */
  .profile {
    padding: 84px 20px 64px;
  }
  .profile__grid {
    grid-template-columns: 1fr;
  }
  /* 档案行改为上下两行，避免长键名挤压 */
  .pblock__row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 0;
  }
  .pblock__key {
    font-size: 10px;
  }
  .pblock__val,
  .pblock__val--long {
    font-size: 0.86rem;
  }
  .profile__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .profile__actions .btn {
    width: 100%;
  }

  /* ==================================================================
     LIFE —— 重新组织，不用三栏
     ================================================================== */
  .life {
    display: block;
    padding-bottom: 74px;
  }

  /* 左档案 → 顶部折叠区 */
  .life__aside {
    position: static;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--line);
    background: var(--near-black);
    padding: 70px 20px 0;
  }

  .person {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 0;
    padding-bottom: 16px;
  }
  .person__initial {
    width: 40px;
    height: 40px;
    margin-bottom: 0;
    font-size: 1rem;
    flex: 0 0 auto;
  }
  .person__name {
    font-size: 0.98rem;
    margin-bottom: 2px;
  }
  .person__meta {
    font-size: 10px;
  }

  /* 折叠开关 */
  .aside-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 13px 0;
    border-top: 1px solid var(--line-soft);
    font-size: 9.5px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-mute);
  }
  .aside-toggle::after {
    content: "＋";
    font-size: 12px;
    color: var(--gold);
    transition: transform 0.3s;
  }
  .aside-toggle[aria-expanded="true"]::after {
    content: "－";
  }

  .aside-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.42s var(--ease);
  }
  .aside-body.is-open {
    max-height: 640px;
  }
  .aside-body .aside-section:first-child {
    border-top: 1px solid var(--line-soft);
  }

  /* 中叙事 → 主体 */
  .life__main {
    padding: 32px 20px 40px;
    max-width: 100%;
  }
  .scene-head__age {
    font-size: 3.1rem;
  }
  .scene-head__title {
    font-size: 1.2rem;
    max-width: 100%;
  }
  .prose {
    font-size: 0.96rem;
    line-height: 2;
    max-width: 100%;
  }

  /* 重要选择占据完整阅读区 */
  .choice {
    margin: 32px -20px;
    border-left: none;
    border-right: none;
    padding: 26px 20px 30px;
    background: #0d0d0d;
  }
  .choice__q {
    font-size: 1.05rem;
  }
  .choice__opt {
    padding: 16px;
  }
  .choice__opt:hover {
    transform: none;
  }
  .choice__opt-label {
    font-size: 0.92rem;
  }
  .choice__opt-context {
    font-size: 11px;
  }

  .second-person {
    margin: 28px 0;
    padding-left: 18px;
  }

  .outcome {
    margin: 28px 0;
  }
  .outcome__text {
    font-size: 0.93rem;
    max-width: 100%;
  }
  .outcome__caveat {
    max-width: 100%;
  }

  .scene-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .scene-foot .btn {
    width: 100%;
  }
  .scene-foot__next {
    text-align: center;
  }

  /* 右时间线 → 故事下方 */
  .life__rail {
    display: block;
    position: static;
    height: auto;
    overflow: visible;
    border-left: none;
    border-top: 1px solid var(--line);
    padding: 30px 20px 24px;
  }
  .rail__title {
    margin-bottom: 18px;
  }
  .rail__item {
    padding: 9px 0 9px 18px;
  }
  .rail__item::before {
    top: 16px;
  }

  /* 底部控制栏：加高、按钮加大触摸区 */
  .controls {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }
  .controls__age {
    font-size: 1.1rem;
  }
  .controls__year {
    font-size: 9px;
  }
  .controls__mid {
    justify-self: center;
  }
  .controls__right {
    gap: 4px;
  }
  .ctl {
    padding: 9px 11px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }
  /* 手机端速度：保留三档，压缩为窄条 */
  .speed {
    border-color: var(--line);
  }
  .speed__opt {
    padding: 9px 7px;
    font-size: 9px;
    letter-spacing: 0;
  }

  /* ---------- 终章 ---------- */
  .epilogue {
    padding: 84px 20px 64px;
  }
  .epi__stats {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 40px;
  }
  .epi__stat {
    padding: 20px 14px;
  }
  .epi__stat-value {
    font-size: 1.3rem;
  }
  .epi__stat-value--lg {
    font-size: 1.8rem;
  }
  .epi__section-text {
    font-size: 0.9rem;
    max-width: 100%;
  }
  .epi__tl-row {
    grid-template-columns: 52px 1fr;
    gap: 4px 14px;
    padding: 12px 0;
  }
  .epi__tl-cat {
    grid-column: 2;
    grid-row: 1;
    font-size: 8.5px;
  }
  .epi__tl-text {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.84rem;
  }
  .epi__tl-age {
    grid-row: 1 / span 2;
    align-self: start;
    padding-top: 2px;
  }
  .epi__coda {
    margin: 44px 0 36px;
    padding: 40px 20px;
  }
  .epi__coda-mark {
    font-size: 1rem;
    letter-spacing: 0.16em;
  }
  .epi__coda-text {
    font-size: 0.88rem;
    max-width: 100%;
  }
  .epi__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .epi__actions .btn {
    width: 100%;
  }

  /* ---------- 世界 ---------- */
  .world {
    padding: 84px 20px 64px;
  }
  .world__grid {
    grid-template-columns: 1fr;
  }

  /* ---------- 模态 ---------- */
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal__panel {
    width: 100%;
    max-height: 88vh;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  }
  .modal__title {
    font-size: 1.25rem;
  }
  .modal__body p {
    font-size: 0.85rem;
    line-height: 1.9;
  }
}

/* ---------- 窄屏手机 <= 380px ---------- */
@media (max-width: 380px) {
  .reveal {
    grid-template-columns: 1fr;
  }
  .epi__stats {
    grid-template-columns: 1fr;
  }
  .controls__year {
    display: none;
  }
  .ctl {
    padding: 9px 4px;
    letter-spacing: 0.05em;
  }
}

/* ---------- 横屏矮屏 ---------- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .birth,
  .home__center {
    align-items: flex-start;
    padding-top: 76px;
  }
  .life__aside {
    position: static;
    height: auto;
  }
}

/* ---------- 打印 ---------- */
@media print {
  body::after,
  .topbar,
  .controls,
  .life__aside,
  .life__rail {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .epilogue {
    padding: 0;
  }
}

/* ==========================================================
   大屏增强（PC）—— ≥1440px
   移动端优先的排版在宽屏下显得字小、列窄。
   这里只做增强，不改变任何既有结构。
   ========================================================== */

@media (min-width: 1440px) {
  :root {
    font-size: 17.5px;
    --reading: 36em;
    --pad-x: clamp(48px, 7vw, 140px);
  }

  /* ---- 首页：标题更舒展，说明列居中 ---- */
  .home__inner {
    max-width: 920px;
  }
  .home__title {
    font-size: clamp(3.4rem, 4.6vw, 5.4rem);
    max-width: none;
  }
  .home__intro {
    max-width: 52ch;
  }
  .home__actions {
    gap: 18px;
  }
  .home__actions .btn {
    padding: 15px 34px;
    font-size: 0.86rem;
  }
  .home__foot {
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
  }

  /* ---- 出生仪式：正文列放宽、字号放大 ---- */
  .birth__wrap {
    max-width: 780px;
  }
  .birth__body {
    font-size: 1.02rem;
    line-height: 2.05;
  }
  .reveal {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 26px 32px;
  }
  .reveal__value {
    font-size: 1.05rem;
  }


  /* ---- 人生页：中间列放宽，正文放大 ---- */
  .life__main {
    max-width: 920px;
    padding-left: clamp(32px, 4vw, 72px);
    padding-right: clamp(32px, 4vw, 72px);
  }
  .scene-head__age {
    font-size: clamp(3.4rem, 4vw, 4.6rem);
  }
  .prose {
    font-size: 1.08rem;
    line-height: 2.12;
    max-width: none;
  }
  .choice__opt {
    padding: 18px 22px;
  }
  .rail__item {
    padding: 11px 14px;
  }
  .aside-list__key,
  .aside-list__val {
    font-size: 12.5px;
  }

  /* ---- 终章 ---- */
  .epilogue__wrap {
    max-width: 980px;
  }
}

@media (min-width: 1920px) {
  :root {
    font-size: 18.5px;
    --reading: 38em;
  }
  .home__inner {
    max-width: 1000px;
  }
  .life__main {
    max-width: 980px;
  }
  .profile__grid {
    max-width: 1280px;
  }
  .pblock:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
