:root {
  --bg: #14161b;
  --bg2: #1c1f26;
  --bg3: #252932;
  --line: #343946;
  --text: #e8e4da;
  --muted: #9a9caa;
  --gold: #d9b45a;
  --good: #6cc07a;
  --bad: #e06a5c;
  --warn: #e3b552;
  --info: #7fb2e5;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, system-ui, sans-serif;
  display: flex; flex-direction: column;
  min-height: 100vh;
}
button {
  font: inherit; color: inherit; cursor: pointer;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px;
}
button:hover:not(:disabled) { border-color: var(--gold); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--gold); color: #1b1608; border-color: var(--gold); font-weight: 700; padding: 9px 22px; }
button.ghost { background: transparent; }
a { color: var(--gold); }

/* Viršutinė juosta */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 16px; background: var(--bg2); border-bottom: 1px solid var(--line);
}
.brand { font-family: Cinzel, Georgia, serif; font-weight: 700; letter-spacing: 3px; color: var(--gold); font-size: 18px; }
.flag-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.5); flex: none; }
.time { display: flex; align-items: center; gap: 10px; }
.date { font-variant-numeric: tabular-nums; min-width: 190px; font-weight: 600; }
.speed { display: flex; gap: 2px; }
.speed button { padding: 4px 9px; border-radius: 4px; }
.speed button.active { background: var(--gold); color: #1b1608; border-color: var(--gold); font-weight: 700; }
.quick { display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; }
.quick .q { display: flex; flex-direction: column; line-height: 1.15; }
.quick .q small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.quick .q b { font-variant-numeric: tabular-nums; }
.menu { display: flex; gap: 4px; }

/* Išdėstymas */
.layout {
  flex: 1; display: grid; gap: 10px; padding: 10px;
  grid-template-columns: minmax(0, 1fr) var(--panel-w, 400px);
  grid-template-rows: minmax(0, 1fr) var(--log-h, 190px);
  grid-template-areas: "map panel" "log panel";
  min-height: 0;
}
.map-wrap { grid-area: map; position: relative; background: #1a3256; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 260px; }
#map { position: absolute; inset: 0; display: block; touch-action: none; }
.map-modes { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 4px; flex-wrap: wrap; }
.map-modes button { background: rgba(20,22,27,.85); font-size: 12px; padding: 4px 8px; }
.map-modes button.active { border-color: var(--gold); color: var(--gold); }
.paused-badge { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(20,22,27,.85); border: 1px solid var(--gold); color: var(--gold); padding: 3px 14px; border-radius: 20px; font-weight: 700; letter-spacing: 2px; font-size: 12px; }
.tooltip { position: absolute; pointer-events: none; background: rgba(20,22,27,.94); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 12px; min-width: 170px; }
.tooltip b { display: block; margin-bottom: 2px; }

/* Šoninis skydelis */
.panel { grid-area: panel; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.panel-head { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-family: Cinzel, Georgia, serif; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.panel-head .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.panel-head .back { margin-top: 8px; font-size: 12px; padding: 3px 8px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: none; border-radius: 0; background: transparent; padding: 9px 2px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 12.5px; }
.tabs button.active { color: var(--gold); border-bottom-color: var(--gold); }
.panel-body { padding: 12px 14px; overflow-y: auto; flex: 1; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--bg3); border-radius: 6px; padding: 7px 9px; }
.stat small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.stat b { font-variant-numeric: tabular-nums; font-size: 15px; }
.bar-stat { margin-top: 12px; }
.bar-stat .lbl { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.bar { height: 9px; background: var(--bg3); border-radius: 5px; position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; transition: width .3s; }
.bar > em { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; opacity: .7; }
.trend { font-size: 11px; color: var(--muted); }
.up { color: var(--good); } .down { color: var(--bad); }
.section-title { margin: 16px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
canvas.spark { width: 100%; height: 90px; background: var(--bg3); border-radius: 6px; display: block; }
.legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 4px; }
.mods { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.mods li { background: var(--bg3); border-radius: 6px; padding: 6px 9px; font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.mods li span:last-child { color: var(--muted); white-space: nowrap; }
.muted { color: var(--muted); }

/* Politika */
.policy { margin-bottom: 16px; }
.policy .lbl { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 600; }
.policy p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.policy input[type=range] { width: 100%; accent-color: var(--gold); }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.levels button { padding: 5px 0; font-size: 12px; }
.levels button.active { background: var(--gold); color: #1b1608; border-color: var(--gold); font-weight: 700; }
.balance { background: var(--bg3); border-radius: 6px; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.balance .total { border-top: 1px solid var(--line); padding-top: 4px; font-weight: 700; }

/* Sprendimai */
.decisions { display: grid; gap: 8px; }
.decision { text-align: left; display: grid; grid-template-columns: 30px 1fr; gap: 2px 8px; padding: 9px 10px; background: var(--bg3); }
.decision .ic { grid-row: span 3; font-size: 20px; line-height: 1; }
.decision .nm { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.decision .nm span { color: var(--gold); font-weight: 600; font-size: 12px; white-space: nowrap; }
.decision .ds { font-size: 12px; color: var(--muted); }
.decision .why { font-size: 11px; color: var(--warn); }

/* Pasaulis */
table.world { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.world th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 3px; border-bottom: 1px solid var(--line); }
table.world td { padding: 6px 3px; border-bottom: 1px solid var(--line); }
table.world tr { cursor: pointer; }
table.world tbody tr:hover td { background: var(--bg3); }
table.world td.nm { display: flex; align-items: center; gap: 6px; font-weight: 600; }

/* Diplomatija ir resursai */
.tag { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--gold); border: 1px solid #5a4b26; border-radius: 4px; padding: 0 4px; font-weight: 600; white-space: nowrap; }
.opinion-box { display: grid; grid-template-columns: auto 1fr; gap: 12px; background: var(--bg3); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; }
.opinion-box small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.opinion-box b { font-size: 26px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.opinion-box .pers { font-size: 13px; text-align: right; }
td.icons span { margin-right: 3px; }
.decision .why .ok { color: var(--good); }
.decision .why .no { color: var(--warn); }
button.mini { font-size: 11px; padding: 2px 7px; }
.mods li button.mini { flex: none; }
table.res { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.res th { text-align: left; color: var(--muted); font-weight: 500; padding: 3px; border-bottom: 1px solid var(--line); }
table.res td { padding: 4px 3px; border-bottom: 1px solid var(--line); }
table.res td.warn { color: var(--warn); }
table.res td:last-child { white-space: nowrap; }
.saves .slot { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.saves .slot-name { font-weight: 600; color: var(--gold); font-size: 13px; }
.saves .slot-info { font-size: 13px; }
.saves .slot-info .swatch { vertical-align: -2px; margin-right: 5px; }
.saves .slot-info small { display: block; color: var(--muted); font-size: 11px; }
.saves .slot-actions { display: flex; gap: 4px; }
.saves .slot-actions button { font-size: 12px; padding: 4px 8px; }
@media (max-width: 520px) { .saves .slot { grid-template-columns: 1fr; gap: 4px; } }

/* Žurnalas */
.log-wrap { grid-area: log; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.log-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.log-head label { font-weight: 400; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.log { list-style: none; margin: 0; padding: 4px 12px; overflow-y: auto; flex: 1; font-size: 12.5px; }
.log li { padding: 3px 0; border-bottom: 1px dashed #2a2e38; display: flex; gap: 10px; }
.log li time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; flex: none; min-width: 110px; }
.log li.good { color: var(--good); } .log li.diplo { color: var(--info); } .log li.bad { color: var(--bad); } .log li.player { color: var(--gold); } .log li.world { color: #b9bccb; }

.credit { text-align: center; padding: 6px 10px 10px; color: var(--muted); font-size: 13px; }
.credit a { font-weight: 700; }

/* Langai */
.overlay { position: fixed; inset: 0; background: rgba(8,9,12,.55); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.overlay[hidden] { display: none; }
#start-screen { background: linear-gradient(90deg, rgba(8,9,12,.92) 0%, rgba(8,9,12,.7) 45%, rgba(8,9,12,.1) 100%); justify-content: flex-start; }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; max-width: 520px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.5); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal h1 { font-family: Cinzel, Georgia, serif; color: var(--gold); letter-spacing: 6px; margin: 0 0 6px; font-size: 34px; }
.modal h2 { font-family: Cinzel, Georgia, serif; margin: 0 0 8px; }
.modal .sub { color: var(--muted); margin-top: 0; }
.country-list { display: grid; gap: 6px; margin: 14px 0; }
.country-opt { text-align: left; display: grid; grid-template-columns: 16px 1fr; gap: 1px 10px; padding: 8px 10px; }
.country-opt .swatch { grid-row: span 2; margin-top: 3px; }
.country-opt b { display: flex; justify-content: space-between; gap: 8px; }
.country-opt b span { font-weight: 400; font-size: 11px; color: var(--muted); }
.country-opt small { color: var(--muted); font-size: 12px; }
.country-opt.active { border-color: var(--gold); background: #2c2a24; }
.start-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.credit-inline { text-align: right; color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.event-kicker { color: var(--gold); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.event-choices { display: grid; gap: 8px; margin-top: 16px; }
.event-choices button { text-align: left; padding: 10px 12px; }
.event-choices button small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.toast { position: fixed; bottom: 46px; left: 50%; transform: translateX(-50%); background: var(--bg3); border: 1px solid var(--gold); padding: 8px 16px; border-radius: 20px; z-index: 20; }

@media (max-width: 900px) {
  .layout { display: flex; flex-direction: column; padding: 8px; flex: none; min-height: auto; }
  .map-wrap { min-height: 0; height: 62vh; width: 100%; }
  .layout > * { flex: none; }
  .panel { min-height: auto; }
  .log-wrap { height: 220px; }
  .map-modes { left: 6px; bottom: 6px; }
  .map-modes button { font-size: 11px; padding: 3px 6px; }
  .panel { max-height: none; }
  .panel-body { overflow: visible; }
  .quick { margin-left: 0; width: 100%; justify-content: space-between; }
  .date { min-width: 0; }
  #start-screen { background: rgba(8,9,12,.75); justify-content: center; }
}

/* 3 etapas: žemėlapio valdymas, kariuomenė */
.zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; }
.zoom button { width: 34px; height: 34px; padding: 0; background: rgba(20,22,27,.88); font-size: 17px; line-height: 1; }
.search { width: 100%; margin-top: 12px; padding: 9px 12px; background: var(--bg3); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.search:focus { outline: none; border-color: var(--gold); }
.country-list { max-height: 42vh; overflow-y: auto; }
.start-pick { font-size: 13px; margin: 0 0 10px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.decision.danger { border-color: #6a3a36; }
.decision.danger .ic { filter: saturate(1.4); }
.war-score { display: flex; justify-content: space-between; font-size: 13px; }
.score-bar { position: relative; height: 8px; background: var(--bg3); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.score-bar::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--muted); }
.score-bar i { position: absolute; top: 0; bottom: 0; background: var(--good); }
.army-card { background: var(--bg3); border: 1px solid var(--gold); border-radius: var(--radius); padding: 10px; margin-bottom: 12px; }
.army-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.army-head span { margin-left: auto; color: var(--muted); font-size: 12px; }
.army-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.army-actions button { font-size: 12px; padding: 5px 9px; }
.army-actions button.active { border-color: var(--gold); color: var(--gold); }
table.armies tr { cursor: pointer; }
table.armies tr.active td { background: #2c2a24; }
.recruit { display: flex; gap: 6px; flex-wrap: wrap; }
.recruit button { display: flex; flex-direction: column; font-size: 12px; padding: 5px 9px; }
.recruit button small { color: var(--muted); font-size: 10.5px; }
.mods li.clickable { cursor: pointer; }
.mods li.clickable:hover { color: var(--gold); }
#loading { z-index: 50; }
.tabs button { font-size: 11.5px; padding: 9px 1px; min-width: 0; }

/* 4 etapas: regionai, tyrimai, išsamūs langai, sunkumas */
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); }
.tabs button { font-size: 11.5px; padding: 7px 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-style: normal; background: var(--gold); color: #1b1608; border-radius: 8px; padding: 0 5px; font-size: 10px; font-weight: 700; margin-left: 2px; }
.badge.warn { background: var(--bad); color: #fff; }
button.stat { text-align: left; border: 1px solid transparent; font: inherit; color: inherit; display: block; width: 100%; }
button.stat em, .stat em { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); }
button.stat.link:hover em { color: var(--gold); }
.link-stat { cursor: pointer; border-radius: 6px; }
.link-stat:hover .lbl span:first-child { color: var(--gold); }
.link-stat .lbl span:first-child::after { content: ' ›'; color: var(--muted); }
table.res tr.clickable { cursor: pointer; }
table.res tr.clickable:hover td { background: var(--bg3); }
.people { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.people > div { background: var(--bg3); border-radius: 6px; padding: 6px 8px; min-width: 0; }
.people small { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px; }
.people b { font-variant-numeric: tabular-nums; font-size: 14px; }
.rstats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.rstat { display: grid; grid-template-columns: 1fr auto auto; gap: 0 6px; align-items: baseline; background: var(--bg3); border-radius: 6px; padding: 5px 8px 6px; font-size: 12px; text-align: left; border: 1px solid transparent; }
button.rstat:hover { border-color: var(--gold); }
.rstat.active { border-color: var(--gold); }
.rstat .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rstat .d { font-size: 11px; min-width: 30px; text-align: right; }
.mini-bar { grid-column: 1 / -1; display: block; height: 4px; background: #1a1d23; border-radius: 2px; position: relative; overflow: hidden; margin-top: 3px; }
.mini-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; }
.mini-bar.big { height: 8px; margin: 6px 0 4px; }
.fx { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.fx b { color: var(--text); font-weight: 500; }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.queue li { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 8px; align-items: center; background: var(--bg3); border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.bulk { display: flex; flex-wrap: wrap; gap: 4px; }
.bulk button { font-size: 11px; }
.sort { float: right; text-transform: none; letter-spacing: 0; }
.sort a { color: var(--muted); text-decoration: none; margin-left: 4px; }
.sort a.on { color: var(--gold); font-weight: 600; }
table.provs tr { cursor: pointer; }
table.provs td:first-child { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-h { font-family: Cinzel, Georgia, serif; margin: 8px 0 2px; font-size: 17px; }
.panel-body > .back { font-size: 12px; padding: 3px 8px; }
.bld { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; background: var(--bg3); border-radius: 6px; padding: 7px 8px; margin-bottom: 5px; font-size: 12.5px; border: 1px solid transparent; }
.bld.has { border-color: #3d3a2c; }
.bld .ic { font-size: 18px; line-height: 1.2; }
.bld .ds { font-size: 11.5px; color: var(--muted); }
.bld .ds.gain { color: var(--info); }
.bld .why { font-size: 11px; color: var(--warn); }
.bld button { font-size: 11.5px; line-height: 1.2; padding: 4px 8px; }
.bld button small { color: var(--muted); font-size: 10.5px; }
.bgroup .section-title { margin: 12px 0 5px; }
.research-head { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.research-head > div { background: var(--bg3); border-radius: 6px; padding: 6px 9px; }
.research-head small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.cur-research { background: var(--bg3); border: 1px solid #2f4a66; border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.cur-research .warn { color: var(--warn); }
.tech-list { display: grid; gap: 5px; }
.tech { display: grid; grid-template-columns: 1fr auto; gap: 8px; background: var(--bg3); border-radius: 6px; padding: 7px 9px; font-size: 12.5px; border-left: 3px solid var(--line); }
.tech .ds { font-size: 11.5px; color: var(--muted); }
.tech .why { font-size: 11px; color: var(--warn); }
.tech.done { border-left-color: var(--good); opacity: .75; }
.tech.done b { color: var(--good); }
.tech.cur { border-left-color: var(--info); background: #222c38; }
.tech.avail { border-left-color: var(--gold); }
.tech.locked { opacity: .6; }
.tbtn { display: flex; flex-direction: column; gap: 4px; }
.modal.detail { max-width: 640px; position: relative; }
.modal .close { position: absolute; top: 12px; right: 12px; padding: 2px 9px; }
.factors { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; }
.factors li { display: flex; justify-content: space-between; gap: 10px; background: var(--bg3); border-radius: 5px; padding: 4px 8px; }
.factors b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two > div { min-width: 0; }
svg.chart { width: 100%; height: 150px; background: var(--bg3); border-radius: 6px; display: block; }
svg.chart text { fill: var(--muted); font-size: 11px; font-family: Inter, sans-serif; }
svg.chart text.v { fill: var(--text); font-weight: 600; }
.flow { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 12.5px; background: var(--bg3); border-radius: 6px; padding: 8px 10px; margin-top: 8px; font-variant-numeric: tabular-nums; }
table.trade select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 12px; padding: 2px; }
.start-opts { border-top: 1px solid var(--line); padding-top: 10px; margin-bottom: 12px; }
.start-opts .lbl { font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.hist-follow { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin: 0 0 10px; background: rgba(127,127,127,0.06); }
.hist-follow label { font-size: 13px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.hist-follow p { font-size: 11.5px; margin: 4px 0 0; }
.hist-follow[hidden] { display: none; }
.levels.four { grid-template-columns: repeat(4, 1fr); }
#btn-edit.active { border-color: var(--gold); color: var(--gold); }
.edit-box { display: grid; gap: 6px; margin-top: 8px; background: var(--bg3); border-radius: 8px; padding: 10px; }
.edit-box .section-title { margin: 6px 0 2px; }
.ed { display: grid; gap: 2px; font-size: 12.5px; }
.ed > span { display: flex; justify-content: space-between; }
.ed input[type=range] { width: 100%; accent-color: var(--gold); }
.ed input[type=text], .ed select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 5px; font: inherit; padding: 5px 7px; }
.ed-res { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12px; }
.ed-res label { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ed-res input { width: 58px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; padding: 3px 5px; }
@media (max-width: 520px) {
  .two, .rstats { grid-template-columns: 1fr; }
  .people { grid-template-columns: 1fr 1fr; }
}

/* QoL: žemėlapio lango dydis, šalių lentelės filtrai, sprendimų grupės */
.zsep { height: 4px; }
.panel { position: relative; }
.log-wrap { position: relative; }
.resizer-v { position: absolute; left: -8px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 3; }
.resizer-h { position: absolute; top: -8px; left: 0; right: 0; height: 8px; cursor: row-resize; z-index: 3; }
.resizer-v:hover, .resizer-h:hover, .resizing .resizer-v, .resizing .resizer-h { background: rgba(217,180,90,.35); border-radius: 4px; }
body.resizing { user-select: none; }
body[data-layout="small"] .layout { --panel-w: 560px; --log-h: 300px; }
body[data-layout="big"] .layout { --log-h: 0px; }
body[data-layout="big"] .log-wrap { display: none; }
body[data-layout="full"] .layout { grid-template-columns: minmax(0, 1fr) 0; grid-template-rows: minmax(0, 1fr) 0; gap: 0; }
body[data-layout="full"] .panel, body[data-layout="full"] .log-wrap { display: none; }
.search.small { margin: 0; padding: 6px 9px; font-size: 13px; }
.ct-ctrl { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.ct-ctrl select { background: var(--bg3); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 12.5px; padding: 4px 6px; max-width: 150px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.chip { font-size: 11.5px; padding: 3px 8px; border-radius: 12px; }
.chip.on { background: var(--gold); color: #1b1608; border-color: var(--gold); font-weight: 600; }
table.world th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
table.world th[data-sort]:hover, table.world th.sorted { color: var(--gold); }
table.world tr.me td { background: #2a281f; }
.dec-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 8px; gap: 8px; }
.dec-top label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.dec-group { margin-bottom: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); }
.dec-group > summary { cursor: pointer; padding: 7px 10px; font-weight: 600; font-size: 13px; list-style: none; display: flex; gap: 6px; align-items: center; }
.dec-group > summary::-webkit-details-marker { display: none; }
.dec-group > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
.dec-group[open] > summary::before { transform: rotate(90deg); }
.dec-group > summary span { margin-left: auto; font-weight: 400; font-size: 11.5px; }
.dec-group .decisions { padding: 0 6px 6px; gap: 5px; }
.decision.compact { padding: 6px 8px; grid-template-columns: 24px 1fr; }
.decision.compact .ic { font-size: 17px; }
.decision.compact .ds { font-size: 11.5px; line-height: 1.35; }
.decision[hidden] { display: none; }
.warnings { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.warnings li { font-size: 12px; background: #2b2220; border-left: 3px solid var(--bad); border-radius: 5px; padding: 5px 8px; cursor: pointer; }
.warnings li.warn { background: #2a2719; border-left-color: var(--warn); }
.warnings li:hover { filter: brightness(1.15); }
@media (max-width: 900px) {
  .resizer-v, .resizer-h { display: none; }
  body[data-layout="small"] .map-wrap { height: 42vh; }
  body[data-layout="big"] .map-wrap { height: 80vh; }
  body[data-layout="big"] .log-wrap { display: flex; }
  body[data-layout="full"] .map-wrap { height: calc(100vh - 110px); }
  body[data-layout="full"] .panel, body[data-layout="full"] .log-wrap { display: none; }
}

/* Pasaulio įtampa, krizės, nustatymai */
.quick button.q { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.quick button.q:hover small { color: var(--gold); }
ul.conds { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
ul.conds li { display: grid; grid-template-columns: 1fr 90px 28px; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; padding: 3px 6px; border-radius: 4px; }
ul.conds li:hover { background: rgba(255,255,255,.04); }
ul.conds li .mini-bar { grid-column: auto; margin: 0; }
ul.conds li b { text-align: right; font-variant-numeric: tabular-nums; }
.mini-bar.big { height: 8px; margin: 8px 0 4px; }
.set-row { display: grid; gap: 4px; margin: 6px 0; font-size: 12.5px; }

/* Tarptautinės organizacijos */
.org-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.org-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line, #3a3f4a); color: var(--muted); }
.org-badge.on { color: var(--gold); border-color: var(--gold); }
.org-card { border: 1px solid var(--line, #3a3f4a); border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; }
.org-head { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.org-head .ic { font-size: 16px; }
.org-card p { font-size: 12px; margin: 4px 0; }
.org-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.org-actions button { font-size: 11.5px; padding: 3px 7px; }
.org-card.member { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }

.org-card .factors li { flex-wrap: wrap; gap: 2px 8px; }
.org-card .factors li b { margin-left: auto; text-align: right; }

/* Pajėgų struktūra */
.mixbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 8px 0 2px; background: var(--bg3); }
.mixbar i, .mixlegend i { display: block; height: 100%; }
.mixlegend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--muted); }
.mixlegend span { display: inline-flex; align-items: center; gap: 4px; }
.mixlegend i { width: 9px; height: 9px; border-radius: 2px; }
.u-inf { background: #8d9a6a; } .u-mech { background: #6f9bb8; } .u-tank { background: #b87a4b; } .u-art { background: #c4544a; }
.u-eng { background: #b5a24a; } .u-ad { background: #7a6bc0; } .u-sup { background: #5fae9a; } .u-rec { background: #c9c9c9; }
.levels.kinds { grid-template-columns: repeat(3, 1fr); margin-bottom: 6px; }
.levels.kinds button { font-size: 11px; padding: 4px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.forces td, table.forces th { font-size: 11.5px; }
.decision.chosen { border-color: var(--gold); }

/* Taikos konferencija */
.modal.conf { max-width: 1280px; width: 100%; height: calc(100vh - 32px); display: flex; flex-direction: column; padding: 16px 18px; overflow: hidden; }
.conf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.conf-head h2 { font-size: 20px; }
.conf-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 14px; min-height: 0; }
.conf-mapwrap { position: relative; min-height: 260px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.conf-mapwrap canvas { width: 100%; height: 100%; display: block; }
.conf-legend { position: absolute; left: 8px; bottom: 6px; right: 8px; font-size: 11px; background: rgba(20,22,27,.75); padding: 4px 8px; border-radius: 6px; }
.conf-side { overflow-y: auto; padding-right: 4px; }
.conf-parts li.turn { outline: 1px solid var(--gold); border-radius: 4px; }
.conf-parts .swatch, .conf-dem .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.conf-kinds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.conf-kinds button { font-size: 11.5px; padding: 5px 6px; text-align: left; }
.conf-kinds button.active { background: var(--gold); color: #1b1608; border-color: var(--gold); font-weight: 700; }
.conf-dem li { align-items: flex-start; gap: 8px; }
.conf-dem li > span:last-child { text-align: right; white-space: nowrap; }
.conf-hist { font-size: 11.5px; color: var(--muted); padding-left: 18px; margin: 4px 0; }
@media (max-width: 860px) {
  .modal.conf { height: auto; max-height: calc(100vh - 32px); overflow-y: auto; }
  .conf-body { grid-template-columns: 1fr; }
  .conf-mapwrap { height: 300px; }
}

/* Partijos ir parlamentai */
.seatbar { position: relative; display: flex; height: 14px; border-radius: 4px; overflow: hidden; margin: 6px 0 2px; background: var(--bg3); }
.seatbar i { display: block; min-width: 1px; }
.seatbar::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--text, #fff); opacity: .7; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
table.pol td { vertical-align: top; }
table.pol td small { font-size: 10.5px; }
.factors.wrap li { flex-wrap: wrap; gap: 2px 8px; }
.factors.wrap li b { white-space: normal; margin-left: auto; text-align: right; }

/* Struktūrizuota įvykio kortelė (balsavimai, kvietimai, kvotos) */
.ev-card { margin-top: 10px; border: 1px solid var(--line, #333); border-radius: 8px; overflow: hidden; font-size: 13px; }
.ev-head { padding: 6px 10px; font-weight: 600; background: rgba(255,255,255,.05); color: var(--gold); }
.ev-row { display: grid; grid-template-columns: 22px minmax(90px, 34%) 1fr; gap: 6px; padding: 5px 10px; border-top: 1px solid rgba(255,255,255,.06); align-items: start; }
.ev-ic { text-align: center; }
.ev-k { color: var(--muted); }
.ev-v { overflow-wrap: anywhere; }
@media (max-width: 520px) { .ev-row { grid-template-columns: 22px 1fr; } .ev-v { grid-column: 2; } }
.ev-card.compact { margin: 6px 0; font-size: 12px; }
.ev-card.compact .ev-row { padding: 3px 8px; }

.help-btn { margin-left: auto; font-family: inherit; font-size: 12px; padding: 3px 8px; }
.modal.help { max-width: 640px; max-height: 85vh; overflow-y: auto; }
.modal.help details { border-top: 1px solid var(--line); padding: 6px 0; }
.modal.help summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.modal.help p { font-size: 13px; margin: 6px 0; line-height: 1.45; }

/* Politinė karjera (v1.4) */
.role-chip { color: var(--gold); font-weight: 600; }
.org-card.career { border-left: 3px solid var(--gold); margin-bottom: 8px; }
.org-card.career .stats { margin: 6px 0 2px; }
.org-card.career select { font-size: 12px; max-width: 220px; }
.mod-row { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; cursor: pointer; }
.mod-row input { margin-top: 3px; }
.edit-box[hidden] { display: none; }
body.ro #panel-body [data-diplo], body.ro #panel-body [data-recruit], body.ro #panel-body .army-actions button,
body.ro #panel-body button[data-act]:not([data-act^="car"]):not([data-act="tab"]):not([data-act="detail"]):not([data-act="cfold"]) { opacity: .5; }
/* Žemėlapio stiliaus perjungiklis (js/mapstyles.js) */
.map-styles { position: absolute; left: 10px; top: 10px; display: flex; gap: 4px; }
.map-styles button { width: 30px; height: 30px; padding: 0; background: rgba(20,22,27,.85); font-size: 15px; line-height: 1; }
.map-styles button.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
@media (max-width: 760px) { .map-styles { left: 6px; top: 6px; } .map-styles button { width: 26px; height: 26px; font-size: 13px; } }
/* Veikėjas (v1.5) */
.ch-tab { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ch-tab td { padding: 2px 4px; vertical-align: middle; }
.ch-tab td:nth-child(2) { width: 40%; }
.ch-bar { display: block; height: 7px; border-radius: 4px; background: rgba(127,127,127,.18); overflow: hidden; }
.ch-bar i { display: block; height: 100%; border-radius: 4px; }
.ch-trait { display: inline-block; font-size: 11.5px; padding: 2px 7px; border-radius: 10px; border: 1px solid var(--gold); margin-right: 4px; }
.ch-start { margin-top: 8px; padding: 8px; border: 1px solid rgba(127,127,127,.3); border-radius: 8px; display: grid; gap: 6px; font-size: 12.5px; }
.ch-start label { display: flex; gap: 6px; align-items: center; }
.ch-start input[type=text], .ch-start select { flex: 1; min-width: 0; }
.ch-start input[type=number] { width: 70px; }
/* Verslas (v1.7) */
.ch-spark { display: flex; align-items: flex-end; gap: 2px; height: 34px; margin-top: 6px; }
.ch-spark i { flex: 1; background: var(--gold); opacity: .7; border-radius: 2px 2px 0 0; }
/* IV-b: įmonių sąrašas */
.firm-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; max-height: 420px; overflow-y: auto; }
.firm-row { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.2fr) 52px minmax(0, 1fr); gap: 6px; align-items: center; padding: 5px 6px; border-radius: 4px; font-size: 12px; cursor: pointer; background: rgba(255, 255, 255, .03); }
.firm-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.firm-row > span:nth-child(n+3) { text-align: right; }
.firm-row:hover, .firm-row.on { background: rgba(255, 255, 255, .08); }
.firm-row.mine { box-shadow: inset 3px 0 0 var(--gold); }
.firm-info { padding: 6px 8px 8px; margin: 0 0 4px; border-left: 2px solid var(--gold); background: rgba(255, 255, 255, .02); }
.firm-info .stats { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; }
.firm-info .stat { padding: 4px 6px; }
.firm-info .stat b { font-size: 12.5px; }
/* V-a: filialai */
.firm-branches { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .08); }
.firm-row.br { cursor: default; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) 52px minmax(0, 1.1fr); }
/* v2.1: išradimų santrauka */
.tech-sum { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12px; margin: 6px 0; padding: 6px 9px; background: var(--bg3); border-radius: 6px; }
.tech-sum .mini { margin-left: auto; }
.tech-done { font-size: 11.5px; display: grid; gap: 3px; margin: 0 0 6px; padding: 6px 9px; border-left: 2px solid var(--good); }
.tech.locked { opacity: .55; }
