:root {
  --lacquer: #1d1411;
  --lacquer2: #2a1c17;
  --lacquer3: #3a241c;
  --paper: #f2e6cc;
  --paper2: #e8d8b4;
  --paper3: #dcc79c;
  --ink: #2b1d14;
  --ink2: #5b4636;
  --muted: #8a735c;
  --red: #a8321f;
  --red2: #c9442c;
  --red3: #7d2016;
  --gold: #c9a14a;
  --gold2: #e2c479;
  --gold3: #8a6a2a;
  --jade: #3f7a5f;
  --blue: #3c6e8f;
  --bad: #b3372a;
  --good: #3c7a4c;
  --sea: #b9c9c4;
  --land: #efe2c2;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --serif: "Noto Serif", "PT Serif", "Georgia", "Times New Roman", serif;
  --cjk: "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "STSong", serif;
  --brush: "Ma Shan Zheng", "Noto Serif SC", "Noto Serif CJK SC", "STKaiti", "KaiTi", serif;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .25 0 0 0 0 .12 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fibers: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .09' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .16 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --fret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10'%3E%3Cpath d='M0 9.2H14.5V.8H3.5V6.2H10V3.6' fill='none' stroke='%23c9a14a' stroke-width='1.3'/%3E%3C/svg%3E");
  --fret-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10'%3E%3Cpath d='M0 9.2H14.5V.8H3.5V6.2H10V3.6' fill='none' stroke='%23a8321f' stroke-width='1.2' opacity='.55'/%3E%3C/svg%3E");
  --clouds: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cg fill='none' stroke='%23c9a14a' stroke-width='1' opacity='.2'%3E%3Cpath d='M4 40h40M14 40c0-9 13-9 13-2 0 5-6 6-8 2M30 40c0-13 19-13 19-3 0 6-7 8-9 3M64 16h44M74 16c0-8 12-8 12-1 0 4-5 5-7 1'/%3E%3C/g%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--lacquer);
  background-image: radial-gradient(circle at 20% 0%, #3a2219 0, transparent 55%), radial-gradient(circle at 100% 100%, #2f1a14 0, transparent 50%);
  color: var(--ink); font-family: var(--serif); font-size: 15px; line-height: 1.4;
  overflow: hidden;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
.hidden { display: none !important; }
.zh { font-family: var(--cjk); }
::selection { background: rgba(168, 50, 31, .25); }
* { scrollbar-width: thin; scrollbar-color: #b59a6a transparent; }

#app { display: flex; flex-direction: column; height: 100vh; }
body.title #app { visibility: hidden; }

/* ---------- титульный пейзаж ---------- */
#backdrop { position: fixed; inset: 0; z-index: 40; overflow: hidden; }
#backdrop svg { width: 100%; height: 100%; display: block; }
#backdrop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(10, 4, 2, .65) 100%); }
body.title #modal { background: rgba(15, 8, 5, .25); }

/* ---------- верхняя панель ---------- */
#topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px; position: relative;
  background: linear-gradient(#35211a, #22150f 70%, #1d110c); color: var(--paper); min-height: 66px; flex-wrap: wrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .45); z-index: 2;
}
#topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 10px; background: var(--fret) repeat-x; background-size: 18px 10px; border-top: 1px solid rgba(201, 161, 74, .5); border-bottom: 1px solid var(--gold); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); background-color: #22150f; }
.seal {
  width: 48px; height: 48px; border-radius: 7px; background: radial-gradient(circle at 35% 30%, #c74a33, var(--red) 60%, #8a2616); color: #fbeedd;
  display: grid; place-items: center; font-family: var(--brush); font-size: 34px; line-height: 1; flex: none;
  box-shadow: inset 0 0 0 2px #e98a70, inset 0 0 0 4px var(--red), 0 2px 8px rgba(0, 0, 0, .5); transform: rotate(-3deg);
}
.seal span { transform: translateY(1px); text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.seal.zhou { background: radial-gradient(circle at 35% 30%, #8a5aa6, #6a3f86 60%, #4d2b63); box-shadow: inset 0 0 0 2px #b999d0, inset 0 0 0 4px #6a3f86, 0 2px 8px rgba(0, 0, 0, .5); }
.titleblock { min-width: 180px; }
.titleblock .dyn { font-size: 18px; font-weight: 700; color: var(--gold2); letter-spacing: .5px; text-shadow: 0 1px 0 #000; }
.titleblock .dyn .zh { font-family: var(--brush); font-weight: 400; font-size: 19px; color: #d98f6e; margin-left: 4px; }
.titleblock .yr { font-size: 12.5px; color: #d9c6a3; }
.titleblock .yr b { color: #fff4dc; }

.stats { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.stat {
  background: linear-gradient(rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)); border: 1px solid rgba(201, 161, 74, .35); border-radius: 7px;
  padding: 3px 6px; min-width: 66px; cursor: help; position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: border-color .15s, background .15s;
}
.stat:hover { border-color: var(--gold2); background: rgba(201, 161, 74, .12); }
.stat .ic { font-family: var(--brush); font-size: 15px; line-height: 1; color: var(--gold2); margin-right: 4px; vertical-align: -1px; }
.stat .l { font-size: 11.5px; color: #cdb88f; letter-spacing: .2px; white-space: nowrap; }
.stat .v { font-size: 16px; font-weight: 700; color: #fff4dc; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 11px; margin-left: 3px; }
.stat .d.up { color: #8fd49a; } .stat .d.down { color: #f19a86; }
.stat .bar { height: 3px; background: rgba(255, 255, 255, .15); border-radius: 2px; margin-top: 2px; }
.stat .bar i { display: block; height: 100%; border-radius: 2px; }
.stat.warn { border-color: #e0664f; background: rgba(224, 102, 79, .15); animation: warnpulse 2s ease-in-out infinite; }
.stat.warn .ic { color: #ffb3a0; border-color: #e0664f; }
@keyframes warnpulse { 50% { box-shadow: 0 0 0 2px rgba(224, 102, 79, .25); } }
.turnbox { display: flex; align-items: center; gap: 10px; }
.decrees { display: flex; gap: 3px; align-items: center; color: #d9c6a3; font-size: 12px; cursor: help; }
.decrees .dot { width: 19px; height: 19px; border-radius: 4px; border: 1.5px solid rgba(201, 161, 74, .6); font-family: var(--brush); font-size: 14px; line-height: 17px; text-align: center; color: rgba(201, 161, 74, .45); transform: rotate(-4deg); }
.decrees .dot.on { background: radial-gradient(circle at 35% 30%, #c74a33, var(--red)); border-color: #e98a70; color: #fbeedd; box-shadow: 0 0 8px rgba(201, 68, 44, .55); }
.btn {
  border: 1px solid var(--ink2); background: linear-gradient(#f0e2c2, var(--paper2)); color: var(--ink); border-radius: 6px; padding: 6px 12px;
  transition: background .12s, transform .05s, box-shadow .12s; box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 1px 2px rgba(0, 0, 0, .12);
}
.btn:hover:not(:disabled) { background: linear-gradient(#f6ead0, var(--paper3)); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.red { background: linear-gradient(#c24129, var(--red)); border-color: #6d1c10; color: #fff3e2; text-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.btn.red:hover:not(:disabled) { background: linear-gradient(#d4533a, var(--red2)); }
.btn.gold { background: linear-gradient(#e4c679, var(--gold) 60%, #b48a36); border-color: #7d6225; color: #2b1d14; font-weight: 700; box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 2px 6px rgba(0, 0, 0, .35); }
.btn.gold:hover:not(:disabled) { background: linear-gradient(#f0d78e, var(--gold2) 60%, #c69b44); }
.btn.gold .zh { font-family: var(--brush); font-weight: 400; font-size: 1.25em; line-height: 0; vertical-align: -1px; color: var(--red3); }
.btn.small { padding: 3px 8px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--paper); border-color: rgba(201, 161, 74, .5); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: rgba(201, 161, 74, .15); }
#endturn { font-size: 16px; padding: 9px 18px; }
#endturn:not(:disabled) { animation: endglow 3.2s ease-in-out infinite; }
@keyframes endglow { 50% { box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 0 14px rgba(226, 196, 121, .55); } }

/* ---------- основная область ---------- */
#main { flex: 1; display: flex; min-height: 0; }
#mapwrap { flex: 1.35; position: relative; min-width: 0; padding: 12px; display: flex; flex-direction: column; }
#map {
  flex: 1; width: 100%; min-height: 0; background: var(--sea); border-radius: 6px;
  border: 3px solid #6b4a2e; box-shadow: var(--shadow), 0 0 0 1px #2a1a12, 0 0 0 5px #4a3020, 0 0 0 6px var(--gold3);
}
/* бумажная фактура и виньетка поверх карты */
#mapwrap::after {
  content: ""; position: absolute; inset: 15px; border-radius: 4px; pointer-events: none;
  background: var(--noise), var(--fibers); mix-blend-mode: multiply; opacity: .9;
  box-shadow: inset 0 0 70px rgba(80, 50, 20, .35), inset 0 0 0 1px rgba(201, 161, 74, .6), inset 0 0 0 4px rgba(243, 232, 204, .35);
}
#side {
  flex: 1; max-width: 580px; min-width: 390px; background-color: var(--paper); display: flex; flex-direction: column; position: relative;
  border-left: 3px solid var(--gold); box-shadow: -4px 0 18px rgba(0, 0, 0, .35);
  background-image: linear-gradient(rgba(255, 255, 255, .25), rgba(255, 255, 255, 0) 120px), var(--noise), var(--fibers);
}
#tabs { display: flex; background: linear-gradient(#e6d3aa, var(--paper3)); border-bottom: 2px solid var(--ink2); position: relative; box-shadow: 0 2px 6px rgba(60, 40, 20, .15); }
#tabs button {
  flex: 1 1 0; border: none; background: transparent; padding: 5px 2px 5px; color: var(--ink2); position: relative; min-width: 0;
  border-bottom: 3px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 0; transition: background .12s, color .12s;
}
#tabs button .tg { font-family: var(--brush); font-size: 19px; line-height: 1.1; color: #8a6d4d; transition: color .12s, transform .15s; }
#tabs button .tl { font-size: 11.5px; letter-spacing: .2px; white-space: nowrap; }
#tabs button:hover { background: rgba(255, 255, 255, .35); }
#tabs button:hover .tg { transform: translateY(-1px); }
#tabs button.on { color: var(--red); border-bottom-color: var(--red); background: var(--paper); font-weight: 700; }
#tabs button.on .tg { color: var(--red); }
#tabs button .badge { position: absolute; top: 2px; right: 50%; margin-right: -20px; background: var(--red); color: #fff; border-radius: 8px; padding: 0 5px; font-size: 10.5px; line-height: 15px; font-weight: 700; box-shadow: 0 0 0 1.5px var(--paper3); }
#tabs button .badge.soft { background: var(--jade); }
#panel { flex: 1; overflow-y: auto; padding: 12px 16px 30px; }

/* карта */
.prov { cursor: pointer; transition: filter .15s; }
.prov:hover { filter: brightness(1.07) saturate(1.15); }
.prov.rebel { stroke-dasharray: 6 3; }
.decor { cursor: pointer; }
.decor:hover { filter: brightness(1.06); fill-opacity: .6; }
.plabel { font-family: var(--serif); font-size: 15px; font-weight: 700; fill: #3a281c; pointer-events: none; paint-order: stroke; stroke: rgba(245, 235, 210, .9); stroke-width: 3.2px; letter-spacing: .3px; }
.psub { font-size: 11px; font-weight: 400; fill: #5b4636; letter-spacing: 0; }
.psub.zh { font-size: 10.5px; fill: #7d2016; letter-spacing: 1.5px; }
.nlabel { font-size: 13px; font-style: italic; fill: #4a3a30; pointer-events: none; paint-order: stroke; stroke: rgba(240, 230, 210, .75); stroke-width: 3px; letter-spacing: .4px; }
.city { fill: #2b1d14; stroke: #f3e7cd; stroke-width: 1.5; pointer-events: none; }
.cityname { font-size: 10.5px; fill: #2b1d14; pointer-events: none; paint-order: stroke; stroke: rgba(245, 235, 210, .9); stroke-width: 2.5px; }
#mapmodes { position: absolute; top: 22px; left: 24px; display: flex; gap: 0; flex-wrap: wrap; z-index: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); border-radius: 6px; }
#mapmodes button { background: rgba(243, 232, 204, .95); border: 1px solid #6b4a2e; border-left-width: 0; padding: 3px 9px 3px 7px; font-size: 12.5px; color: var(--ink2); display: flex; align-items: center; gap: 4px; }
#mapmodes button:first-child { border-left-width: 1px; border-radius: 6px 0 0 6px; }
#mapmodes button:last-child { border-radius: 0 6px 6px 0; }
#mapmodes button .zh { font-family: var(--brush); font-size: 16px; line-height: 1; color: var(--red); }
#mapmodes button:hover { background: #fffaf0; }
#mapmodes button.on { background: linear-gradient(#c24129, var(--red)); color: #fff; border-color: #6d1c10; }
#mapmodes button.on .zh { color: #ffe0b0; }
#maplegend {
  position: absolute; bottom: 24px; left: 24px; background: rgba(243, 232, 204, .95); border: 1px solid #6b4a2e; z-index: 1;
  border-radius: 6px; padding: 5px 10px; font-size: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: 72%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25), inset 0 0 0 2px rgba(255, 255, 255, .35);
}
#maplegend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 3px; vertical-align: -2px; border: 1px solid #6b4a2e; }
#maplegend .sw.ln { border: none; border-top: 3px solid #b3372a; height: 3px; width: 16px; vertical-align: 3px; border-radius: 0; opacity: .7; }
#maplegend .sw.ln.wall { border-top: 4px dotted #5e4630; opacity: 1; }
#maplegend .sw.jd { background: #6a3f86; color: #fff; font-size: 9px; text-align: center; line-height: 11px; }
#maplegend .grad { width: 90px; height: 10px; border: 1px solid #6b4a2e; display: inline-block; vertical-align: -1px; border-radius: 2px; }

/* панели */
h2 { margin: 2px 0 12px; font-size: 21px; color: var(--red); display: flex; align-items: center; gap: 10px; padding-bottom: 8px; position: relative; }
h2::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--fret-red) repeat-x; background-size: 11px 6px; opacity: .8; }
h2 .zh { font-size: 15px; color: #fbeedd; font-weight: 400; background: var(--red); padding: 1px 6px 2px; border-radius: 3px; letter-spacing: 2px; font-family: var(--brush); font-size: 18px; box-shadow: inset 0 0 0 1.5px #e98a70; }
h3 { margin: 18px 0 8px; font-size: 13.5px; color: var(--ink2); text-transform: uppercase; letter-spacing: 1.2px; display: flex; align-items: center; gap: 8px; }
h3::before { content: "◆"; color: var(--red); font-size: 9px; }
h3::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--paper3), transparent); }
p { margin: 6px 0; }
a { color: var(--red3); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.card {
  background: linear-gradient(rgba(255, 255, 255, .55), rgba(255, 255, 255, .3)); border: 1px solid var(--paper3); border-radius: 8px; padding: 9px 11px; margin: 8px 0;
  box-shadow: 0 1px 3px rgba(80, 50, 20, .08), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.card.hot { border-color: rgba(179, 55, 42, .55); background: linear-gradient(rgba(179, 55, 42, .09), rgba(179, 55, 42, .04)); box-shadow: inset 3px 0 0 var(--bad), 0 1px 3px rgba(80, 50, 20, .08); }
.card.good { border-color: var(--good); }
.card.emp { background: linear-gradient(135deg, rgba(255, 244, 210, .8), rgba(255, 255, 255, .35)); border-color: #d6b66c; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .45), 0 2px 8px rgba(120, 80, 20, .12); }
.card.adv, .card.calm { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.aic { flex: none; font-family: var(--brush); width: 28px; height: 28px; border-radius: 5px; display: grid; place-items: center; font-size: 19px; background: var(--ink2); color: var(--paper); transform: rotate(-3deg); }
.card.hot .aic { background: var(--red); color: #fbeedd; box-shadow: inset 0 0 0 1.5px #e98a70; }
.card.calm .aic { background: var(--jade); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.sb { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 14px; }
.kv .k { color: var(--ink2); }
.meter { height: 8px; background: rgba(60, 40, 20, .12); border-radius: 4px; overflow: hidden; min-width: 60px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15); }
.meter i { display: block; height: 100%; border-radius: 4px; background-image: linear-gradient(rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 60%) !important; background-color: inherit; }
.meter i { background-blend-mode: normal; }
.mrow { display: grid; grid-template-columns: 118px 1fr 42px; gap: 8px; align-items: center; margin: 5px 0; font-size: 13.5px; }
.mrow .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink2); }
.tag { display: inline-block; font-size: 11.5px; border-radius: 10px; padding: 1px 7px; background: var(--paper3); color: var(--ink); margin: 1px 2px; white-space: nowrap; border: 1px solid rgba(0, 0, 0, .06); }
.tag.red { background: var(--red); color: #fff; } .tag.green { background: var(--jade); color: #fff; } .tag.gold { background: linear-gradient(#e4c679, var(--gold)); color: #3a2a10; }
.tag.blue { background: var(--blue); color: #fff; } .tag.purple { background: #7d5a8c; color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.chip { font-size: 11.5px; border-radius: 4px; padding: 1px 6px; background: rgba(0, 0, 0, .07); }
.chip.g { background: rgba(60, 122, 76, .17); color: #1f5530; } .chip.b { background: rgba(179, 55, 42, .15); color: #7d2016; }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 7px; }
.act {
  text-align: left; border: 1px solid var(--paper3); background: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .4)); border-radius: 8px; padding: 8px 9px;
  display: flex; gap: 9px; align-items: flex-start; color: var(--ink); transition: border-color .12s, box-shadow .12s, transform .12s;
  box-shadow: 0 1px 2px rgba(80, 50, 20, .08);
}
.act:hover:not(:disabled) { border-color: var(--red); background: #fffaf0; box-shadow: 0 3px 10px rgba(120, 50, 20, .15); transform: translateY(-1px); }
.act:disabled { opacity: .5; cursor: not-allowed; }
.act .ic { font-family: var(--brush); font-size: 21px; color: #fbeedd; line-height: 1; width: 32px; height: 32px; display: grid; place-items: center; flex: none; background: radial-gradient(circle at 35% 30%, #c74a33, var(--red)); border-radius: 6px; box-shadow: inset 0 0 0 1.5px #e98a70, 0 1px 2px rgba(0, 0, 0, .2); transform: rotate(-2deg); }
.act:disabled .ic { background: #9a8a78; box-shadow: none; }
.act .t { font-weight: 700; font-size: 14px; }
.act .ds { font-size: 12px; color: var(--ink2); margin-top: 1px; }
.act .cs { font-size: 12px; margin-top: 4px; color: var(--ink); }
.act .why { font-size: 11.5px; color: var(--bad); margin-top: 2px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; color: var(--ink2); font-weight: 400; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1.5px solid var(--paper3); padding: 3px 4px; }
table.tbl td { padding: 4px; border-bottom: 1px solid rgba(90, 60, 30, .08); vertical-align: middle; }
table.tbl tr:nth-child(even) td { background: rgba(255, 255, 255, .18); }
table.tbl tr[data-sel]:hover td { background: rgba(201, 161, 74, .15); }
table.tbl tr.heir td { background: rgba(201, 161, 74, .16); }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.who { display: flex; gap: 8px; align-items: center; }
.portrait { flex: none; display: block; filter: drop-shadow(0 1px 2px rgba(60, 30, 10, .3)); }
.fac { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); }
.slot { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px dashed var(--muted); border-radius: 8px; margin: 6px 0; background: rgba(255, 255, 255, .3); position: relative; }
.slot.filled { border-style: solid; border-color: var(--paper3); background: linear-gradient(rgba(255, 255, 255, .65), rgba(255, 255, 255, .4)); box-shadow: 0 1px 3px rgba(80, 50, 20, .08); }
.slot .role { font-family: var(--brush); font-size: 22px; color: var(--red); width: 30px; text-align: center; }
.slot .role.mini { position: absolute; left: 36px; top: 30px; width: 20px; height: 20px; font-size: 13px; line-height: 20px; background: var(--red); color: #fbeedd; border-radius: 4px; box-shadow: 0 0 0 1.5px var(--paper); }
.slot select { flex: 1; font-family: inherit; font-size: 13px; padding: 4px; background: #fffaf0; border: 1px solid var(--paper3); border-radius: 5px; min-width: 0; }
.person .nm { font-weight: 700; }
.person .nm.big { font-size: 16.5px; }
.person .st { font-size: 12px; color: var(--ink2); }
.sk { display: inline-block; margin-right: 6px; }
.sk b { color: var(--red3); }
.pol { margin: 10px 0; }
.pol .opts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.pol .opt { border: 1px solid var(--paper3); background: rgba(255, 255, 255, .55); border-radius: 7px; padding: 5px 9px; font-size: 13px; text-align: left; max-width: 250px; transition: border-color .12s, box-shadow .12s; }
.pol .opt.cur { background: linear-gradient(#c24129, var(--red)); color: #fff; border-color: #6d1c10; box-shadow: 0 2px 6px rgba(168, 50, 31, .3); }
.pol .opt:hover:not(:disabled):not(.cur) { border-color: var(--red); box-shadow: 0 2px 6px rgba(120, 50, 20, .12); }
.pol .opt:disabled:not(.cur) { opacity: .5; cursor: not-allowed; }
.pol .opt small { display: block; font-size: 11.5px; opacity: .85; }
.log { font-size: 13px; }
.log .yr { font-weight: 700; color: var(--red); margin: 12px 0 4px; display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--paper3); }
.log .yr .zh { font-weight: 400; font-size: 12px; color: var(--muted); letter-spacing: 2px; }
.log .e { padding: 3px 0; margin: 1px 0; display: flex; gap: 7px; align-items: flex-start; }
.log .e .lg { flex: none; width: 19px; height: 19px; border-radius: 4px; font-size: 12px; line-height: 19px; text-align: center; background: var(--paper3); color: var(--ink2); margin-top: 1px; }
.log .e.rebel .lg, .log .e.disaster .lg, .log .e.war .lg, .log .e.bad .lg { background: var(--bad); color: #fff; }
.log .e.good .lg { background: var(--good); color: #fff; }
.log .e.reign .lg { background: linear-gradient(#e4c679, var(--gold)); color: var(--red3); }
.log .e.reign { font-weight: 600; }
.log .e.policy .lg, .log .e.court .lg { background: var(--blue); color: #fff; }
.log .e.foreign .lg { background: #7d5a8c; color: #fff; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters button { font-size: 12px; padding: 2px 9px; border-radius: 10px; border: 1px solid var(--paper3); background: rgba(255, 255, 255, .5); }
.filters button:hover { border-color: var(--ink2); }
.filters button.on { background: var(--ink2); color: #fff; border-color: var(--ink2); }
.chart { width: 100%; height: 150px; background: linear-gradient(rgba(255, 255, 255, .6), rgba(255, 255, 255, .35)); border: 1px solid var(--paper3); border-radius: 7px; }
.chart text { font-size: 10px; fill: var(--ink2); font-family: var(--serif); }
.legend { font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; margin: 3px 0 10px; }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: 3px; margin-right: 4px; border-radius: 2px; }
.legend b { color: var(--ink); }

/* модальное окно */
#modal { position: fixed; inset: 0; background: rgba(15, 8, 5, .72); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fadein .18s ease-out; backdrop-filter: blur(1.5px); }
@keyframes fadein { from { opacity: 0; } }
#modal .box {
  background-color: var(--paper); border-radius: 10px; max-width: 720px; width: 100%; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65), 0 0 0 1px #2a1a12, 0 0 0 5px #5a3a24, 0 0 0 6px var(--gold); border: 2px solid var(--gold); position: relative;
  background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0) 200px), var(--noise), var(--fibers);
  animation: rise .22s cubic-bezier(.2, .8, .3, 1.1);
}
@keyframes rise { from { transform: translateY(14px) scale(.98); opacity: 0; } }
#modal .box::before { content: ""; display: block; height: 10px; background: var(--fret) repeat-x #3a241c; background-size: 18px 10px; border-bottom: 1px solid var(--gold); position: sticky; top: 0; z-index: 2; }
#modal .box.wide { max-width: 980px; }
.mhead { display: flex; gap: 16px; align-items: center; padding: 16px 22px 12px; border-bottom: 1px solid var(--paper3); background: var(--clouds); background-size: 160px 80px; }
.mhead .big { font-family: var(--brush); font-size: 46px; color: #fbeedd; background: radial-gradient(circle at 35% 30%, #c74a33, var(--red) 60%, #8a2616); border-radius: 9px; width: 68px; height: 68px; display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 3px #e98a70, inset 0 0 0 5px var(--red), 0 3px 10px rgba(0, 0, 0, .3); transform: rotate(-3deg); line-height: 1; }
.mhead.hist .big { background: radial-gradient(circle at 35% 30%, #e4c679, var(--gold) 60%, #9a7428); color: var(--red3); box-shadow: inset 0 0 0 3px #f6e2a8, inset 0 0 0 5px var(--gold), 0 3px 10px rgba(0, 0, 0, .3); }
.mhead h1 { margin: 0; font-size: 24px; color: var(--red); }
.mhead .sub { color: var(--ink2); font-size: 13px; margin-top: 2px; }
.mbody { padding: 14px 22px 20px; }
.mbody .text { font-size: 15.5px; line-height: 1.6; margin-bottom: 14px; }
.scrolltext { padding: 12px 16px; background: rgba(255, 250, 235, .6); border-left: 3px solid var(--gold); border-radius: 0 6px 6px 0; box-shadow: inset 0 0 20px rgba(160, 120, 60, .08); }
.choice {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; width: 100%; text-align: left; margin: 8px 0; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--paper3); background: linear-gradient(rgba(255, 255, 255, .75), rgba(255, 255, 255, .45)); color: var(--ink);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.choice > .cn { flex: none; font-size: 14px; font-weight: 700; width: 26px; height: 26px; line-height: 26px; text-align: center; border-radius: 50%; background: var(--paper3); color: var(--red3); align-self: flex-start; transition: background .12s, color .12s; }
.choice > .ct { flex: 1; }
.choice > .ch, .choice > .chips { flex-basis: 100%; margin-left: 36px; }
.choice:hover:not(:disabled) { border-color: var(--red); background: #fffaf0; box-shadow: 0 4px 12px rgba(120, 50, 20, .15); transform: translateX(2px); }
.choice:hover:not(:disabled) > .cn { background: var(--red); color: #fff; }
.choice:disabled { opacity: .5; cursor: not-allowed; }
.choice .ct { font-weight: 700; font-size: 15px; }
.choice .ch { font-size: 12.5px; color: var(--ink2); margin-top: 2px; }
.keyhint { text-align: right; margin: 6px 0 0; font-size: 11.5px; }
.scn { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.scn button { text-align: left; border: 2px solid var(--paper3); background: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .4)); border-radius: 10px; padding: 10px 12px; color: var(--ink); position: relative; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.scn button::after { content: attr(data-z); position: absolute; right: -6px; bottom: -18px; font-family: var(--brush); font-size: 86px; color: var(--red); opacity: .07; pointer-events: none; line-height: 1; }
.scn button:hover { border-color: #c9a080; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(80, 40, 20, .15); }
.scn button.on { border-color: var(--red); background: #fff8ec; box-shadow: 0 4px 16px rgba(168, 50, 31, .28); }
.scn .y { font-size: 28px; font-weight: 700; color: var(--red); }
.scn .zh { font-size: 22px; color: var(--ink2); margin-left: 6px; font-family: var(--brush); }
.scn .tt { font-weight: 700; margin: 2px 0 4px; }
.scn .bl { font-size: 12.5px; color: var(--ink2); }
.hero { text-align: center; padding: 20px 20px 8px; position: relative; background: var(--clouds); background-size: 180px 90px; }
.hero .zhbig { font-family: var(--brush); font-size: 74px; color: var(--red); letter-spacing: 10px; line-height: 1; text-shadow: 0 2px 0 rgba(120, 30, 10, .15); }
.hero h1 { margin: 6px 0 2px; font-size: 30px; color: var(--ink); letter-spacing: 1px; }
.hero .sub { color: var(--ink2); font-style: italic; }
.hero .stamp { position: absolute; right: 26px; top: 22px; width: 54px; height: 54px; border: 2.5px solid var(--red); border-radius: 6px; color: var(--red); font-family: var(--brush); font-size: 22px; line-height: 24px; display: grid; place-items: center; transform: rotate(8deg); opacity: .75; padding: 2px; }
.orn { height: 12px; margin: 10px auto 0; max-width: 320px; background: var(--fret-red) repeat-x center; background-size: 14px 8px; opacity: .7; }
.seg { display: inline-flex; border: 1px solid var(--ink2); border-radius: 7px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg button { border: none; background: linear-gradient(#f0e2c2, var(--paper2)); padding: 6px 14px; }
.seg button + button { border-left: 1px solid rgba(91, 70, 54, .4); }
.seg button.on { background: linear-gradient(#6d5442, var(--ink2)); color: #fff; }
.help h4 { margin: 14px 0 4px; color: var(--red); display: flex; gap: 8px; align-items: center; }
.help h4::before { content: "◆"; font-size: 9px; }
.help p, .help li { font-size: 14px; }
.close { position: absolute; top: 18px; right: 12px; border: none; background: transparent; font-size: 22px; color: var(--ink2); z-index: 3; border-radius: 50%; width: 34px; height: 34px; }
.close:hover { background: rgba(0, 0, 0, .06); color: var(--red); }
.rbox { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.rbox > div { background: rgba(255, 255, 255, .5); border: 1px solid var(--paper3); border-radius: 7px; padding: 5px 9px; }
.rbox .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink2); }
.rbox .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 60; max-width: 390px; }
.toast { background: linear-gradient(#35211a, var(--lacquer2)); color: var(--paper); border-left: 4px solid var(--gold); padding: 9px 13px; border-radius: 6px; box-shadow: var(--shadow), inset 0 0 0 1px rgba(201, 161, 74, .25); font-size: 14px; animation: tin .25s cubic-bezier(.2, .8, .3, 1.2); }
.toast.bad { border-left-color: var(--red2); } .toast.good { border-left-color: #6fbf82; }
@keyframes tin { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#tip { position: fixed; z-index: 70; background: linear-gradient(#35211a, var(--lacquer2)); color: var(--paper); padding: 8px 11px; border-radius: 7px; font-size: 13px; max-width: 300px; pointer-events: none; box-shadow: var(--shadow); border: 1px solid var(--gold); }
#tip .th { font-size: 14px; color: var(--gold2); }
#tip .th .zh { color: #d98f6e; margin-left: 3px; }
#tip .ts { font-size: 12px; color: #d9c6a3; margin: 2px 0; }
#tip .tw { color: #f19a86; font-weight: 700; margin: 3px 0; }
#tip .tb { display: grid; grid-template-columns: 92px 1fr 26px; gap: 6px; align-items: center; font-size: 12px; margin: 3px 0; }
#tip .tb i { height: 5px; background: rgba(255, 255, 255, .15); border-radius: 3px; overflow: hidden; }
#tip .tb b { display: block; height: 100%; }
#tip .tb em { font-style: normal; text-align: right; color: #fff4dc; }

/* смена года */
#yearfx { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none; }
#yearfx .yf { text-align: center; padding: 26px 70px; background: radial-gradient(ellipse at center, rgba(29, 20, 17, .9) 0, rgba(29, 20, 17, .75) 55%, transparent 72%); color: var(--paper); opacity: 0; }
#yearfx.go .yf { animation: yearin 2.1s ease-in-out forwards; }
#yearfx .yz { font-family: var(--brush); font-size: 64px; color: var(--gold2); letter-spacing: 8px; line-height: 1.1; text-shadow: 0 3px 12px rgba(0, 0, 0, .6); }
#yearfx .yy { font-size: 26px; font-weight: 700; letter-spacing: 2px; margin-top: 4px; }
#yearfx .ye { font-size: 14px; color: #d9c6a3; font-style: italic; margin-top: 2px; }
@keyframes yearin { 0% { opacity: 0; transform: scale(.94); letter-spacing: 0; } 18% { opacity: 1; transform: none; } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1.03); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

@media (max-width: 1000px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  #topbar { gap: 8px; padding: 8px 8px 14px; }
  .titleblock { flex: 1; min-width: 0; }
  .turnbox { margin-left: auto; }
  .stats { order: 3; flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); }
  .stat { min-width: 0; }
  .stat .l { letter-spacing: 0; font-size: 10px; }
  #main { flex-direction: column; }
  #mapwrap { height: min(78vh, calc(100vw * 0.8)); flex: none; padding: 6px; }
  #mapwrap::after { inset: 9px; }
  #mapmodes { top: 14px; left: 14px; }
  #mapmodes button { font-size: 11px; padding: 2px 5px; }
  #mapmodes button .zh { font-size: 13px; }
  #maplegend { display: none; }
  #side { max-width: none; min-width: 0; border-left: none; border-top: 3px solid var(--gold); }
  #panel { overflow: visible; padding: 10px 16px 30px; }
  .mrow { grid-template-columns: 96px 1fr 38px; }
  #modal .box { max-height: 96vh; }
  .mhead .big { width: 50px; height: 50px; font-size: 32px; }
  .mhead h1 { font-size: 19px; }
  .hero .zhbig { font-size: 52px; }
  .hero .stamp { display: none; }
}
@media (max-width: 520px) {
  #endturn { font-size: 14px; padding: 7px 10px; }
  .decrees .dot { width: 15px; height: 15px; font-size: 10px; line-height: 13px; }
  .actions { grid-template-columns: 1fr; }
  #topbar { row-gap: 8px; }
  .turnbox { order: 2; flex-basis: 100%; justify-content: space-between; }
  .turnbox #endturn { flex: 1; }
  #tabs { overflow-x: auto; scrollbar-width: none; }
  #tabs button { flex: 0 0 auto; min-width: 64px; padding: 5px 6px; }
  #tabs button .tl { font-size: 11px; }
  .titleblock .dyn { font-size: 16px; }
  .titleblock .dyn .zh { display: none; }
  .mbody, .mhead { padding-left: 14px; padding-right: 14px; }
  #yearfx .yz { font-size: 44px; }
}
/* ---------- карта: детали ---------- */
.prov { stroke: #6b4a2e; stroke-width: 1.1; stroke-linejoin: round; }
.prov.lost { fill-opacity: .8; }
.selline { fill: none; stroke: #a8321f; stroke-width: 2.6; stroke-linejoin: round; pointer-events: none; stroke-dasharray: 7 3; animation: march 1.6s linear infinite; }
@keyframes march { to { stroke-dashoffset: -20; } }
.decor { stroke: #8d7a60; stroke-width: 1; stroke-dasharray: 3 3; stroke-linejoin: round; }
.decor.war { stroke: #a8321f; stroke-width: 1.8; stroke-dasharray: none; animation: warpulse 1.8s ease-in-out infinite; }
.decor.tributary { stroke: #b08a34; stroke-width: 1.5; stroke-dasharray: 6 3; }
.decor.alliance { stroke: #3f7a5f; stroke-width: 1.5; stroke-dasharray: 6 3; }
@keyframes warpulse { 50% { stroke-opacity: .35; } }
.island { fill: #e3d4b0; stroke: #6b5a45; stroke-width: 1; stroke-linejoin: round; }
.river { fill: none; stroke: #6d9fb0; stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.river-bank { fill: none; stroke: #f3ecd8; stroke-width: 4.6; stroke-linecap: round; opacity: .7; pointer-events: none; }
.rivername { font-size: 9.5px; font-style: italic; fill: #3f6f80; letter-spacing: 1px; pointer-events: none; paint-order: stroke; stroke: rgba(243, 236, 216, .8); stroke-width: 2.5px; }
.canal { fill: none; stroke: #b88a2e; stroke-width: 2; stroke-dasharray: 5 3; pointer-events: none; }
.canal-bank { fill: none; stroke: #f5ead0; stroke-width: 4.5; opacity: .8; pointer-events: none; }
.wall { fill: none; stroke: #5e4630; stroke-width: 2.4; stroke-linejoin: round; pointer-events: none; }
.wall-t { fill: none; stroke: #5e4630; stroke-width: 6; stroke-dasharray: 1.6 4.2; pointer-events: none; }
.silk { fill: none; stroke: #8a5c2a; stroke-width: 1.8; stroke-dasharray: .1 5; stroke-linecap: round; pointer-events: none; opacity: .9; }
.silk.closed { opacity: .35; }
.silkname { font-size: 10px; font-style: italic; fill: #7a4f22; letter-spacing: 1.5px; pointer-events: none; paint-order: stroke; stroke: rgba(243, 236, 216, .85); stroke-width: 2.5px; }
.searoute { fill: none; stroke: #6f8f8a; stroke-width: 1.1; stroke-dasharray: 4 4; pointer-events: none; }
.townname { font-size: 9px; fill: #4a3a30; font-style: italic; pointer-events: none; paint-order: stroke; stroke: rgba(245, 235, 210, .85); stroke-width: 2.2px; }
.townname.foreign { fill: #3a2e26; }
.lakename { font-size: 8.5px; fill: #3f6f80; font-style: italic; paint-order: stroke; stroke: rgba(243, 236, 216, .7); stroke-width: 2px; }
.cityname.cap { font-weight: 700; font-size: 11.5px; fill: #7d2016; }
.sealabel { font-size: 12px; font-style: italic; fill: #56736e; letter-spacing: 2px; pointer-events: none; }
.sealabel.zh { font-size: 11px; letter-spacing: 3px; font-style: normal; }
.farland { font-size: 13px; font-style: italic; fill: #7a6552; letter-spacing: 2px; pointer-events: none; }
.farland.zh { font-size: 12px; font-style: normal; letter-spacing: 4px; }
.nlabel.war { fill: #8e2416; font-weight: 700; }
.nlabel.tributary { fill: #7a5a1a; }
.nlabel.alliance { fill: #2f5d45; }
.cmp { font-size: 11px; fill: #5e4630; font-weight: 700; }
.seal-t { font-size: 17px; fill: #fbeedd; }
.compass { pointer-events: none; opacity: .9; }
.flame { pointer-events: none; transform-box: fill-box; transform-origin: 50% 100%; animation: flick .9s ease-in-out infinite alternate; }
@keyframes flick { from { transform: scale(1, 1); } to { transform: scale(1.12, .9); } }
.swords { pointer-events: none; }
#map.soft .plabel { font-size: 14px; }
.silk.alt { opacity: .55; stroke-dasharray: .1 6; }
.silk.closed.alt { opacity: .2; }

/* ---------- свиток: прилипающая шапка, закладки, раскрывающиеся строки ---------- */
#side { position: relative; }
.phead {
  position: sticky; top: -12px; z-index: 5; margin: -12px -16px 10px; padding: 12px 16px 8px;
  background-color: var(--paper); background-image: linear-gradient(rgba(255, 255, 255, .3), rgba(255, 255, 255, .15)), var(--noise);
  box-shadow: 0 6px 10px -8px rgba(80, 50, 20, .45); border-bottom: 1px solid rgba(220, 199, 156, .7);
}
.phead h2 { margin-bottom: 8px; }
.phead > :last-child { margin-bottom: 0; }
.subnav { display: flex; gap: 0; margin-top: 2px; border-bottom: 2px solid var(--paper3); overflow-x: auto; scrollbar-width: none; }
.subnav button {
  flex: 1 1 auto; border: none; background: transparent; padding: 6px 10px 7px; font-size: 13px; color: var(--ink2);
  display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; position: relative;
  border-radius: 7px 7px 0 0; transition: background .12s, color .12s;
}
.subnav button .zh { font-family: var(--brush); font-size: 17px; line-height: 1; color: #9a7a58; }
.subnav button:hover { background: rgba(255, 255, 255, .45); }
.subnav button.on { color: var(--red3); font-weight: 700; background: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .35)); }
.subnav button.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -2px; height: 3px; border-radius: 2px; background: var(--red); }
.subnav button.on .zh { color: var(--red); }
.subnav em { font-style: normal; font-size: 10.5px; font-weight: 700; background: var(--paper3); color: var(--ink2); border-radius: 8px; padding: 0 6px; line-height: 16px; }
.subnav em.hot { background: var(--red); color: #fff; }

details.acc {
  border: 1px solid var(--paper3); border-radius: 8px; margin: 6px 0; overflow: hidden;
  background: linear-gradient(rgba(255, 255, 255, .55), rgba(255, 255, 255, .3)); box-shadow: 0 1px 2px rgba(80, 50, 20, .07);
  transition: border-color .12s, box-shadow .12s;
}
details.acc:hover { border-color: #cdb07a; }
details.acc[open] { box-shadow: 0 3px 12px rgba(80, 50, 20, .13); border-color: #cdb07a; }
details.acc.hot { border-color: rgba(179, 55, 42, .55); box-shadow: inset 3px 0 0 var(--bad); }
details.acc > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 8px 10px; min-height: 40px; user-select: none;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary:hover { background: rgba(255, 255, 255, .45); }
details.acc > summary .st { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.acc > summary .sg { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 4px; background: var(--ink2); color: var(--paper); font-size: 12px; margin-right: 6px; vertical-align: 1px; }
details.acc > summary .cur { font-size: 12.5px; color: #fff; background: linear-gradient(#b8452c, var(--red)); border-radius: 10px; padding: 1px 9px; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.chev { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--paper3); position: relative; transition: transform .2s, background .12s; }
.chev::before { content: ""; position: absolute; left: 6px; top: 5px; width: 5px; height: 5px; border-right: 1.6px solid var(--ink2); border-bottom: 1.6px solid var(--ink2); transform: rotate(45deg); }
details.acc[open] > summary .chev { transform: rotate(180deg); background: var(--gold2); }
.accb { padding: 4px 11px 10px; border-top: 1px dashed var(--paper3); animation: accin .18s ease-out; }
@keyframes accin { from { opacity: 0; transform: translateY(-4px); } }
details.acc.flat { background: rgba(255, 255, 255, .25); margin-top: 16px; }
details.acc.year { margin: 4px 0; }
details.acc.year > summary { min-height: 34px; padding: 5px 10px; }
details.acc.year .accb { padding-top: 2px; }
.kinds { display: flex; gap: 2px; }
.kinds .lg { width: 17px; height: 17px; border-radius: 4px; font-size: 11px; line-height: 17px; text-align: center; background: var(--paper3); color: var(--ink2); }
.kinds .k-rebel, .kinds .k-war, .kinds .k-disaster, .kinds .k-bad { background: var(--bad); color: #fff; }
.kinds .k-good { background: var(--good); color: #fff; } .kinds .k-reign { background: var(--gold); color: var(--red3); }
.kinds .k-policy, .kinds .k-court { background: var(--blue); color: #fff; } .kinds .k-foreign { background: #7d5a8c; color: #fff; }
.cnt { display: inline-block; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; padding: 0 6px; line-height: 17px; border-radius: 9px; background: var(--paper3); color: var(--ink2); letter-spacing: 0; text-transform: none; }
.cnt.hot { background: var(--red); color: #fff; } .cnt.good { background: var(--good); color: #fff; }
.minibar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: rgba(60, 40, 20, .13); overflow: hidden; flex: none; vertical-align: middle; }
.minibar i { display: block; height: 100%; border-radius: 3px; }
.ws { font-weight: 700; font-size: 12.5px; padding: 0 7px; border-radius: 9px; line-height: 18px; }
.ws.up { background: rgba(60, 122, 76, .18); color: #1f5530; } .ws.dn { background: rgba(179, 55, 42, .16); color: #7d2016; }
.pwr { font-size: 12px; color: var(--ink2); min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.pwr::before { content: "⚔ "; opacity: .55; }

/* компактные мерки в две колонки */
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.mgrid .mrow { grid-template-columns: 96px 1fr 34px; font-size: 13px; }
.card.slim { padding: 4px 11px; margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.facts span { font-size: 12.5px; background: rgba(255, 255, 255, .55); border: 1px solid var(--paper3); border-radius: 12px; padding: 1px 9px 1px 3px; display: inline-flex; align-items: center; gap: 5px; cursor: help; }
.facts em { font-style: normal; width: 18px; height: 18px; border-radius: 50%; background: var(--ink2); color: var(--paper); font-size: 11px; line-height: 18px; text-align: center; }

/* полоса провинций */
.pstrip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.pstrip button { font-size: 12px; padding: 2px 8px 2px 6px; border-radius: 11px; border: 1px solid var(--paper3); background: rgba(255, 255, 255, .55); color: var(--ink); display: inline-flex; align-items: center; gap: 5px; transition: border-color .12s, background .12s; }
.pstrip button i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.pstrip button:hover { border-color: var(--ink2); background: #fffaf0; }
.pstrip button.on { background: linear-gradient(#c24129, var(--red)); color: #fff; border-color: #6d1c10; font-weight: 700; }
.pstrip button.lost { color: var(--muted); font-style: italic; }
.pstrip button.reb:not(.on) { border-color: var(--bad); color: var(--red3); }

/* обзор: принцы и бюджет */
.princes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.prince { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--paper3); border-radius: 8px; background: rgba(255, 255, 255, .45); }
.prince.heir { border-color: #d6b66c; background: linear-gradient(135deg, rgba(255, 244, 210, .85), rgba(255, 255, 255, .4)); }
.prince .nm { font-size: 13.5px; }
.prince .st { font-size: 11.5px; color: var(--ink2); }
.prince .st .tag { font-size: 10.5px; padding: 0 5px; }
.prince .amb { margin-top: 2px; }
.prince .amb .minibar { width: 100%; height: 4px; }
.budget { padding-top: 6px; }
.bud { margin: 4px 0 8px; }
.bh { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink2); }
.bh b { font-size: 14px; color: var(--ink); letter-spacing: 0; }
.bbar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: rgba(60, 40, 20, .08); margin: 3px 0 4px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15); }
.bbar i { display: block; height: 100%; border-right: 1px solid rgba(255, 255, 255, .6); cursor: help; transition: filter .12s; }
.bbar i:hover { filter: brightness(1.15); }
.bleg { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 11.5px; color: var(--ink2); }
.bleg b { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.bleg em { font-style: normal; color: var(--ink); font-weight: 700; }

/* двор: кандидаты */
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.cand { display: flex; gap: 8px; align-items: center; padding: 7px 8px; border: 1px solid var(--paper3); border-radius: 8px; background: linear-gradient(rgba(255, 255, 255, .65), rgba(255, 255, 255, .35)); }
.cand .nm { font-size: 13.5px; }
.card.fcard { padding: 7px 11px; }

/* указы */
.dline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dline .dots { display: inline-flex; gap: 3px; }
.dd { width: 20px; height: 20px; border-radius: 4px; border: 1.5px solid rgba(168, 50, 31, .45); font-family: var(--brush); font-size: 14px; line-height: 17px; text-align: center; color: rgba(168, 50, 31, .45); transform: rotate(-4deg); }
.dd.on { background: radial-gradient(circle at 35% 30%, #c74a33, var(--red)); border-color: #e98a70; color: #fbeedd; }
h3 .zh { font-family: var(--brush); font-size: 16px; color: var(--red); letter-spacing: 0; }
.act .ab { display: flex; flex-direction: column; min-width: 0; }
.act .ds { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.act { padding: 7px 9px; }

/* границы */
.armyline { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink2); margin: -2px 0 6px; cursor: help; }
.armyline em { font-style: normal; font-family: var(--brush); color: var(--red); margin-right: 3px; font-size: 15px; }
.armyline .pw { margin-left: auto; }
.armyline .pw b { color: var(--red3); font-size: 14px; }

/* итоги */
.scorebox { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.scorebox > div { text-align: center; padding: 6px 4px; border: 1px solid var(--paper3); border-radius: 8px; background: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .35)); }
.scorebox em { display: block; font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink2); }
.scorebox b { display: block; font-size: 20px; color: var(--red3); line-height: 1.2; }
.scorebox small { font-size: 11px; color: var(--muted); }
.chartcard { padding-top: 4px; }
.chartcard .subnav { margin-bottom: 8px; }

/* наверх */
#totop {
  position: absolute; right: 18px; bottom: 18px; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid #e98a70; z-index: 6;
  background: radial-gradient(circle at 35% 30%, #c74a33, var(--red)); color: #fbeedd; font-family: var(--brush); font-size: 22px; line-height: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3); opacity: 0; transform: translateY(10px) scale(.9); pointer-events: none; transition: opacity .2s, transform .2s;
}
#totop.show { opacity: 1; transform: none; pointer-events: auto; }
#totop:hover { filter: brightness(1.1); }

@media (max-width: 1000px) {
  .phead { top: 0; margin-top: -10px; }
  #totop { position: fixed; right: 14px; bottom: 14px; }
}
@media (max-width: 520px) {
  .mgrid { grid-template-columns: 1fr; }
  .scorebox { grid-template-columns: repeat(2, 1fr); }
  .subnav button { padding: 6px 8px 7px; font-size: 12.5px; }
  details.acc > summary .cur { max-width: 38%; }
}
.subnav button { padding: 6px 7px 7px; gap: 4px; min-width: 0; }
.subnav button .sl { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) {
  .subnav button:not(.on) .sl { display: none; }
  .subnav button .zh { font-size: 19px; }
  .subnav button.on { flex-grow: 3; }
}
