// data.jsx — all narrative content for the Banana Republic arc.
// Profile dimensions measured during ESCAPE, used to seed DICTATOR:
//   nerve    — boldness / risk tolerance
//   mercy    — concern for others vs. self-preservation
//   guile    — working the system vs. blunt force
//   resolve  — principled/long-term vs. expedient/short-term
//   defiance — against the system vs. compliant with it
// Each is accumulated as a signed integer, then normalized at the transition.

const ESCAPE_INTRO = {
  station: "CENTRAL SORTING — STATION 7",
  clerk: "CLERK 0447",
  lines: [
    "The Republic thanks you for your service.",
    "You sort the mail. You report what must be reported.",
    "Every envelope that crosses this desk has been opened before it reaches you, and will be opened again after.",
    "You have decided to leave. You have not told anyone. You cannot.",
    "Process the day's letters. Reach the border. Try not to be noticed.",
  ],
};

// ── ESCAPE LETTERS ──────────────────────────────────────────────────────────
// choice deltas: suspicion (toward 100 = caught), progress (toward 100 = escaped)
// profile deltas applied to the named dimensions.
const LETTERS = [
  {
    id: "santos",
    day: 1,
    from: "M. SANTOS",
    to: "J. SANTOS",
    flag: "FLAGGED BY ROUTING — POSSIBLE CIPHER",
    body: [
      "Dear Brother,",
      "The weather has been unusual — 17 degrees at noon, 45 at sunset.",
      "Mother sends her love from Hospital Three. The blue door is open again.",
      "Do not write back the usual way.",
      "— M.",
    ],
    note: "The numbers are not weather. Hospital Three was demolished in '19.",
    cipher: ["17 → WARD.  45 → ROOM.", "'blue door' — the safehouse is open.", "'Hospital Three' — the quarry road.", "They are telling someone how to leave."],
    choices: [
      {
        label: "Mark suspicious — forward to State Security",
        sub: "A name gets a knock at the door tonight. Your record stays clean.",
        suspicion: -8, progress: 4,
        profile: { mercy: -3, defiance: -2, guile: 1 },
        log: "You forwarded the Santos letter. Security thanks you in writing.",
      },
      {
        label: "Let it through — copy the cipher first",
        sub: "You learn how they hide things. The letter continues its journey.",
        suspicion: 6, progress: 8,
        profile: { mercy: 2, nerve: 2, guile: 3 },
        log: "You copied the Santos cipher. It may be a key. It may be a trap.",
      },
      {
        label: "Destroy it — it never existed",
        sub: "No record, no knock. But unrouted mail gets counted.",
        suspicion: 11, progress: 3,
        profile: { mercy: 3, defiance: 3, nerve: 2 },
        log: "You burned the Santos letter in the stove. The ash is evidence too.",
      },
    ],
  },
  {
    id: "denounce",
    day: 1,
    from: "A CONCERNED CITIZEN",
    to: "MINISTRY OF ORDER",
    flag: "DENUNCIATION — PRIORITY ROUTING",
    body: [
      "To whom it concerns,",
      "My downstairs neighbor, Teacher Okonkwo, listens to foreign radio after curfew.",
      "I have heard the dial through the floor. I am a loyal citizen.",
      "I ask only that this be noted, and that my water ration be restored.",
    ],
    note: "Denunciations are rewarded. Processing them quickly is how clerks survive.",
    choices: [
      {
        label: "File it — quick, clean, rewarded",
        sub: "Teacher Okonkwo is processed. You are noted as efficient.",
        suspicion: -6, progress: 5,
        profile: { mercy: -3, defiance: -2, resolve: -1 },
        log: "You filed the denunciation. The teacher's name enters the system.",
      },
      {
        label: "Lose it in the unsorted pile",
        sub: "It will surface eventually. Or it won't. Plausible.",
        suspicion: 5, progress: 4,
        profile: { mercy: 2, guile: 2, defiance: 1 },
        log: "You buried the denunciation. Bureaucracy is a good place to hide things.",
      },
      {
        label: "Forge a clerical rejection — wrong ministry",
        sub: "Send it on a six-week detour through three offices.",
        suspicion: 8, progress: 6,
        profile: { guile: 3, defiance: 2, nerve: 2 },
        log: "You forged a routing rejection. The denouncer will get a form, not justice.",
      },
    ],
  },
  {
    id: "child",
    day: 2,
    hand: true,
    from: "A CHILD",
    to: "PRISONER 6611, BLOCK D",
    flag: "ADDRESSEE INCARCERATED — DELIVERY PROHIBITED",
    body: [
      "papa",
      "i lost the tooth. mama says you would want to know.",
      "i am being brave like you said. i am not crying in this letter.",
      "come home when they let you.",
    ],
    note: "Mail to political prisoners is prohibited. It is also, sometimes, all a family has left.",
    choices: [
      {
        label: "Slip it into the block delivery anyway",
        sub: "A guard might find it. The guard might also have a child.",
        suspicion: 9, progress: 5,
        profile: { mercy: 3, nerve: 3, defiance: 2 },
        log: "You smuggled the child's letter into Block D. You'll never know if it arrived.",
      },
      {
        label: "Confiscate — follow the rule",
        sub: "The rule exists for a reason. The reason is fear.",
        suspicion: -3, progress: 4,
        profile: { mercy: -2, resolve: 1, defiance: -2 },
        log: "You confiscated the child's letter. It goes in the gray bin with the others.",
      },
      {
        label: "Attach it to the prisoner's file as evidence of contact",
        sub: "Demonstrates vigilance. Mother and child are now 'associates.'",
        suspicion: -7, progress: 3,
        profile: { mercy: -4, defiance: -3, guile: 1 },
        log: "You added the child's letter to the file. Vigilance is rewarded.",
      },
    ],
  },
  {
    id: "contact",
    day: 2,
    from: "[NO RETURN ADDRESS]",
    to: "CLERK 0447",
    flag: "ADDRESSED TO YOU",
    body: [
      "Clerk. We know which desk you sit at.",
      "There is a truck leaving the quarry Thursday before dawn. The driver answers to 'blue door.'",
      "Bring nothing. Tell no one. Burn this.",
      "If you are not the person we think you are, forget you read it.",
    ],
    note: "This is either the way out, or the most expensive mistake of your life.",
    cipher: ["'blue door' — the same phrase as the Santos letter.", "The driver is theirs. The quarry is real.", "This is the route. It has your name on it."],
    choices: [
      {
        label: "Answer the code — commit to the truck",
        sub: "You're in. No backing out after dawn Thursday.",
        suspicion: 7, progress: 18,
        profile: { nerve: 4, defiance: 3, mercy: 1 },
        log: "You answered 'blue door.' Thursday is now the most important day of your life.",
      },
      {
        label: "Ignore it — find your own way out alone",
        sub: "Trust no one. Owe no one. Slower, but yours.",
        suspicion: 2, progress: 6,
        profile: { resolve: 3, guile: 2, mercy: -1 },
        log: "You ignored the resistance. You'll cross the border on your own terms or not at all.",
      },
      {
        label: "Report the contact — buy yourself safety",
        sub: "Hand them the cell. Security will remember your loyalty.",
        suspicion: -14, progress: 2,
        profile: { mercy: -5, defiance: -4, guile: 2 },
        log: "You reported the resistance contact. Doors will open for you. Some will close forever.",
      },
    ],
  },
  {
    id: "bribe",
    day: 3,
    hand: true,
    from: "MME. FERREIRA",
    to: "[ABROAD]",
    flag: "CURRENCY DETECTED IN ENVELOPE",
    body: [
      "Inside this envelope is more money than you make in a season.",
      "I am not asking you to do anything wrong. I am asking you to do nothing.",
      "Let the letter go. Forget the weight of it. We both have families.",
    ],
    note: "The money is real. Taking it is survival. Taking it is also a hook they can pull later.",
    choices: [
      {
        label: "Take it — and let the letter through",
        sub: "Honest corruption. You needed it. So did she.",
        suspicion: 4, progress: 7, money: true,
        profile: { guile: 3, mercy: 1, resolve: -2 },
        log: "You took Ferreira's money and let the letter fly. Now someone owns a piece of you.",
      },
      {
        label: "Take it — then report her anyway",
        sub: "Keep the money, keep the credit. Lose the last of something.",
        suspicion: -9, progress: 5, money: true,
        profile: { mercy: -5, guile: 2, defiance: -2 },
        log: "You took the money and reported her. Efficient. The mirror will have notes.",
      },
      {
        label: "Refuse — process strictly by the book",
        sub: "No money, no compromise, no thread for them to pull.",
        suspicion: -1, progress: 4,
        profile: { resolve: 4, mercy: 0, defiance: 0 },
        log: "You refused the bribe and followed procedure. Clean hands, empty pockets.",
      },
    ],
  },
];

// ── BORDER (escape resolution) ──────────────────────────────────────────────
const BORDER = {
  title: "THURSDAY — BEFORE DAWN",
  body: [
    "The quarry road is white with frost. There is a truck. There is a checkpoint you did not expect.",
    "A young soldier — younger than you — shines a light at your papers. His hand is shaking more than yours.",
  ],
  choices: [
    {
      label: "Talk your way through — calm, papers, a small lie",
      sub: "Lean on composure and a forged stamp.",
      need: "guile",
      profile: { guile: 2, nerve: 1 },
      log: "You talked through the checkpoint. The soldier wanted to believe you.",
    },
    {
      label: "Run for the treeline when his light drops",
      sub: "Trust your legs and the dark.",
      need: "nerve",
      profile: { nerve: 3 },
      log: "You ran. Branches, breath, no shots. The border is behind you.",
    },
    {
      label: "Offer him everything you have to look away",
      sub: "Money, watch, the letter in your coat.",
      need: "mercy",
      profile: { guile: 1, mercy: 1 },
      log: "You bought the soldier's blindness. He has a family too, he said.",
    },
  ],
};

// ── STATE NEWS (morning propaganda, per day) ────────────────────────────────
const NEWS = {
  1: {
    date: "STATE BULLETIN — MONDAY",
    items: [
      "Economic productivity reaches record heights under the administration's wise guidance.",
      "Citizens are reminded that vigilance is the truest form of patriotism. Report the unusual.",
      "Mail volumes are down. The Ministry thanks postal staff for their diligence and discretion.",
    ],
  },
  2: {
    date: "STATE BULLETIN — TUESDAY",
    items: [
      "Foreign agitators continue their attempts to destabilize our peaceful and contented nation.",
      "New identification protocols at all transport hubs, introduced for the safety of citizens.",
      "There is no shortage of bread. Reports of a shortage of bread are themselves the shortage.",
    ],
  },
  3: {
    date: "STATE BULLETIN — WEDNESDAY",
    items: [
      "A successful raid has uncovered a propaganda network. Forty-seven detained for reeducation.",
      "The border regions report record happiness. There is no reason for any citizen to travel.",
      "Loyalty is its own reward. Disloyalty is also, in time, its own reward.",
    ],
  },
};

// ── EVENING (one escape action per day) ─────────────────────────────────────
const EVENINGS = {
  1: {
    title: "After your shift, the corridor is empty.",
    sub: "You have the night. Spend it on staying ordinary, or on getting out.",
    choices: [
      { label: "Study the cipher you copied — learn how they hide things", sub: "Knowledge you can use at the border.",
        suspicion: 1, progress: 7, profile: { guile: 3, nerve: 1 },
        log: "You spent the night decoding. The hospital is a quarry. The weather is a map." },
      { label: "Burn anything that ties you to the missing mail", sub: "Erase the trail before it's a noose.",
        suspicion: -7, progress: 3, profile: { nerve: 2, defiance: 1 },
        log: "You burned everything incriminating. Cold hands, clean desk, quiet conscience — almost." },
      { label: "Sleep. Look ordinary. Ordinary people are not arrested.", sub: "The most radical act is appearing to have nothing to hide.",
        suspicion: -3, progress: 2, profile: { resolve: 3 },
        log: "You slept like a loyal citizen. Or you lay still and pretended to, which is the same skill." },
    ],
  },
  2: {
    title: "A name passes you in the dark of the depot.",
    sub: "Thursday is close. You can prepare, or you can leap.",
    choices: [
      { label: "Make contact with the driver early — confirm the truck", sub: "Bold. Exposed. Decisive.",
        suspicion: 6, progress: 12, profile: { nerve: 3, defiance: 2 },
        log: "You met the driver early. He trusts you now. So does anyone watching him." },
      { label: "Forge a transit stamp from a returned form", sub: "A second way out, made by your own hand.",
        suspicion: 3, progress: 9, profile: { guile: 4 },
        log: "You forged a transit stamp. It is nearly perfect. Nearly is the dangerous word." },
      { label: "Watch the watchers — memorize the patrol rota", sub: "Patience over papers.",
        suspicion: 1, progress: 6, profile: { resolve: 3, guile: 1 },
        log: "You learned the patrols by heart. You know exactly when the dark is darkest." },
    ],
  },
  3: {
    title: "The last night before the quarry road.",
    sub: "Whatever you are, you are about to be it at full speed.",
    choices: [
      { label: "Pack nothing. Memorize the route. Become forgettable.", sub: "Travel as a rumor.",
        suspicion: -2, progress: 8, profile: { resolve: 4, nerve: 1 },
        log: "You packed nothing and memorized everything. A person with no luggage has no story to check." },
      { label: "Say a silent goodbye to the neighbor who fed you", sub: "A risk that buys nothing but your own soul.",
        suspicion: 3, progress: 4, profile: { mercy: 4 },
        log: "You said goodbye without words. She understood. She will be questioned, and she knew that, and she nodded." },
      { label: "Steal a colleague's papers as a backup identity", sub: "Their risk becomes your insurance.",
        suspicion: 5, progress: 11, profile: { nerve: 3, mercy: -3, guile: 1 },
        log: "You took Delgado's papers. If they catch the name, they catch him. You decided you could live with that." },
    ],
  },
};

// ── DICTATOR DECISION CARDS ─────────────────────────────────────────────────
// pillars: military, economy, people, foreign  (0..100, start ~50, seeded)
// Some choices enqueue delayed consequences (fire N days later).
// `callback` choices reference the player's escape — wired in engine if profile matches.
const PILLARS = [
  { key: "military", label: "Military", glyph: "shield", color: "#c25a4d" },
  { key: "economy",  label: "Economy",  glyph: "coin",   color: "#d9a23c" },
  { key: "people",   label: "People",   glyph: "people", color: "#4faa86" },
  { key: "foreign",  label: "Foreign",  glyph: "globe",  color: "#6d8bc4" },
];

const CARDS = [
  {
    id: "inauguration",
    title: "The Chair Is Still Warm",
    brief: "Your predecessor died in this office — officially of a heart attack, in a building with no stairs to fall down. The cabinet waits for your first instruction. Everyone is watching which way you lean.",
    choices: [
      { label: "Promise continuity — nothing changes", d: { military: 6, people: -4, foreign: 2 },
        log: "You promised continuity. The generals relax. The streets do not." },
      { label: "Promise reform — vaguely, warmly", d: { people: 8, military: -6, foreign: 4 },
        log: "You promised reform. The word travels faster than your ability to deliver it.",
        enqueue: { id: "reform_due", after: 4 } },
      { label: "Say nothing — let them guess", d: { military: 2, people: -1, economy: 2 },
        log: "You said nothing quotable. Ambiguity is a currency. It inflates." },
    ],
  },
  {
    id: "spending",
    title: "The General's Request",
    brief: "General Martinez requests a 40% increase in military spending — to modernize, to 'project strength to our enemies and our own people.' The finance minister has gone quietly pale. The number is enormous. The general is smiling.",
    choices: [
      { label: "Grant the full increase — buy total loyalty", d: { military: 16, economy: -12, people: -5, foreign: 4 },
        log: "You funded the army in full. The generals adore you. The clinics close to pay for it.",
        enqueue: { id: "gutted_services", after: 4 } },
      { label: "Offer half — a reasonable compromise", d: { military: 8, economy: -7 },
        log: "You offered half. Martinez accepts reluctantly: 'I hope you know what you're doing, Excellency.'" },
      { label: "Reject it — the economy comes first", d: { military: -14, economy: 10, people: 7, foreign: -3 },
        log: "You refused the army its money. Martinez resigns. Units report sudden 'training difficulties.'",
        enqueue: { id: "vasquez_move", after: 4 } },
    ],
  },
  {
    id: "journalist",
    title: "The Foreign Journalist",
    brief: "An American reporter has published an exposé on prison conditions — Block D, specifically. Photographs. The military wants her expelled before dawn. Your foreign minister is sweating.",
    choices: [
      { label: "Expel her tonight", d: { military: 12, foreign: -16, people: -4 },
        log: "You expelled the journalist. The footage airs anyway, now with a deportation angle.",
        enqueue: { id: "sanctions", after: 3 } },
      { label: "Ignore it — let the story die on its own", d: { military: -8, foreign: 4, people: 8 },
        log: "You ignored the exposé. The generals note your weakness." },
      { label: "Invite her to tour 'the reforms'", d: { economy: -5, foreign: 14, people: 10, military: -5 },
        log: "You staged a tour. Now you must build the reforms you showed her.",
        enqueue: { id: "reform_due", after: 5 } },
    ],
  },
  {
    id: "bread",
    title: "The Price of Bread",
    brief: "Wheat reserves are short. The treasury can subsidize bread for two more months, or let the price find its level now. Hungry capitals make history. Empty treasuries make coups.",
    choices: [
      { label: "Keep the subsidy — borrow against the future", d: { people: 10, economy: -12 },
        log: "Bread stays cheap. The debt does not.",
        enqueue: { id: "debt_call", after: 5 } },
      { label: "Let prices rise — blame the weather", d: { economy: 10, people: -14 },
        log: "Bread doubled overnight. So did the word 'enough' in three languages.",
        enqueue: { id: "bread_riot", after: 2 } },
      { label: "Seize private stockpiles — feed the cities", d: { people: 6, economy: -4, military: 4, foreign: -6 },
        log: "You seized the granaries. The merchants who funded you are now counting." },
    ],
  },
  {
    id: "general",
    title: "General Vasquez Requests a Meeting",
    brief: "Your most popular general wants a private audience. He has been visiting barracks. He has been quoted. He brings you a gift — an antique pistol, beautifully cleaned. The symbolism is doing a lot of work.",
    choices: [
      { label: "Promote him — closer where you can see him", d: { military: 8, people: -2 },
        log: "You promoted Vasquez. A rival kept close is still a rival, but visible.",
        enqueue: { id: "vasquez_move", after: 6 } },
      { label: "Send him to a distant post — politely exiled", d: { military: -10, foreign: 2 },
        log: "You exiled Vasquez to the frontier. The army remembers his face better than yours." },
      { label: "Have him arrested at the door", d: { military: -6, people: 4, foreign: -4 },
        log: "You arrested Vasquez. Decisive. The other generals recalculate their odds." },
    ],
  },
  {
    id: "santos_callback",
    title: "A Name You Sorted",
    brief: "Intelligence flags a rising resistance cell. Their courier network uses a weather cipher — temperatures that aren't temperatures. The lead organizer goes by a single initial. The file lands on your desk with a familiar surname: SANTOS.",
    callback: true,
    choices: [
      { label: "Crush the cell — overwhelming force", d: { military: 8, people: -10, foreign: -6 },
        log: "You crushed the Santos cell. The cipher dies with them. So does the blue door.",
        enqueue: { id: "martyr", after: 3 } },
      { label: "Offer amnesty — bring them to the table", d: { people: 10, military: -8, foreign: 6 },
        log: "You offered the Santos cell amnesty. The generals call it surrender. The people call it Thursday." },
      { label: "Turn one of them — make a courier yours", d: { military: 2, people: -2, economy: 0 },
        log: "You turned a Santos courier. Now you read the resistance's mail. You know how that feels.",
        enqueue: { id: "double_agent", after: 4 } },
    ],
  },
  {
    id: "election",
    title: "The Question of an Election",
    brief: "Foreign creditors will release frozen funds if you hold 'a credible vote.' Your interior minister can deliver any result you specify. The only variable is how convincing you need the theater to be.",
    choices: [
      { label: "Hold a real election — and risk it", d: { people: 14, foreign: 12, military: -12, economy: 6 },
        log: "You called a real election. The most dangerous thing a strongman can do is count honestly.",
        enqueue: { id: "election_day", after: 6 } },
      { label: "Stage a 71% victory — clean enough to cash", d: { foreign: 8, economy: 8, people: -6 },
        log: "You staged a 71% win. Modest. Believable. Everyone knows. The money clears." },
      { label: "Cancel it — declare a state of emergency", d: { military: 8, foreign: -12, people: -8, economy: -4 },
        log: "You cancelled the vote. Emergencies, like subsidies, are easy to start." },
    ],
  },
  {
    id: "students",
    title: "The Square Is Full",
    brief: "Students have occupied Liberty Square. No violence yet — guitars, banners, a list of demands written by someone who has read too much and feared too little. By nightfall there will be cameras. By morning, a decision will have been made whether you make it or not.",
    choices: [
      { label: "Clear the square before the cameras arrive", d: { military: 6, people: -16, foreign: -10 },
        log: "You cleared the square at 4 a.m. There were no cameras. There were phones.",
        enqueue: { id: "martyr", after: 2 } },
      { label: "Let them tire — wait it out, cut the power", d: { people: -4, economy: -2, military: -2 },
        log: "You cut the power and waited. Patience reads as weakness to some, mercy to others." },
      { label: "Meet a delegation — concede something small", d: { people: 12, military: -8, foreign: 6 },
        log: "You met the students. A small concession now is a precedent forever." },
    ],
  },
  {
    id: "loan",
    title: "The Neighbor's Generous Loan",
    brief: "A larger, richer neighbor offers a loan that would refill the treasury overnight. The terms are buried in an annex: a naval basing right, a vote at the assembly, a quiet say in your appointments. Sovereignty, sold by the clause.",
    choices: [
      { label: "Take the loan — sign the annex", d: { economy: 16, foreign: 6, military: -4, people: -4 },
        log: "You took the loan. The treasury is full. The annex is a leash with a long lead.",
        enqueue: { id: "patron_calls", after: 5 } },
      { label: "Negotiate — loan without the basing right", d: { economy: 8, foreign: -2 },
        log: "You haggled the annex thinner. Less money, fewer masters." },
      { label: "Refuse — find the money at home", d: { economy: -6, military: 4, people: -2 },
        log: "You refused the loan. Pride is expensive. You'll pay for it in the cities." },
    ],
  },
  {
    id: "mirror",
    title: "A Tour of Block D",
    brief: "Your reforms require a gesture. Your advisors propose you personally tour a prison block — the same block the journalist photographed — and order improvements on camera. You recognize the block number. You sorted mail addressed to it once, in another life.",
    callback: true,
    choices: [
      { label: "Tour it — order real reforms, fund them", d: { people: 12, economy: -8, foreign: 8, military: -4 },
        log: "You walked Block D and meant it. Somewhere a child's confiscated letter is still in a gray bin." },
      { label: "Tour it — order cosmetic fixes for the cameras", d: { foreign: 8, people: 2, economy: -2 },
        log: "You painted Block D for the cameras. The paint is the reform." },
      { label: "Refuse to go — send a deputy", d: { people: -6, military: 2 },
        log: "You sent a deputy to Block D. You could not make yourself walk through that door." },
    ],
  },
  {
    id: "succession",
    title: "The Question No One Asks Aloud",
    brief: "You are not young. A faction wants you to name a successor — to stabilize the markets, they say. To know where to aim, you suspect. Naming an heir creates a destination for everyone's ambition, including yours to outlive it.",
    choices: [
      { label: "Name a loyal nonentity — a placeholder", d: { military: 4, economy: 4, people: -2 },
        log: "You named a nobody as heir. The markets calm. The nobody starts having ideas." },
      { label: "Refuse — there is no after", d: { military: -4, foreign: -4, people: 2 },
        log: "You refused to name a successor. The vacuum after you will be someone else's problem. Probably soon." },
      { label: "Build a council — diffuse the target", d: { people: 6, military: -2, foreign: 4, economy: -2 },
        log: "You built a succession council. Five ambitions watching each other is a kind of peace." },
    ],
  },
  {
    id: "anniversary",
    title: "The Anniversary",
    brief: "It is one year since you took the chair. The ministry of information has prepared a parade, a speech, a commemorative coin with your profile. The treasury notes the cost. The people note the bread. The cameras note everything.",
    choices: [
      { label: "Hold the parade — full spectacle", d: { military: 8, foreign: 4, economy: -8, people: -6 },
        log: "You held the parade. The tanks gleamed. The coin spends at half its minted value." },
      { label: "Cancel it — redirect funds to bread", d: { people: 12, military: -8, economy: -2 },
        log: "You cancelled the parade for bread. Humble. The generals wanted their tanks on television." },
      { label: "A modest ceremony — split the difference", d: { people: 2, military: 2, economy: -2 },
        log: "You held a modest ceremony. Nobody is thrilled. Nobody is furious. Survival, possibly." },
    ],
  },
  {
    id: "plague",
    title: "Fever in the Provinces",
    brief: "A sickness is moving through the southern provinces faster than the roads can carry the news. The health ministry wants a quarantine. The trade ministry notes that a quarantine is a wall, and walls have two sides, and harvests rot on both.",
    choices: [
      { label: "Seal the provinces — contain it hard", d: { people: -8, economy: -10, military: 6 },
        log: "You sealed the south. The fever slows. So does everything else. The cordon has machine guns now." },
      { label: "Downplay it — there is no fever", d: { people: 4, economy: 4, foreign: -6 },
        log: "You declared the south healthy. The fever did not receive the memo.",
        enqueue: { id: "fever_spreads", after: 3 } },
      { label: "Request foreign medics — swallow the optics", d: { people: 8, foreign: 10, military: -4, economy: -4 },
        log: "You let foreign doctors in. They saved lives and took photographs. Both will be remembered." },
    ],
  },
  {
    id: "strike",
    title: "The Docks Have Stopped",
    brief: "The dockworkers have downed tools. Nothing leaves the port, which means nothing earns. Their leader is a woman with a calm voice and a list. Your industrialists want her gone. Your treasury wants the cranes moving by morning.",
    choices: [
      { label: "Break the strike — send in the army", d: { military: 4, economy: 6, people: -14, foreign: -6 },
        log: "You broke the strike. The cranes move. The calm-voiced woman is somewhere quiet now.",
        enqueue: { id: "martyr", after: 3 } },
      { label: "Negotiate — concede the smaller demands", d: { people: 10, economy: -8, military: -4 },
        log: "You negotiated. The docks reopen. The industrialists will remember that you blinked." },
      { label: "Wait them out — freeze their accounts", d: { economy: -4, people: -6, guile: 0 },
        log: "You froze the strike fund and waited. Hunger is a patient negotiator, and it works for you." },
    ],
  },
  {
    id: "statue",
    title: "A Statue of You",
    brief: "The capital's artists' guild — newly enthusiastic — proposes a bronze of you in the central square, forty feet tall, hand raised in benediction. It would cost a school. It would also tell everyone, permanently, who is in charge.",
    choices: [
      { label: "Approve it — cast it in bronze", d: { military: 4, economy: -8, people: -6 },
        log: "Your bronze self rises over the square, hand raised, eyes empty. Pigeons are already disrespecting it.",
        enqueue: { id: "cult_warning", after: 5 } },
      { label: "Refuse — fund the school instead", d: { people: 10, military: -4, economy: -2 },
        log: "You chose the school over the statue. Humility reads as weakness to exactly the people you should worry about." },
      { label: "Let them build it with their own money", d: { people: 2, military: 2 },
        log: "You let the guild fund the statue themselves. Devotion you don't pay for is the most dangerous kind — it expects things." },
    ],
  },
  {
    id: "defector",
    title: "The Officer Who Knows Too Much",
    brief: "A senior intelligence officer wants to defect — to walk into a foreign embassy with a briefcase of everything. Your people have a few hours' window. The briefcase contains, among other things, the order you signed last week.",
    choices: [
      { label: "Have him stopped — permanently", d: { military: 4, people: -6, foreign: -8 },
        log: "The officer never reached the embassy. The briefcase is recovered. The method will leak; it always does.",
        enqueue: { id: "martyr", after: 4 } },
      { label: "Let him go — cut your losses", d: { foreign: -10, military: -4, people: 2 },
        log: "You let the officer walk. The briefcase is abroad now. You will read your own orders in their newspapers." },
      { label: "Out-bid the embassy — buy him back", d: { economy: -8, military: 2, foreign: -2 },
        log: "You bought the officer's loyalty back, for now. Loyalty with a price tag has a renewal date." },
    ],
  },
  {
    id: "tape",
    title: "The Predecessor's Tape",
    brief: "A recording has surfaced of your predecessor — the one who died of a heart attack in a building with no stairs — ordering something unforgivable. Releasing it would damn a dead man and, by proximity, the chair you now sit in. Burying it requires people to stay quiet.",
    choices: [
      { label: "Release it — let the dead man carry it all", d: { people: 8, foreign: 6, military: -10 },
        log: "You released the tape. The dead predecessor is now the villain of record. The generals who served him are doing math." },
      { label: "Bury it — and the people who held it", d: { military: 6, people: -8, foreign: -4 },
        log: "You buried the tape. The silence cost more than the tape would have. It usually does.",
        enqueue: { id: "double_agent", after: 4 } },
      { label: "Leak it slowly — control the bleed", d: { foreign: 2, people: 2, military: -2 },
        log: "You leaked the tape in pieces, steering each headline. You have learned the censor's deepest secret: timing is the message." },
    ],
  },
  {
    id: "border",
    title: "A Truck at the Quarry",
    brief: "Border intelligence reports a smuggling route — a truck, before dawn, the driver answering to a code phrase. People are leaving. Clerks, teachers, the educated young. Your interior minister wants the route closed and the next truck made an example.",
    callback: true,
    choices: [
      { label: "Close the route — make an example", d: { military: 6, people: -10, foreign: -6 },
        log: "You closed the quarry road. The next truck did not make it. You know that road.",
        enqueue: { id: "martyr", after: 2 } },
      { label: "Leave it open — let the unhappy go", d: { people: 6, economy: -6, foreign: 4 },
        log: "You left the road open. A country you can leave is a country fewer people fight." },
      { label: "Watch it — turn it into an intelligence asset", d: { military: 4, people: -2 },
        log: "You let the road run and watched who used it. You once prayed no one was watching it." },
    ],
  },
];

// ── DELAYED CONSEQUENCES ────────────────────────────────────────────────────
const CONSEQUENCES = {
  sanctions: {
    title: "The Sanctions Arrive",
    brief: "The expelled journalist's footage triggered a vote abroad. Accounts frozen, exports blocked. The minister you trusted to make it 'go away' is suddenly very interested in the ceiling.",
    d: { economy: -10, foreign: -8 },
  },
  reform_due: {
    title: "The Reforms You Promised",
    brief: "The word you used — 'reform' — has been quoted back to you on banners, in cables, by your own ministers. A promise unkept is a debt that compounds in public.",
    d: { people: -8, foreign: -4 },
  },
  debt_call: {
    title: "The Debt Is Called",
    brief: "The future you borrowed against has arrived to collect for the bread subsidy. The creditors are polite. Polite creditors are the most expensive kind.",
    d: { economy: -12, foreign: -4 },
  },
  bread_riot: {
    title: "Bread Riots",
    brief: "The price of bread became the price of patience. Three cities, then five. The army is asking for rules of engagement, which is the army asking permission.",
    d: { people: -10, military: -4, foreign: -4 },
  },
  vasquez_move: {
    title: "General Vasquez Makes His Move",
    brief: "The general you kept close was close enough to count the guard rotations. Tanks moved at 3 a.m. — not yet against you, but in a direction that rhymes with it.",
    d: { military: -14, people: -4 },
  },
  martyr: {
    title: "A Martyr Is Made",
    brief: "Someone died who didn't have to, and a photograph exists. A name becomes a chant. You cannot arrest a chant, though your interior minister has prepared a memo proposing exactly that.",
    d: { people: -12, foreign: -8 },
  },
  double_agent: {
    title: "Your Courier Is Burned",
    brief: "The resistance courier you turned has been turned back, or was never turned at all. The intelligence you trusted was a mirror they held up to you. You, of all people, should have known the mail can be read both ways.",
    d: { military: -8, people: -2 },
  },
  patron_calls: {
    title: "Your Patron Has a Request",
    brief: "The neighbor whose loan refilled your treasury would like a small favor — a vote, a port, a minister replaced. The leash you accepted has reached its length, and it is being gently, firmly, pulled.",
    d: { foreign: -6, people: -6, military: -2 },
  },
  election_day: {
    title: "The Votes Are Counted",
    brief: "You did the most dangerous thing. The count is in. It is closer than your ministers promised and your generals feared. The republic holds its breath and so, briefly, do you.",
    d: { people: 10, foreign: 10, military: -6 },
  },
  gutted_services: {
    title: "The Clinics That Closed",
    brief: "The money you handed the army came from somewhere. The somewhere had a waiting room, and a queue, and a name over the door. The queue is now in the street, and it has learned the army's new budget down to the decimal.",
    d: { people: -12, economy: -2 },
  },
  fever_spreads: {
    title: "The Fever Was Real",
    brief: "The sickness you declared nonexistent has reached the capital, where the foreign press lives. It turns out a fever cannot read a decree. The provinces you abandoned have stopped sending tax, sons, or forgiveness.",
    d: { people: -10, economy: -6, foreign: -4 },
  },
  cult_warning: {
    title: "The Bronze Has Admirers",
    brief: "Your forty-foot bronze self has become a shrine. People leave flowers, then petitions, then demands, addressed not to the man but to the statue — which, being bronze, promises everything and refuses nothing. You are competing with your own monument.",
    d: { people: 6, military: -4, foreign: -2 },
  },
};

// ── ENDINGS ─────────────────────────────────────────────────────────────────
// Triggered when a pillar hits 0 (collapse) or 100 (a different kind of failure),
// or when you survive the deck.
const ENDINGS = {
  military_0: { tag: "DEPOSED", title: "The Stairs You Did Not Have",
    body: "The army stopped answering. They came for you the way they came for your predecessor — quietly, in a building with no convenient stairs. The chair is warm again, for someone else." },
  military_100: { tag: "FIGUREHEAD", title: "A Uniform With Your Face On It",
    body: "The generals adore you. They adore you the way a ventriloquist adores the doll. You sign what is placed before you. You wave from the balcony. You are the most beloved hostage in the republic." },
  economy_0: { tag: "BANKRUPT", title: "The Treasury Echoes",
    body: "There is no money for the army, the bread, or the parade. A state that cannot pay is a state that cannot command. The collapse will be blamed on you, accurately, which is the rarest kind of blame." },
  economy_100: { tag: "OWNED", title: "Solvent and Sold",
    body: "The treasury has never been fuller. None of it is yours. Every account has a foreign cosignatory, every minister a second employer. You preside over a wholly-owned subsidiary that flies its own flag for sentiment." },
  people_0: { tag: "UPRISING", title: "The Square Could Not Be Cleared",
    body: "There were too many for the trucks, too many for the cells, too many for the chant to be arrested. They did not need the quarry road. They came to the office instead. You knew that road. You should have left it open." },
  people_100: { tag: "CULT", title: "Beloved",
    body: "They weep when you speak. They name children after you. They cannot imagine the republic without you, which means they cannot imagine the republic. You have become a religion, and religions do not govern. They wait." },
  foreign_0: { tag: "PARIAH", title: "The Maps Redrawn Around You",
    body: "No embassy returns the call. The exports rot at the border. You are sovereign over every inch of a country the world has agreed to stop seeing. Total independence, achieved by elimination." },
  foreign_100: { tag: "PROTECTORATE", title: "A Friend of Powerful Friends",
    body: "Your foreign friends are delighted. They visit often. They have opinions about your appointments, your ports, your votes, and lately your replacement. You are very well-liked, the way a useful thing is well-liked." },
  survived: { tag: "ENDURED", title: "Still in the Chair",
    body: "You are still here. The pillars still stand, leaning. No one has come up the stairs you do not have. You have learned what your predecessor knew and could not say: that power is not freedom, it is the same impossible desk, with a worse view of the door." },
};

Object.assign(window, {
  ESCAPE_INTRO, LETTERS, NEWS, EVENINGS, BORDER, PILLARS, CARDS, CONSEQUENCES, ENDINGS,
});
