:root {
  --bg: #0e1116; --bg2: #161b22; --panel: #1b222c; --panel2: #222b36; --line: #2b3542;
  --text: #e7edf3; --muted: #93a1b0; --accent: #d71920; --red: #d71920; --red-dim: #8f1217;
  --good: #46c46e; --bad: #ef5350; --warn: #f5b54a; --fill: #4f8fd0; /* neutral bar fill (not "danger" red) */
  --radius: 14px; --shadow: 0 10px 30px rgba(0,0,0,.45); --maxw: 880px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #9cc4ef; outline-offset: 2px; border-radius: 4px; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1000px 600px at 50% -10%, #1c2530 0%, var(--bg) 55%);
  color: var(--text); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5; min-height: 100vh; padding-bottom: env(safe-area-inset-bottom);
}
button { font-family: inherit; cursor: pointer; color: inherit; }
#app { max-width: var(--maxw); margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.up { color: var(--good); } .down { color: var(--bad); } .warn { color: var(--warn); }
.good { color: var(--good); } .bad { color: var(--bad); }

/* ---- generic panels & buttons ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px; margin: 12px; box-shadow: var(--shadow); }
.panel.slim { padding: 10px 14px; }
.panel h2 { margin: 0 0 6px; font-size: 19px; }
.panel h3 { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.panel > h3:first-child, .panel h2 + h3 { margin-top: 0; }
.eyebrow { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--red); background: rgba(215,25,32,.12); border: 1px solid rgba(215,25,32,.35); padding: 3px 9px; border-radius: 999px; margin-bottom: 8px; }
.eyebrow.warn { color: var(--warn); background: rgba(245,181,74,.12); border-color: rgba(245,181,74,.35); }
.brief { font-size: 15.5px; line-height: 1.6; color: #d7e0ea; }
.hint { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.btn { background: var(--red); color: #fff; border: none; border-radius: 12px; padding: 13px 18px; font-size: 15px; font-weight: 700; transition: .12s; }
.btn:hover { background: #ec2630; } .btn:active { transform: translateY(1px); }
.btn:disabled { background: #3a4350; color: #8390a0; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost.danger { border-color: var(--red-dim); color: #ff8a8a; }
.btn.wide { width: 100%; justify-content: center; }
textarea { width: 100%; min-height: 116px; resize: vertical; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 13px; font-size: 15px; line-height: 1.55; }
textarea:focus { outline: none; border-color: var(--red-dim); box-shadow: 0 0 0 3px rgba(215,25,32,.18); }

/* ---- start screen ---- */
.hero { text-align: center; padding: 30px 16px 4px; }
.hero h1 { font-size: 30px; margin: 10px 16px 6px; letter-spacing: -.4px; }
.hero .tag { color: var(--muted); font-size: 15px; max-width: 620px; margin: 0 auto; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand.center { justify-content: center; }
.brand .leaf { font-size: 26px; } .brand small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.parties { display: grid; gap: 10px; }
.partycard { background: var(--panel2); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; transition: .14s; cursor: pointer; }
.partycard.sel { border-color: var(--accent); background: rgba(215,25,32,.10); }
.partycard .pn { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.partycard .pl2 { color: var(--muted); font-size: 12px; margin-top: 3px; }
.partycard .pb { color: #c6d0db; font-size: 13px; margin-top: 6px; }
.diffs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.diff { background: var(--panel2); border: 2px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.diff.sel { border-color: var(--accent); background: rgba(215,25,32,.10); }
.diff b { display: block; font-size: 14px; } .diff span { font-size: 11px; color: var(--muted); }
.field { margin-top: 14px; } .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; color: var(--text); font-size: 15px; }

/* ---- top bar (play) ---- */
.topbar2 { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(14,17,22,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.tb-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-l .leaf { font-size: 20px; }
.tb-id b { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(42vw, 168px); }
.tb-id span { font-size: 11px; color: var(--muted); }
.tb-r { display: flex; gap: 10px; }
.tb-stat { text-align: right; } .tb-stat b { font-size: 16px; display: block; } .tb-stat span { font-size: 10px; color: var(--muted); }
.termprog { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: #232c37; }
.termprog > span { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* ---- tab bar ---- */
.tabwrap { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; max-width: var(--maxw); margin: 0 auto;
  background: rgba(20,25,32,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 2px calc(6px + env(safe-area-inset-bottom)); }
.tabbtn { flex: 1; min-height: 50px; background: none; border: none; color: var(--muted); font-size: 18px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative; }
.tabbtn span:nth-child(2) { font-size: 11px; font-weight: 600; }
.tabbtn.on { color: var(--text); }
.tabbtn.on span { color: var(--accent); }
.tabbtn .dot { position: absolute; top: 5px; right: 50%; transform: translateX(16px); width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---- mini macro strip ---- */
.minimacro { display: flex; justify-content: space-between; gap: 6px; }
.mm { text-align: center; flex: 1; min-width: 0; } .mm span { display: block; font-size: 10.5px; color: var(--muted); } .mm b { font-size: 14px; }

/* ---- tones ---- */
.tones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tone { text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.tone.sel { border-color: var(--accent); background: rgba(215,25,32,.12); }
.tone b { display: block; margin-bottom: 3px; font-size: 14px; } .tone span { font-size: 11px; color: var(--muted); }

/* ---- suggested policy chips ---- */
.suggs { display: grid; gap: 7px; margin: 10px 0 2px; }
.sugbtn { text-align: left; background: var(--panel2); border: 1px dashed var(--line); border-radius: 11px; padding: 9px 11px; }
.sugbtn:hover { border-color: var(--accent); }
.sugbtn.sel { border-style: solid; border-color: var(--accent); background: rgba(215,25,32,.10); }
.sugbtn b { display: block; font-size: 13px; margin-bottom: 2px; }
.sugbtn span { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ---- newspapers ---- */
.papers { display: grid; gap: 10px; }
.paper { background: #f4efe6; color: #1a1a1a; border-radius: 10px; padding: 12px 14px; border: 1px solid #d8cdba; }
.masthead { font-family: Georgia, serif; font-weight: 700; font-size: 12px; border-bottom: 2px solid #1a1a1a; padding-bottom: 5px; margin-bottom: 7px; display: flex; justify-content: space-between; align-items: center; }
.masthead .slant { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #4a4338; font-weight: 700; }
.paper .hl { font-family: Georgia, serif; font-weight: 700; font-size: 16px; line-height: 1.3; }

/* ---- movers / stakeholders ---- */
.movers { display: grid; gap: 8px; }
.mover { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; display: flex; gap: 10px; align-items: center; }
.mover .emoji { font-size: 22px; } .mover .who { font-weight: 700; font-size: 14px; } .mover .tag { color: var(--muted); font-size: 12px; }
.mover .chg { margin-left: auto; font-weight: 800; }
.stk { display: grid; gap: 7px; }
.stk .s { background: var(--panel2); border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; padding: 8px 11px; font-size: 13px; }
.stk .s.happy { border-left-color: var(--good); } .stk .s.angry { border-left-color: var(--bad); }

/* ---- stat tiles + sparkline ---- */
.hud2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: linear-gradient(180deg, var(--panel2) 0%, var(--bg2) 100%); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.stat .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.stat .v { font-size: 22px; font-weight: 800; margin-top: 1px; }
.stat .sub { font-size: 11px; color: var(--muted); }
.sp { margin-top: 6px; } .sp svg { width: 100%; height: 34px; display: block; } .sp.big svg { height: 60px; }

/* ---- gauge ---- */
.gaugewrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.gauge-side { flex: 1; min-width: 180px; }
.seatline { font-size: 14px; margin-bottom: 8px; }

/* ---- seat bar ---- */
.seatbar2 { position: relative; height: 26px; border-radius: 7px; overflow: hidden; background: #232c37; border: 1px solid var(--line); margin: 4px 0 2px; }
.seatbar2 .segs { display: flex; height: 100%; }
.seatbar2 .segs > div { height: 100%; }
.majline2 { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; opacity: .65; }
.majlbl2 { position: absolute; top: 4px; font-size: 9px; color: #fff; transform: translateX(4px); opacity: .8; }

/* ---- party bars ---- */
.pbars, .pbar { display: grid; }
.pbar { grid-template-columns: 64px 1fr 38px; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.pbar .pt { height: 9px; border-radius: 5px; background: #2a323d; overflow: hidden; } .pbar .pt > span { display: block; height: 100%; }
.pbar .pv { text-align: right; font-weight: 700; }
.prows { margin-top: 10px; } .prow { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.pdot { width: 12px; height: 12px; border-radius: 50%; } .pname { flex: 1; font-size: 14px; } .pseats { font-weight: 800; }
.gov { font-size: 9px; background: var(--accent); padding: 1px 5px; border-radius: 5px; vertical-align: middle; }
.conf { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; border: 1px solid var(--line); }
.conf.ok { border-left: 3px solid var(--good); } .conf.warn { border-left: 3px solid var(--warn); } .conf.bad { border-left: 3px solid var(--bad); }

/* ---- budget ---- */
.bsum { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.bsum.big { grid-template-columns: 1fr 1fr; }
.bsum > div { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: center; }
.bsum span { display: block; font-size: 10px; color: var(--muted); } .bsum b { font-size: 15px; }
.lever { margin: 9px 0; }
.ll { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; } .ll b { font-weight: 700; }
.lctl { display: flex; align-items: center; gap: 8px; }
.step { min-width: 44px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); font-size: 20px; font-weight: 700; }
.step:hover { border-color: var(--fill); }
.ltrack { flex: 1; height: 8px; border-radius: 5px; background: #2a323d; overflow: hidden; } .ltrack > span { display: block; height: 100%; background: var(--fill); }

/* ---- tile map ---- */
.tilemap { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 5px; margin: 10px 0; }
.tilemap::before { content: ''; grid-column: 1; grid-row: 1; aspect-ratio: 1; }
.tile { aspect-ratio: 1; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #0c0f13; font-weight: 800; position: relative; }
.tile .tm-ab { font-size: 12px; } .tile .tm-v { font-size: 13px; }
.tm-mv { position: absolute; top: 2px; right: 4px; font-size: 9px; }
.tm-mv.up { color: #0a3d1a; } .tm-mv.down { color: #5b1212; }
.provlist, .regions { margin-top: 8px; }
.pli { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pli-name { flex: 1; min-width: 0; } .pli-v { white-space: nowrap; font-weight: 700; }
.regions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.reg { display: grid; grid-template-columns: 28px 1fr 26px; align-items: center; gap: 6px; font-size: 12px; }
.reg .rt { height: 8px; border-radius: 5px; background: #2a323d; overflow: hidden; } .reg .rt > span { display: block; height: 100%; }
.reg b { text-align: right; }

/* ---- history log ---- */
.logrow { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.logrow .ld { font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 56px; }
.logrow .le { font-size: 13px; font-weight: 600; } .logrow .lp { font-size: 12px; color: #c6d0db; }

/* ---- verdict / end ---- */
.verdict { text-align: center; padding: 22px 16px; }
.verdict .big { font-size: 24px; font-weight: 800; margin: 6px 0; }
.verdict .tag { color: var(--muted); max-width: 460px; margin: 4px auto 0; font-size: 14px; }

.foot { text-align: center; color: var(--muted); font-size: 11.5px; margin: 18px 12px 30px; line-height: 1.5; }
.toast { position: fixed; bottom: calc(120px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; }

/* Premium badge (shown when premium is simulated on) */
.prem-badge { display: inline-block; margin-left: 7px; font-size: 9.5px; font-weight: 800; letter-spacing: .5px; vertical-align: middle;
  color: #1a1205; background: linear-gradient(180deg, #ffd76a, #f5b54a); padding: 2px 6px; border-radius: 6px; }

/* Dev/test premium toggle — stands in for auth + payments while building.
   Sits clear above the bottom tab bar (and inside the app column on wide
   screens) so it never covers a tab's tap target. */
.devtoggle { position: fixed; bottom: calc(88px + env(safe-area-inset-bottom)); right: max(14px, calc(50vw - var(--maxw) / 2 + 14px)); z-index: 40; display: flex; align-items: center; gap: 7px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px 7px 10px;
  box-shadow: var(--shadow); font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; transition: .15s; }
.devtoggle:hover { border-color: #ffd76a55; }
.devtoggle .dt-dot { width: 9px; height: 9px; border-radius: 50%; background: #4a5564; transition: .15s; }
.devtoggle .dt-tag { font-size: 8.5px; letter-spacing: .6px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }
.devtoggle.on { color: #ffd76a; border-color: #f5b54a; background: linear-gradient(180deg, rgba(245,181,74,.14), rgba(245,181,74,.06)); }
.devtoggle.on .dt-dot { background: #f5b54a; box-shadow: 0 0 8px #f5b54a; }

/* ---- tone capital cost ---- */
.tone .cost { font-size: 10.5px; font-weight: 700; color: var(--bad); background: rgba(239,83,80,.12); border-radius: 5px; padding: 1px 5px; vertical-align: middle; }
.tone .cost.up { color: var(--good); background: rgba(70,196,110,.12); }

/* ---- detected-issue chips (teaches the parser) ---- */
.detected { margin: 10px 0 2px; font-size: 12px; }
.detected .dlbl { color: var(--muted); margin-right: 4px; }
.dchip { display: inline-block; margin: 3px 4px 0 0; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 11.5px; }
.dchip.prog { color: #8fd0ff; border-color: #2f5d80; background: rgba(79,143,208,.12); }
.dchip.cons { color: #ffb3a8; border-color: #7a3a33; background: rgba(239,83,80,.12); }
.dchip.mid { color: var(--muted); }

/* ---- verdict emoji + responsive heading ---- */
.vemoji { font-size: 46px; line-height: 1; }
.vemoji.big { font-size: 54px; margin-bottom: 4px; }
.verdict .big { font-size: clamp(20px, 6vw, 28px); font-weight: 800; margin: 6px 0; text-wrap: balance; }

/* ---- confirm modal ---- */
.modal-ov { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; max-width: 360px; box-shadow: var(--shadow); }
.modal p { margin: 0 0 14px; font-size: 14.5px; }

@media (min-width: 640px) {
  .parties { grid-template-columns: 1fr 1fr 1fr; }
  .papers { grid-template-columns: 1fr 1fr 1fr; }
  .movers { grid-template-columns: 1fr 1fr; }
  .stk { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 38px; }
}

/* Honour reduced-motion: drop transitions, animations and smooth scrolling. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
