@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600&family=Nunito+Sans:opsz,wght@6..12,400;6..12,600;6..12,700;6..12,800&display=swap");

/* Regent components. Set the game's accent once on the game root:
   Rail Regent  -> .rg-game { --accent: var(--forest); }
   Tribe Regent -> .rg-game { --accent: var(--accent-tribe); } */
:root { --accent: var(--forest); }
.rg-tribe { --accent: var(--accent-tribe); }
.rg-rail { --accent: var(--forest); }

/* Button */
.rg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box; border: 0; border-radius: var(--radius-lg); padding: 0 16px; min-height: 44px; font: 600 15px/1.2 var(--font-display); letter-spacing: .01em; white-space: nowrap; color: var(--ink); background: var(--paper-2); cursor: pointer; }
.rg-btn.primary { background: var(--accent); color: var(--on-accent); }
.rg-btn.end { background: var(--accent); color: var(--on-accent); }
.rg-btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.rg-btn.sm { min-height: 36px; padding: 0 12px; border-radius: var(--radius-md); }
.rg-btn small { font: 600 11.5px/1.2 var(--font-body); letter-spacing: 0; opacity: .85; font-variant-numeric: tabular-nums; }
.rg-btn:has(small) { flex-direction: column; gap: 0; padding-top: 4px; padding-bottom: 4px; }
.rg-btn.icon { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-md); font-size: 22px; }
.rg-btn.icon.sm { width: 36px; height: 36px; min-height: 36px; }
.rg-btn.icon[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.rg-btn:disabled { opacity: .45; cursor: default; }
.rg-btn.short:disabled { background: var(--bad); color: #fff; opacity: 1; }
.rg-btn:focus-visible, .rg-seg button:focus-visible, .rg-bcard:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }

/* Segmented control */
.rg-seg { display: flex; gap: 3px; padding: 3px; border-radius: var(--radius-lg); background: var(--paper-2); }
.rg-seg button { flex: 1; min-height: 40px; padding: 10px 4px; border: 0; border-radius: 9px; background: none; font: 700 14px/1.2 var(--font-body); color: var(--ink); cursor: pointer; }
.rg-seg button[aria-pressed="true"] { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* Money pill + coin */
.rg-money { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: var(--radius-lg); color: var(--gold-ink); background: linear-gradient(170deg, var(--gold-light) 0%, var(--gold) 45%, var(--gold-deep-fill) 100%); box-shadow: 0 1px 4px rgba(80,50,0,.35), inset 0 1px 0 rgba(255,255,255,.6), inset 0 -2px 0 rgba(120,70,0,.25); }
.rg-money b { font: 600 24px/1 var(--font-display); font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 rgba(255,240,190,.8); }
.rg-coin { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22%3E%3Cdefs%3E%3CradialGradient id=%22f%22 cx=%2238%25%22 cy=%2232%25%22 r=%2275%25%22%3E%3Cstop offset=%220%22 stop-color=%22%23FFF3B0%22/%3E%3Cstop offset=%22.45%22 stop-color=%22%23F7CF5B%22/%3E%3Cstop offset=%221%22 stop-color=%22%23D9982A%22/%3E%3C/radialGradient%3E%3ClinearGradient id=%22r%22 x1=%220%22 y1=%220%22 x2=%221%22 y2=%221%22%3E%3Cstop offset=%220%22 stop-color=%22%23E8A92A%22/%3E%3Cstop offset=%221%22 stop-color=%22%239A6510%22/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%2215.5%22 fill=%22%237A4E0A%22/%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%2214.6%22 fill=%22url%28%23r%29%22/%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%2214.6%22 fill=%22none%22 stroke=%22%237A4E0A%22 stroke-width=%221.1%22 stroke-dasharray=%221 1.25%22 opacity=%22.55%22/%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%2211.6%22 fill=%22url%28%23f%29%22/%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%2211.6%22 fill=%22none%22 stroke=%22%23B07812%22 stroke-width=%221%22/%3E%3Ccircle cx=%2216%22 cy=%2216.6%22 r=%229.6%22 fill=%22none%22 stroke=%22%23FFF1B8%22 stroke-width=%22.8%22 opacity=%22.6%22/%3E%3Cpath d=%22M10.2 20.2 9.4 12.6l3.5 3 3.1-5 3.1 5 3.5-3-.8 7.6z%22 fill=%22%23B07812%22/%3E%3Cpath d=%22M10.4 21.1h11.2v1.9H10.4z%22 fill=%22%23B07812%22/%3E%3Cpath d=%22M9.8 12.9 12.9 15.6 16 10.6%22 fill=%22none%22 stroke=%22%23FFF1B8%22 stroke-width=%22.7%22 stroke-linejoin=%22round%22 opacity=%22.8%22/%3E%3Cpath d=%22M6.5 11.5a10.5 10.5 0 0 1 7-5.6%22 fill=%22none%22 stroke=%22%23fff%22 stroke-width=%221.6%22 stroke-linecap=%22round%22 opacity=%22.7%22/%3E%3C/svg%3E") center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(80,50,0,.35)); }
.rg-money .rg-coin { width: 26px; height: 26px; }
.rg-delta { font: 600 22px/1.05 var(--font-display); color: var(--good); font-variant-numeric: tabular-nums; }
.rg-delta.neg { color: var(--bad); }


/* Panels over the map */
.rg-panel { background: rgba(247,244,236,.96); border-radius: var(--radius-xl); box-shadow: var(--shadow-panel); color: var(--ink); }
.rg-hud { background: rgba(247,244,236,.96); border-radius: 0 0 var(--radius-panel) var(--radius-panel); box-shadow: var(--shadow-panel); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.rg-hud-row { display: flex; align-items: center; gap: 10px; }
.rg-sheet { background: var(--paper); border-radius: var(--radius-panel) var(--radius-panel) 0 0; box-shadow: var(--shadow-sheet); padding: 16px; display: flex; flex-direction: column; gap: 12px; color: var(--ink); }
.rg-sheet-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rg-sheet h2 { margin: 0; font: 600 22px/1.05 var(--font-display); }
.rg-x { width: 36px; height: 36px; flex: none; border: 0; border-radius: var(--radius-md); background: var(--paper-2); font-size: 20px; color: var(--ink); cursor: pointer; }
.rg-eyebrow { font: 800 11px/1.3 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; }
.rg-stat { display: flex; flex-direction: column; background: var(--paper-2); border-radius: var(--radius-md); padding: 7px 9px; }
.rg-stat b { font: 600 20px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.rg-stat small { font-size: 11px; color: var(--muted); }
.rg-bar { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.rg-bar > span { display: block; height: 100%; background: var(--good); }

/* Chips */
.rg-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: var(--radius-pill); background: var(--paper-2); font: 600 13px/1.2 var(--font-body); color: var(--ink); font-variant-numeric: tabular-nums; }
.rg-chip.good { background: #DCEBD6; }
.rg-chip.on { background: var(--accent); color: var(--on-accent); }
button.rg-chip { border: 0; cursor: pointer; font-weight: 700; }

/* Build card */
.rg-bgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rg-bcard { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px 9px; border: 0; border-radius: var(--radius-xl); background: var(--card); box-shadow: var(--shadow-card), inset 0 0 0 1px var(--line); font: inherit; color: var(--ink); text-align: center; cursor: pointer; }
.rg-bcard b { font: 600 15px/1.15 var(--font-display); }
.rg-bcard small { font-size: 11.5px; color: var(--muted); }
.rg-price { margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font: 600 14px/1.2 var(--font-display); }
.rg-price .rg-coin { width: 14px; height: 14px; }
.rg-bcard.poor { cursor: not-allowed; background: #EFEBE3; box-shadow: inset 0 0 0 1px var(--line); } .rg-bcard.poor .bc-img { filter: grayscale(1); opacity: .45; } .rg-bcard.poor b, .rg-bcard.poor small { color: var(--muted); } .rg-bcard.poor .rg-price { background: #E8E2D6; color: var(--bad); }
.rg-bcard .rg-price .lock { display: inline-block; width: 9px; height: 8px; margin-right: 3px; border-radius: 2px; background: currentColor; position: relative; top: 1px; } .rg-bcard .rg-price .lock::before { content: ''; position: absolute; left: 1.5px; top: -5px; width: 6px; height: 6px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; box-sizing: border-box; }
.rg-bcard.shake { animation: rg-shake .38s ease; }
@keyframes rg-shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.rg-bcard.done { cursor: default; background: #F3F7EE; } .rg-bcard.done .rg-price { background: #E3EFD8; color: var(--forest); }

/* Map labels and tags (absolutely placed over the canvas) */
.rg-label { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; white-space: nowrap; font: 600 19px/1.1 var(--font-display); color: #fff; letter-spacing: .01em; text-shadow: 0 1px 2px rgba(20,35,25,.9), 0 0 6px rgba(20,35,25,.55); }
.rg-label.sm { font-size: 13px; }
.rg-label .owner { width: 10px; height: 6px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.55); }
.rg-tag { display: inline-block; padding: 2px 6px; border-radius: 8px; background: rgba(247,244,236,.95); color: var(--ink); font: 700 12px/1.3 var(--font-body); box-shadow: var(--shadow-tag); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rg-tag.sum { padding: 3px 10px; color: var(--gold-ink); font: 600 16px/1.2 var(--font-display); background: linear-gradient(170deg, var(--gold-light) 0%, var(--gold) 55%, var(--gold-deep-fill) 100%); box-shadow: 0 2px 6px rgba(80,50,0,.45); }

/* Resource icon: a coloured picture on a light disc in its group's tint (food green, war grey, luxury lilac), ringed in the group colour */
.rg-res { --rg: var(--muted); display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--paper-2); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--rg) 45%, transparent), 0 0 0 1.5px #fff, 0 1px 2px rgba(0,0,0,.25); }
.rg-res[data-g="mat"] { --rg: var(--res-mat); background: var(--res-bg-mat); }
.rg-res[data-g="forsvar"] { --rg: var(--res-forsvar); background: var(--res-bg-forsvar); }
.rg-res[data-g="lyx"] { --rg: var(--res-lyx); background: var(--res-bg-lyx); }
.rg-res svg { width: 76%; height: 76%; }
.rg-res.sm { width: 18px; height: 18px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rg) 45%, transparent), 0 0 0 1px #fff; }
.rg-res.sm svg { width: 82%; height: 82%; }
.rg-res.lg { width: 34px; height: 34px; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--rg) 45%, transparent), 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.25); }
.rg-res.near { outline: 2px solid var(--ink); outline-offset: 1px; }
.rg-res.import { outline: 2px dashed var(--muted); outline-offset: 1px; }
.rg-res.missing { background: var(--paper-2) !important; box-shadow: inset 0 0 0 1.5px var(--line); }
.rg-res.missing svg { filter: grayscale(1); opacity: .35; }
.rg-resrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* pulse: a resource your realm lacks has just come into view – the icon by the place's name breathes for a few rounds, instead of a message */
.rg-res.pulse { animation: rg-respulse 1.4s ease-in-out infinite; }
@keyframes rg-respulse { 50% { box-shadow: 0 0 0 1.5px rgba(255,255,255,.9), 0 0 0 7px color-mix(in srgb, var(--gold) 55%, transparent); transform: scale(1.12); } }

/* Advisor: one suggested next step under the HUD; tap goes to the place it names */
.rg-advice { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius-md); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font: 600 13px/1.3 var(--font-body); color: var(--ink); text-align: left; cursor: pointer; }
.rg-advice::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.rg-advice span { flex: 1; min-width: 0; }
.rg-advice b { color: var(--accent); font-weight: 800; }
/* with an icon: the thing the advice is about (a resource, a sword, a gift) replaces the dot */
.rg-advice.has-icon::before { display: none; }
.rg-advice > .rg-res { flex: none; }

/* Popover: compact action panel anchored to a place on the map. Values from Rail Regent's build panel (#buildpanel / #homepop). */
.rg-pop { position: absolute; left: 0; top: 0; z-index: 3; display: flex; flex-direction: column; gap: 8px; padding: 10px; width: max-content; max-width: min(320px, calc(100vw - 16px)); box-sizing: border-box; background: rgba(247,244,236,.97); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop); color: var(--ink); font: 400 13px/1.35 var(--font-body); }
.rg-pop::after { content: ''; position: absolute; left: var(--arrow-x, 50%); bottom: -6px; width: 12px; height: 12px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.rg-pop.below::after { bottom: auto; top: -6px; }
.rg-pop.short { box-shadow: var(--shadow-pop), inset 0 3px 0 var(--bad); }
.rg-pop-top { display: flex; align-items: flex-start; gap: 10px; }
.rg-pop-head { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.rg-pop-head b { font: 600 18px/1.2 var(--font-display); }
.rg-pop-head small { font-size: 12px; color: var(--muted); }
.rg-pop .rg-x { width: 30px; height: 30px; font-size: 18px; margin: -2px -2px 0 auto; }
.rg-pop-cost { display: flex; align-items: center; gap: 5px; padding: 0 4px; font: 600 19px/1.1 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rg-pop-cost.bad { color: var(--bad); }
.rg-pop-row { display: flex; gap: 6px; }
.rg-pop-row .rg-btn { flex: 1; min-height: 44px; }
.rg-pop .rg-seg button { min-height: 32px; padding: 5px 4px; font-size: 13px; }

/* Versus: your strength against theirs, as one split bar */
.rg-versus { display: flex; flex-direction: column; gap: 4px; }
.rg-versus-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--paper-2); gap: 2px; }
.rg-versus-bar .you { background: var(--accent); }
.rg-versus-bar .them { background: var(--muted); }
.rg-versus-bar .levy { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, transparent 3px 6px); transition: flex .2s; }
/* Slider: how much to commit, e.g. from "the army as it stands" to a full campaign with levies; the consequence is shown as text under it */
.rg-slider { width: 100%; margin: 4px 0 0; accent-color: var(--accent); }
.rg-slider-lab { display: flex; justify-content: space-between; font: 700 11px/1.2 var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rg-versus-lab { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.rg-versus-lab b { color: var(--ink); font: 600 15px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }

/* Meter: a 0–100 standing (friendship, loyalty) with a goal mark and an optional preview of what an action adds */
.rg-meter { display: flex; flex-direction: column; gap: 4px; }
.rg-meter-track { position: relative; height: 10px; border-radius: 5px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.rg-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); }
.rg-meter-gain { position: absolute; top: 0; bottom: 0; border-radius: 0 5px 5px 0; background: repeating-linear-gradient(135deg, var(--accent) 0 3px, transparent 3px 6px); opacity: .55; }
.rg-meter-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--ink); }
.rg-meter-lab { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.rg-meter-lab b { color: var(--ink); }
.rg-meter.mini { width: 34px; }
.rg-meter.mini .rg-meter-track { height: 6px; }
.rg-meter.mini .rg-meter-mark { top: -2px; bottom: -2px; width: 1.5px; }

/* Army token: the force in a place that can march (defenders stay and are shown only in the sheet) */
.rg-army { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px 2px 4px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font: 600 14px/1.1 var(--font-display); font-variant-numeric: tabular-nums; box-shadow: var(--shadow-tag); text-shadow: none; white-space: nowrap; }
.rg-army svg { width: 15px; height: 15px; flex: none; }
.rg-army small { font: 700 11px/1 var(--font-body); opacity: .9; }
.rg-army.march { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; will-change: transform; background: var(--war-bg); color: var(--ink); padding: 2px 8px 2px 3px; box-shadow: inset 0 0 0 1.5px var(--war), 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.45); }
.rg-army.march svg { width: 20px; height: 20px; }
.rg-res.war { --rg: var(--war); background: var(--war-bg); } .rg-res.def { --rg: var(--defence); background: var(--defence-bg); } .rg-res.infl { --rg: var(--influence); background: var(--influence-bg); } .rg-res.food { --rg: var(--food); background: var(--food-bg); }
/* sized: the whole army as sword + shield side by side (neutrals: shield only), no number; --s = 20 + 2.6·√(men/10) px, max 46, × zoom */
.rg-army.sized { position: relative; height: var(--s); min-width: var(--s); padding: 0 calc(var(--s) * .2); gap: calc(var(--s) * .04); justify-content: center; border-radius: calc(var(--s) / 2); box-sizing: border-box; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.rg-army.sized svg { width: calc(var(--s) * .58); height: calc(var(--s) * .58); }
.rg-army.sized:not(.ready):not(.neutral) { background: color-mix(in srgb, var(--accent) 60%, var(--paper)); }
.rg-army.sized.neutral { background: var(--neutral); color: var(--ink); border-color: rgba(255,255,255,.8); }

/* pair: the army as two soldiers side by side, each sized by its own share - the soldier with a sword = attack force, the soldier behind a shield = defence; neutrals: a grey defender.
   Each badge: a coloured soldier on a light ground ringed in its meaning colour; --s = 3.2*sqrt(men) px, 20-56, x zoom; hidden below 10 men. Shield at the town, sword out in the land */
.rg-army.pair { background: none; box-shadow: none; padding: 0; gap: 3px; align-items: flex-end; }
.rg-army.pair > i { display: grid; place-items: center; width: var(--s); height: var(--s); border-radius: 50%; box-sizing: border-box; box-shadow: inset 0 0 0 1.5px var(--ring), 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.45); }
.rg-army.pair > i svg { width: 82%; height: 82%; }
.rg-army.pair > .atk { --ring: var(--war); background: var(--war-bg); }
.rg-army.pair > .def { --ring: var(--defence); background: var(--defence-bg); }
.rg-army.pair > .def.short { box-shadow: inset 0 0 0 1.5px var(--ring), 0 0 0 2px #fff, 0 0 0 4.5px var(--bad), 0 2px 6px rgba(0,0,0,.45); }
.rg-army.pair.neutral > .def { --ring: var(--muted); background: var(--paper-2); }
.rg-army.pair.neutral > .def svg { filter: grayscale(1); opacity: .8; }
.rg-army.pair > i[hidden] { display: none; }

/* Thought bubble: what a place wants, under its name – the same bubble as Rail Regent's town wishes:
   white card with a dashed gold edge, a "?" badge, a small round tail, the wanted thing as a muted picture inside. Tap opens the place. */
.rg-bubble { pointer-events: auto; cursor: pointer; position: relative; display: grid; place-items: center; width: 38px; height: 30px; margin-top: 4px; border-radius: var(--radius-xl); background: rgba(255,255,255,.92); border: 2px dashed var(--coin); box-shadow: 0 2px 6px rgba(0,0,0,.45); text-shadow: none; box-sizing: border-box; }
.rg-bubble::before { content: '?'; position: absolute; top: -8px; right: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--coin); color: #fff; font: 800 11px/16px var(--font-body); text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.rg-bubble::after { content: ''; position: absolute; bottom: -9px; left: 10px; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.92); border: 1.5px dashed var(--coin); }
.rg-bubble svg { width: 22px; height: 22px; opacity: .75; filter: saturate(.6); }
.rg-bubble .rg-res { width: 22px; height: 22px; }
.rg-bubble .rg-res svg { width: 76%; height: 76%; opacity: 1; filter: none; }
/* unrest: the same bubble in red, "!" badge, rounds left inside */
.rg-bubble.oro { border-color: var(--bad); }
.rg-bubble.oro::before { content: '!'; background: var(--bad); }
.rg-bubble.oro::after { border-color: var(--bad); }
.rg-bubble.oro b { font: 600 17px/1 var(--font-display); color: var(--bad); }
.rg-bubble.oro.ok { border-color: var(--warn); } .rg-bubble.oro.ok::before { background: var(--warn); } .rg-bubble.oro.ok::after { border-color: var(--warn); } .rg-bubble.oro.ok b { color: var(--warn); }

/* Wish: a place's wish in its sheet, a quote edged in the group colour; the build card that answers it glows */
.rg-wish { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: var(--paper-2); border-radius: var(--radius-md); border-left: 4px solid var(--coin); font-size: 14px; line-height: 1.35; }
.rg-wish .rg-eyebrow { color: var(--gold-deep); }
.rg-wish.oro { --wish: var(--bad); background: #F6E2DD; }
.rg-bcard.wished:not(:disabled) { box-shadow: 0 0 0 3px var(--gold), var(--shadow-card); animation: rg-wishpulse 1.4s ease-in-out infinite; }
.rg-bcard.wished::before { content: '!'; position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--coin); color: var(--gold-ink); font: 800 13px/1 var(--font-body); box-shadow: var(--shadow-tag); }
@keyframes rg-wishpulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 60%, transparent), var(--shadow-card); } }


/* Population dot: place size when zoomed out (Rail Regent's town dots) */
.rg-popdot { display: block; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 2px rgba(20,35,25,.65), 0 1px 3px rgba(0,0,0,.4); }
.rg-popdot.mine { background: var(--player-1); box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.4); }


/* Round summary: after End turn, only when something big happened; one tap to continue */
.rg-summary { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; width: min(92vw, 360px); box-sizing: border-box; }
.rg-summary-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rg-summary-h b { font: 600 18px/1.2 var(--font-display); }
.rg-summary-h small { font-size: 12px; color: var(--muted); }
.rg-summary ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.rg-summary li { display: flex; gap: 8px; font-size: 14px; line-height: 1.35; cursor: pointer; }
.rg-summary li::before { content: ''; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--good); }
.rg-summary li.bad::before { background: var(--bad); }

/* Map event markers: what changed in a place this round */
.rg-tag.ev { color: var(--forest); font: 600 15px/1.2 var(--font-display); }
.rg-tag.evbad { color: var(--bad); font: 600 15px/1.2 var(--font-display); }
.rg-tag.loss { color: var(--bad); font: 600 16px/1.2 var(--font-display); }
.rg-bubble.oro.rg-anim:not(.ok) { animation: rg-pulse 1.4s ease-in-out infinite; }
@keyframes rg-pulse { 50% { transform: scale(1.1); } }

/* Meaning colours: a meter takes the colour of what it measures (gold money, black war, blue defence, purple influence/luxury/culture, green food) – set --accent on a group to recolour its meter and buttons */
.rg-grp { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.rg-grp.war { --accent: var(--war); } .rg-grp.infl { --accent: var(--influence); } .rg-grp.def { --accent: var(--defence); } .rg-grp.food { --accent: var(--food); }
.rg-grp-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 800 11px/1.3 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.rg-grp-h svg { width: 14px; height: 14px; vertical-align: -2px; }
.rg-grp-h .v { text-transform: none; letter-spacing: 0; font: 700 12px/1.3 var(--font-body); color: var(--ink); font-variant-numeric: tabular-nums; }
.rg-grp .rg-meter-fill, .rg-grp .rg-bar > span { background: var(--accent); }

/* Slot meter: one slot per kind with its icon baked in, filled when the place has it (Lyx: vin, bärnsten, ylle; Krig: trä, järn, hästar) */
.rg-slots { display: flex; gap: 3px; }
.rg-slots > span { flex: 1; display: grid; place-items: center; height: 24px; border-radius: 6px; background: var(--paper-2); color: color-mix(in srgb, var(--muted) 55%, transparent); box-shadow: inset 0 0 0 1px var(--line); }
.rg-slots > span.on { background: var(--accent); color: #fff; box-shadow: none; }
.rg-slots svg { width: 15px; height: 15px; }
.rg-slots > span.built:not(.on) { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); border: 1.5px dashed color-mix(in srgb, var(--accent) 35%, transparent); box-sizing: border-box; }
.rg-grp.oro { box-shadow: inset 0 0 0 1.5px var(--bad); }
.rg-btn.def-btn { background: var(--defence); color: #fff; }
/* Level pips: a place's size as 1–4 filled pips beside "Nivå n" */
.rg-pips { display: inline-flex; gap: 2px; vertical-align: 1px; }
.rg-pips i { width: 6px; height: 6px; border-radius: 2px; background: var(--line); }
.rg-pips i.on { background: var(--food); }

/* Split bar: the army as defence (blue, shield) and attack (black, sword); the total is shown beside it */
.rg-split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--paper-2); }
.rg-split .def { background: var(--defence); } .rg-split .atk { background: var(--war); } .rg-split .gap { background: repeating-linear-gradient(135deg, var(--bad) 0 3px, transparent 3px 6px); opacity: .6; }
.rg-split-lab { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.rg-split-lab b { color: var(--ink); font: 600 14px/1.1 var(--font-display); }
.rg-split-lab svg { width: 13px; height: 13px; vertical-align: -2px; }

/* End turn ready: once the round's moves are used, the button breathes */
.rg-btn.end.ready { animation: rg-ready 1.6s ease-in-out infinite; }
@keyframes rg-ready { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); } }
/* Gift mark by a place's name after a gift, fading over a few rounds */
.rg-giftmark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--influence-bg); color: var(--influence); box-shadow: inset 0 0 0 1.5px var(--influence), 0 0 0 1.5px #fff, var(--shadow-tag); }
.rg-giftmark svg { width: 12px; height: 12px; }

/* Toast */
.rg-toast { padding: 8px 12px; border-radius: var(--radius-md); background: var(--toast); color: #fff; font: 400 13px/1.35 var(--font-body); text-align: center; }

@media (prefers-reduced-motion: reduce) { .rg-anim, .rg-btn.end.ready, .rg-bcard.wished, .rg-res.pulse { animation: none !important; } }

/* ---- Synced from Rail Regent (Oct 2026): screens and panels both games need ---- */

/* Overlay + card: setup, help and end screens over a deep accent gradient (dim over a running game) */
.rg-overlay { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; overflow-y: auto; padding: 24px 16px; box-sizing: border-box; background: linear-gradient(160deg, var(--overlay-top) 0%, var(--overlay-mid) 60%, var(--overlay-deep) 100%); }
.rg-overlay.dim { background: rgba(20,35,25,.55); }
.rg-card { box-sizing: border-box; width: min(100%, 420px); display: flex; flex-direction: column; gap: 16px; padding: var(--space-22); border-radius: var(--radius-card); background: var(--paper); box-shadow: var(--shadow-modal); color: var(--ink); font: 400 14px/1.5 var(--font-body); }
.rg-card h1 { margin: 0; font: 600 34px/1.1 var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.rg-card p { margin: 0; }
.rg-brand { display: flex; align-items: center; gap: 12px; }
.rg-brand img, .rg-brand svg { width: 44px; height: 44px; flex: none; }
.rg-field { display: flex; flex-direction: column; gap: 6px; }

/* Mode picker: three big choices on the setup card (Sweden · Campaign · Free play) */
.rg-modes { font-family: var(--font-body); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rg-mode { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 10px; border: 0; border-radius: var(--radius-xl); background: var(--paper-2); font: inherit; color: var(--ink); text-align: center; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.rg-mode svg, .rg-mode img { width: 34px; height: 34px; }
.rg-mode b { font: 600 17px/1.15 var(--font-display); }
.rg-mode small { font-size: 11.5px; line-height: 1.25; color: var(--muted); }
.rg-mode:hover { transform: translateY(-1px); }
.rg-mode[aria-selected="true"] { background: var(--card); box-shadow: 0 2px 10px rgba(20,35,25,.18), inset 0 0 0 2px var(--accent); }

/* Level list: campaign maps in order; locked ones are disabled, won ones take a gold number */
.rg-levels { font-family: var(--font-body); display: flex; flex-direction: column; gap: 4px; }
.rg-level { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-lg); background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.rg-level:hover:not(:disabled) { background: var(--paper-2); }
.rg-level.on { background: var(--paper-2); box-shadow: inset 0 0 0 2px var(--accent); }
.rg-level:disabled { opacity: .45; cursor: default; }
.rg-level > i { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 600 14px/1 var(--font-display); font-style: normal; }
.rg-level.won > i { background: var(--coin); color: var(--gold-ink); }
.rg-level:disabled > i { background: #9a9a96; }
.rg-level > span { display: flex; flex-direction: column; line-height: 1.2; }
.rg-level b { font: 600 17px/1.2 var(--font-display); }
.rg-level small { font-size: 12.5px; color: var(--muted); }

/* Tutorial: one step at a time, near the thing it points at; the target gets .rg-hl */
.rg-tut { font-family: var(--font-body); box-sizing: border-box; width: min(360px, calc(100vw - 24px)); padding: 10px 14px 12px; border-radius: 16px; background: rgba(247,244,236,.98); border-left: 4px solid var(--accent); box-shadow: 0 4px 18px rgba(20,35,25,.32); color: var(--ink); animation: rg-in .3s ease; }
.rg-tut-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.rg-tut p { margin: 2px 0 10px; font: 400 14.5px/1.4 var(--font-body); }
.rg-tut-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.rg-tut .rg-x { width: 28px; height: 28px; font-size: 18px; border-radius: var(--radius-sm); }
.rg-hl { border-radius: var(--radius-md); animation: rg-hl 1.4s ease-in-out infinite; }
@keyframes rg-hl { 0%,100% { box-shadow: 0 0 0 3px rgba(232,169,42,.9); } 50% { box-shadow: 0 0 0 8px rgba(232,169,42,.25), 0 0 0 3px rgba(232,169,42,.9); } }
@keyframes rg-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Standings: every player's score, yours highlighted; the change since last round in small */
.rg-scores { display: flex; flex-direction: column; gap: 2px; min-width: 240px; max-width: calc(100vw - 24px); padding: 8px 10px; box-sizing: border-box; font: 400 14px/1.3 var(--font-body); }
.rg-score { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: var(--radius-sm); }
.rg-score.on { background: var(--paper-2); }
.rg-score > i { width: 11px; height: 11px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.rg-score > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-score b { font: 600 15px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.rg-score small { width: 44px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.rg-score small.up { color: var(--good); } .rg-score small.down { color: var(--bad); }

/* Goals: missions and bonuses; ⚑ for goals, ★ for bonuses; a done goal is ticked and muted */
.rg-goals { font-family: var(--font-body); display: flex; flex-direction: column; padding: 4px 8px 6px; }
.rg-goal { box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 9px; background: none; font: 400 14px/1.3 var(--font-body); color: var(--ink); text-align: left; }
button.rg-goal { cursor: pointer; } button.rg-goal:hover { background: var(--paper-2); }
.rg-goal > i, .rg-goal-ic { flex: none; width: 18px; flex: none; text-align: center; font-style: normal; color: var(--gold-deep); }
.rg-goal > span:not([class]), .rg-goal-tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-goal b { font: 600 14px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.rg-goal.done > i, .rg-goal.done .rg-goal-ic { color: var(--good); font-weight: 800; } .rg-goal.done > span, .rg-goal.done .rg-goal-tx { color: var(--muted); }

/* Bonus star by a place's name: gold now, orange soon, grey when last chance passed */
.rg-star { display: inline-block; padding: 0 6px; border-radius: var(--radius-sm); background: linear-gradient(170deg, #FFE9A8, var(--gold)); color: var(--gold-ink); font: 600 12px/1.5 var(--font-display); text-shadow: none; box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.rg-star.soon { background: linear-gradient(170deg, #FFD7A0, #E8954A); }
.rg-star.last { background: linear-gradient(170deg, #E9E2D6, #B9AFA2); color: #5A4E40; opacity: .8; }

/* Burst: a goal reached, over the place on the map; rises and fades in 2.8 s */
.rg-burst { position: absolute; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-lg); background: linear-gradient(170deg, #FFE9A8, var(--gold)); color: var(--gold-ink); font: 600 15px/1.2 var(--font-display); white-space: nowrap; box-shadow: 0 2px 10px rgba(60,35,0,.45), inset 0 0 0 1.5px #C8891C; transform: translate(-50%, -140%); animation: rg-burst 2.8s ease-out forwards; }
.rg-burst b { font-size: 17px; }
@keyframes rg-burst { 0% { opacity: 0; transform: translate(-50%, -100%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -140%) scale(1.08); } 20% { transform: translate(-50%, -140%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%); } }

/* Float: a gain or loss rising from the map (1.5 s) */
.rg-float { position: absolute; transform: translate(-50%, -50%); font: 600 15px/1 var(--font-display); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.85), 0 0 4px rgba(0,0,0,.6); animation: rg-rise 1.5s ease-out forwards; pointer-events: none; }
.rg-float.good { color: #CDEFB8; } .rg-float.bad { color: #FFC2B8; }
@keyframes rg-rise { from { opacity: 0; translate: 0 6px; } 15% { opacity: 1; } to { opacity: 0; translate: 0 -38px; } }
.rg-money.bump { animation: rg-bump .25s ease-out; }
@keyframes rg-bump { 50% { transform: scale(1.06); } }

/* Bottom bar: the floating action bar bottom-right */
.rg-actions { display: flex; gap: 6px; padding: 6px; border-radius: 16px; background: rgba(247,244,236,.96); box-shadow: var(--shadow-panel); }

/* Toast stack: confirmations under the HUD */
.rg-toasts { display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.rg-toast { transition: opacity .35s, transform .35s; }
.rg-toast.out { opacity: 0; transform: translateY(-6px); }

@media (prefers-reduced-motion: reduce) { .rg-burst, .rg-float, .rg-hl, .rg-tut, .rg-money.bump { animation: none !important; } .rg-burst { opacity: 1; } }

/* Realm pill (HUD row 1): your realm in one tap target – colour dot + regions · folk · calm. Tap opens the realm sheet. */
.rg-realm-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 0; border-radius: var(--radius-pill); background: var(--paper-2); font: 700 13px/1.1 var(--font-body); color: var(--ink); font-variant-numeric: tabular-nums; cursor: pointer; white-space: nowrap; min-width: 0; }
.rg-realm-pill .sep { width: 1px; height: 12px; background: var(--line); flex: none; }
.rg-realm-pill.on { box-shadow: inset 0 0 0 2px var(--gold); }
@media (max-width: 440px) { .rg-realm-pill { font-size: 12px; padding: 4px 8px; gap: 4px; } }

/* Troops (ArmyToken, current): RegentIcons.troops() inside .rg-troops; box is 3em × 3em, feet on the bottom edge. Set font-size = front soldier width in px. */
.rg-troops { position: absolute; left: 0; top: 0; width: 3em; height: 3em; pointer-events: none; will-change: transform; }
.rg-troops > i { position: absolute; display: block; transform: translate(-50%, -100%); }
.rg-troops > i svg { width: 100%; height: 100%; display: block; overflow: visible; }
.rg-troops > i.f { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.rg-troops > i.s { filter: drop-shadow(0 .5px .6px rgba(0,0,0,.35)); }
.rg-troops[hidden] { display: none; }
