/* ============================================================
 * 《海岸科考求生》样式 —— 科考手记 · 纸墨风
 * 纸 #f1e8d3 / 墨 #2b2620 / 朱砂 #b03a2e / 黛青 #3d5a62
 * ============================================================ */
:root {
  --paper: #f1e8d3;
  --paper2: #f6f0e1;
  --paper3: #e9dec2;
  --ink: #2b2620;
  --ink2: #6b6154;
  --ink3: #a3977f;
  --hairline: #d3c5a5;
  --rule: #b7a98a;
  --cinnabar: #b03a2e;
  --teal: #3d5a62;
  --ochre: #8a6f42;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Noto Serif SC", "Source Han Serif SC", "SimSun", "STSong", serif;
  font-size: 15px;
  line-height: 1.8;
}
#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- 顶栏：报头 ---------- */
header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 22px 8px;
  border-bottom: 3px double var(--rule);
  background: var(--paper);
}
.brand { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.brand .mast { font-size: 12px; letter-spacing: .28em; color: var(--ink2); }
.brand h1 {
  font-size: 21px; margin: 0; font-weight: normal; color: var(--ink);
  letter-spacing: .3em;
}
.btns { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.btns i { color: var(--ink3); font-style: normal; }
button {
  background: none; border: none; color: var(--ink);
  font-family: inherit; font-size: 14px; padding: 0 4px; cursor: pointer;
  border-bottom: 1px solid transparent;
}
button:hover { color: var(--cinnabar); border-bottom-color: var(--cinnabar); }
button:disabled { color: var(--ink3); cursor: default; border-bottom-color: transparent; }

/* ---------- 主布局 ---------- */
main {
  flex: 1; display: grid; gap: 16px; padding: 16px 22px;
  grid-template-columns: minmax(320px, 470px) minmax(0, 1fr);
  min-height: 0;
}
aside, section {
  background: var(--paper2);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  min-height: 0; overflow: auto;
}
aside { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
section { padding: 20px 26px; display: flex; flex-direction: column; }

/* ---------- 图幅 ---------- */
#mapWrap {
  border: 1px solid var(--rule);
  border-radius: 2px; overflow: hidden; flex-shrink: 0;
  background: var(--paper);
}
#map { display: block; width: 100%; height: auto; }
.ink-label {
  font-family: Georgia, "Noto Serif SC", "SimSun", serif;
  font-size: 12px; fill: var(--ink); letter-spacing: .12em;
}
#water, #waterWaves, #floodMud, #floodMang { transition: y .9s ease, height .9s ease, opacity .9s ease; }
#waterTop { transition: y1 .9s ease, y2 .9s ease; }
.station polygon { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.station text { font-size: 12px; fill: var(--ink); font-family: inherit; letter-spacing: 0; }
.station.on polygon { fill: var(--cinnabar); stroke: var(--cinnabar); }
.station.on text { fill: var(--cinnabar); }
#rain line { animation: rainfall .55s linear infinite; }
@keyframes rainfall { from { transform: translateY(-14px); } to { transform: translateY(14px); } }

/* ---------- 观测记录（状态行 + 三栏刻度条） ---------- */
#statusLine { font-size: 14px; line-height: 1.9; }
#statusLine .big { font-size: 15.5px; letter-spacing: .06em; }
#statusLine .big b { color: var(--cinnabar); font-weight: normal; }
#statusLine .sub { color: var(--ink2); font-size: 13px; }
#statusLine .sep { color: var(--ink3); padding: 0 6px; }

.bar { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.bar .bl { width: 34px; font-size: 13px; color: var(--ink2); letter-spacing: .2em; }
.bar .track {
  flex: 1; height: 8px; border: 1px solid var(--hairline); background: var(--paper);
  position: relative;
}
.bar .track::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), var(--hairline) calc(25% - 1px), var(--hairline) 25%);
  pointer-events: none;
}
.bar .fill { height: 100%; transition: width .4s ease; }
.fill.hp { background: var(--cinnabar); }
.fill.sta { background: var(--ochre); }
.fill.water { background: var(--teal); }
.bar .bv { width: 46px; text-align: right; font-size: 12.5px; color: var(--ink2); font-variant-numeric: tabular-nums; }

/* ---------- 手记（背包/线索） ---------- */
#journal { border-top: 1px solid var(--hairline); padding-top: 6px; }
#journal summary {
  cursor: pointer; font-size: 13.5px; letter-spacing: .22em; color: var(--ink2);
}
#journal summary:hover { color: var(--cinnabar); }
.jrow { margin: 7px 0; font-size: 13.5px; line-height: 1.9; }
.jrow b { color: var(--ink2); font-weight: normal; letter-spacing: .1em; }
.dim { color: var(--ink3); }
.clues { margin: 2px 0 0; padding-left: 4px; list-style: none; }
.clues li { font-size: 13px; margin: 4px 0; padding-left: 16px; position: relative; color: #46403a; }
.clues li::before { content: "※"; position: absolute; left: 0; color: var(--cinnabar); font-size: 11px; top: 1px; }

/* ---------- 正文 ---------- */
#sceneKicker {
  font-size: 12px; letter-spacing: .32em; color: var(--ink2);
  flex-shrink: 0; min-height: 18px;
}
#sceneHead {
  font-size: 22px; letter-spacing: .12em; color: var(--ink);
  margin: 2px 0 10px; padding-bottom: 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
#sceneHead::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 34px; height: 3px; background: var(--cinnabar);
}
#logBox { flex: 1; overflow-y: auto; padding-right: 10px; min-height: 120px; }
.entry { margin: 9px 0; line-height: 2.0; white-space: pre-wrap; font-size: 15px; }
.entry.scene { color: #332d26; }
.entry.end { color: var(--ink); border: 1px solid var(--rule); padding: 12px 16px; background: var(--paper); }
.entry.good { color: var(--teal); font-size: 13.5px; }
.entry.bad { color: var(--cinnabar); font-size: 13.5px; }
.entry.warn { color: var(--cinnabar); font-size: 13.5px; letter-spacing: .05em; }
.entry.clue { color: var(--teal); font-size: 13.5px; }
.entry.item { color: var(--ochre); font-size: 13.5px; }

/* ---------- 选项：目录式 ---------- */
#opts {
  flex-shrink: 0; margin-top: 12px;
  border-top: 1px solid var(--hairline);
}
button.opt {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  text-align: left; padding: 10px 8px; font-size: 15px; font-family: inherit;
  border: none; border-bottom: 1px dashed var(--hairline);
  background: none; color: var(--ink); cursor: pointer;
}
button.opt:hover:not(:disabled) { background: var(--paper3); }
button.opt:hover:not(:disabled) .arrow { opacity: 1; transform: translateX(0); }
button.opt .num { color: var(--cinnabar); font-size: 14px; letter-spacing: 0; min-width: 30px; flex-shrink: 0; }
button.opt .arrow {
  margin-left: auto; color: var(--cinnabar); opacity: 0; transform: translateX(-6px);
  transition: all .18s ease; font-style: normal;
}
button.opt.disabled { cursor: default; color: var(--ink3); flex-direction: column; gap: 2px; }
button.opt.disabled .reason { font-size: 12.5px; color: var(--ink3); padding-left: 40px; }
button.opt.disabled .reason::before { content: "△ "; }
button.opt.sq {
  display: inline-flex; width: auto; gap: 6px;
  border: 1px solid var(--ink); padding: 6px 16px; margin: 6px 8px 0 0; font-size: 14px;
  background: var(--paper);
}
button.opt.sq:hover { background: var(--ink); color: var(--paper); }
button.opt.sq:hover .num { color: var(--paper); }

/* ---------- 结局：卷宗 ---------- */
.endingCard {
  border: 3px double var(--ink); padding: 22px 26px; background: var(--paper);
  margin-top: 4px;
}
.endingCard .seal {
  display: inline-block; border: 2px solid var(--cinnabar); color: var(--cinnabar);
  font-size: 28px; letter-spacing: .2em; padding: 2px 12px 2px 16px;
  transform: rotate(-3deg); margin-bottom: 10px;
}
.endingCard.lose .seal { border-color: var(--ink2); color: var(--ink2); }
.endingCard .etitle { font-size: 18px; letter-spacing: .1em; margin: 6px 0 14px; }
.endingCard .etext { line-height: 2.05; white-space: pre-wrap; font-size: 14.5px; }
.endingCard .hint { margin-top: 14px; color: var(--ink2); font-size: 12.5px; text-align: center; }
.endingCard .againWrap { text-align: center; margin-top: 14px; }

/* ---------- 模态：公文页 ---------- */
#modal {
  position: fixed; inset: 0; background: rgba(43, 38, 32, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#modal.hidden { display: none; }
#modalCard {
  background: var(--paper2); border: 3px double var(--ink); border-radius: 2px;
  padding: 20px 26px; max-width: 560px; width: 100%; max-height: 84vh; overflow: auto;
}
#modalCard h3 {
  margin: 4px 0 14px; font-weight: normal; font-size: 17px; letter-spacing: .18em;
  border-bottom: 1px solid var(--hairline); padding-bottom: 8px;
}
.slotRow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px dashed var(--hairline); padding: 9px 2px; margin: 0;
}
.slotInfo { font-size: 13.5px; }
.helpText p { line-height: 2.0; font-size: 13.5px; margin: 8px 0; }
.endRow { padding: 5px 4px; border-bottom: 1px dashed var(--hairline); font-size: 13.5px; }
.endRow.locked { color: var(--ink3); }
.erank { display: inline-block; min-width: 30px; color: var(--cinnabar); }
.endGallery { margin-bottom: 12px; }

footer {
  text-align: center; color: var(--ink2); font-size: 12.5px; padding: 9px;
  border-top: 1px solid var(--hairline); background: var(--paper);
  letter-spacing: .05em;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--hairline); }
::-webkit-scrollbar-thumb:hover { background: var(--rule); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); }
  aside { max-height: 46vh; }
  #app { height: auto; min-height: 100vh; }
}
