:root {
  --bg: #f7f8fb; --card: #fff; --ink: #12162a; --muted: #5b6480; --line: #e2e6ef;
  --accent: #2f5bd0; --accent-ink: #fff;
  --go: #127a45; --tbd: #9a6b00; --live: #b4232a; --past: #5b6480; --fail: #b4232a;
  --shadow: 0 1px 2px rgba(18, 22, 42, .06), 0 8px 24px rgba(18, 22, 42, .06);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --card: #141a2e; --ink: #e9edf8; --muted: #99a3c0; --line: #232b45;
    --accent: #7aa2ff; --accent-ink: #0b1020;
    --go: #4fd18b; --tbd: #f0c14b; --live: #ff7b83; --past: #99a3c0; --fail: #ff7b83;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: .01em }
a { color: var(--accent) }

.app { max-width: 1360px; margin: 0 auto; padding: 0 12px }

/* 头部三行：标题 / 视图+搜索 / 筛选+计数。手机上一共 ~130px，原来 260px 只露出 5 行任务 */
.masthead { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: calc(6px + env(safe-area-inset-top)) 0 6px; border-bottom: 1px solid var(--line) }
/* 往下滚就收起标题行和计数行，把高度还给列表；往上滚立即恢复。矮视口（横屏 390px 高）下头部原本占 40% */
body.scrolled .topbar, body.scrolled .count { display: none }
.topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 26px }
.masthead h1 { font-size: 17px; letter-spacing: .02em }
.stamp { font-size: 11px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }

.toolbar { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-width: 0 }
.toolbar input, .chips select {
  min-width: 0; min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--card); color: var(--ink); font: inherit; font-size: 14px; text-overflow: ellipsis
}
.toolbar input { flex: 1 1 auto }
.toolbar input:focus-visible, .chips select:focus-visible, .tabs button:focus-visible, .chip:focus-visible, .row:focus-visible, .next:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

.tabs { flex: 0 0 auto; display: flex; gap: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 3px }
.tabs button { position: relative; min-width: 68px; min-height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer }
/* 视觉尺寸不变、命中区扩到 44+：头部已经够挤，不能靠加高来满足触摸标准 */
.tabs button::after { content: ""; position: absolute; inset: -6px -2px }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink) }

.chips { display: flex; align-items: center; gap: 7px; margin-top: 7px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px }
.chips::-webkit-scrollbar { display: none }
.chip { flex: 0 0 auto; min-height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer }
.chips select { flex: 0 0 auto; max-width: 36%; height: 30px; min-height: 30px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted) }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)) }
.count { margin: 5px 2px 0; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums }

.panes { display: grid; gap: 12px; padding: 10px 0 4px; align-items: start }

/* 下一发：首页第一屏要能回答「最近能看什么」 */
.next { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; width: 100%; text-align: left; padding: 12px 13px; margin-bottom: 10px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); cursor: pointer; font: inherit; color: inherit; transition: transform .12s ease, border-color .12s ease }
.next:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)) }
.next:active { transform: scale(.995) }
.nx-main { min-width: 0; display: grid; gap: 3px }
.nx-k { display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.nx-k b { font-size: 17px; font-weight: 800; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; color: var(--ink) }
.nx-k b.soon { color: var(--live) } .nx-k b.past { color: var(--muted); font-weight: 600 }
.nx-main h2 { font-size: 16px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical }
.nx-s { margin: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.nx-side { display: grid; gap: 5px; align-content: start; justify-items: end; text-align: right }
.nx-go { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap }
.tag.hz { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)) }

/* 列表：按天分组，组内密集行 + 细线，不再一行一张卡 */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0 }
.day { list-style: none }
.daybar { position: sticky; top: var(--barh, 132px); z-index: 5; display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 7px 12px 5px; background: var(--bg); border-bottom: 1px solid var(--line) }
.daybar b { font-size: 13px; font-weight: 750; letter-spacing: .01em }
.daybar span { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums }
.rows { list-style: none; margin: 0; padding: 0; background: var(--card); border-bottom: 1px solid var(--line) }

.row { display: grid; grid-template-columns: 54px 1fr auto; gap: 11px; align-items: center; width: 100%; text-align: left; min-height: 56px; padding: 8px 12px; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); background: transparent; color: inherit; font: inherit; cursor: pointer }
.rows > li:last-child .row { border-bottom: 0 }
.row:hover { background: color-mix(in srgb, var(--accent) 7%, transparent) }
.row:active { background: color-mix(in srgb, var(--accent) 13%, transparent) }
.row[aria-current="true"] { background: color-mix(in srgb, var(--accent) 11%, transparent); box-shadow: inset 3px 0 0 var(--accent) }
.row time { display: grid; gap: 1px; font-variant-numeric: tabular-nums }
.row time b { font-size: 15px; font-weight: 700 }
.row time span { font-size: 11px; color: var(--muted) }
.row .who { display: grid; gap: 2px; min-width: 0 }
.row .who strong { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.row .who small { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; min-width: 0; overflow: hidden; white-space: nowrap }
.row .who small span { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis }
.row .who small i { font-style: normal; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; flex: none }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; background: color-mix(in srgb, var(--c) 15%, var(--card)); color: var(--c) }
.badge.go { --c: var(--go) } .badge.tbd { --c: var(--tbd) } .badge.live { --c: var(--live) } .badge.past { --c: var(--past) } .badge.fail { --c: var(--fail) }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c) }

/* 详情：手机全屏层，宽屏常驻右栏 */
.pane-detail { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow) }
.detail-placeholder { padding: 40px 16px; text-align: center; color: var(--muted) }
.detail-placeholder p { margin: 0 }
body.detail-open .pane-detail {
  position: fixed; inset: 0; z-index: 50; border-radius: 0; border: 0; overflow: auto;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-overflow-scrolling: touch; animation: sheet .18s ease-out
}
@keyframes sheet { from { transform: translateY(14px); opacity: .4 } to { transform: none; opacity: 1 } }
@media (prefers-reduced-motion: reduce) { body.detail-open .pane-detail { animation: none } }
body.detail-open { overflow: hidden }

.d-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 14px 12px; background: var(--card); border-bottom: 1px solid var(--line) }
.d-head h2 { font-size: 17px; line-height: 1.3; flex: 1 }
.d-close { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font-size: 20px; cursor: pointer }
.d-body { padding: 14px; display: grid; gap: 16px }
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 12px; font-size: 14px }
.kv dt { color: var(--muted) }
.kv dd { margin: 0; overflow-wrap: anywhere }
.sect > h3, .sect > summary { display: flex; align-items: center; gap: 7px; font-size: 15px; color: var(--accent); letter-spacing: .01em; text-transform: none; margin-bottom: 9px }
.sect > h3 .s-ico, .sect > summary .s-ico { font-size: 15px; opacity: .9 }
/* 可折叠小节：整行标题就是点击区 */
.sect.fold > summary { cursor: pointer; list-style: none; margin-bottom: 0; min-height: 32px; border-radius: 8px }
.sect.fold > summary::-webkit-details-marker { display: none }
.sect.fold > summary::after { content: "▸"; margin-left: auto; font-size: 12px; color: var(--muted); transition: transform .15s ease }
.sect.fold[open] > summary { margin-bottom: 9px }
.sect.fold[open] > summary::after { transform: rotate(90deg) }
.sect.fold > summary:hover { color: color-mix(in srgb, var(--accent) 80%, var(--ink)) }
.sect.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.grid2 { display: grid; gap: 10px }
.card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg) }
.az { display: flex; gap: 14px; align-items: center }
.az svg { flex: none }
.az .num { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums }
table.legs { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums }
table.legs th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line) }
table.legs td { padding: 6px; border-bottom: 1px solid var(--line) }
table.legs tr:last-child td { border-bottom: 0 }
.quote-label { margin: 8px 0 3px; font-size: 11px; color: var(--muted) }
.quote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--line); background: var(--bg); border-radius: 0 10px 10px 0; font: 12px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere }
.tags { display: flex; gap: 6px; flex-wrap: wrap }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted) }
.note { font-size: 12px; color: var(--muted); margin: 0 }
.empty { padding: 32px; text-align: center; color: var(--muted) }
.muted { color: var(--muted); font-size: 12px }
.foot { padding: 18px 0 28px; color: var(--muted); font-size: 13px }
.foot summary { cursor: pointer; font-weight: 650; min-height: 32px }
.foot ul { margin: 8px 0; padding-left: 18px; display: grid; gap: 6px }

/* 折叠屏外屏 / 小平板 */
@media (min-width: 640px) {
  body { font-size: 16px }
  .masthead h1 { font-size: 19px }
  .toolbar { gap: 10px }
  .toolbar input { max-width: 420px }
  .chips select { max-width: 260px; height: 34px }
  .chips { overflow: visible; flex-wrap: wrap }
  .row { grid-template-columns: 62px 1fr auto; padding: 8px 14px }
  .d-body { grid-template-columns: 1fr; padding: 18px 20px }
}
/* 内屏 / 平板：分栏，详情常驻。--barh 由 JS 按头部实测高度写入 */
@media (min-width: 900px) {
  .panes { grid-template-columns: minmax(360px, 460px) 1fr; gap: 16px }
  .pane-list, .pane-detail { position: sticky; top: var(--barh, 132px); max-height: calc(100vh - var(--barh, 132px) - 14px); overflow: auto }
  body.detail-open .pane-detail { position: sticky; inset: auto; animation: none; border: 1px solid var(--line); border-radius: var(--r); max-height: calc(100vh - var(--barh, 132px) - 14px) }
  .d-close { display: none }
  .d-head { padding: 16px 18px }
  .d-body { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start }
  .d-body .wide { grid-column: 1 / -1 }
  .next { grid-template-columns: 1fr; }
  .nx-side { grid-auto-flow: column; justify-content: start; align-items: center; justify-items: start; text-align: left; flex-wrap: wrap }
  /* 分栏时列表自己是滚动容器，吸顶条要贴容器顶而不是让出头部高度 */
  .daybar { top: 0 }
}
@media (min-width: 1200px) {
  .panes { grid-template-columns: 500px 1fr }
}

/* ---- 详情页：参照 nextspaceflight 任务页的 hero + 大时刻 + 窗口滑轨 + 卫星地图 ---- */
.d-headline { flex: 1; min-width: 0 }
.d-eyebrow { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.d-head h2 { font-size: 20px; line-height: 1.25 }

.tcard { display: grid; gap: 12px }
.t-label { margin: 0; font-size: 12px; color: var(--muted); font-weight: 600 }
.t-line { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap }
.t-big { display: flex; align-items: baseline; gap: 2px; font-variant-numeric: tabular-nums }
.t-big b { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1 }
.t-big span { font-size: 15px; color: var(--muted); font-weight: 600 }
.t-side { display: grid; gap: 1px; margin-left: auto; text-align: right }
.t-date { margin: 0; font-size: 14px; font-weight: 650 }
.t-count { margin: 2px 0 0; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted) }
.t-count.soon { color: var(--live) }
.t-count.past { color: var(--muted); font-weight: 600 }

/* 窗口标尺：只标「起飞落在窗口的哪个位置」，不做填充——填充会被读成进度，历史任务上尤其误导 */
.wslide { display: grid; gap: 5px }
.wcap { margin: 0; text-align: center; font-size: 11px; font-weight: 600; color: var(--muted) }
.wtrack { position: relative; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 12%, var(--card)) }
.wnode { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid var(--card) }
.wnode.open, .wnode.close { width: 9px; height: 9px; background: var(--muted) }
.wnode.go { width: 15px; height: 15px; background: var(--go); box-shadow: 0 0 0 3px color-mix(in srgb, var(--go) 25%, transparent) }
/* 两端标签贴各自的端点，用三等分会把两端往里拽 20%，看着像窗口变窄 */
.wlabels { position: relative; height: 32px; font-size: 11px; color: var(--muted) }
.wlabels > span { position: absolute; top: 0; display: grid; gap: 1px }
.wlabels .open { left: 0 }
.wlabels .end { right: 0; text-align: right }
.wlabels b { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums }

.mapcard { display: grid; gap: 12px; padding: 10px }
.mapbox { position: relative; height: min(320px, 46vh); border-radius: 12px; overflow: hidden; background: #101623; z-index: 0 }
.padcard { display: grid; gap: 3px; padding: 2px 4px }
.pad-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.pad-top b { font-size: 15px; font-weight: 700 }

/* Leaflet 覆盖层 */
.lw-map-mount { background: #101623 }
.lw-pad-icon { background: none; border: 0 }
.lw-pad-dot { position: relative; z-index: 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #17c964; color: #06210f; box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 2px 8px rgba(0,0,0,.5) }
.lw-pad-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(23,201,100,.75); animation: lw-pulse 2.4s ease-out infinite }
@keyframes lw-pulse { 0% { transform: scale(1); opacity: .8 } 70%,100% { transform: scale(2.1); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .lw-pad-ring { animation: none } }
.lw-arrow-icon { background: none; border: 0; color: #cfe0ff; font-size: 13px; line-height: 1; text-shadow: 0 1px 3px rgba(0,0,0,.9) }
.lw-arrow-icon span { display: block }
.lw-compass { display: flex; align-items: center; gap: 7px; padding: 5px 9px 5px 5px; border-radius: 12px; background: rgba(8,12,24,.78); border: 1px solid rgba(255,255,255,.16); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.35) }
.lw-compass p { margin: 0; display: grid; gap: 0 }
.lw-compass b { font-size: 15px; font-variant-numeric: tabular-nums }
.lw-compass span { font-size: 11px; opacity: .82; white-space: nowrap }
.lw-zoom { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: rgba(8,12,24,.78); border: 1px solid rgba(255,255,255,.16) }
.lw-zoom button { min-width: 62px; min-height: 44px; padding: 5px 9px; border: 0; border-radius: 8px; background: transparent; color: #e9edf8; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer }
.lw-zoom button.on { background: rgba(122,162,255,.28) }
.leaflet-container { font: inherit; background: #101623 }
.leaflet-control-zoom a { width: 40px; height: 40px; line-height: 40px; background: rgba(8,12,24,.82); color: #fff; border-color: rgba(255,255,255,.16) }
/* 触摸设备上地图默认不抢单指滑动，点一下才允许拖图——否则地图会吃掉整页滚动 */
.lw-drag-hint { position: absolute; left: 50%; bottom: 10px; z-index: 600; transform: translateX(-50%); padding: 7px 12px; border-radius: 999px; background: rgba(8,12,24,.82); border: 1px solid rgba(255,255,255,.18); color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none }
.mapbox.lw-armed .lw-drag-hint { display: none }
.leaflet-bar a:first-child { border-radius: 8px 8px 0 0 }
.leaflet-bar a:last-child { border-radius: 0 0 8px 8px }
.lw-map-degraded::after { content: "卫星底图瓦片加载失败，仅显示矢量要素"; position: absolute; left: 8px; bottom: 26px; z-index: 500; padding: 5px 9px; border-radius: 8px; background: rgba(180,35,42,.9); color: #fff; font-size: 11px }
.lw-map-fallback { margin: 0; padding: 18px 12px; color: var(--muted); font-size: 13px; text-align: center }

@media (min-width: 900px) {
  .d-body > .tcard { grid-column: 1 / -1 }
  .mapbox { height: 400px }
  .t-big b { font-size: 46px }
}
