/* VOX ATLAS 第三版：字号、滚动条、手机布局 */

/* ---------- 字号：界面里的小字整体放大 ---------- */
.mono { font-size: 12px; }
.small { font-size: 14px; }
.lbl { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--sub); margin-bottom: 8px; }
.ex-list li { font-size: 15px; }
.pick-list button { font-size: 15px; }
.detail { font-size: 16px; }
.dq blockquote { font-size: 18px; }
.who { font-size: 14px; }
.tip { font-size: 14px; max-width: 260px; }
.voices .nm { font-size: 17px; }
.voices .ct { font-size: 13px; }
.tpl-list button { font-size: 14px; }
.tpl-list button small { font-size: 11px; }
.m-grid span { font-size: 13px; }

/* ---------- 滚动条：细、低对比、跟纸色融合 ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(32, 35, 31, .26) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(32, 35, 31, .22); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(32, 35, 31, .42); }
::-webkit-scrollbar-corner { background: transparent; }
/* 横向滑动的标签条不显示滚动条，用两端渐隐提示还能滑 */
.voices, .seg-strip, .chips-scroll { scrollbar-width: none; }
.voices::-webkit-scrollbar, .seg-strip::-webkit-scrollbar, .chips-scroll::-webkit-scrollbar { display: none; }
.finale { scrollbar-color: rgba(236, 231, 218, .3) transparent; }

/* ---------- 探索：桌面 ---------- */
.ex-meta h2 { font-size: 24px; font-weight: 500; margin: 6px 0 2px; }
.ex-side { gap: 26px; }
.ex-tpl .seg { margin-top: 12px; }
.ex-bar { align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.ex-rangebox { flex: 1; min-width: 0; }
.ex-rangebox .seg-bars { margin: 10px 0 0; }
.ex-range .lbl { margin: 0 4px 0 0; }
.msheet-head, .mbar, .mscrim { display: none; }
.viewer-desc { font-size: 15px; }

/* ---------- 海报：预览工具条、放大查看 ---------- */
.sheet-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; width: 100%; max-width: 640px; }
.sheet-bar .sheet-cap { margin: 0; }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(30, 37, 32, .92); display: flex; flex-direction: column; }
.lb-bar { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 12px 16px; color: #ECE7DA; }
.lb-bar .mono { margin-right: auto; color: #A3AA9B; }
.lb-bar .chip { background: transparent; color: #ECE7DA; border-color: rgba(236, 231, 218, .4); }
.lb-body { flex: 1; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 0 16px 24px; }
/* 适合屏幕：宽高都不超出（--r = 宽 / 高） */
.lb-sheet { width: min(100%, calc((100svh - 100px) * var(--r))); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6); }
.lb-sheet svg { width: 100%; height: 100%; display: block; }
.lightbox.real .lb-body { place-items: start center; }
.lightbox.real .lb-sheet { max-width: none; }

/* =================== 手机 =================== */
@media (max-width: 860px) {
  body { font-size: 16px; }

  /* --- 探索：人物在上（横滑），画布占满，工具在底部栏，其余进抽屉 --- */
  .explore { display: flex; flex-direction: column; min-height: auto; }
  .ex-side { order: 0; position: sticky; top: 56px; z-index: 30; background: var(--paper); border: 0; border-bottom: 1px solid var(--rule); padding: 8px var(--gutter); gap: 0; }
  .ex-meta, .ex-people .lbl { display: none; }
  .ex-people .voices { margin: 0; padding: 2px 0; mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .ex-people .voices li button { min-height: 40px; }
  .ex-main { order: 1; padding: 12px var(--gutter) calc(84px + env(safe-area-inset-bottom)); }
  .ex-bar { margin: 0; }
  .ex-actions { display: none; }
  .ex-stage { flex: none; aspect-ratio: auto; height: calc(100svh - 56px - 58px - 84px - 24px); min-height: 380px; }
  .viewer-desc { display: none; }

  /* 抽屉：从底部升起；用 bottom 动画而不是 transform，里面的详情卡（fixed）才能正常定位 */
  .msheet {
    position: fixed; left: 0; right: 0; bottom: -80svh; z-index: 70; max-height: 72svh; overflow: auto;
    background: var(--paper); border-top: 1px solid var(--ink); border-radius: 14px 14px 0 0;
    padding: 0 var(--gutter) calc(84px + env(safe-area-inset-bottom)); visibility: hidden;
    transition: bottom .42s var(--ease), visibility 0s .42s; box-shadow: 0 -24px 48px -24px rgba(32, 35, 31, .35);
  }
  .msheet.open { bottom: 0; visibility: visible; transition: bottom .42s var(--ease), visibility 0s; }
  .msheet-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--paper); padding: 14px 0 10px; z-index: 2; }
  .msheet-head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; border-radius: 4px; background: var(--rule); transform: translateX(-50%); }
  .msheet-head h3 { margin: 0; font-size: 18px; font-weight: 500; }
  .msheet-x { width: 40px; height: 40px; border: 1px solid var(--rule); border-radius: 50%; background: var(--paper); font-size: 20px; cursor: pointer; }
  .msheet .lbl { display: none; }
  .ex-tpl .tpl-list { grid-template-columns: repeat(3, 1fr); }
  .ex-tpl .tpl-list button { min-height: 56px; }
  .ex-range { flex-wrap: wrap; }
  .ex-range .select { max-width: none; flex: 1 1 40%; }
  .ex-rangebox .seg-bars { height: 56px; }
  .ex-rangebox .seg-bars button { height: 56px; }
  .ex-panel.msheet { display: block; border-left: 0; position: fixed; max-height: 72svh; top: auto; }
  .ex-panel .ex-list-head { display: none; }
  .ex-panel .detail.sheet:not(.open) { display: none; }
  .ex-panel .detail.sheet.open { visibility: visible; z-index: 80; }

  /* 底部工具栏 */
  .mbar {
    display: grid; grid-template-columns: 1fr 1fr 1fr 48px 1.3fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
    background: rgba(241, 238, 230, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--rule); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px;
  }
  .mbar button, .mbar a { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 52px; border-radius: 10px; text-decoration: none; cursor: pointer; }
  .mbar b { font-weight: 500; font-size: 15px; }
  .mbar small { font-size: 11px; color: var(--sub); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mbar button.on { background: rgba(32, 35, 31, .07); }
  .mbar .mb-go { background: var(--ink); color: var(--paper); flex-direction: row; font-size: 15px; }
  .mscrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(30, 37, 32, .28); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .mscrim.on { opacity: 1; pointer-events: auto; }
  /* 抽屉所在的吸顶条有自己的层级，打开时整体抬到遮罩之上 */
  .ex-side:has(.msheet.open) { z-index: 72; }
  /* 详情卡也在底部栏之上 */
  .detail.sheet { padding-bottom: calc(96px + env(safe-area-inset-bottom)); max-height: 70svh; }

  /* --- 海报：预览吸顶、参数在下、导出常驻底部 --- */
  .studio { gap: 16px; }
  .poster-preview { position: sticky; top: 56px; z-index: 20; height: 44svh; min-height: 0; padding: 10px; order: -1; border-left: 0; border-right: 0; margin: 0 calc(var(--gutter) * -1); }
  .poster-preview .sheet { height: calc(100% - 44px); width: auto !important; max-width: 100%; }
  .sheet-bar { margin-top: 8px; }
  .studio-panel { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .export-row {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 75; margin: 0; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 6px;
    background: rgba(241, 238, 230, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--rule); padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }
  .export-row .btn { min-height: 48px; padding: 0 8px; font-size: 14px; }
  .ptabs { position: sticky; top: calc(56px + 44svh); z-index: 15; background: var(--paper); }
  .pick-list { max-height: none; }
  .page-title { margin: 10px 0 6px; }
  .page { padding-top: 16px; }

  /* --- 上传 / 确认：主按钮常驻底部 --- */
  .import-grid #go { position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40; min-height: 52px; }
  .import-grid { padding-bottom: 80px; }
  .edit-bar { position: fixed !important; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; margin: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(241, 238, 230, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--rule); border-bottom: 0; display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; }
  .edit-bar .stats { grid-column: 1 / -1; gap: 14px; font-size: 13px; }
  .edit-bar .stats b { font-size: 18px; }
  .edit-bar .btn { min-height: 46px; }
  .edit-grid { padding-bottom: 130px; }
  .seg-card { padding: 14px; }

  /* 首页示例：模板切换横向滑动，详情在画布下 */
  .stage-wrap .tpl-tabs { display: flex; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .stage-wrap .tpl-tabs::-webkit-scrollbar { display: none; }
  .stage-wrap .tpl-tabs button { flex: 0 0 auto; border-bottom: 0; padding: 10px 14px; }
  .stage-wrap .tpl-tabs button small { display: block; }
}

/* 只有手机 / 触屏才吸附横向标签条 */
@media (pointer: coarse) {
  .voices { scroll-snap-type: x proximity; }
  .voices li { scroll-snap-align: start; }
}


/* ---------- 手机细节修正 ---------- */
.hero-theme { align-self: flex-start; }
@media (max-width: 640px) {
  .hero-over { letter-spacing: .08em; font-size: 11px; }
  .hero-over::after { display: none; }
}
@media (max-width: 860px) {
  /* 海报预览：画面 + 一行工具条都在吸顶区域内，不再溢出压到表单 */
  .poster-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; gap: 6px; }
  .poster-preview .sheet { height: calc(100% - 38px); flex: none; }
  .sheet-bar { margin: 0; height: 32px; max-width: none; width: 100%; padding: 0 4px; }
  .sheet-bar .sheet-cap { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
  .sheet-bar .chip { min-height: 30px; padding: 2px 10px; font-size: 12px; flex: none; }
  /* 上传页：状态提示不被底部固定按钮挡住 */
  .import-grid > div:first-child { padding-bottom: 72px; }
}


/* ---------- 海报：只保存 PNG ---------- */
.export-row { align-items: center; }
.hd-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--sub); cursor: pointer; padding: 0 6px; }
.hd-toggle input { width: 16px; height: 16px; accent-color: var(--ink); }

/* ---------- 海报工作台：手机上整体收紧 ---------- */
@media (max-width: 860px) {
  .studio-panel, .studio-panel .select, .studio-panel .input, .studio-panel .chip, .studio-panel button { font-size: 14px; }
  .studio-panel .field { margin-bottom: 10px; }
  .studio-panel .field > span { font-size: 12px; margin-bottom: 4px; }
  .studio-panel .select, .studio-panel .input { min-height: 38px; padding: 6px 10px; }
  .studio-panel h3 { font-size: 13px; margin: 12px 0 6px; padding-top: 10px; }
  .ptabs button { min-height: 40px; padding: 6px 4px; font-size: 14px; }
  .pick-head { margin: 10px 0 6px; font-size: 13px; }
  .pick-list button { font-size: 14px; line-height: 1.55; padding: 8px 2px; grid-template-columns: 22px 24px 1fr; }
  .pick-list .pk { width: 18px; height: 18px; font-size: 10px; }
  .pick-list .mono { font-size: 10px; }
  .tpl-list button { min-height: 44px; font-size: 13px; padding: 6px 8px; }
  .tpl-list button small { font-size: 10px; }
  .swatch { width: 32px; height: 32px; }
  .studio-panel .muted.small, #pickHint { font-size: 12px; }
  /* 页面标题和面包屑 */
  .studio ~ *, .page .crumbs { font-size: 12px; }
  .page .page-title { font-size: 22px; margin: 6px 0 4px; }
  /* 底部保存栏：高清开关 + 一个主按钮 */
  .export-row { grid-template-columns: auto 1fr !important; }
  .export-row .btn { font-size: 15px; }
}

@media (max-width: 860px) {
  /* 控件用黑体：宋体字面大、笔画重，小屏上显得拥挤；台词仍用宋体 */
  .studio-panel, .studio-panel .select, .studio-panel .input, .studio-panel .chip, .studio-panel button,
  .ptabs button, .export-row, .export-row .btn, .sheet-bar .chip, .page .crumbs, .page .page-title { font-family: var(--sans); }
  .pick-list .tx { font-family: var(--serif); }
  .page .page-title { font-weight: 500; letter-spacing: .04em; }
}

@media (max-width: 860px) {
  .poster-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* 面包屑已写明"海报"，手机上省下这一行给预览 */
  .studio { margin-top: 10px; }
}

/* 窄屏导航：链接不换行，间距和字距收小 */
.nav-links a { white-space: nowrap; }
@media (max-width: 420px) {
  .nav { gap: 8px; padding: 0 12px; }
  .brand { letter-spacing: .2em; font-size: 12px; }
  .nav-links { gap: 12px; font-size: 13px; }
  .theme-btn { min-height: 30px; padding: 4px 7px; margin-left: 0; }
}

/* 上传页：上次的作品（保存在浏览器里） */
.resume { display: grid; grid-template-columns: 1fr auto; gap: 10px 24px; align-items: center; margin: 0 0 28px; padding: 18px 20px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; }
.resume-title { font-size: 20px; margin: 4px 0 2px; }
.resume-title .muted { font-size: 14px; margin-left: 10px; }
.resume-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.resume-note { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) {
  .resume { grid-template-columns: 1fr; padding: 14px 16px; }
  .resume-actions { justify-content: flex-start; }
}
