@font-face { font-family: 'Flags'; src: url('../vendor/TwemojiCountryFlags.woff2') format('woff2'); unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F; font-display: swap; }
:root {
  --bg: #060c1c; --panel: rgba(9, 16, 36, 0.94); --panel2: rgba(20, 32, 64, 0.9); --line: rgba(140, 170, 255, 0.18);
  --text: #eef3ff; --dim: #9fb0d6; --gold: #ffd23f; --red: #ef4444; --blue: #3b82f6; --green: #22c55e; --teal: #14b8a6; --purple: #a855f7;
  --hd: 'Flags', 'Oswald', Impact, 'Arial Narrow Bold', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --tabs-h: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 15px/1.35 'Flags', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }
.hidden { display: none !important; }
#app { position: fixed; inset: 0; }
#globe { position: absolute; inset: 0; }
#globe canvas { display: block; width: 100% !important; height: 100% !important; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------- globe labels ---------- */
.glabel { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; white-space: nowrap; font-size: 11px; font-weight: 600; letter-spacing: .2px;
  color: #fff; text-shadow: 0 1px 3px #000, 0 0 6px rgba(0,0,0,.8); padding: 1px 4px; border-radius: 6px; will-change: transform; }
.glabel i { font-style: normal; margin-right: 2px; }
.glabel.war { background: rgba(200, 30, 30, .75); text-shadow: none; animation: warblink 1s infinite alternate; }
.glabel.ally { color: #b9ffd2; }
.glabel.trade { color: #a5f3fc; }
.glabel.sanc { color: #e9d5ff; }
.glabel.us { font-size: 13px; color: #fff; background: rgba(40, 90, 230, .8); text-shadow: none; }
.glabel.sel { background: var(--gold); color: #111; text-shadow: none; font-size: 13px; z-index: 5; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
@keyframes warblink { to { background: rgba(255, 70, 70, .95); } }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 0; left: 0; right: 0; padding: calc(6px + var(--safe-t)) 10px 6px; display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: linear-gradient(180deg, rgba(4, 9, 24, .95), rgba(4, 9, 24, .75)); border-bottom: 1px solid var(--line); z-index: 20; backdrop-filter: blur(6px); }
.hud-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.seal { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: radial-gradient(circle, #1e3a8a, #0b1530); border: 2px solid var(--gold); flex: none; }
#date { font: 700 18px var(--hd); letter-spacing: 1px; }
#term { font-size: 11px; color: var(--dim); white-space: nowrap; }
.hud-ap { flex: 1; max-width: 300px; text-align: center; cursor: pointer; position: relative; }
.aplabel { font-size: 10px; letter-spacing: 2px; color: var(--dim); }
#ap { font: 700 24px/1 var(--hd); }
.apbar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); margin-top: 3px; position: relative; overflow: hidden; }
.apbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; border-radius: 3px; background: linear-gradient(90deg, #ef4444, #f59e0b 40%, #22c55e 70%); background-size: 300px 6px; transition: width .6s; }
.apbar b.ap50 { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: rgba(255,255,255,.6); }
.hud-right { display: flex; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
.chip.big { font: 600 14px var(--hd); letter-spacing: .5px; padding: 5px 10px; }
.chip.neg { color: #fca5a5; } .chip.pos { color: #86efac; }
.iconbtn { width: 36px; height: 36px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 18px; display: grid; place-items: center; }
.iconbtn:active { transform: scale(.94); }
#statbar { position: absolute; top: calc(58px + var(--safe-t)); left: 0; right: 0; display: flex; gap: 6px; padding: 5px 10px; overflow-x: auto; z-index: 19; scrollbar-width: none; }
#statbar::-webkit-scrollbar { display: none; }
#statbar .chip { cursor: pointer; background: rgba(9,16,36,.8); }
#ticker { position: absolute; top: calc(92px + var(--safe-t)); left: 10px; right: 10px; height: 24px; display: flex; align-items: center; z-index: 18; border-radius: 6px; overflow: hidden; background: rgba(9,16,36,.75); border: 1px solid var(--line); pointer-events: none; }
.tk-tag { background: var(--red); font: 700 11px var(--hd); letter-spacing: 1px; padding: 0 8px; height: 100%; display: grid; place-items: center; flex: none; }
.tk-wrap { flex: 1; overflow: hidden; height: 100%; position: relative; }
#tickerText { position: absolute; white-space: nowrap; top: 3px; font-size: 12.5px; will-change: transform; }
#tickerText b { color: var(--gold); margin: 0 14px; }

/* mandates widget */
#mandates { position: absolute; left: 10px; top: calc(124px + var(--safe-t)); z-index: 17; width: 250px; background: rgba(9,16,36,.78); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 12.5px; }
#mandates h4 { margin: 0 0 4px; font: 600 12px var(--hd); letter-spacing: 1.5px; color: var(--gold); }
.mrow { display: flex; gap: 6px; padding: 3px 0; border-top: 1px solid rgba(255,255,255,.06); }
.mrow:first-of-type { border-top: 0; }
.mrow small { color: var(--dim); margin-left: auto; white-space: nowrap; }

/* ---------- tabs & panel ---------- */
#tabs { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; z-index: 30;
  background: linear-gradient(0deg, rgba(4,9,24,.98), rgba(4,9,24,.9)); border-top: 1px solid var(--line); }
#tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 10.5px; color: var(--dim); position: relative; min-width: 0; }
#tabs button i { font-style: normal; font-size: 21px; transition: transform .15s; }
#tabs button.on { color: var(--gold); }
#tabs button.on i { transform: translateY(-2px) scale(1.12); }
#tabs button.on::after { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
.dot { position: absolute; top: 8px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
#panel { position: absolute; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-b)); height: 56vh; z-index: 25; background: var(--panel); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; box-shadow: 0 -10px 30px rgba(0,0,0,.5); animation: slideup .22s ease-out; backdrop-filter: blur(8px); }
#panel.tall { height: 78vh; }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }
.panel-grab { width: 44px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 7px auto 0; flex: none; cursor: grab; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 6px 16px; flex: none; }
.panel-head h2 { margin: 0; font: 700 20px var(--hd); letter-spacing: 1px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; min-width: 0; }
#panelBody { flex: 1; overflow-y: auto; padding: 0 14px 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; user-select: text; }
#endBtn { position: absolute; right: 12px; bottom: calc(var(--tabs-h) + var(--safe-b) + 12px); z-index: 26; padding: 10px 18px; border-radius: 16px;
  background: linear-gradient(180deg, #ffe066, #f59e0b); color: #1a1200; box-shadow: 0 6px 20px rgba(245, 158, 11, .45), inset 0 -3px 0 rgba(0,0,0,.2); display: flex; flex-direction: column; align-items: center; animation: glow 2s infinite; }
#endBtn:active { transform: scale(.95); }
.eb-main { font: 700 18px var(--hd); letter-spacing: 1px; }
.eb-main::after { content: ' ▶'; }
.eb-sub { font-size: 11px; font-weight: 600; opacity: .8; }
#endBtn.busy { filter: grayscale(.7) brightness(.7); animation: none; pointer-events: none; }
body.panel-open #endBtn { bottom: calc(var(--tabs-h) + var(--safe-b) + 56vh + 10px); }
body.panel-open.tall #endBtn { display: none; }
@keyframes glow { 50% { box-shadow: 0 6px 30px rgba(255, 210, 63, .8), inset 0 -3px 0 rgba(0,0,0,.2); } }

/* ---------- panel content ---------- */
.sec { margin: 12px 0 6px; font: 600 13px var(--hd); letter-spacing: 1.5px; color: var(--gold); text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.sec small { color: var(--dim); font: 12px system-ui; letter-spacing: 0; text-transform: none; margin-left: auto; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--dim); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.kv > div { background: rgba(0,0,0,.2); border-radius: 10px; padding: 6px 8px; }
.kv b { display: block; font: 600 16px var(--hd); letter-spacing: .5px; }
.kv span { font-size: 11px; color: var(--dim); }
.bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; position: relative; }
.bar i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; transition: width .5s; }
.bar.center i { left: 50%; }
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 7px; }
.act { position: relative; text-align: left; padding: 9px 10px 8px; border-radius: 12px; background: linear-gradient(180deg, rgba(59,130,246,.22), rgba(59,130,246,.08)); border: 1px solid rgba(96,165,250,.35); min-height: 58px; transition: transform .1s; }
.act:active:not(:disabled) { transform: scale(.96); }
.act .ai { font-size: 18px; }
.act .an { font-weight: 700; font-size: 13.5px; display: block; margin-top: 1px; }
.act .ad { font-size: 11px; color: var(--dim); display: block; line-height: 1.2; margin-top: 2px; }
.act .cost { position: absolute; top: 7px; right: 8px; font-size: 11px; font-weight: 700; color: var(--gold); }
.act:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.6); }
.act.danger { background: linear-gradient(180deg, rgba(239,68,68,.3), rgba(239,68,68,.08)); border-color: rgba(248,113,113,.45); }
.act.good { background: linear-gradient(180deg, rgba(34,197,94,.25), rgba(34,197,94,.07)); border-color: rgba(74,222,128,.4); }
.btn { padding: 10px 16px; border-radius: 12px; font-weight: 700; background: var(--panel2); border: 1px solid var(--line); }
.btn.gold { background: linear-gradient(180deg, #ffe066, #f59e0b); color: #1a1200; border: 0; }
.btn.red { background: linear-gradient(180deg, #f87171, #dc2626); border: 0; }
.btn.blue { background: linear-gradient(180deg, #60a5fa, #2563eb); border: 0; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.search { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--text); outline: none; margin: 4px 0 8px; user-select: text; }
.clist { display: flex; flex-direction: column; gap: 4px; }
.crow { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.04); text-align: left; width: 100%; }
.crow:active { background: rgba(255,255,255,.1); }
.crow .fl { font-size: 20px; }
.crow .nm { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel { font: 600 13px var(--hd); min-width: 34px; text-align: right; }
.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.pill { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: rgba(255,255,255,.08); white-space: nowrap; }
.pill.war { background: #b91c1c; } .pill.ally { background: #15803d; } .pill.trade { background: #0f766e; } .pill.sanc { background: #6d28d9; } .pill.prog { background: #1d4ed8; }
.pol { padding: 9px 10px; }
.pol .pn { font-weight: 700; }
.lv { display: flex; gap: 4px; margin-top: 7px; }
.lv button { flex: 1; padding: 7px 2px; border-radius: 8px; background: rgba(255,255,255,.07); font-size: 11px; line-height: 1.1; border: 1px solid transparent; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lv button.cur { background: var(--gold); color: #111; font-weight: 700; }
.lv button:disabled { opacity: .5; }
.grp { display: grid; grid-template-columns: 26px 1fr 44px; align-items: center; gap: 6px; padding: 4px 0; }
.grp .gi { font-size: 18px; }
.grp .gv { font: 600 14px var(--hd); text-align: right; }
.trend-up { color: #4ade80; } .trend-down { color: #f87171; }
.spark { width: 100%; height: 70px; display: block; }
.warcard { border-color: rgba(248,113,113,.5); background: linear-gradient(180deg, rgba(127,29,29,.5), rgba(30,15,20,.6)); }
.front { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #b91c1c 0%, #444 50%, #1d4ed8 100%); position: relative; margin: 6px 0; }
.front b { position: absolute; top: -4px; width: 6px; height: 22px; border-radius: 3px; background: #fff; box-shadow: 0 0 8px #fff; transform: translateX(-3px); transition: left .6s; }
.strats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 6px; }
.strats button { padding: 7px; border-radius: 9px; background: rgba(255,255,255,.07); font-size: 12px; text-align: left; }
.strats button.cur { background: var(--gold); color: #111; font-weight: 700; }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.achc { display: flex; gap: 8px; align-items: center; padding: 7px; border-radius: 10px; background: rgba(255,255,255,.05); font-size: 12px; }
.achc .ai { font-size: 22px; }
.achc.lock { opacity: .35; filter: grayscale(1); }
.achc b { display: block; font-size: 12.5px; }

/* ---------- modal ---------- */
#modal { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 14px; background: rgba(2, 5, 14, .62); backdrop-filter: blur(3px); animation: fadein .18s; }
@keyframes fadein { from { opacity: 0; } }
.mcard { width: min(480px, 100%); max-height: calc(100vh - 28px); overflow-y: auto; background: linear-gradient(180deg, #13214a, #0a1430); border: 1px solid rgba(255,210,63,.35); border-radius: 20px; padding: 18px 16px 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7); animation: pop .28s cubic-bezier(.2,1.4,.4,1); position: relative; }
@keyframes pop { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.mcard.urgent { border-color: var(--red); box-shadow: 0 0 0 2px rgba(239,68,68,.4), 0 20px 60px rgba(0,0,0,.7); }
.ribbon { position: absolute; top: 12px; left: -2px; background: var(--red); font: 700 11px var(--hd); letter-spacing: 2px; padding: 3px 10px; border-radius: 0 6px 6px 0; }
.ribbon.blue { background: var(--blue); }
.eimg { width: 86px; height: 86px; margin: 4px auto 6px; border-radius: 50%; display: grid; place-items: center; font-size: 48px; background: radial-gradient(circle at 35% 30%, #2b4a9a, #0b1530); border: 3px solid var(--gold); box-shadow: 0 0 30px rgba(255,210,63,.25); animation: bob 2.5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-3deg); } }
.mcard h3 { margin: 4px 0 6px; text-align: center; font: 700 24px/1.1 var(--hd); letter-spacing: .5px; }
.mcard p { margin: 0 0 12px; text-align: center; color: #cfdaf5; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { text-align: left; padding: 11px 13px; border-radius: 14px; background: linear-gradient(180deg, rgba(59,130,246,.28), rgba(59,130,246,.12)); border: 1px solid rgba(96,165,250,.45); font-weight: 600; transition: transform .1s, background .15s; }
.choice:hover { background: linear-gradient(180deg, rgba(59,130,246,.45), rgba(59,130,246,.2)); }
.choice:active { transform: scale(.97); }
.choice:disabled { opacity: .4; }
.hints { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.hint { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 99px; background: rgba(0,0,0,.3); }
.hint.up { color: #86efac; } .hint.down { color: #fca5a5; } .hint.neu { color: #fde68a; }
.outcome { text-align: center; font: 600 18px var(--hd); padding: 14px; border-radius: 14px; margin: 6px 0 10px; }
.outcome.good { background: rgba(34,197,94,.2); color: #86efac; } .outcome.bad { background: rgba(239,68,68,.2); color: #fca5a5; }
.dice { text-align: center; font-size: 44px; animation: spin .5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mfoot { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.opt { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid var(--line); margin-bottom: 7px; }
.opt:active { transform: scale(.98); }
.opt b { display: block; }
.opt small { color: var(--dim); }
.opt .pct { float: right; font: 700 18px var(--hd); color: var(--gold); }

/* ---------- toasts / banner / advisor ---------- */
#toasts { position: absolute; top: calc(124px + var(--safe-t)); right: 10px; z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; max-width: calc(100% - 20px); }
.toast { background: rgba(9,16,36,.95); border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.5); animation: tin .3s ease-out; max-width: 340px; }
.toast.good { border-left-color: var(--green); } .toast.bad { border-left-color: var(--red); } .toast.ach { border-left-color: var(--purple); background: linear-gradient(90deg, rgba(88,28,135,.95), rgba(9,16,36,.95)); }
.toast.out { animation: tout .3s forwards; }
@keyframes tin { from { transform: translateX(40px); opacity: 0; } }
@keyframes tout { to { transform: translateX(40px); opacity: 0; } }
#banner { position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); z-index: 65; background: linear-gradient(180deg, #1e3a8a, #0b1530); border: 2px solid var(--gold); border-radius: 16px; padding: 10px 18px; text-align: center; animation: bannerin .35s cubic-bezier(.2,1.4,.4,1); box-shadow: 0 10px 40px rgba(0,0,0,.6); min-width: 260px; pointer-events: none; }
#banner .bt { font: 700 22px var(--hd); letter-spacing: 1px; }
#banner .bs { font-size: 13px; color: #cfdaf5; }
@keyframes bannerin { from { transform: translate(-50%, -30px) scale(.8); opacity: 0; } }
.float { position: absolute; z-index: 80; font: 700 22px var(--hd); pointer-events: none; animation: floatup 1.4s ease-out forwards; text-shadow: 0 2px 6px #000; }
@keyframes floatup { to { transform: translateY(-50px); opacity: 0; } }
#advisor { position: absolute; left: 10px; bottom: calc(var(--tabs-h) + var(--safe-b) + 12px); z-index: 27; max-width: min(360px, calc(100% - 150px)); display: flex; gap: 8px; align-items: flex-end; animation: tin .3s; }
#advisor .av { font-size: 34px; flex: none; }
#advisor .ab { background: #fff; color: #111; padding: 9px 12px; border-radius: 14px 14px 14px 4px; font-size: 13px; font-weight: 500; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
#advisor .ab b.who { display: block; font-size: 11px; color: #1d4ed8; letter-spacing: 1px; }
#advisor .ab button { margin-top: 6px; font-size: 12px; font-weight: 700; color: #1d4ed8; }
body.panel-open #advisor { display: none; }

/* ---------- title ---------- */
#title { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center;
  background: radial-gradient(ellipse at center, rgba(6,12,28,.2), rgba(6,12,28,.85) 70%); overflow-y: auto; }
.logo { font: 700 clamp(44px, 12vw, 96px)/.9 var(--hd); letter-spacing: 2px; text-transform: uppercase; }
.logo .l1 { display: block; background: linear-gradient(180deg, #fff 0%, #cfe0ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #1d4ed8); }
.logo .l2 { display: block; background: linear-gradient(180deg, #ff6b6b, #dc2626); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #450a0a); transform: rotate(-3deg); animation: shake 3s infinite; }
@keyframes shake { 92% { transform: rotate(-3deg); } 94% { transform: rotate(2deg) scale(1.05); } 96% { transform: rotate(-5deg); } 98% { transform: rotate(-3deg); } }
.tag { color: #cfdaf5; margin: 14px 0 22px; font-size: 16px; }
.tbtns { display: flex; flex-direction: column; gap: 10px; width: min(320px, 100%); }
.tbtns .btn { font: 700 20px var(--hd); letter-spacing: 1px; padding: 14px; }
.stars { color: var(--gold); letter-spacing: 6px; font-size: 18px; }
.ng { width: min(560px, 100%); text-align: left; }
.ng h3 { font: 700 26px var(--hd); margin: 0 0 10px; text-align: center; }
.ng label { display: block; font: 600 13px var(--hd); letter-spacing: 1.5px; color: var(--gold); margin: 12px 0 5px; }
.ng input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.4); color: var(--text); font-size: 17px; user-select: text; }
.parties, .diffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.party, .diff { padding: 10px 8px; border-radius: 14px; background: rgba(255,255,255,.06); border: 2px solid transparent; text-align: center; }
.party .pi { font-size: 28px; }
.party b, .diff b { display: block; font-size: 13.5px; }
.party small, .diff small { display: block; font-size: 11px; color: var(--dim); line-height: 1.2; margin-top: 3px; }
.party.on, .diff.on { border-color: var(--gold); background: rgba(255,210,63,.12); }
#loading { position: absolute; inset: 0; z-index: 100; display: grid; place-content: center; text-align: center; background: var(--bg); gap: 8px; color: var(--dim); }
.ld-eagle { font-size: 64px; animation: bob 1s infinite; }

/* election overlay */
.elec { position: absolute; left: 50%; top: calc(12px + var(--safe-t)); transform: translateX(-50%); width: min(560px, calc(100% - 20px)); z-index: 62; background: rgba(9,16,36,.94); border: 2px solid var(--gold); border-radius: 18px; padding: 12px 14px; text-align: center; }
.elec h3 { margin: 0; font: 700 22px var(--hd); letter-spacing: 1px; }
.evbar { display: flex; height: 22px; border-radius: 11px; overflow: hidden; background: rgba(255,255,255,.1); margin: 8px 0 4px; position: relative; }
.evbar i { display: block; height: 100%; transition: width .2s; }
.evbar .mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: #fff; }
.evnums { display: flex; justify-content: space-between; font: 700 20px var(--hd); }
.evnums small { display: block; font: 12px system-ui; color: var(--dim); }
.elast { font-size: 13px; color: #cfdaf5; min-height: 18px; }
.elec-res { position: absolute; left: 50%; bottom: calc(30px + var(--safe-b)); transform: translateX(-50%); z-index: 62; text-align: center; width: min(460px, calc(100% - 20px)); }

/* ---------- desktop layout ---------- */
@media (min-width: 900px) {
  :root { --tabs-h: 0px; }
  #tabs { top: calc(124px + var(--safe-t)); bottom: auto; left: auto; right: 10px; width: 64px; height: auto; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; padding: 4px 0; }
  #tabs button { padding: 8px 0; font-size: 11px; }
  #tabs button.on::after { top: 20%; bottom: 20%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  #panel, #panel.tall { left: auto; right: 84px; top: calc(124px + var(--safe-t)); bottom: 96px; width: 420px; height: auto; border-radius: 18px; border: 1px solid var(--line); animation: slidein .2s ease-out; }
  @keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
  .panel-grab { display: none; }
  #endBtn, body.panel-open #endBtn { bottom: 22px; right: 22px; padding: 14px 30px; border-radius: 18px; display: flex; }
  body.panel-open.tall #endBtn { display: flex; }
  .eb-main { font-size: 24px; }
  #ticker { left: 50%; right: auto; width: min(760px, 60%); transform: translateX(-50%); }
  #toasts { top: auto; bottom: 100px; right: 520px; }
  #advisor { bottom: 24px; max-width: 420px; }
  body.panel-open #advisor { display: flex; }
  .hud-ap { max-width: 380px; }
}
@media (max-width: 899px) {
  #mandates { display: none !important; }
  #hud { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .seal { width: 32px; height: 32px; font-size: 18px; }
  #date { font-size: 15px; }
  .chip.big { font-size: 13px; padding: 4px 7px; }
  #ap { font-size: 21px; }
  #endBtn { padding: 8px 14px; }
  .eb-main { font-size: 16px; }
  #toasts { top: calc(124px + var(--safe-t)); }
}
@media (max-width: 420px) {
  #term { display: none; }
  .hud-right .iconbtn { width: 32px; height: 32px; }
  .acts { grid-template-columns: 1fr 1fr; }
}
