/*
 * Cybersecurity Merit Badge 2026 - shared styles.
 * CSP: style-src 'self'. No inline styles anywhere; all styling lives here.
 * Palette (text contrast >= 4.5:1 against its background):
 *   --ink #1a202c on #ffffff (16:1), --muted #4a5568 on #ffffff (7.5:1),
 *   --brand #4c51bf on #ffffff (6.6:1), #ffffff on --brand (6.6:1),
 *   --ok-ink #22543d on --ok-bg #c6f6d5 (8.4:1),
 *   --warn-ink #744210 on --warn-bg #fefcbf (7.6:1),
 *   --err-ink #9b2c2c on --err-bg #fed7d7 (6.0:1),
 *   --idle-ink #2d3748 on --idle-bg #e2e8f0 (10:1).
 */

:root {
  --ink: #1a202c;
  --muted: #4a5568;
  --brand: #4c51bf;
  --brand-dark: #434190;
  --brand-2: #6b46c1;
  --bg: #f7fafc;
  --surface: #ffffff;
  --line: #cbd5e0;
  --ok-ink: #22543d;
  --ok-bg: #c6f6d5;
  --warn-ink: #744210;
  --warn-bg: #fefcbf;
  --err-ink: #9b2c2c;
  --err-bg: #fed7d7;
  --idle-ink: #2d3748;
  --idle-bg: #e2e8f0;
  --focus: #dd6b20;
  --radius: 10px;
  --shadow: 0 4px 14px rgba(26, 32, 44, 0.1);
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: var(--brand);
}

a:hover {
  color: var(--brand-dark);
}

h1,
h2,
h3 {
  line-height: 1.25;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--brand);
  z-index: 100;
}

.skip-link:focus {
  top: 0.5rem;
}

[hidden] {
  display: none !important;
}

/* ---------- layout ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #ffffff;
}

.site-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.site-header a,
.site-header .who {
  color: #ffffff;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.site-nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration-thickness: 3px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.container-wide {
  max-width: none;
  padding: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.muted {
  color: var(--muted);
}

/* ---------- forms ---------- */

label {
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

input[type="text"],
input[type="password"],
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid #718096;
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  max-width: 100%;
}

textarea {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--brand);
  margin: 0;
  flex: none;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1.25rem;
}

legend {
  font-weight: 700;
  padding: 0 0.35rem;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.choice-list.inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.required-mark {
  color: var(--err-ink);
}

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border: 2px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--brand);
}

.btn-secondary:hover {
  background: #ebf4ff;
  color: var(--brand-dark);
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  background: var(--idle-bg);
  border-color: var(--idle-bg);
  color: var(--idle-ink);
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.message {
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  margin: 0.75rem 0;
}

.message:empty {
  display: none;
}

.message-error {
  background: var(--err-bg);
  color: var(--err-ink);
}

.message-ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.message-info {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.login-card {
  max-width: 420px;
  margin: 3rem auto;
}

.login-card input {
  width: 100%;
}

/* ---------- troop totals ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand);
}

.stat-label {
  color: var(--muted);
}

/* ---------- progress bar ---------- */

.progress {
  margin: 0.5rem 0 1rem;
}

progress {
  width: 100%;
  height: 1rem;
  accent-color: var(--brand);
}

/* ---------- checklist rows ---------- */

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checklist-row {
  border: 1px solid var(--line);
  border-left: 6px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.25rem;
  margin-bottom: 0.9rem;
}

.checklist-row.is-done {
  border-left-color: #2f855a;
}

.checklist-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.checklist-head label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
}

.checklist-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.prereq-no {
  display: inline-block;
  min-width: 2.2rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
}

.req-tag {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: #ebf4ff;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.85rem;
}

.troop-count {
  font-size: 0.85rem;
  color: var(--muted);
}

.resources {
  margin: 0.4rem 0;
  padding-left: 1.25rem;
}

.answer {
  margin-top: 0.6rem;
}

.answer input[type="text"] {
  width: 100%;
  max-width: 32rem;
}

.row-status {
  font-size: 0.875rem;
  font-weight: 600;
  min-height: 1.3em;
  margin-top: 0.4rem;
}

.row-status.ok {
  color: var(--ok-ink);
}

.row-status.err {
  color: var(--err-ink);
}

.row-status.pending {
  color: var(--muted);
}

/* ---------- status badges ---------- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-not-started {
  background: var(--idle-bg);
  color: var(--idle-ink);
}

.badge-in-progress {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.badge-done {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

/* ---------- dashboard tables ---------- */

.table-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0.4rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ebf4ff;
  color: var(--ink);
}

.data-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  white-space: nowrap;
}

.data-table thead th:first-child {
  left: 0;
  z-index: 3;
}

.data-table tfoot td,
.data-table tfoot th {
  position: sticky;
  bottom: 0;
  background: #edf2f7;
  font-weight: 700;
}

.cell-done {
  background: #f0fff4;
}

.cell-check {
  color: var(--ok-ink);
  font-weight: 700;
}

.cell-time {
  display: block;
  color: var(--muted);
  white-space: nowrap;
}

.cell-answer {
  display: block;
  font-style: italic;
  white-space: pre-line; /* keep line breaks of multiline answers */
}

.toggle-state {
  font-weight: 700;
}

/* presenter
 * Class names (shared contract with admin/present.html + js/present.js):
 *   .presenter            full-viewport page wrapper (grid: main + footer)
 *   .presenter-main       scrollable topic content area
 *   .presenter-footer     bottom bar with Back / Next buttons and "n / 32"
 *   .topic-index          fixed off-screen left <nav>; revealed on hover of
 *                         .topic-index-hotzone, on its own :hover, and on
 *                         :focus-within (keyboard)
 *   .topic-index-hotzone  12px-wide fixed strip at the left screen edge;
 *                         must be a preceding sibling of .topic-index
 *   .disclaimer           large warning box (evil portal)
 *   .break-banner         large centred break text
 * Helpers: .topic-meta, .topic-block, .speaker-notes, .topic-index-group,
 *          .topic-index a[aria-current="page"]
 */

.presenter {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
  height: 100vh;
  background: var(--surface);
}

.presenter-main {
  overflow-y: auto;
  padding: 2rem 3rem 2rem 3.5rem;
  font-size: 1.25rem;
}

.presenter-main h1 {
  font-size: 2.4rem;
  margin: 0 0 0.5rem;
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.topic-block {
  font-weight: 700;
  color: var(--brand);
}

.speaker-notes {
  margin-top: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: var(--bg);
  font-size: 1rem;
}

.speaker-notes summary {
  cursor: pointer;
  font-weight: 700;
}

.presenter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--line);
  background: #edf2f7;
}

.presenter-footer .btn {
  min-width: 7rem;
}

.topic-index-hotzone {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 12px;
  z-index: 20;
}

.topic-index {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(-100%);
  transition: transform 0.15s ease-out;
  z-index: 30;
  font-size: 0.9rem;
}

.topic-index-hotzone:hover + .topic-index,
.topic-index:hover,
.topic-index:focus-within {
  transform: translateX(0);
}

.topic-index-group {
  margin: 0 0 0.75rem;
}

.topic-index-group h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.topic-index ul,
.topic-index ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic-index a {
  display: block;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  text-decoration: none;
}

.topic-index a:hover {
  background: #ebf4ff;
}

.topic-index a[aria-current="page"] {
  background: var(--brand);
  color: #ffffff;
}

.disclaimer {
  border: 4px solid var(--err-ink);
  border-radius: var(--radius);
  background: var(--err-bg);
  color: var(--err-ink);
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.break-banner {
  font-size: 4rem;
  font-weight: 800;
  text-align: center;
  color: var(--brand);
  margin: 15vh 0 2rem;
}

@media (prefers-reduced-motion: reduce) {
  .topic-index {
    transition: none;
  }
}

@media print {
  .site-header,
  .btn,
  .presenter-footer,
  .topic-index,
  .topic-index-hotzone {
    display: none;
  }
}

/* =====================================================================
 * Theme B "Cyber Agent" (scout-facing pages: index, scout, survey, follow).
 * Opt-in via <body class="theme-agent">. EVERY selector below is scoped
 * under .theme-agent so admin pages (no body class) keep the neutral look.
 * Keyframe names are prefixed cb-agent- to avoid clashes.
 *
 * WCAG AA contrast, measured (WCAG 2.x relative luminance):
 *   ink #e6f1ff on bg #0b1220 16.4:1; ink on grid line #0f1d29 15.0:1;
 *   muted #a7b4c8 on bg 8.9:1 (grid line 8.1:1); cyan #5eead4 on bg 12.7:1;
 *   ink on surface #111a2e 15.2:1; muted on surface 8.3:1;
 *   cyan on surface 11.7:1; link #7dd3fc on surface 10.4:1;
 *   link hover #bae6fd on surface 13.1:1; green #86efac on surface 12.3:1;
 *   amber #fcd34d on surface 12.0:1; error #fca5a5 on surface 9.1:1;
 *   #0b1220 on cyan btn #5eead4 12.7:1; on hover #99f6e4 14.9:1;
 *   #0b1220 on amber #fcd34d 13.0:1 (mission number chip, skip link);
 *   disabled #a7b4c8 on #1e293b 7.0:1; cyan on #1e293b 9.9:1;
 *   ink on #1e293b 12.8:1 (secondary btn hover);
 *   done row #0f2a24: ink 13.4:1, muted 7.3:1, link 9.1:1, green 10.9:1,
 *     cyan 10.3:1, amber 10.6:1, error 8.0:1;
 *   message-error #fecaca on #3b1219 11.3:1; message-info #fcd34d on #2a2110 11.0:1;
 *   message-ok #86efac on #0f2a24 10.9:1.
 * Full validation still needs manual testing with assistive technologies.
 * ===================================================================== */

.theme-agent {
  color-scheme: dark;
  color: #e6f1ff;
  background-color: #0b1220;
  background-image:
    linear-gradient(rgba(94, 234, 212, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 234, 212, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  min-height: 100vh;
}

.theme-agent a {
  color: #7dd3fc;
  text-underline-offset: 2px;
}

.theme-agent a:hover {
  color: #bae6fd;
}

.theme-agent :focus-visible {
  outline: 3px solid #fcd34d;
  outline-offset: 2px;
}

.theme-agent .skip-link {
  background: #fcd34d;
  color: #0b1220;
  font-weight: 700;
}

.theme-agent .muted,
.theme-agent .stat-label,
.theme-agent .checklist-meta,
.theme-agent .troop-count,
.theme-agent .scale-labels,
.theme-agent .topic-meta {
  color: #a7b4c8;
}

.theme-agent .lead {
  font-size: 1.1rem;
  margin: 0 0 1rem;
}

/* ---------- header ---------- */

.theme-agent .site-header {
  background: #0b1220;
  color: #e6f1ff;
  border-bottom: 2px solid #5eead4;
  box-shadow: 0 2px 16px rgba(94, 234, 212, 0.15);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.theme-agent .site-header h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  color: #5eead4;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.theme-agent .brand-sub {
  font-size: 0.8rem;
  font-weight: 400;
  color: #a7b4c8;
  text-transform: none;
  letter-spacing: 0;
}

.theme-agent .site-header .who {
  color: #e6f1ff;
}

.theme-agent .site-header a:not(.btn) {
  color: #7dd3fc;
}

.theme-agent .site-header a:not(.btn):hover {
  color: #bae6fd;
}

/* ---------- headings ---------- */

.theme-agent h2,
.theme-agent h3 {
  color: #5eead4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
}

.theme-agent h2 {
  text-transform: uppercase;
  font-size: 1.1rem;
}

.theme-agent main h1 {
  color: #e6f1ff;
}

/* ---------- surfaces ---------- */

.theme-agent .card,
.theme-agent .stat,
.theme-agent .checklist-row {
  background: #111a2e;
  border: 1px solid #23324f;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.theme-agent .checklist-row {
  border-left: 4px solid #334155;
}

.theme-agent .checklist-row.is-done {
  background: #0f2a24;
  border-color: #1f4d40;
  border-left-color: #86efac;
}

.theme-agent .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.theme-agent .stat-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.theme-agent .stat-value {
  color: #5eead4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- buttons ---------- */

.theme-agent .btn {
  background: #5eead4;
  border-color: #5eead4;
  color: #0b1220;
  border-radius: 8px;
}

.theme-agent .btn:hover {
  background: #99f6e4;
  border-color: #99f6e4;
  color: #0b1220;
}

.theme-agent .btn-secondary {
  background: transparent;
  border-color: #5eead4;
  color: #5eead4;
}

.theme-agent .btn-secondary:hover {
  background: #1e293b;
  border-color: #5eead4;
  color: #5eead4;
}

.theme-agent .site-header .btn-secondary {
  border-color: #a7b4c8;
  color: #e6f1ff;
}

.theme-agent .site-header .btn-secondary:hover {
  background: #1e293b;
  color: #e6f1ff;
}

.theme-agent .btn-link {
  color: #7dd3fc;
}

.theme-agent .btn[disabled],
.theme-agent .btn[disabled]:hover,
.theme-agent .btn[aria-disabled="true"] {
  background: #1e293b;
  border-color: #334155;
  color: #a7b4c8;
}

/* ---------- forms ---------- */

.theme-agent input[type="text"],
.theme-agent input[type="password"],
.theme-agent select,
.theme-agent textarea {
  background: #0b1220;
  color: #e6f1ff;
  border: 2px solid #5eead4;
}

.theme-agent option {
  background: #0b1220;
  color: #e6f1ff;
}

.theme-agent input[type="checkbox"],
.theme-agent input[type="radio"] {
  accent-color: #5eead4;
}

.theme-agent fieldset {
  border-color: #334155;
}

.theme-agent legend {
  color: #e6f1ff;
}

.theme-agent .required-mark {
  color: #fca5a5;
}

.theme-agent .message-error {
  background: #3b1219;
  color: #fecaca;
  border: 1px solid #fca5a5;
}

.theme-agent .message-ok {
  background: #0f2a24;
  color: #86efac;
  border: 1px solid #86efac;
}

.theme-agent .message-info {
  background: #2a2110;
  color: #fcd34d;
  border: 1px solid #fcd34d;
}

.theme-agent .login-card {
  border-top: 3px solid #5eead4;
  text-align: left;
}

.theme-agent .login-badge {
  font-size: 2.2rem;
  line-height: 1;
  margin: 0 0 0.25rem;
}

/* ---------- mission rows ---------- */

.theme-agent .checklist-head label {
  align-items: flex-start;
}

.theme-agent .checklist-head input[type="checkbox"] {
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.1rem;
}

.theme-agent .prereq-no {
  background: #fcd34d;
  color: #0b1220;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.theme-agent .req-tag {
  background: transparent;
  color: #5eead4;
  border: 1px solid #5eead4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.theme-agent .resources a,
.theme-agent .checklist-row p {
  overflow-wrap: anywhere;
}

.theme-agent .row-status.ok {
  color: #86efac;
}

.theme-agent .row-status.err {
  color: #fca5a5;
}

.theme-agent .row-status.pending {
  color: #fcd34d;
}

/* ---------- progress + rank ladder ---------- */

.theme-agent .agent-status {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  align-items: center;
}

.theme-agent .agent-status > * {
  min-width: 0;
}

.theme-agent .progress {
  display: grid;
  gap: 0.4rem;
  margin: 0;
}

.theme-agent progress {
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  border: 1px solid #334155;
  border-radius: 999px;
  background: #1e293b;
  overflow: hidden;
}

.theme-agent progress::-webkit-progress-bar {
  background: #1e293b;
  border-radius: 999px;
}

.theme-agent progress::-webkit-progress-value {
  background: linear-gradient(90deg, #5eead4, #7dd3fc);
  border-radius: 999px;
  box-shadow: 0 0 10px #5eead4;
}

.theme-agent progress::-moz-progress-bar {
  background: linear-gradient(90deg, #5eead4, #7dd3fc);
  border-radius: 999px;
}

.theme-agent .rank {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.theme-agent .rank-shield {
  flex: none;
  display: block;
  width: 72px;
}

.theme-agent .shield {
  display: block;
  width: 100%;
  height: auto;
}

.theme-agent .shield-body {
  fill: #0b1220;
  stroke: #5eead4;
  stroke-width: 4;
}

.theme-agent .shield.is-top .shield-body {
  stroke: #fcd34d;
}

.theme-agent .shield-star {
  fill: #fcd34d;
}

.theme-agent .rank-text {
  flex: 1 1 12rem;
  min-width: 0;
}

.theme-agent .rank-text p {
  margin: 0;
}

.theme-agent .rank-label,
.theme-agent .rank-next {
  color: #a7b4c8;
  font-size: 0.9rem;
}

.theme-agent .rank-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fcd34d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.theme-agent .ladder {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
}

.theme-agent .ladder li {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #334155;
  color: #a7b4c8;
}

.theme-agent .ladder li.reached {
  border-color: #86efac;
  color: #86efac;
}

.theme-agent .ladder li.current {
  border-color: #fcd34d;
  color: #fcd34d;
  font-weight: 700;
}

.theme-agent .banner {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  background: #0f2a24;
  color: #86efac;
  border: 1px solid #86efac;
}

@media (min-width: 720px) {
  .theme-agent .agent-status {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ---------- 100% celebration (scout.js celebrate()) ---------- */

.theme-agent .celebrate {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(11, 18, 32, 0.88);
}

.theme-agent .celebrate-box {
  position: relative;
  z-index: 2;
  background: #111a2e;
  color: #e6f1ff;
  border: 2px solid #5eead4;
  border-radius: 14px;
  box-shadow: 0 0 30px rgba(94, 234, 212, 0.35);
  padding: 1.5rem;
  max-width: 22rem;
  margin: 1rem;
  text-align: center;
}

.theme-agent .celebrate-box h2 {
  margin: 0.5rem 0 0.25rem;
}

.theme-agent .celebrate-box p {
  margin: 0.3rem 0 1rem;
}

.theme-agent .celebrate-shield {
  width: 88px;
  margin: 0 auto;
  animation: cb-agent-pulse 1s ease-in-out 3;
}

.theme-agent .confetti {
  position: absolute;
  top: -2rem;
  z-index: 1;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: cb-agent-fall 2.6s linear forwards;
}

.theme-agent .confetti.c0 { background: #5eead4; }
.theme-agent .confetti.c1 { background: #fcd34d; }
.theme-agent .confetti.c2 { background: #86efac; }
.theme-agent .confetti.c3 { background: #7dd3fc; }
.theme-agent .confetti.c4 { background: #f472b6; }

/* Horizontal position + delay via classes (CSP: no style="" / element.style). */
.theme-agent .confetti.x0 { left: 5%; }
.theme-agent .confetti.x1 { left: 15%; }
.theme-agent .confetti.x2 { left: 25%; }
.theme-agent .confetti.x3 { left: 35%; }
.theme-agent .confetti.x4 { left: 45%; }
.theme-agent .confetti.x5 { left: 55%; }
.theme-agent .confetti.x6 { left: 65%; }
.theme-agent .confetti.x7 { left: 75%; }
.theme-agent .confetti.x8 { left: 85%; }
.theme-agent .confetti.x9 { left: 95%; }
.theme-agent .confetti.d0 { animation-delay: 0s; }
.theme-agent .confetti.d1 { animation-delay: 0.2s; }
.theme-agent .confetti.d2 { animation-delay: 0.4s; }
.theme-agent .confetti.d3 { animation-delay: 0.6s; }
.theme-agent .confetti.d4 { animation-delay: 0.8s; }

@keyframes cb-agent-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

@keyframes cb-agent-pulse {
  50% {
    transform: scale(1.15);
  }
}

/* ---------- small screens ---------- */

@media (max-width: 480px) {
  .theme-agent .container {
    padding: 1rem 0.75rem 2rem;
  }

  .theme-agent .site-header {
    padding: 0.75rem 1rem;
  }

  .theme-agent .card,
  .theme-agent .checklist-row {
    padding: 0.9rem 1rem;
  }

  .theme-agent .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .theme-agent .stat-value {
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-agent .confetti {
    display: none;
  }

  .theme-agent .celebrate-shield {
    animation: none;
  }
}
