/*
 * css/app.css — 全站样式（和纸 / 墨 / 朱印）
 *
 * 核心逻辑：底色是纸，字是墨，唯一的高饱和色是朱。势力颜色由数据带过来（内联 style），
 *           这里只定义纸面、字阶、发丝线与留白。
 * 关键决策：
 *   1. 分区靠留白和 1px 发丝线，不靠深色方块堆叠 —— 深色面板是「后台管理系统」的
 *      观感，这个项目要的是「一册正在被写的编年史」。
 *   2. 明朝体（Noto Serif SC）承担标题与叙事，黑体（Noto Sans SC）只放数字和小标签。
 *      小标签一律宽字距，西文小写转大写，这是整套版式的呼吸感来源。
 *   3. 纹理、印章、刻度全部是 CSS 渐变与边框画的。真正的图片素材（纹章、君主像、
 *      城池远景）走 /img/ 渐进补齐，没到位时一律有排版兜底 —— 缺图要看起来是有意的。
 *   4. 改这个文件后必须 bump inc/header.php 里的 ASSET_VER。
 * 依赖：无。
 *   5. S2 起页面上有了第一个按钮（派出车队）。按钮也不许破坏纸面：不是实心方块，
 *      是一枚朱色边框的小印，按下去才填实。整站唯一的高饱和色仍然只有朱。
 * 本次改动：S2 加「补给线」一节的样式。
 */

:root {
  --paper:       #f3efe7;
  --paper-card:  #fbf9f4;
  --paper-deep:  #e7e0d3;
  --ink:         #22201c;
  --ink-2:       #4e4840;
  --ink-3:       #8b8378;
  --ink-4:       #b6ada0;
  --rule:        #ded7c9;
  --rule-soft:   #eae4d8;
  --vermillion:  #b34733;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --sans:  "Noto Sans SC", "PingFang SC", "Hiragino Sans", -apple-system, "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.85;
  background-color: var(--paper);
  /* 纸纤维：两层极淡的渐变，凑近才看得见。
     ── 有真的和纸纹理素材时，只改这一处：
        background-image:
          url("/img/washi.webp"),
          radial-gradient(120% 80% at 15% 0%, rgba(255,255,255,.55), transparent 60%);
        background-size: 480px 480px, auto;
        background-repeat: repeat, no-repeat;
     素材要求：无缝平铺、灰度或极淡暖灰、单张 100KB 以内。 */
  background-image:
    repeating-linear-gradient(0deg, rgba(34, 32, 28, .012) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(34, 32, 28, .010) 0 1px, transparent 1px 4px),
    radial-gradient(120% 80% at 15% 0%, rgba(255, 255, 255, .55), transparent 60%);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ 顶栏 */

.topbar { max-width: 1120px; margin: 0 auto; padding: 40px 32px 0; }
.topbar-in { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }

.brand {
  margin: 0;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: .26em;
  text-indent: .26em;
  line-height: 1.3;
}
.brand-sub {
  margin: 6px 0 0;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .28em;
  color: var(--ink-3);
}
.brand-en { color: var(--ink-4); margin-left: 6px; }

.nav { display: flex; gap: 18px; margin-top: 12px; }
.nav a {
  font-family: var(--sans); font-size: 12px; font-weight: 300; letter-spacing: .2em;
  color: var(--ink-3); text-decoration: none; padding-bottom: 3px;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--vermillion); border-bottom-color: var(--vermillion); }

/* 朱印：世界时间落在这里，像一枚盖上去的章 */
.seal {
  flex: 0 0 auto;
  width: 78px; height: 78px;
  background: var(--vermillion);
  color: #fbf6ee;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(251, 246, 238, .38);
  font-family: var(--serif);
  line-height: 1.1;
  user-select: none;
}
.seal-day { font-size: 25px; font-weight: 500; letter-spacing: .02em; }
.seal-day::before { content: "第"; font-size: 11px; margin-right: 2px; vertical-align: .22em; opacity: .85; }
.seal-day::after  { content: "日"; font-size: 12px; margin-left: 2px; vertical-align: .1em; opacity: .85; }
.seal-hour { font-family: var(--sans); font-size: 10px; letter-spacing: .14em; margin-top: 4px; opacity: .9; }

.worldnote {
  max-width: 1120px;
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .16em;
  color: var(--ink-3);
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px 90px; }

/* ------------------------------------------------------------------ 章节 */

.sec { margin-top: 56px; }
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.sec-no {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border: 1px solid var(--vermillion);
  color: var(--vermillion);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.sec-title { margin: 0; font-size: 19px; font-weight: 500; letter-spacing: .22em; text-indent: .22em; }
.sec-en {
  font-family: var(--sans); font-size: 10px; font-weight: 300;
  letter-spacing: .3em; color: var(--ink-4); text-transform: uppercase;
}
.sec-rule { flex: 1; height: 1px; background: var(--rule); }

.hint {
  font-family: var(--sans); font-size: 12px; font-weight: 300;
  line-height: 1.9; color: var(--ink-3); margin: 14px 0 0;
}
.hint-flush { margin: 0; }
.skeleton { font-family: var(--sans); font-size: 12px; color: var(--ink-4); letter-spacing: .16em; }

.alert {
  margin-top: 32px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--vermillion);
  background: var(--paper-card);
  padding: 16px 20px;
  font-size: 14px;
  color: var(--ink-2);
}

/* -------------------------------------------------------------- 战况卡 */

.verdict { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.vcard {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  padding: 22px 24px 20px;
}
.vpair { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.vpair .chip { width: 9px; height: 9px; flex: 0 0 auto; }
.vpair .nm { font-size: 13px; letter-spacing: .12em; color: var(--ink-2); }
.vpair .bar { flex: 1; height: 1px; background: var(--rule); }

.vmain { font-size: 15px; letter-spacing: .04em; line-height: 1.5; }
.vmain .num { font-size: 30px; font-weight: 500; letter-spacing: 0; margin: 0 4px; }
.vmain .who { font-weight: 500; }

.vmeta {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule-soft);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-family: var(--sans); font-size: 11px; font-weight: 300; letter-spacing: .1em;
  color: var(--ink-3);
}
.vmeta .front-nodes { font-family: var(--serif); font-size: 12px; letter-spacing: .06em; color: var(--ink-2); }
.vdelta.up   { color: var(--vermillion); }
.vdelta.down { color: var(--ink-2); }
.vdelta.flat { color: var(--ink-4); }

/* ---------------------------------------------------------- 地图与势力 */

.board { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(230px, .55fr); gap: 34px; align-items: start; }
/* 栅格子项默认 min-width:auto，会被 SVG 的固有宽度顶出横向滚动条 —— 必须归零 */
.board > *, .chron-layout > * { min-width: 0; }
.mapwrap { position: relative; }
#map, #chart { width: 100%; max-width: 100%; height: auto; display: block; }
.legend-note {
  margin: 0; text-align: center;
  font-family: var(--sans); font-size: 11px; font-weight: 300;
  letter-spacing: .12em; color: var(--ink-4);
}

.chartwrap { border: 1px solid var(--rule); background: var(--paper-card); padding: 18px 20px 10px; }

/* 全图页：地图占满宽度。世界地图到位后这里就是主视觉 */
.mapfull { position: relative; border: 1px solid var(--rule); background: var(--paper-card); padding: 10px; }
.mapfull #map { width: 100%; max-width: 100%; height: auto; display: block; }
.nations-row { flex-direction: row; flex-wrap: wrap; }
.nations-row .ncard { flex: 1 1 230px; min-width: 0; }

.tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--paper-card);
  border: 1px solid var(--ink-4);
  padding: 10px 13px; min-width: 158px;
  box-shadow: 0 6px 22px rgba(34, 32, 28, .13);
}
.tip .t-name { font-size: 15px; letter-spacing: .08em; }
.tip .t-owner {
  font-family: var(--sans); font-size: 10px; font-weight: 300; letter-spacing: .16em;
  color: var(--ink-3); margin-bottom: 8px;
}
.tip .row {
  display: flex; justify-content: space-between; gap: 18px;
  font-family: var(--sans); font-size: 11px; font-weight: 300; color: var(--ink-3);
  line-height: 1.9;
}
.tip .row b { font-weight: 400; color: var(--ink); font-variant-numeric: tabular-nums; }
.tip .t-warn { color: var(--vermillion); }

.nations { display: flex; flex-direction: column; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.ncard { background: var(--paper-card); padding: 16px 18px; }
.nhead { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.nmeta { flex: 1; min-width: 0; }
.nline { display: flex; align-items: center; gap: 8px; }
.nline .chip { width: 9px; height: 9px; flex: 0 0 auto; }
.nname { font-size: 15px; letter-spacing: .1em; }
.nrank { margin-left: auto; font-family: var(--sans); font-size: 10px; letter-spacing: .14em; color: var(--ink-4); }
.nruler {
  font-family: var(--sans); font-size: 10.5px; font-weight: 300; letter-spacing: .1em;
  color: var(--ink-3); margin: 4px 0 0;
}
.ncapital {
  font-family: var(--sans); font-size: 10px; font-weight: 300; letter-spacing: .12em;
  color: var(--ink-4); margin-top: 2px;
}
.ncapital.is-occupied { color: var(--vermillion); font-weight: 400; }

/* 君主像。立绘没到位时落一枚名字印 —— 缺图要看起来是有意的，不是坏了 */
.portrait {
  width: 56px; height: 70px; flex: 0 0 auto;
  border: 1px solid var(--rule); background: var(--paper-deep);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--paper-card);
}
.portrait .face { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait .mono { font-size: 27px; line-height: 1; opacity: .45; }
.crest { width: 15px; height: 15px; flex: 0 0 auto; object-fit: contain; display: block; }
.vpair .crest { width: 14px; height: 14px; }

/* 王都 / 城镇远景，压在浮窗顶上 */
.tip-city {
  display: block; width: calc(100% + 26px); height: 84px; object-fit: cover;
  margin: -10px -13px 10px; border-bottom: 1px solid var(--rule);
}
.nrow { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.nrow .lab {
  width: 26px; flex: 0 0 auto;
  font-family: var(--sans); font-size: 10px; font-weight: 300; letter-spacing: .1em; color: var(--ink-3);
}
.nrow .track { flex: 1; height: 3px; background: var(--paper-deep); box-shadow: inset 0 0 0 1px rgba(34,32,28,.045); }
.nrow .track > i { display: block; height: 100%; }
.nrow .val {
  width: 36px; flex: 0 0 auto; text-align: right;
  font-family: var(--sans); font-size: 11px; font-weight: 300; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- 补给线 */

.relief { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, .34fr); gap: 34px; align-items: start; }
.relief > * { min-width: 0; }

.rlist { display: flex; flex-direction: column; gap: 1px; background: var(--rule-soft); }
.rrow {
  background: var(--paper-card);
  padding: 16px 18px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 18px;
  align-items: center;
}
.rrow.off { background: transparent; }

.rhead { display: flex; align-items: center; gap: 9px; grid-column: 1; }
.rhead .chip { width: 7px; height: 7px; flex: 0 0 auto; }
.rname { font-size: 16px; letter-spacing: .1em; }
.rowner {
  font-family: var(--sans); font-size: 10px; font-weight: 300;
  letter-spacing: .16em; color: var(--ink-4);
}

.rnums { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.rnum { font-family: var(--sans); font-size: 11px; font-weight: 300; white-space: nowrap; }
.rnum i { font-style: normal; color: var(--ink-4); letter-spacing: .14em; margin-right: 6px; }
.rnum b {
  font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; letter-spacing: .02em;
}

.ract { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
.rgain {
  display: block; margin-bottom: 8px;
  font-family: var(--sans); font-size: 10px; font-weight: 300;
  letter-spacing: .12em; color: var(--ink-3); white-space: nowrap;
}
.rno {
  font-family: var(--sans); font-size: 11px; font-weight: 300;
  letter-spacing: .1em; color: var(--ink-4); line-height: 1.7;
}

/* 按钮是一枚朱印，不是实心方块——纸面上只容得下这一种高饱和 */
.rbtn {
  font-family: var(--serif); font-size: 13px; letter-spacing: .18em; text-indent: .18em;
  color: var(--vermillion); background: transparent;
  border: 1px solid var(--vermillion); border-radius: 0;
  padding: 7px 16px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, color .12s;
}
.rbtn:hover { background: var(--vermillion); color: #fbf6ee; }
.rbtn:focus-visible { outline: 1px solid var(--vermillion); outline-offset: 3px; }
.rbtn[disabled] { color: var(--ink-4); border-color: var(--rule); cursor: default; background: transparent; }

.rside { display: flex; flex-direction: column; gap: 26px; }
.rblock { border-top: 1px solid var(--rule); padding-top: 12px; }
.rlabel {
  font-family: var(--sans); font-size: 10px; font-weight: 300;
  letter-spacing: .24em; color: var(--ink-4); text-transform: uppercase; margin-bottom: 10px;
}
.rconvoy {
  display: flex; justify-content: space-between; gap: 12px;
  font-family: var(--sans); font-size: 11.5px; font-weight: 300; color: var(--ink-2);
  padding: 4px 0; line-height: 1.8;
}
.rconvoy .to { font-family: var(--serif); font-size: 13.5px; letter-spacing: .08em; }
.rconvoy .eta { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rcap {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule-soft);
  font-family: var(--sans); font-size: 10.5px; font-weight: 300; letter-spacing: .12em; color: var(--ink-4);
}

.rmsg {
  margin: 16px 0 0; padding: 10px 14px;
  border-left: 2px solid var(--ink-4); background: var(--paper-card);
  font-family: var(--sans); font-size: 12px; font-weight: 300; letter-spacing: .06em;
  line-height: 1.9; color: var(--ink-2);
}
.rmsg.bad { border-left-color: var(--vermillion); }

.t-convoy b { color: var(--vermillion); }

/* -------------------------------------------------------------- 编年史 */

.chron-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }

.toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  font-family: var(--sans); font-size: 11px; font-weight: 300; letter-spacing: .16em; color: var(--ink-3);
  white-space: nowrap;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-box { width: 13px; height: 13px; border: 1px solid var(--ink-4); position: relative; }
.toggle input:checked + .toggle-box { background: var(--vermillion); border-color: var(--vermillion); }
.toggle input:checked + .toggle-box::after {
  content: ""; position: absolute; left: 3.5px; top: .5px; width: 4px; height: 8px;
  border: solid #fbf6ee; border-width: 0 1.5px 1.5px 0; transform: rotate(42deg);
}
.toggle input:focus-visible + .toggle-box { outline: 1px solid var(--vermillion); outline-offset: 2px; }

.chron-layout { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 22px; }
.chron-rail {
  writing-mode: vertical-rl;
  font-size: 15px; letter-spacing: .32em; color: var(--ink-4);
  border-right: 1px solid var(--rule);
  padding: 2px 8px 0 0;
  justify-self: end;
  height: 100%;
}

.chronicle { display: flex; flex-direction: column; gap: 26px; }
.dayhead { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.dayhead .d { font-size: 13px; letter-spacing: .18em; color: var(--ink-3); white-space: nowrap; }
.dayhead .r { flex: 1; height: 1px; background: var(--rule-soft); }

.entry { display: flex; gap: 11px; padding: 5px 0; align-items: flex-start; }
.entry .chip { width: 6px; height: 6px; flex: 0 0 auto; margin-top: 13px; }
.entry .txt { flex: 1; font-size: 15.5px; line-height: 1.95; color: var(--ink-2); }
.entry.sev3 .txt { color: var(--ink); }
.entry.sev1 .txt { color: var(--ink-3); }
.tag {
  display: inline-block; vertical-align: 2px; margin-right: 8px;
  border: 1px solid var(--vermillion); color: var(--vermillion);
  font-family: var(--sans); font-size: 9px; font-weight: 300; letter-spacing: .12em;
  padding: 0 4px; line-height: 1.7;
}
.empty { font-family: var(--sans); font-size: 12px; color: var(--ink-4); letter-spacing: .14em; }

/* -------------------------------------------------------------- 页脚 */

.foot {
  max-width: 1120px; margin: 0 auto; padding: 26px 32px 54px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: 11px; font-weight: 300; letter-spacing: .14em;
  color: var(--ink-4);
}

@media (max-width: 940px) {
  .board { grid-template-columns: 1fr; gap: 26px; }
  .verdict { grid-template-columns: 1fr; }
  .relief { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 620px) {
  .topbar { padding: 28px 20px 0; }
  .wrap { padding: 0 20px 64px; }
  .foot { padding: 22px 20px 44px; }
  .brand { font-size: 23px; }
  .seal { width: 64px; height: 64px; }
  .seal-day { font-size: 21px; }
  .chron-layout { grid-template-columns: 1fr; gap: 0; }
  .chron-rail { display: none; }
  .chron-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  /* 窄屏上按钮换行落到下面，别把地名挤没了 */
  .rrow { grid-template-columns: 1fr; }
  .ract { grid-column: 1; grid-row: auto; text-align: left; margin-top: 10px; }
  .rgain { margin-bottom: 6px; }
}
