/* Become Prime Minister — stil. Mörk, saklig "statsapparat"-look för menyerna,
   anime-scener för debatter (css för dem längst ned). */
:root {
  --bg: #0b1322;
  --bg2: #111c30;
  --panel: #16243a;
  --panel2: #1c2d47;
  --line: #27395a;
  --text: #e8eef8;
  --muted: #93a3bd;
  --gold: #f2c14e;
  --gold2: #c99a2e;
  --red: #e5484d;
  --xred: rgba(229,72,77,.55);
  --green: #3ecf8e;
  --blue: #4f8ff7;
  --orange: #f59e42;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --r: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
input[type=range] { padding: 0; background: transparent; border: none; width: 100%; accent-color: var(--gold); }
input[type=color] { padding: 2px; width: 46px; height: 34px; }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; }
h1 { font-family: var(--serif); font-size: 34px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; line-height: 1.5; }
small, .muted { color: var(--muted); }
a { color: var(--blue); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c3f62; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#modals, #scene { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#modals > *, #scene > * { pointer-events: auto; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; animation: toastIn .25s ease-out; font-size: 14px; }
.toast.bad { border-left-color: var(--red); } .toast.good { border-left-color: var(--green); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0 } to { transform: none; opacity: 1 } }

/* --- knappar --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 9px 16px; font-weight: 600; font-size: 14px; transition: background .12s, transform .08s, border-color .12s; }
.btn:hover { background: #26395a; border-color: #3b5380; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gold { background: var(--gold); color: #1a1405; border-color: var(--gold2); }
.btn.gold:hover { background: #ffd062; }
.btn.red { background: var(--red); color: #fff; border-color: #b23338; }
.btn.green { background: var(--green); color: #052a1a; border-color: #2aa870; }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 26px; font-size: 17px; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

/* --- startskärm --- */
.start { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 50% 20%, #1c3561 0%, #0b1322 60%); }
.start::before { content: ''; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M60 0v120M0 60h120' stroke='%23ffffff' stroke-opacity='.025'/%3E%3C/svg%3E"); }
.start .card { position: relative; width: min(760px, 94vw); background: rgba(16,28,48,.9); border: 1px solid var(--line); border-radius: 18px; padding: 36px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.start h1 { font-size: 46px; line-height: 1.05; color: var(--gold); letter-spacing: -.5px; }
.start h1 small { display: block; font-family: var(--font); font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px; }
.start .lead { color: var(--muted); font-size: 16px; max-width: 560px; }
.saves { display: grid; gap: 10px; margin: 18px 0; }
.save { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.save .who { display: flex; align-items: center; gap: 12px; }
.save .dot { width: 14px; height: 14px; border-radius: 50%; }
.save b { display: block; }
.ver { position: absolute; right: 14px; bottom: 10px; color: var(--muted); font-size: 12px; }

/* --- uppsättning (skapa parti/ledare) --- */
.setup { flex: 1; overflow: auto; padding: 24px; }
.setup .inner { max-width: 1180px; margin: 0 auto; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.steps span.on { background: var(--gold); color: #1a1405; border-color: var(--gold2); font-weight: 700; }
.steps span.done { color: var(--green); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.panel h3 { display: flex; align-items: center; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.field input[type=text], .field input[type=number], .field select, .field textarea { width: 100%; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick .opt { background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; transition: border-color .12s; }
.pick .opt:hover { border-color: #3b5380; }
.pick .opt.on { border-color: var(--gold); background: #1b2a44; }
.pick .opt b { display: block; margin-bottom: 4px; }
.pick .opt small { display: block; line-height: 1.35; }
.party-card { display: flex; gap: 12px; align-items: center; }
.party-card .logo { width: 54px; height: 54px; flex: none; }
.party-card .logo svg { width: 100%; height: 100%; }
.axis { display: grid; grid-template-columns: 160px 1fr 160px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.axis .l { text-align: right; color: var(--muted); } .axis .r { color: var(--muted); }
.axis .name { grid-column: 1 / -1; font-weight: 600; margin-top: 4px; display: flex; justify-content: space-between; }
.axis .name span { color: var(--gold); font-weight: 700; }
.trait { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.trait b { text-align: right; color: var(--gold); }
.portrait { background: linear-gradient(180deg, #1c2d47, #101a2c); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; aspect-ratio: 3 / 4; display: flex; align-items: flex-end; justify-content: center; }
.portrait svg { width: 100%; height: 100%; display: block; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.chip.on { background: var(--gold); color: #1a1405; border-color: var(--gold2); font-weight: 600; }
.chip.static { cursor: default; }
.points { font-weight: 700; color: var(--gold); }

/* --- spelet: topplist + sidomeny + innehåll --- */
.game { flex: 1; display: grid; grid-template-rows: 58px 1fr; grid-template-columns: 220px 1fr; min-height: 0; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.topbar .brand { font-family: var(--serif); font-weight: 900; color: var(--gold); font-size: 18px; letter-spacing: .2px; white-space: nowrap; }
.topbar .date { font-weight: 600; } .topbar .date small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.stat { display: flex; flex-direction: column; line-height: 1.15; }
.stat small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat b { font-size: 15px; }
.stat .d { font-size: 11px; } .up { color: var(--green); } .down { color: var(--red); }
.topbar .spacer { flex: 1; }
.pchip { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); padding: 5px 10px 5px 6px; border-radius: 999px; }
.pchip .logo { width: 28px; height: 28px; } .pchip .logo svg { width: 100%; height: 100%; }
.ap { display: flex; gap: 3px; } .ap i { width: 12px; height: 12px; border-radius: 3px; background: var(--gold); display: inline-block; } .ap i.off { background: var(--line); }
.sidenav { background: var(--bg2); border-right: 1px solid var(--line); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.sidenav button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: none; color: var(--text); padding: 9px 10px; border-radius: 8px; font-weight: 500; font-size: 14px; }
.sidenav button:hover { background: var(--panel); }
.sidenav button.on { background: var(--panel2); color: var(--gold); font-weight: 700; }
.sidenav button .ic { width: 22px; text-align: center; }
.sidenav button .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 7px; font-weight: 700; }
.sidenav .sep { height: 1px; background: var(--line); margin: 8px 4px; }
.content { overflow: auto; padding: 18px; min-height: 0; }
.content .inner { max-width: 1240px; margin: 0 auto; }
.page-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-title h2 { font-family: var(--serif); font-size: 26px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.card h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card h3 .ic { margin-right: 4px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kpi small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.kpi b { font-size: 20px; display: block; }
.kpi .d { font-size: 12px; }
.bar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 999px; transition: width .3s; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.item.clickable { cursor: pointer; } .item.clickable:hover { border-color: #3b5380; }
.item .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.item .top b { font-size: 14px; }
.item .meta { font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { background: rgba(242,193,78,.08); }
.pbar { display: flex; align-items: center; gap: 8px; }
.pbar .bar { flex: 1; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--panel2); color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.tag.red { background: rgba(229,72,77,.2); color: #ff7a7f; } .tag.green { background: rgba(62,207,142,.2); color: #5ee3a8; } .tag.gold { background: rgba(242,193,78,.2); color: var(--gold); } .tag.blue { background: rgba(79,143,247,.2); color: #8ab4ff; }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.action { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .12s, transform .08s; }
.action:hover { border-color: var(--gold); transform: translateY(-1px); }
.action.off { opacity: .45; cursor: not-allowed; }
.action .t { font-weight: 700; display: flex; justify-content: space-between; }
.action .t .cost { color: var(--gold); font-size: 12px; }
.action small { color: var(--muted); line-height: 1.35; }
.news { display: flex; flex-direction: column; gap: 10px; }
.nitem { display: grid; grid-template-columns: 64px 1fr; gap: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.nitem .outlet { font-weight: 800; font-size: 12px; padding: 6px 4px; border-radius: 6px; text-align: center; align-self: start; line-height: 1.1; }
.nitem h4 { font-family: var(--serif); font-size: 17px; margin: 0 0 4px; line-height: 1.25; }
.nitem p { margin: 0; font-size: 13px; color: var(--muted); }
.nitem .meta { font-size: 11px; color: var(--muted); margin-top: 6px; }
.post { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.post .head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.post .head .av { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: var(--panel2); }
.post .head .av svg { width: 100%; height: 100%; }
.post .body { font-size: 14px; line-height: 1.45; }
.post .stats { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-top: 6px; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; background: var(--c); vertical-align: -1px; }
.seats { display: flex; height: 26px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.seats i { display: block; height: 100%; min-width: 1px; }
.seatmap { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; }
.seatmap i { aspect-ratio: 1; border-radius: 50%; display: block; }
.hemi { width: 100%; height: auto; display: block; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: transparent; border: none; color: var(--muted); padding: 8px 12px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
.tabs.domtabs { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; align-items: center; padding-bottom: 6px; }
.tabs.domtabs .dgl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); opacity: .8; white-space: nowrap; }
.tabs.domtabs .dgb { display: flex; flex-wrap: wrap; gap: 2px; }
.tabs.domtabs button { padding: 5px 9px; margin-bottom: 0; position: relative; }
.tabs.domtabs button small { font-weight: 400; opacity: .55; font-size: 11px; }
.tabs.domtabs .dgd { position: absolute; top: 4px; right: 1px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); opacity: .8; }
@media (max-width: 760px) { .tabs.domtabs { grid-template-columns: 1fr; } .tabs.domtabs .dgl { margin-top: 6px; } .tabs.domtabs button { font-size: 12px; padding: 4px 7px; text-align: left; } }
.stat-table td.name { width: 44%; }
.spark { width: 110px; height: 26px; }
.sv-map { width: 100%; max-width: 420px; }
.reg { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.reg .r { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.reg .r b { display: block; }
.budget .axis { grid-template-columns: 180px 1fr 90px; }
.empty { color: var(--muted); font-style: italic; padding: 12px; text-align: center; }
.timeline { display: flex; flex-direction: column; gap: 6px; }
.timeline .ev { display: grid; grid-template-columns: 96px 1fr; gap: 10px; font-size: 13px; }
.timeline .ev small { color: var(--muted); }
.relbar { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.relbar .bar { flex: 1; background: linear-gradient(90deg, rgba(229,72,77,.25), transparent 50%, rgba(62,207,142,.25)); position: relative; }
.relbar .bar i { position: absolute; top: -2px; width: 4px; height: 14px; border-radius: 2px; background: #fff; }
.minister { display: flex; gap: 10px; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.minister .av { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--panel2); flex: none; }
.minister .av svg { width: 100%; height: 100%; }
.face { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--panel2); flex: none; }
.face svg { width: 100%; height: 100%; }
.face.lg { width: 72px; height: 72px; border-radius: 14px; }

/* --- modal --- */
.modal-bg { position: absolute; inset: 0; background: rgba(4,8,16,.72); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal { width: min(720px, 96vw); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); animation: popIn .18s ease-out; }
.modal.wide { width: min(1000px, 96vw); }
@keyframes popIn { from { transform: translateY(14px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal .mh { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal .mh h2 { font-family: var(--serif); }
.modal .mb { padding: 18px 20px; }
.modal .mf { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal .mf.stack { flex-direction: column; align-items: stretch; }
.modal .mf.stack .btn { justify-content: flex-start; text-align: left; white-space: normal; }
.choice { display: flex; flex-direction: column; gap: 8px; }
.choice .btn { justify-content: flex-start; text-align: left; white-space: normal; padding: 12px 14px; line-height: 1.35; }
.choice .btn small { color: var(--muted); font-weight: 500; margin-left: auto; white-space: nowrap; padding-left: 10px; }
.xclose { background: transparent; border: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 8px; }

/* --- veckorapport --- */
.report .sec { margin-bottom: 14px; }
.report .sec h4 { margin: 0 0 6px; color: var(--gold); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.report ul { margin: 0; padding-left: 18px; line-height: 1.5; }
.delta { font-variant-numeric: tabular-nums; }

/* --- valnatt --- */
.valnatt { position: absolute; inset: 0; background: #060a14; display: flex; flex-direction: column; overflow: auto; }
.valnatt .head { padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(90deg, #0d1a33, #060a14); border-bottom: 1px solid var(--line); }
.valnatt .head h1 { color: #fff; font-size: 28px; }
.valnatt .live { color: var(--red); font-weight: 800; letter-spacing: 2px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .35 } }
.valnatt .body { padding: 20px 24px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
@media (max-width: 900px) { .valnatt .body { grid-template-columns: 1fr; } }
.valnatt .bars { display: flex; flex-direction: column; gap: 8px; }
.valnatt .pb { display: grid; grid-template-columns: 54px 1fr 70px 60px; align-items: center; gap: 10px; font-size: 15px; }
.valnatt .pb .bar { height: 22px; background: #121b2e; }
.valnatt .pb b.pct { text-align: right; font-size: 18px; } .valnatt .pb .seat { text-align: right; color: var(--muted); }
.valnatt .pb .prev { font-size: 11px; color: var(--muted); }
.valnatt .ticker { font-family: var(--serif); font-size: 18px; min-height: 60px; padding: 12px 16px; background: var(--panel); border-left: 4px solid var(--red); border-radius: 8px; }
.valnatt .regs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.valnatt .regs .r { font-size: 12px; background: var(--panel); padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }
.valnatt .regs .r.in { border-color: var(--green); }
.valnatt .regs .r b { display: block; font-size: 12px; }

/* --- debatt-scen (anime) --- */
.aa { position: absolute; inset: 0; background: #000; overflow: hidden; user-select: none; font-family: var(--font); }
.aa .stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.aa .view { position: relative; width: 100%; height: 100%; max-width: calc(100vh * 16 / 9); max-height: calc(100vw * 9 / 16); margin: auto; overflow: hidden; background: #111; }
.aa .bg { position: absolute; inset: 0; } .aa .bg svg { width: 100%; height: 100%; display: block; }
.aa .char { position: absolute; bottom: -6%; height: 100%; width: 50%; display: flex; align-items: flex-end; justify-content: center; transition: transform .25s ease-out, opacity .2s; will-change: transform; }
.aa .char.left { left: 0; } .aa .char.right { right: 0; }
.aa .char svg { height: 100%; width: auto; max-width: none; display: block; filter: drop-shadow(0 8px 16px rgba(0,0,0,.45)); }
.aa .char.solo { left: 50%; transform: translateX(-50%); width: 60%; }
.aa .char.dim { opacity: .55; filter: brightness(.6); }
.aa .char.hidden { opacity: 0; }
.aa .char.enter-left { animation: slideL .35s ease-out; } .aa .char.enter-right { animation: slideR .35s ease-out; }
@keyframes slideL { from { transform: translateX(-30%); opacity: 0 } } @keyframes slideR { from { transform: translateX(30%); opacity: 0 } }
.aa .textbox { position: absolute; left: 3%; right: 3%; bottom: 3%; min-height: 25%; background: rgba(8,12,24,.86); border: 2px solid rgba(255,255,255,.18); border-radius: 10px; padding: 18px 24px 22px; color: #fff; font-size: clamp(16px, 2.2vw, 26px); line-height: 1.4; box-shadow: 0 10px 30px rgba(0,0,0,.5); cursor: pointer; backdrop-filter: blur(3px); }
.aa .textbox .name { position: absolute; top: -18px; left: 16px; background: #fff; color: #111; font-weight: 800; padding: 4px 14px; border-radius: 6px; font-size: clamp(13px, 1.5vw, 18px); border: 2px solid #111; letter-spacing: .3px; }
.aa .textbox .name.left { background: #ffe08a; } .aa .textbox .name.right { background: #9ad0ff; }
.aa .textbox .txt { min-height: 2.8em; white-space: pre-wrap; }
.aa .textbox .next { position: absolute; right: 18px; bottom: 10px; font-size: 14px; color: #ffd062; animation: bob 1s infinite; }
@keyframes bob { 50% { transform: translateY(3px) } }
.aa .choices { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, 86%); display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.aa .choices .btn { background: rgba(8,12,24,.92); border: 2px solid #fff; color: #fff; font-size: clamp(14px, 1.7vw, 20px); padding: 14px 18px; justify-content: flex-start; text-align: left; white-space: normal; line-height: 1.3; border-radius: 10px; }
.aa .choices .btn:hover { background: #ffd062; color: #111; border-color: #ffd062; }
.aa .choices .btn .kind { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .7; margin-bottom: 2px; }
.aa .choices .btn.obj { border-color: #ff4d4d; }
.aa .meter { position: absolute; top: 3%; left: 50%; transform: translateX(-50%); width: 46%; z-index: 4; }
.aa .meter .lbl { display: flex; justify-content: space-between; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000; font-weight: 700; letter-spacing: .5px; margin-bottom: 3px; }
.aa .meter .track { height: 14px; background: rgba(0,0,0,.6); border: 2px solid #fff; border-radius: 999px; position: relative; overflow: hidden; }
.aa .meter .track i { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; background: #ffd062; transition: all .4s; }
.aa .meter .track i.neg { background: #ff5d5d; }
.aa .topic { position: absolute; top: 3%; left: 3%; background: rgba(0,0,0,.6); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; border: 1px solid rgba(255,255,255,.25); z-index: 4; }
.aa .topic small { display: block; font-weight: 500; opacity: .75; }
.aa .burst { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 8; pointer-events: none; }
.aa .burst span { font-family: 'Bangers', Impact, sans-serif; font-size: clamp(60px, 11vw, 150px); color: #e8262b; -webkit-text-stroke: 3px #fff; text-shadow: 6px 6px 0 #1a1a1a, 0 0 30px rgba(0,0,0,.4); transform: rotate(-8deg); letter-spacing: 2px; animation: burst .55s cubic-bezier(.2,1.6,.4,1) both; }
.aa .burst span.blue { color: #2b7de8; }
.aa .burst span.green { color: #2ab85a; }
@keyframes burst { 0% { transform: scale(.2) rotate(-8deg); opacity: 0 } 60% { transform: scale(1.15) rotate(-8deg); opacity: 1 } 100% { transform: scale(1) rotate(-8deg); opacity: 1 } }
.aa .burst::before { content: ''; position: absolute; width: 70vmin; height: 70vmin; background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,255,255,0) 65%); animation: flash .5s ease-out both; }
@keyframes flash { from { transform: scale(.2); opacity: 1 } to { transform: scale(1.6); opacity: 0 } }
.aa.shake .view { animation: shake .45s; }
@keyframes shake { 0%,100% { transform: translate(0,0) } 15% { transform: translate(-12px, 6px) } 30% { transform: translate(10px, -8px) } 45% { transform: translate(-8px, 4px) } 60% { transform: translate(6px, -4px) } 80% { transform: translate(-3px, 2px) } }
.aa .whiteflash { position: absolute; inset: 0; background: #fff; z-index: 7; pointer-events: none; animation: wf .35s ease-out both; }
@keyframes wf { from { opacity: .9 } to { opacity: 0 } }
.aa .result { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.72); z-index: 9; }
.aa .result .box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 32px; width: min(560px, 90%); text-align: center; }
.aa .result h2 { font-family: var(--serif); font-size: 30px; color: var(--gold); }
.aa .skip { position: absolute; top: 3%; right: 3%; z-index: 6; }
.aa .evidence { position: absolute; left: 3%; top: 12%; width: 30%; background: rgba(255,255,255,.95); color: #111; border-radius: 10px; padding: 12px 14px; font-size: 14px; z-index: 6; box-shadow: var(--shadow); border: 3px solid #e8262b; animation: popIn .2s; }
.aa .evidence b { display: block; color: #e8262b; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }

/* --- diverse --- */
.hero-logo { width: 120px; height: 120px; }
.hero-logo svg { width: 100%; height: 100%; }
.pos-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.bloc { display: flex; gap: 10px; flex-wrap: wrap; }
.bloc .b { flex: 1; min-width: 200px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.danger { color: var(--red); font-weight: 700; }
.ok { color: var(--green); font-weight: 700; }
kbd { background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
.help { font-size: 13px; color: var(--muted); line-height: 1.5; }
.loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* ---------- v0.4: fritext ---------- */
.composer textarea { width: 100%; min-height: 80px; resize: vertical; font-size: 15px; line-height: 1.45; }
.composer .ctitle { font-weight: 700; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.composer .ctitle small { color: var(--muted); font-weight: 500; }
.adviser { font-size: 12px; color: var(--muted); margin: 4px 0 6px; min-height: 16px; }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.sugg small { color: var(--muted); }
.thread { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.comment { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.comment.mine { border-color: var(--gold); background: #1b2a44; }
.comment a { color: var(--gold); }
.post.deleted .body { opacity: .5; text-decoration: line-through; }
.post.clickable { cursor: pointer; } .post.clickable:hover { border-color: #3b5380; }
.item.deleted small { text-decoration: line-through; opacity: .6; }
.chat { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chat .msg { background: var(--bg2); border-radius: 10px; padding: 8px 10px; font-size: 14px; max-width: 85%; }
.chat .msg.mine { align-self: flex-end; background: #1b2a44; border: 1px solid var(--gold); }
.chat .msg b { font-size: 12px; color: var(--muted); display: block; }
.speech { max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.speech .line { background: var(--bg2); border-left: 3px solid var(--line); padding: 6px 10px; border-radius: 6px; font-size: 14px; animation: popIn .2s ease-out; }
.speech .line.good { border-left-color: var(--green); } .speech .line.bad { border-left-color: var(--red); }
.speech .line small { color: var(--muted); }
.meterline { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; }
.meterline .bar { flex: 1; height: 12px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.meterline .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold), var(--green)); transition: width .4s; }
/* debattscenens skrivruta */
.aa .choices { width: min(880px, 92%); }
.aa .choices .composer { background: rgba(8,12,24,.94); border: 2px solid #fff; border-radius: 12px; padding: 14px 16px; color: #fff; }
.aa .choices .composer textarea { width: 100%; background: #0d1424; color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; font-size: clamp(14px, 1.5vw, 18px); padding: 10px; resize: vertical; font-family: inherit; }
.aa .choices .composer .adviser { color: #ffd062; }
.aa .choices .composer .sugg .chip { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.3); }
.aa .choices .composer .sugg .chip:hover { background: #ffd062; color: #111; }
.aa .choices .composer .btn { font-size: 15px; padding: 9px 16px; }
.aa .choices .composer .btn.obj { border-color: #ff4d4d; color: #ff6b6b; font-family: 'Bangers', Impact, sans-serif; letter-spacing: 1px; font-size: 18px; }
/* tecknade sprites */
.aa .char img.sprite { height: 84%; width: auto; max-width: none; display: block; filter: drop-shadow(0 8px 16px rgba(0,0,0,.45)); }
.aa .char img.sprite.talking { animation: talkbob .35s ease-in-out infinite alternate; }
@keyframes talkbob { from { transform: translateY(0); } to { transform: translateY(-1.2%); } }
.aa .char.right img.sprite.talking { animation-name: talkbobR; }
@keyframes talkbobR { from { transform: scaleX(-1) translateY(0); } to { transform: scaleX(-1) translateY(-1.2%); } }
.sprite-face { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait img.sprite { height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; max-height: 200px; overflow: auto; margin-top: 6px; }
.gallery .g { border: 2px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; aspect-ratio: 1; background: #fff; }
.gallery .g.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.gallery .g img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* ---------- v0.5: känslor, anpassning, logotyp ---------- */
.aa .moodchip { position: absolute; top: 10%; right: 3%; background: rgba(8,12,24,.85); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 5px 12px; font-size: clamp(12px, 1.3vw, 16px); font-weight: 700; z-index: 4; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.parts .prow { display: flex; align-items: center; gap: 8px; margin: 4px 0; flex-wrap: wrap; }
.parts .prow > span:first-child { width: 120px; font-size: 13px; color: var(--muted); }
.parts .swatch.orig { background: repeating-linear-gradient(45deg, #888 0 4px, #444 4px 8px); }
.logo-up { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-up input[type=file] { max-width: 260px; font-size: 12px; }
.drift { font-size: 12px; color: var(--muted); margin-top: 4px; }
/* ---------- v0.6: spelets AI, staben ---------- */
.aichip { white-space: nowrap; }
.aichip.on { border-color: var(--green); color: #5ee3a8; }
.aichip.load { border-color: var(--gold); color: var(--gold); }
.aichip.err { border-color: var(--red); color: #ff7a7f; }
.chatcard { display: flex; flex-direction: column; min-height: 60vh; }
.chatlog { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; max-height: 58vh; }
.chatlog .msg { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; max-width: 82%; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.chatlog .msg.mine { align-self: flex-end; background: #1b2a44; border-color: var(--gold); }
.chatlog .msg b { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.chatlog .msg.typing div { color: var(--muted); font-style: italic; }
.chatin { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.chatin textarea { flex: 1; resize: vertical; font-size: 15px; }

/* v0.7 ytterligheter: röda zoner, varningar, sammanfattning i partiskaparen */
.xin { display: flex; flex-direction: column; gap: 2px; }
.zbar { height: 4px; border-radius: 3px; background: var(--line); margin: 0 7px; }
.axis.xaxis .l small.xl, .axis.xaxis .r small.xl { display: block; color: #ff7a7f; font-size: 11px; margin-top: 2px; }
.xbanner { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); }
.xbanner.gold { border-color: rgba(242,193,78,.5); } .xbanner.orange { border-color: var(--orange); background: rgba(245,158,66,.08); } .xbanner.red { border-color: var(--red); background: rgba(229,72,77,.1); }
.xbanner.red b { color: #ff7a7f; } .xbanner.orange b { color: var(--orange); }
.item.xitem { border-color: rgba(229,72,77,.6); background: rgba(229,72,77,.06); }
.xwarn { color: #ff7a7f; font-size: 12px; font-weight: 600; margin-top: 4px; } .xwarn:empty { display: none; }
.pnum { width: 110px; padding: 4px 8px; }
.pctl { margin-top: 8px; } .pctl select { width: 100%; }
.polsum { margin-bottom: 12px; }
@media (max-width: 760px) { .axis.xaxis { grid-template-columns: 1fr; } .axis.xaxis .l, .axis.xaxis .r { text-align: left; } }
.axis .name span.danger { color: #ff7a7f; }

/* v0.9 snurra medan spelets AI arbetar */
@keyframes spin { to { transform: rotate(360deg) } }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.22); border-top-color: var(--gold); border-radius: 50%; animation: spin .75s linear infinite; vertical-align: -2px; flex: 0 0 auto; }
.spin.sm { width: 11px; height: 11px; border-width: 2px; margin-right: 4px; }
.aibusy { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; align-items: center; gap: 9px; max-width: calc(100vw - 32px); padding: 7px 14px; border-radius: 999px; background: rgba(10,16,30,.94); border: 1px solid var(--gold); color: #fff; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.45); pointer-events: none; animation: fadeIn .2s ease; }
.aibusy[hidden] { display: none; }
.aibusy .s { color: var(--gold); font-variant-numeric: tabular-nums; }
.aibusy .h { color: #ffb4b6; } .aibusy .h:empty { display: none; }
.aa .textbox .spin { width: 18px; height: 18px; }
.aa .textbox .tsec { opacity: .6; font-size: .8em; }
