/* ══ Bill Survival Game v2 — Frontend ══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
.bsg-game {
  max-width: 760px; margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.6; color: #1a1a2e; position: relative;
}
.bsg-screen { display: none; }
.bsg-screen-active { display: block; }

/* ── Buttons ─────────────────────────────────────────────────── */
.bsg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: 1.5px solid #ccc; border-radius: 8px;
  background: #fff; cursor: pointer; font-size: .95rem; font-family: inherit;
  font-weight: 500; transition: all .15s; text-decoration: none; color: inherit;
}
.bsg-btn:hover { background: #f4f4f4; border-color: #999; }
.bsg-btn-primary { background: #1a4fa8; color: #fff; border-color: #1a4fa8; }
.bsg-btn-primary:hover { background: #153e86; border-color: #153e86; }
.bsg-btn-lg { padding: 13px 28px; font-size: 1.05rem; }

/* ── Intro screen ─────────────────────────────────────────────── */
.bsg-hero { text-align: center; padding: 2rem 1rem 1.5rem; }
.bsg-hero-icon { font-size: 3rem; margin-bottom: .4rem; }
.bsg-hero h2 { font-size: 1.8rem; margin: 0 0 .5rem; }
.bsg-hero p { color: #555; max-width: 500px; margin: 0 auto 1.5rem; }

.bsg-congress-context {
  background: #f0f4ff; border: 1px solid #c5d3f0; border-radius: 10px;
  padding: 1rem 1.2rem; margin-bottom: 1.5rem;
}
.bsg-cc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #666; margin-bottom: .6rem; font-weight: 600; }
.bsg-cc-grid { display: flex; flex-wrap: wrap; gap: 6px 1.5rem; margin-bottom: .5rem; }
.bsg-cc-item { display: flex; gap: 6px; align-items: baseline; font-size: .85rem; }
.bsg-cc-key { color: #666; }
.bsg-cc-val { font-weight: 700; color: #1a4fa8; }
.bsg-cc-preset { font-size: 11px; color: #888; font-style: italic; }

.bsg-stage-flow {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 4px; margin-bottom: 1.5rem;
}
.bsg-flow-step { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: #555; }
.bsg-flow-icon { font-size: 1.2rem; }
.bsg-flow-arrow { color: #bbb; font-size: .85rem; }

.bsg-mechanics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1.8rem; }
@media (max-width: 500px) { .bsg-mechanics-grid { grid-template-columns: 1fr; } }
.bsg-mechanic-card {
  background: #f9f9f9; border: 1px solid #e8e8e8; border-radius: 10px;
  padding: .9rem 1rem;
}
.bsg-mech-icon { font-size: 1.4rem; margin-bottom: 4px; }
.bsg-mechanic-card strong { display: block; margin-bottom: 4px; }
.bsg-mechanic-card p { margin: 0; font-size: .85rem; color: #555; }

/* ── Draft screen ─────────────────────────────────────────────── */
.bsg-draft-header { margin-bottom: 1.25rem; }
.bsg-draft-header h2 { margin: 0 0 .3rem; }
.bsg-draft-header p { margin: 0; color: #555; font-size: .9rem; }
.bsg-field { margin-bottom: 1.25rem; }
.bsg-field label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .9rem; }
.bsg-field input[type="text"], .bsg-field select {
  width: 100%; padding: 10px 12px; border: 1.5px solid #d0d0d0;
  border-radius: 8px; font-size: .95rem; font-family: inherit;
}
.bsg-field input:focus, .bsg-field select:focus {
  outline: none; border-color: #1a4fa8; box-shadow: 0 0 0 3px rgba(26,79,168,.12);
}
.bsg-topic-hint { font-size: .82rem; color: #888; margin-top: 5px; font-style: italic; min-height: 1.2em; }
.bsg-scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .bsg-scope-grid { grid-template-columns: 1fr; } }
.bsg-choice-btn {
  padding: .9rem 1rem; border: 2px solid #ddd; border-radius: 10px;
  background: #fff; cursor: pointer; text-align: left; font-family: inherit;
  transition: border-color .15s, background .15s; display: flex; flex-direction: column; gap: 5px;
}
.bsg-choice-btn:hover { border-color: #1a4fa8; background: #f5f8ff; }
.bsg-choice-btn.bsg-selected { border-color: #1a4fa8; background: #edf2ff; }
.bsg-choice-title { font-weight: 700; font-size: .95rem; }
.bsg-choice-effects { display: flex; flex-wrap: wrap; gap: 4px; }
.bsg-choice-note { font-size: .8rem; color: #666; }
.bsg-eff-tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.bsg-eff-pos { background: #e6f9ee; color: #1a7a3e; }
.bsg-eff-neg { background: #fdecea; color: #a93226; }
.bsg-draft-actions { display: flex; gap: 10px; align-items: center; margin-top: 1rem; }
.bsg-error { color: #c0392b; font-size: .9rem; margin-top: .5rem; }

/* ── Stage screen ─────────────────────────────────────────────── */
.bsg-progress-track { display: flex; gap: 5px; margin-bottom: 1rem; }
.bsg-track-pip { flex: 1; height: 7px; border-radius: 4px; background: #e0e0e0; transition: background .3s; }
.bsg-track-pip.done   { background: #27ae60; }
.bsg-track-pip.active { background: #1a4fa8; }
.bsg-track-pip.failed { background: #e74c3c; }

.bsg-congress-snap {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  background: #f5f5f5; border-radius: 8px;
  padding: .6rem .9rem; margin-bottom: 1rem; font-size: 12px;
}
.bsg-snap-item { display: flex; gap: 5px; align-items: baseline; }
.bsg-snap-key { color: #888; font-weight: 600; }
.bsg-snap-item span:last-child { color: #333; }

.bsg-hud { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .9rem; }
.bsg-scores { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.bsg-score-row { display: flex; align-items: center; gap: 8px; }
.bsg-score-label { width: 115px; font-size: 12px; font-weight: 600; color: #555; flex-shrink: 0; }
.bsg-bar-wrap { flex: 1; height: 9px; background: #e8e8e8; border-radius: 5px; overflow: hidden; }
.bsg-bar-fill { height: 100%; border-radius: 5px; transition: width .4s ease, background .4s; }
.bsg-bar-support  { background: #27ae60; }
.bsg-bar-approval { background: #1a4fa8; }
.bsg-bar-const    { background: #e67e22; }
.bsg-score-num { width: 28px; text-align: right; font-size: 13px; font-weight: 700; }

.bsg-capital-display {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fffbea; border: 1.5px solid #f0d060; border-radius: 10px;
  padding: .5rem .8rem; min-width: 64px; text-align: center; flex-shrink: 0;
}
.bsg-capital-icon { font-size: 1.2rem; }
.bsg-capital-num { font-size: 1.6rem; font-weight: 800; line-height: 1; color: #8a5a00; }
.bsg-capital-label { font-size: 10px; font-weight: 700; color: #999; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }

.bsg-warning {
  background: #fff3cd; border: 1px solid #ffc107; border-radius: 8px;
  padding: .6rem .9rem; font-size: .875rem; color: #856404; margin-bottom: .75rem;
}

/* Consequence & vote math panels */
.bsg-consequence-panel {
  background: #f0faf4; border-left: 4px solid #27ae60;
  border-radius: 0 8px 8px 0; padding: 1rem 1.1rem; margin-bottom: .9rem;
}
.bsg-justify-box { font-size: .875rem; color: #1a7a3e; margin-bottom: .6rem; font-style: italic; }
.bsg-consequence-text { font-size: .9rem; color: #333; }
.bsg-real-world-note {
  margin-top: .7rem; padding-top: .7rem;
  border-top: 1px solid #c5e8d0;
  font-size: .82rem; color: #555; font-style: italic;
}
.bsg-vote-math-panel {
  background: #f5f5f5; border-radius: 8px; padding: .75rem 1rem;
  font-size: .85rem; margin-bottom: .9rem;
}
.bsg-vm-row { margin-bottom: 3px; color: #444; }
.bsg-vm-warn { color: #c0392b; font-weight: 600; }

/* Amendment card */
.bsg-amendment-card {
  border-radius: 10px; border: 2px solid #ddd;
  padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.bsg-amend-friendly   { border-color: #27ae60; background: #f0faf4; }
.bsg-amend-hostile    { border-color: #e74c3c; background: #fef9f9; }
.bsg-amend-bipartisan { border-color: #8e44ad; background: #faf5ff; }
.bsg-amend-header { display: flex; align-items: center; gap: 10px; margin-bottom: .5rem; }
.bsg-amend-type-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 2px 10px; border-radius: 12px;
  background: rgba(0,0,0,.07); letter-spacing: .4px;
}
.bsg-amend-title { font-weight: 700; font-size: 1rem; }
.bsg-amend-offerer { font-size: .82rem; color: #777; margin-bottom: .5rem; }
.bsg-amend-text {
  margin: .5rem 0; padding: .5rem .9rem;
  border-left: 3px solid #ccc; font-style: italic; color: #444; font-size: .9rem;
}
.bsg-amend-rationale { font-size: .87rem; color: #555; margin-bottom: .5rem; }
.bsg-amend-civics {
  font-size: .82rem; color: #555; font-style: italic;
  background: rgba(0,0,0,.04); border-radius: 6px; padding: .5rem .75rem;
  margin-bottom: .75rem;
}
.bsg-amend-choices { display: flex; flex-direction: column; gap: 8px; }
.bsg-amend-choice-wrap { border: 1px solid #e0e0e0; border-radius: 8px; padding: .75rem; background: #fff; }
.bsg-amend-btn {
  font-size: .9rem; font-weight: 600; font-family: inherit;
  padding: 6px 14px; border-radius: 6px; border: 1.5px solid transparent;
  cursor: pointer; transition: opacity .15s;
}
.bsg-amend-accept { background: #e6f9ee; color: #1a7a3e; border-color: #a8daba; }
.bsg-amend-reject { background: #fdecea; color: #a93226; border-color: #f5b7b1; }
.bsg-amend-counter{ background: #f4f0ff; color: #6c3483; border-color: #c39bd3; }
.bsg-amend-btn:hover { opacity: .8; }
.bsg-amend-choice-eff { font-size: 12px; color: #666; margin-left: 8px; }
.bsg-amend-choice-tradeoff { font-size: .82rem; color: #888; margin-top: 4px; font-style: italic; }

/* Event card */
.bsg-event-card {
  border-radius: 10px; border-left: 5px solid #e67e22;
  background: #fff8ee; padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.bsg-event-card.bsg-event-opportunity { border-left-color: #27ae60; background: #f0faf4; }
.bsg-event-card.bsg-event-wildcard    { border-left-color: #9b59b6; background: #f8f5ff; }
.bsg-event-header { display: flex; align-items: center; gap: 8px; margin-bottom: .4rem; }
.bsg-event-icon-el { font-size: 1.3rem; }
.bsg-event-type-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #888; }
.bsg-event-card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.bsg-event-detail { font-size: .9rem; color: #555; margin: 0 0 .4rem; font-weight: 600; }
.bsg-event-narrative { font-size: .87rem; color: #666; margin: 0 0 .6rem; }
.bsg-event-immediate { font-size: .85rem; margin-bottom: .6rem; }
.bsg-event-real-world {
  font-size: .82rem; color: #666; font-style: italic;
  background: rgba(0,0,0,.04); border-radius: 6px;
  padding: .5rem .75rem; margin-bottom: .75rem;
}
.bsg-event-responses { display: flex; flex-direction: column; gap: 7px; }
.bsg-event-response {
  display: flex; flex-direction: column; gap: 3px;
  padding: .7rem .9rem; border: 1.5px solid #ddd; border-radius: 8px;
  background: #fff; cursor: pointer; font-family: inherit; text-align: left;
  transition: border-color .15s, background .15s;
}
.bsg-event-response:hover { border-color: #1a4fa8; background: #f5f8ff; }
.bsg-resp-label { font-weight: 600; font-size: .9rem; }
.bsg-resp-eff   { font-size: 12px; color: #888; }
.bsg-resp-desc  { font-size: .82rem; color: #555; font-style: italic; }

/* Stage card */
.bsg-stage-card { background: #fff; border: 1.5px solid #e0e0e0; border-radius: 12px; padding: 1.2rem; margin-bottom: .9rem; }
.bsg-stage-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.bsg-stage-badge {
  background: #edf2ff; color: #1a4fa8;
  font-size: 11px; font-weight: 700; padding: 3px 11px; border-radius: 20px;
}
.bsg-stage-counter { font-size: 12px; color: #999; font-weight: 600; }
.bsg-stage-card h2 { margin: 0 0 .4rem; font-size: 1.2rem; }
.bsg-stage-desc { margin: 0 0 .9rem; color: #555; font-size: .9rem; }

.bsg-staffer-wrap { margin-bottom: 1rem; }
.bsg-brief-toggle {
  background: none; border: 1px dashed #ccc; border-radius: 6px;
  padding: 4px 12px; font-size: .82rem; color: #888; cursor: pointer;
  font-family: inherit; transition: background .15s;
}
.bsg-brief-toggle:hover { background: #f5f5f5; }
.bsg-staffer-brief {
  background: #f8f9fa; border-radius: 8px; padding: .75rem .9rem;
  font-size: .87rem; color: #444; margin-top: .5rem; line-height: 1.6;
}
.bsg-what-to-watch {
  font-size: .82rem; color: #666; margin-top: .5rem; padding: .4rem .9rem;
  border-left: 3px solid #1a4fa8; background: #f0f4ff; border-radius: 0 6px 6px 0;
}

.bsg-decisions-label { font-size: .82rem; color: #999; font-weight: 600; margin-bottom: .6rem; text-transform: uppercase; letter-spacing: .4px; }
.bsg-decisions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 540px) { .bsg-decisions { grid-template-columns: 1fr; } }

.bsg-decision-btn {
  padding: .9rem 1rem; border: 1.5px solid #e0e0e0; border-radius: 10px;
  background: #fff; cursor: pointer; text-align: left; font-family: inherit;
  transition: border-color .15s, background .15s; display: flex; flex-direction: column; gap: 5px;
}
.bsg-decision-btn:hover:not(:disabled):not(.bsg-cant-afford) { border-color: #1a4fa8; background: #f5f8ff; }
.bsg-decision-btn:disabled { opacity: .5; cursor: default; }
.bsg-decision-btn.bsg-cant-afford {
  opacity: .5; cursor: not-allowed;
  border-style: dashed; border-color: #ccc;
}
.bsg-dec-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.bsg-dec-label { font-weight: 700; font-size: .9rem; flex: 1; }
.bsg-capital-cost {
  font-size: 11px; font-weight: 700; color: #8a5a00;
  background: #fffbea; border: 1px solid #f0d060; border-radius: 10px;
  padding: 1px 7px; flex-shrink: 0;
}
.bsg-dec-desc { font-size: .82rem; color: #555; }
.bsg-dec-justify {
  font-size: .8rem; color: #1a4fa8; font-style: italic;
  background: #f0f4ff; border-radius: 5px; padding: 4px 8px;
}
.bsg-dec-effects { display: flex; flex-wrap: wrap; gap: 3px; }
.bsg-effect-tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.bsg-eff-pos { background: #e6f9ee; color: #1a7a3e; }
.bsg-eff-neg { background: #fdecea; color: #a93226; }
.bsg-dec-tradeoff { font-size: .78rem; color: #e67e22; font-style: italic; }

.bsg-log-details { margin-top: .5rem; }
.bsg-log-details summary { font-size: .82rem; color: #aaa; cursor: pointer; }
.bsg-log { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .82rem; max-height: 140px; overflow-y: auto; }
.bsg-log li { padding: 2px 0; color: #666; border-bottom: 1px solid #f0f0f0; }
.bsg-log-event         { color: #c0392b; }
.bsg-log-event_response{ color: #e67e22; }
.bsg-log-amendment     { color: #8e44ad; }
.bsg-log-decision      { color: #27ae60; }

/* ── Outcome screen ───────────────────────────────────────────── */
.bsg-outcome-banner {
  text-align: center; border-radius: 12px; padding: 2rem 1rem;
  margin-bottom: 1.5rem; border: 1.5px solid #e0e0e0;
}
.bsg-outcome-pass    { background: #eafaf1; border-color: #a9dfbf; }
.bsg-outcome-fail    { background: #fdecea; border-color: #f5b7b1; }
.bsg-outcome-vetoed  { background: #fff8ee; border-color: #f9d79e; }
.bsg-outcome-unconst { background: #f8f0ff; border-color: #d7bde2; }
.bsg-outcome-icon { font-size: 3rem; margin-bottom: .5rem; }
.bsg-outcome-banner h2 { margin: 0 0 .5rem; font-size: 1.5rem; }
.bsg-outcome-banner p  { margin: 0; color: #555; }

.bsg-outcome-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 1.25rem; }
@media (max-width: 480px) { .bsg-outcome-stats { grid-template-columns: repeat(2,1fr); } }
.bsg-os-card { background: #f8f9fa; border-radius: 10px; padding: .75rem; text-align: center; border: 1px solid #e8e8e8; }
.bsg-os-card.bsg-os-score { background: #edf2ff; border-color: #c5d3f0; }
.bsg-os-num   { font-size: 1.6rem; font-weight: 800; }
.bsg-os-label { font-size: 11px; color: #888; margin-top: 2px; }

.bsg-outcome-civics {
  font-size: .9rem; color: #555; background: #f8f8f8; border-radius: 8px;
  padding: .9rem 1rem; margin-bottom: 1.2rem; line-height: 1.7;
}
.bsg-outcome-actions { margin-bottom: 1.5rem; }

.bsg-mini-leaderboard { border: 1px solid #e0e0e0; border-radius: 10px; padding: 1rem 1.1rem; }
.bsg-mini-leaderboard h3 { margin: 0 0 .75rem; font-size: 1rem; }
.bsg-mini-lb-row { display: flex; gap: 8px; align-items: center; padding: .35rem 0; border-bottom: 1px solid #f0f0f0; font-size: .875rem; }
.bsg-mini-lb-row:last-child { border-bottom: none; }
.bsg-lb-rank   { width: 24px; font-weight: 700; color: #888; }
.bsg-lb-name   { min-width: 80px; font-weight: 600; }
.bsg-lb-bill   { flex: 1; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bsg-lb-score  { font-weight: 700; color: #1a4fa8; }

/* ── Loading ───────────────────────────────────────────────────── */
.bsg-loading {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.82); display: flex;
  align-items: center; justify-content: center; z-index: 20; border-radius: 12px;
}
.bsg-spinner {
  width: 38px; height: 38px; border: 3px solid #ddd;
  border-top-color: #1a4fa8; border-radius: 50%;
  animation: bsg-spin .65s linear infinite;
}
@keyframes bsg-spin { to { transform: rotate(360deg); } }

/* ── Legislative journey map ─────────────────────────────────── */
.bsg-map-wrap {
  margin-bottom: 1rem; border-radius: 12px; overflow: hidden;
  background: #f0f4ff; border: 1px solid #c5d3f0;
}
.bsg-map-outcome { margin-bottom: 1.25rem; }
.bsg-map-svg { width: 100%; height: auto; display: block; }

/* Remove old progress-track pip styles (map replaces it) */
.bsg-progress-track { display: none; }

/* ── Qualitative decision pills ──────────────────────────────── */
.bsg-dec-qual { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.bsg-qual-group { display: flex; flex-wrap: wrap; gap: 3px; }
.bsg-qual-benefit {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 12px;
  background: #e6f9ee; color: #1a7a3e;
}
.bsg-qual-risk {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 12px;
  background: #fdecea; color: #a93226;
}
/* Capital cost as emoji dots instead of a number */
.bsg-capital-cost {
  font-size: 13px; letter-spacing: -1px; flex-shrink: 0;
  color: #8a5a00; line-height: 1;
}
/* Resp effects in event cards */
.bsg-resp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.bsg-resp-effects { display: flex; flex-wrap: wrap; gap: 3px; }

/* ── Character dialogue ──────────────────────────────────────── */
.bsg-character-box {
  border: 1.5px solid #c5d3f0; border-radius: 12px;
  background: #fff; padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.bsg-char-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: .75rem;
}
.bsg-char-avatar { font-size: 2rem; flex-shrink: 0; }
.bsg-char-meta { flex: 1; }
.bsg-char-name  { font-weight: 700; font-size: .95rem; }
.bsg-char-title { font-size: .78rem; color: #777; }
.bsg-char-party-badge {
  font-size: 11px; font-weight: 700; color: #fff;
  padding: 2px 10px; border-radius: 12px; flex-shrink: 0;
}
.bsg-char-speech {
  font-size: .9rem; color: #333; line-height: 1.6;
  background: #f8f9ff; border-radius: 8px; padding: .7rem .9rem;
  border-left: 3px solid #c5d3f0;
}
.bsg-char-speech em { font-style: italic; }

/* Reaction box — shown after the student picks a decision */
.bsg-char-reaction {
  border: 1.5px solid #f0d060; border-radius: 10px;
  background: #fffdf0; padding: .8rem 1rem; margin-bottom: 1rem;
}
.bsg-reaction-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: #8a5a00; margin-bottom: .4rem;
}
.bsg-reaction-speech {
  font-size: .9rem; color: #333; line-height: 1.6;
  font-style: italic;
}
