:root {
  --bg: #0b1114;
  --bg2: #111a1e;
  --panel: rgba(18, 27, 31, 0.86);
  --panel-solid: #141e22;
  --line: rgba(176, 141, 87, 0.22);
  --line2: rgba(176, 141, 87, 0.45);
  --gold: #c9a368;
  --gold2: #e4c58f;
  --brass: #b08d57;
  --text: #ece3cf;
  --muted: #9aa5a3;
  --dim: #6c7775;
  --teal: #3f8f8c;
  --teal2: #63b3ad;
  --red: #c4483c;
  --red2: #e06a5c;
  --green: #6fae6a;
  --amber: #d99a3a;
  --paper: #efe6d2;
  --ink: #2a2118;
  --r: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --serif: "Playfair Display", "PT Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; }

.btn {
  border: 1px solid var(--line2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
  font-weight: 600;
  white-space: nowrap;
}
.btn:hover { background: rgba(201, 163, 104, 0.12); border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-gold {
  background: linear-gradient(180deg, #d8b679, #a9844c);
  color: #1d150b;
  border-color: #e6c991;
  box-shadow: 0 2px 10px rgba(201, 163, 104, 0.25), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-gold:hover { background: linear-gradient(180deg, #e7c88e, #b88f55); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(196, 72, 60, .6); color: #f2b3aa; }
.btn-danger:hover { background: rgba(196, 72, 60, .15); border-color: var(--red); }
.btn-icon { padding: 8px 11px; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  backdrop-filter: blur(6px);
}
.sec-title {
  font-size: 13px;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--gold);
  margin: 22px 0 10px;
  font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.sec-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line2), transparent); }
.card > .sec-title:first-child { margin-top: 0; }

/* ═══════════ СТАРТ ═══════════ */
#start { min-height: 100vh; position: relative; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.start-bg { position: fixed; inset: 0; background-size: cover; background-position: center; filter: saturate(.9); }
.start-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 30% 40%, rgba(11,17,20,.25), rgba(11,17,20,.92) 70%), linear-gradient(180deg, rgba(11,17,20,.2), rgba(11,17,20,.95)); }
.start-inner { position: relative; z-index: 1; width: 100%; max-width: 560px; }
.logo { text-align: center; margin-bottom: 26px; }
.logo-mark { font-size: 40px; color: var(--gold); text-shadow: 0 0 30px rgba(201,163,104,.5); }
.logo h1 { font-size: clamp(48px, 9vw, 82px); letter-spacing: .04em; color: var(--gold2); text-shadow: 0 4px 30px rgba(0,0,0,.7); line-height: 1; }
.tagline { color: #d8cfbb; font-family: "PT Serif", serif; font-style: italic; font-size: 17px; margin: 14px auto 0; max-width: 440px; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
.start-card { display: flex; flex-direction: column; gap: 14px; background: rgba(13, 20, 23, .82); box-shadow: var(--shadow); }
.start-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 600; }
.start-card input {
  background: rgba(0,0,0,.35); border: 1px solid var(--line2); border-radius: 8px; padding: 12px 14px;
  font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--text); outline: none; font-weight: 500;
}
.start-card input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,163,104,.15); }
.years { display: flex; flex-wrap: wrap; gap: 6px; }
.years button { border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 20px; padding: 4px 11px; font-size: 13px; cursor: pointer; color: var(--muted); }
.years button:hover { color: var(--text); border-color: var(--gold); }
.years button .yh { color: var(--dim); margin-left: 4px; }
.start-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.start-actions .btn-gold { flex: 1; padding: 13px; font-size: 16px; }
.saves { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.save-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(13,20,23,.75); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.save-item:hover { border-color: var(--gold); }
.save-item .s-name { font-weight: 600; flex: 1; }
.save-item .s-meta { color: var(--muted); font-size: 13px; }
.save-item .s-del { color: var(--dim); padding: 2px 6px; border: none; background: none; cursor: pointer; }
.save-item .s-del:hover { color: var(--red2); }

/* ═══════════ ИГРА ═══════════ */
#game { min-height: 100vh; position: relative; }
.era-bg { position: fixed; inset: 0; background-size: cover; background-position: center; opacity: .22; filter: blur(2px) saturate(.8); z-index: 0; }
.era-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,17,20,.4), rgba(11,17,20,.9)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px 18px;
  background: rgba(9, 14, 16, .92); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px);
}
.tb-country { display: flex; align-items: center; gap: 12px; min-width: 0; }
.flag { width: 42px; height: 28px; border-radius: 3px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 0 0 1px rgba(255,255,255,.15); flex-shrink: 0; }
.flag div { flex: 1; }
.tb-name { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.tb-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.tb-date { text-align: center; padding: 0 14px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.tb-year { font-family: var(--serif); font-size: 22px; font-weight: 800; color: var(--gold2); line-height: 1; }
.tb-q { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.tb-chips { display: flex; gap: 6px; flex: 1; flex-wrap: nowrap; min-width: 0; overflow: hidden; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chip { display: flex; flex-direction: column; flex-shrink: 0; padding: 3px 10px; border-radius: 7px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.05); min-width: 72px; }
.chip .c-l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.chip .c-v { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip .c-d { font-size: 11px; margin-left: 4px; font-weight: 600; }
.good { color: var(--green); } .bad { color: var(--red2); } .warn { color: var(--amber); }
.tb-right { display: flex; align-items: center; gap: 10px; }
.will { display: flex; gap: 4px; }
.will i { width: 11px; height: 11px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(201,163,104,.6); display: block; }
.will i.off { background: rgba(255,255,255,.1); box-shadow: none; }
.btn-end { padding: 10px 18px; }

.tabs { position: sticky; top: 57px; z-index: 19; display: flex; gap: 2px; padding: 0 14px; background: rgba(9,14,16,.85); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: none; padding: 11px 15px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--gold2); border-bottom-color: var(--gold); }
.tabs button .badge { background: var(--red); color: #fff; font-size: 10.5px; border-radius: 9px; padding: 0 6px; margin-left: 2px; }
.content { position: relative; z-index: 1; padding: 6px 18px 60px; max-width: 1500px; margin: 0 auto; }

/* Кабинет */
.cab-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
.event {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow);
}
.event.done { opacity: .78; }
.ev-img { background-size: cover; background-position: center; min-height: 220px; position: relative; }
.ev-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 60%, rgba(18,27,31,.9)); }
.ev-painting { position: absolute; bottom: 10px; left: 10px; z-index: 1; background: rgba(0,0,0,.65); padding: 3px 10px; border-radius: 12px; font-size: 12px; color: var(--muted); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.ev-img.fresh { animation: reveal 1.2s ease; }
@keyframes reveal { from { filter: brightness(2) blur(6px); } to { filter: none; } }
.ev-cat { position: absolute; top: 10px; left: 10px; z-index: 1; background: rgba(0,0,0,.6); border: 1px solid var(--line2); padding: 2px 9px; border-radius: 12px; font-size: 11.5px; color: var(--gold2); text-transform: uppercase; letter-spacing: .08em; }
.ev-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.ev-title { font-size: 21px; line-height: 1.2; color: var(--gold2); }
.ev-text { color: #dcd3bf; font-family: "PT Serif", Georgia, serif; font-size: 15.5px; line-height: 1.55; }
.ev-adv { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.ev-adv img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line2); }
.ev-opts { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.opt { text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 8px; padding: 9px 12px; cursor: pointer; transition: all .15s; }
.opt:hover { border-color: var(--gold); background: rgba(201,163,104,.08); }
.opt b { display: block; font-weight: 600; }
.opt span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; font-style: italic; }
.opt.chosen { border-color: var(--gold); background: rgba(201,163,104,.14); }
.opt[disabled] { cursor: default; }
.opt[disabled]:not(.chosen) { opacity: .45; }
.ev-own { display: flex; gap: 8px; }
.ev-own input { flex: 1; background: rgba(0,0,0,.3); border: 1px dashed var(--line2); border-radius: 8px; padding: 8px 12px; outline: none; min-width: 0; }
.ev-own input:focus { border-style: solid; border-color: var(--gold); }
.result { border-left: 3px solid var(--gold); padding: 8px 12px; background: rgba(201,163,104,.07); border-radius: 0 8px 8px 0; font-size: 13.5px; }
.result .narr { font-family: "PT Serif", serif; margin-bottom: 4px; }
.chg { display: inline-flex; gap: 3px; margin: 2px 6px 2px 0; padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,.05); font-size: 12px; font-variant-numeric: tabular-nums; }
.delayed-tag { display: inline-block; font-size: 12px; color: var(--amber); margin-top: 3px; }

.last-turn { margin-top: 14px; }
.last-turn .lt-head { display: flex; justify-content: space-between; align-items: baseline; }
.lt-deltas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lt-item { margin-top: 8px; font-size: 13.5px; }
.lt-item.delayed { color: var(--amber); }
.situation { font-family: "PT Serif", serif; font-size: 15.5px; line-height: 1.6; color: #e0d7c2; }
.problems { margin: 10px 0 0; padding-left: 18px; color: var(--muted); }

.adv { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-start; }
.adv img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line2); flex-shrink: 0; }
.adv .bubble { background: var(--panel); border: 1px solid var(--line); border-radius: 0 10px 10px 10px; padding: 8px 12px; font-size: 13.5px; }
.adv .who { font-size: 11.5px; color: var(--gold); font-weight: 600; margin-bottom: 2px; }

.paper { background: var(--paper); color: var(--ink); border-radius: 4px; padding: 12px 14px 13px; margin-bottom: 10px; box-shadow: var(--shadow); position: relative; font-family: "PT Serif", Georgia, serif; }
.paper::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.015) 0 2px, transparent 2px 4px); pointer-events: none; border-radius: 4px; }
.paper .p-outlet { font-family: var(--serif); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 2px solid var(--ink); padding-bottom: 3px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: baseline; }
.paper .p-slant { font-family: var(--sans); font-size: 10px; font-weight: 600; letter-spacing: .08em; opacity: .6; }
.paper .p-head { font-weight: 700; font-size: 16px; line-height: 1.25; margin-bottom: 5px; }
.paper .p-text { font-size: 13.5px; line-height: 1.45; }
.paper.opp { background: #e8e4dc; }
.paper.foreign { background: #e2e8e6; }
.wn { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.wn b { display: block; color: var(--text); }
.wn span { color: var(--muted); }
.wn.war b { color: var(--red2); }

/* Указы */
.decree-box textarea { width: 100%; background: rgba(0,0,0,.3); border: 1px solid var(--line2); border-radius: 8px; padding: 12px; resize: vertical; outline: none; font-size: 15px; }
.decree-box textarea:focus { border-color: var(--gold); }
.decree-row { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.examples { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.examples button { font-size: 12px; border: 1px dashed var(--line2); background: none; border-radius: 14px; padding: 3px 10px; cursor: pointer; color: var(--muted); }
.examples button:hover { color: var(--text); border-color: var(--gold); }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.act { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 11px 13px; cursor: pointer; display: flex; gap: 11px; transition: all .15s; }
.act:hover:not([disabled]) { border-color: var(--gold); background: rgba(201,163,104,.08); transform: translateY(-1px); }
.act[disabled] { opacity: .45; cursor: not-allowed; }
.act .a-ic { font-size: 22px; line-height: 1; }
.act .a-l { font-weight: 600; font-size: 14px; }
.act .a-d { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.act .a-cd { font-size: 11.5px; color: var(--amber); margin-top: 3px; }
.dlog { padding: 12px 14px; margin-bottom: 8px; }
.dlog .d-h { display: flex; justify-content: space-between; gap: 10px; }
.dlog .d-t { font-weight: 600; color: var(--gold2); }
.dlog .d-q { color: var(--muted); font-style: italic; font-size: 13px; margin: 3px 0; }
.dlog.failed .d-t { color: var(--red2); }

/* Бюджет */
.budget-grid { display: grid; grid-template-columns: 1fr 1fr 360px; gap: 16px; margin-top: 16px; }
.sl { margin-bottom: 12px; }
.sl-h { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 3px; }
.sl-h b { font-variant-numeric: tabular-nums; color: var(--gold2); }
.sl-h b.changed { color: var(--teal2); }
input[type=range] { width: 100%; accent-color: var(--gold); }
.bsum-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.bsum-row.total { font-weight: 700; font-size: 17px; border-bottom: none; padding-top: 12px; }
.budget-sum .btn { width: 100%; margin-top: 12px; padding: 12px; }
.bbar { height: 10px; border-radius: 5px; background: rgba(255,255,255,.06); overflow: hidden; display: flex; margin: 10px 0 4px; }
.bbar div { height: 100%; }

/* Страна */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.stat { display: grid; grid-template-columns: minmax(0, 1fr) 70px 86px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.04); font-size: 13.5px; }
.stat .s-v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .s-v .fake { color: var(--amber); cursor: help; }
.stat .bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 4px; }
.stat .bar div { height: 100%; border-radius: 3px; }
.spark { width: 86px; height: 24px; }
.fog { margin-top: 14px; padding: 10px 14px; border: 1px solid rgba(217,154,58,.35); background: rgba(217,154,58,.07); border-radius: 8px; font-size: 13.5px; }

/* Власть */
.risks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.gauge { text-align: center; padding: 14px; }
.gauge .g-v { font-family: var(--serif); font-size: 34px; font-weight: 800; line-height: 1.1; }
.gauge .g-l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.gauge .g-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.07); margin-top: 8px; overflow: hidden; }
.gauge .g-bar div { height: 100%; }
.factions { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.faction { display: flex; gap: 12px; align-items: center; padding: 12px; }
.faction img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.faction .f-b { flex: 1; min-width: 0; }
.faction .f-n { font-weight: 600; display: flex; justify-content: space-between; }
.faction .f-w { font-size: 12px; color: var(--muted); }
.faction .bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.07); margin-top: 6px; overflow: hidden; }
.faction .bar div { height: 100%; }
.ministers { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.minister { display: flex; gap: 14px; padding: 12px; }
.minister img { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line2); }
.minister .m-role { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); }
.minister .m-name { font-family: var(--serif); font-size: 17px; font-weight: 700; }
.minister .m-trait { font-size: 12.5px; color: var(--muted); font-style: italic; }
.mbars { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; font-size: 11.5px; margin-top: 6px; align-items: center; color: var(--muted); }
.mbars .bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.07); overflow: hidden; }
.mbars .bar div { height: 100%; }
.minister .btn { margin-top: 8px; }
.minister.vacant { border-color: rgba(196,72,60,.5); }
.cand { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; cursor: pointer; }
.cand:hover { border-color: var(--gold); background: rgba(201,163,104,.06); }

/* Мир */
.world-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; margin-top: 16px; }
.map-card { padding: 8px; position: relative; overflow: hidden; }
#map { width: 100%; height: auto; display: block; }
#map path { stroke: #0b1114; stroke-width: .4; cursor: pointer; transition: opacity .15s; }
#map path:hover { opacity: .8; stroke: var(--gold2); stroke-width: 1; }
#map path.sel { stroke: #fff; stroke-width: 1.4; }
.map-tip { position: absolute; pointer-events: none; background: rgba(0,0,0,.85); border: 1px solid var(--line2); padding: 6px 10px; border-radius: 6px; font-size: 12.5px; z-index: 5; max-width: 240px; }
.map-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 4px 8px 6px; }
.map-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.country-panel h3 { font-size: 22px; color: var(--gold2); }
.cp-sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.cp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; margin: 10px 0; }
.cp-stats div { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.05); padding: 3px 0; }
.cp-stats b { font-variant-numeric: tabular-nums; }
.rel-bar { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--red), #555 50%, var(--green)); position: relative; margin: 8px 0 4px; }
.rel-bar i { position: absolute; top: -4px; width: 4px; height: 16px; background: #fff; border-radius: 2px; transform: translateX(-2px); box-shadow: 0 0 6px #000; }
.diplo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.diplo-grid .btn { font-size: 12.5px; padding: 8px 8px; white-space: normal; text-align: left; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: rgba(255,255,255,.07); }
.tag.red { background: rgba(196,72,60,.25); color: #f4b1a8; }
.tag.green { background: rgba(111,174,106,.2); color: #b6dfb2; }
.tag.gold { background: rgba(201,163,104,.2); color: var(--gold2); }
.war-card { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 10px; align-items: center; padding: 12px 16px; margin-top: 10px; }
.war-card .wside { font-weight: 600; }
.war-card .wside:last-child { text-align: right; }
.front { height: 12px; background: rgba(196,72,60,.5); border-radius: 6px; overflow: hidden; position: relative; }
.front div { height: 100%; background: var(--teal2); }
.front-l { text-align: center; font-size: 12px; color: var(--muted); margin-top: 3px; }
.table-wrap { overflow-x: auto; }
.ctable { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--panel); border-radius: var(--r); overflow: hidden; }
.ctable th { text-align: left; padding: 9px 10px; color: var(--gold); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line2); cursor: pointer; white-space: nowrap; }
.ctable td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.04); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctable tr:hover td { background: rgba(201,163,104,.06); cursor: pointer; }

/* Летопись */
.charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.chart-card { padding: 12px; height: 220px; min-width: 0; position: relative; }
.charts > *, .stats-grid > *, .budget-grid > *, .world-grid > *, .cab-grid > * { min-width: 0; }
.chart-card h4 { margin: 0 0 4px; font-size: 12.5px; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; }
.chart-card canvas { max-height: 180px; }
.chron { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.chron .c-date { font-family: var(--serif); color: var(--gold2); font-weight: 700; font-size: 18px; }
.chron .c-text { font-family: "PT Serif", serif; font-size: 15px; line-height: 1.6; }
.chron .c-papers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chron .c-papers span { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--line2); padding-left: 8px; }
.reign { padding: 12px 16px; margin-bottom: 8px; }

/* Модалки */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(5, 8, 10, .78); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); }
.loader-card { text-align: center; max-width: 440px; }
.seal { width: 92px; height: 92px; margin: 0 auto 18px; position: relative; display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--gold); }
.seal-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(201,163,104,.15); border-top-color: var(--gold); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-msg { font-family: var(--serif); font-size: 21px; color: var(--gold2); }
.loader-time { margin-top: 6px; color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.loader-quote { margin-top: 10px; color: var(--muted); font-style: italic; font-family: "PT Serif", serif; min-height: 44px; }
.modal-card { background: var(--panel-solid); border: 1px solid var(--line2); border-radius: 12px; max-width: 720px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal-card .m-img { height: 280px; background-size: cover; background-position: center; border-radius: 12px 12px 0 0; }
.modal-card .m-body { padding: 22px 24px; }
.modal-card h2 { font-size: 28px; color: var(--gold2); }
.modal-card .nick { font-style: italic; color: var(--gold); margin: 4px 0 12px; }
.modal-card .m-text { font-family: "PT Serif", serif; font-size: 15.5px; line-height: 1.65; white-space: pre-line; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; background: #1b2529; border: 1px solid var(--line2); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); max-width: min(560px, calc(100vw - 32px)); font-size: 14px; }
.toast.err { border-color: var(--red); }

/* ═══════════ АДАПТИВ ═══════════ */
@media (max-width: 1200px) {
  .tb-chips .chip:nth-child(n+6) { display: none; }
  .budget-grid { grid-template-columns: 1fr 1fr; }
  .budget-sum { grid-column: span 2; }
  .stats-grid, .charts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .cab-grid, .world-grid { grid-template-columns: 1fr; }
  .event { grid-template-columns: 1fr; }
  .ev-img { min-height: 170px; }
  .ev-img::after { background: linear-gradient(180deg, transparent 60%, rgba(18,27,31,.9)); }
  .risks { grid-template-columns: 1fr 1fr; }
  .tb-chips { display: none; }
}
@media (max-width: 700px) {
  body { font-size: 14px; }
  .topbar { gap: 10px; padding: 8px 12px; flex-wrap: wrap; }
  .tb-name { font-size: 15px; max-width: 170px; }
  .tb-sub { max-width: 170px; }
  .tb-date { padding: 0 8px; }
  .tb-year { font-size: 18px; }
  .tb-right { margin-left: auto; }
  .btn-end { padding: 8px 12px; font-size: 13px; }
  .will { display: none; }
  .tb-chips { display: flex !important; order: 5; flex: 1 0 100%; overflow-x: auto; mask-image: none; scrollbar-width: none; }
  .tb-chips::-webkit-scrollbar { display: none; }
  .tb-chips .chip { display: flex !important; min-width: 0; }
  .tabs { top: 0; position: relative; }
  .content { padding: 4px 12px 80px; }
  .budget-grid, .stats-grid, .charts { grid-template-columns: 1fr; }
  .budget-sum { grid-column: auto; }
  .chron { grid-template-columns: 1fr; gap: 4px; }
  .modal-card .m-img { height: 180px; }
  .war-card { grid-template-columns: 1fr; text-align: center; }
  .war-card .wside:last-child { text-align: center; }
}

/* Настройки */
.eng-badge { display: block; margin: 16px auto 0; background: rgba(13,20,23,.7); border: 1px solid var(--line); color: var(--muted); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 13px; }
.eng-badge:hover { color: var(--text); border-color: var(--gold); }
.eng-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.eng { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.eng.on { border-color: var(--gold); background: rgba(201,163,104,.08); }
.eng input { margin-top: 4px; accent-color: var(--gold); }
.eng b { display: block; }
.eng span { font-size: 13px; color: var(--muted); }
