:root {
  --bg: #0c1018;
  --panel: #171d28;
  --panel2: #1e2634;
  --line: #2d3648;
  --gold: #d8b978;
  --gold2: #f2dca6;
  --text: #dfe4ec;
  --dim: #8b96a8;
  --good: #6fc98a;
  --bad: #d76b5a;
  --shadow: 0 6px 22px rgba(0,0,0,.55);
}
* { box-sizing: border-box; }
/* 关键修复：作者样式里的 display（.screen/#game/.modal 等）会压过浏览器对 [hidden] 的
   默认 display:none，若不显式声明，开始界面会一直盖在地图上导致“点开始没反应”。 */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif; overflow: hidden; }
button { font-family: inherit; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 3px; cursor: pointer; padding: 3px 8px; }
button:hover { border-color: var(--gold); color: var(--gold2); }
button:disabled { opacity: .45; cursor: default; }
input[type=search], input[type=text] { background: #10151e; border: 1px solid var(--line);
  color: var(--text); padding: 6px 8px; border-radius: 3px; width: 100%; font-family: inherit; }
.dim { color: var(--dim); }
.good { color: var(--good); } .bad { color: var(--bad); }

/* ---------- 开始界面 ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1b2436 0%, #090c12 70%); z-index: 50; overflow: auto; }
.start-inner { width: min(1100px, 94vw); padding: 28px 0 40px; }
.start-inner h1 { font-size: 46px; letter-spacing: 10px; margin: 0; text-align: center; color: var(--gold2);
  text-shadow: 0 2px 18px rgba(216,185,120,.25); }
.sub { text-align: center; color: var(--dim); margin: 6px 0 22px; letter-spacing: 2px; }
#loading { text-align: center; color: var(--gold); padding: 30px; }
.bm-label { color: var(--gold); font-size: 13px; letter-spacing: 2px; margin: 0 0 8px; }
.bookmarks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.bm { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 6px;
  text-align: center; cursor: pointer; }
.bm:hover { border-color: var(--gold); }
.bm.on { border-color: var(--gold2); background: #26304a; box-shadow: inset 0 0 0 1px rgba(242,220,166,.25); }
.bm .y { font-size: 18px; color: var(--gold2); }
.bm .n { font-size: 11px; color: var(--dim); }
.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.pol-list { height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 4px;
  margin-top: 8px; background: #10151e; }
.pol-row { padding: 5px 9px; cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 13px;
  border-bottom: 1px solid #171c26; }
.pol-row:hover { background: #1d2534; }
.pol-row.on { background: #2a3350; }
.sw { width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,.5); flex: none; }
.pol-info { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px;
  min-height: 240px; font-size: 14px; line-height: 1.7; }
button.big { width: 100%; margin-top: 12px; padding: 12px; font-size: 17px; letter-spacing: 4px;
  background: #26304a; border-color: var(--gold); color: var(--gold2); }
.tip { color: var(--dim); font-size: 12px; margin-top: 10px; line-height: 1.6; }

/* ---------- 主界面 ---------- */
#game { position: fixed; inset: 0; display: flex; flex-direction: column; }
#topbar { height: 54px; flex: none; display: flex; align-items: center; gap: 18px; padding: 0 12px;
  background: linear-gradient(#1c2433, #141a24); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.realm { display: flex; align-items: center; gap: 9px; min-width: 220px; }
.flag { width: 26px; height: 26px; border-radius: 3px; border: 1px solid rgba(0,0,0,.6); background: #555; }
.realm-name { font-size: 16px; color: var(--gold2); line-height: 1.2; }
.realm-ruler { font-size: 12px; }
.res { display: flex; gap: 14px; flex: 1; }
.res-item { display: flex; align-items: baseline; gap: 4px; font-size: 14px; }
.res-item .ico { color: var(--gold); font-size: 13px; }
.res-item .delta { font-size: 11px; color: var(--dim); }
.res-item.tech { color: #9fd8ff; }
.clock { display: flex; align-items: center; gap: 8px; }
.speeds { display: flex; gap: 2px; }
.speeds button { padding: 2px 6px; font-size: 12px; }
.speeds button.on { border-color: var(--gold2); color: var(--gold2); }
.date { min-width: 130px; text-align: right; color: var(--gold2); font-size: 15px; }
#btnPause { width: 32px; }

#modebar { flex: none; display: flex; gap: 4px; padding: 5px 10px; background: #121722;
  border-bottom: 1px solid var(--line); overflow-x: auto; }
#modebar button { font-size: 12px; padding: 3px 9px; }
#modebar button.on { border-color: var(--gold2); color: var(--gold2); background: #26304a; }

#stage { position: relative; flex: 1; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#map:active { cursor: grabbing; }

.panel { position: absolute; top: 10px; width: 320px; max-height: calc(100% - 130px);
  background: rgba(23,29,40,.96); border: 1px solid var(--line); border-radius: 5px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; }
#left { left: 10px; }
#right { right: 10px; width: 350px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px;
  border-bottom: 1px solid var(--line); color: var(--gold2); font-size: 15px; }
.panel-head .x { border: none; background: none; font-size: 18px; line-height: 1; }
.panel-body { padding: 10px; overflow: auto; font-size: 13px; line-height: 1.75; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); }
.tabs button { font-size: 12px; padding: 4px 8px; border-bottom: none; border-radius: 3px 3px 0 0; }
.tabs button.on { border-color: var(--gold2); color: var(--gold2); background: #26304a; }

.kv { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dotted #29313f; padding: 2px 0; }
.kv span:first-child { color: var(--dim); }
h4 { margin: 12px 0 5px; color: var(--gold); font-size: 13px; letter-spacing: 1px;
  border-bottom: 1px solid var(--line); padding-bottom: 3px; }
h4:first-child { margin-top: 0; }
.chip { display: inline-block; background: #232c3c; border: 1px solid var(--line); border-radius: 10px;
  padding: 1px 8px; margin: 2px 3px 2px 0; font-size: 12px; }
.chip.pos { border-color: #3f6f4f; color: #a8e0b8; }
.chip.neg { border-color: #6f3f3f; color: #e8a8a0; }
.bar { height: 6px; background: #10151e; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #6d8fbf, #d8b978); }
table.mini { width: 100%; border-collapse: collapse; font-size: 12px; }
table.mini td, table.mini th { padding: 2px 4px; border-bottom: 1px solid #242c3a; text-align: left; }
table.mini th { color: var(--dim); font-weight: normal; }
.row-btn { display: block; width: 100%; text-align: left; margin: 2px 0; font-size: 12px; }

#logbox { position: absolute; left: 10px; bottom: 10px; width: 480px; max-height: 190px;
  background: rgba(18,23,32,.94); border: 1px solid var(--line); border-radius: 5px; display: flex; flex-direction: column; }
.log-head { display: flex; justify-content: space-between; padding: 4px 8px; color: var(--gold);
  font-size: 12px; border-bottom: 1px solid var(--line); }
.log-head button { padding: 0 6px; font-size: 12px; }
#logBody { overflow: auto; padding: 6px 8px; font-size: 12px; line-height: 1.65; }
#logBody .l { border-bottom: 1px solid #1b212c; padding: 1px 0; }
#logBody .y { color: var(--dim); margin-right: 6px; }
#logBody .war { color: #e8a08c; } #logBody .peace { color: #9fd8b0; }
#logBody .succession { color: #d8c58a; } #logBody .revolt { color: #e0a0d0; }
#logBody .era { color: var(--gold2); } #logBody .player { color: #9fd8ff; }
#logBody .tech { color: #9fd8ff; } #logBody .death { color: #b0b8c8; }

.tooltip { position: fixed; pointer-events: none; background: rgba(12,16,24,.96); border: 1px solid var(--line);
  border-radius: 4px; padding: 6px 9px; font-size: 12px; line-height: 1.6; z-index: 40; max-width: 260px; }

.modal { position: fixed; inset: 0; background: rgba(6,8,12,.72); display: flex; align-items: center;
  justify-content: center; z-index: 60; }
.modal-inner { width: min(560px, 92vw); background: linear-gradient(#1d2534, #151b26);
  border: 1px solid var(--gold); border-radius: 6px; padding: 20px 22px; box-shadow: var(--shadow); }
.modal-inner h2 { margin: 0 0 10px; color: var(--gold2); font-size: 20px; letter-spacing: 2px; }
.modal-inner p { line-height: 1.9; font-size: 14px; }
#mOpts button { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 9px 12px; font-size: 14px; }
#mOpts .opt-tip { color: var(--dim); font-size: 12px; margin-left: 8px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #10151e; }
::-webkit-scrollbar-thumb { background: #2c3648; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3c4a62; }
