/* Veridian City Ethics Simulator (Harbinger Veridian brand: navy, chrome and electric blue). Light and dark themes use their own selected steps. */
:root {
  --page: #f6f7f5;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #4a4a46;
  --muted: #6d6c67;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.12);
  --brand: #0b4fb3;          /* Harbinger blue */
  --brand-ink: #ffffff;
  --brand-soft: #e6eefb;
  --accent: #1f66d1;         /* single-series bars (lens profile) */
  --accent-track: #dbe6f8;
  --focus: #b45309;
  --navy: #0a1428;           /* header and logo backdrop, both themes */
  --navy-2: #12264a;
  /* Status: fixed scale, always paired with an icon and a label */
  --good: #0ca30c;      --good-track: #d8f1d8;   --good-text: #006300;
  --warn: #fab219;      --warn-track: #fdeec8;   --warn-text: #7a5200;
  --crit: #d03b3b;      --crit-track: #f6dada;   --crit-text: #a32020;
  --radius: 10px;
  font-size: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a29b;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.12);
    --brand: #7fb1ff;
    --brand-ink: #0b0b0b;
    --brand-soft: #13223b;
    --accent: #5b9cf5;
    --accent-track: #1b2c47;
    --focus: #fbbf24;
    --good-track: #183418;   --good-text: #0ca30c;
    --warn-track: #3d3016;   --warn-text: #fab219;
    --crit-track: #3e1c1c;   --crit-text: #ef7a7a;
  }
}

* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.55; color: var(--ink); background: var(--page); }
body { margin: 0; }
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.9rem; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.4rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0 0 0.9rem; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus, h1:focus, h2:focus { outline: none; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }

/* Header */
.site-header { background: linear-gradient(100deg, var(--navy), var(--navy-2)); color: #fff; border-bottom: 3px solid #1f7aff; }
.site-header .emblem { height: 2.9rem; width: auto; display: block; }
.brand-hero { background: radial-gradient(ellipse at 50% 40%, #16336a 0%, var(--navy) 70%); border-radius: var(--radius); padding: 1rem; text-align: center; margin-bottom: 1.25rem; }
.brand-hero img { width: min(100%, 15rem); height: auto; }
.header-inner { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.8rem; padding-bottom: 0.8rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.7rem; }
.seal { width: 2.6rem; height: 2.6rem; }
.brand-city { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.9; }
.brand-title { font-size: 1.2rem; font-weight: 650; }
.progress { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; font-weight: 600; }
.progress .steps { display: flex; gap: 3px; }
.progress .step { width: 1.15rem; height: 0.5rem; border-radius: 999px; background: rgba(255, 255, 255, 0.3); }
.progress .step.done { background: currentColor; }
.progress .step.now { background: currentColor; outline: 2px solid currentColor; outline-offset: 1px; }
.site-footer { color: var(--muted); font-size: 0.85rem; padding: 2rem 0 2.5rem; }

#app { padding-top: 1.75rem; padding-bottom: 1rem; min-height: 70vh; }

/* Cards and buttons */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 46rem; }
.btn { display: inline-block; font: inherit; font-weight: 600; border-radius: 8px; padding: 0.7rem 1.3rem; border: 2px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--brand); }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }
label.field { display: block; font-weight: 600; margin-bottom: 0.35rem; }
input[type=text] { font: inherit; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; width: min(100%, 24rem); background: var(--surface); color: var(--ink); }
.notice { background: var(--brand-soft); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }

/* Pickers */
.grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); margin: 1rem 0; }
.pick { text-align: left; font: inherit; color: inherit; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; cursor: pointer; }
.pick:hover:not([disabled]) { border-color: var(--brand); }
.pick[disabled] { cursor: not-allowed; opacity: 0.6; }
.pick .name { font-weight: 650; font-size: 1.05rem; display: block; }
.pick .sub { color: var(--ink-2); font-size: 0.92rem; display: block; margin-top: 0.25rem; }
.pick .tag { display: inline-block; font-size: 0.75rem; font-weight: 650; margin-top: 0.5rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--brand-soft); color: var(--ink); }

/* Layout with meter panel */
.layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
@media (max-width: 52rem) { .layout { grid-template-columns: minmax(0, 1fr); } .panel { position: static; } }
.panel { position: sticky; top: 1rem; }
.panel h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }

/* Meter list: name, figure, bar; the fill carries status, the track is a lighter step of the same ramp */
.meters { list-style: none; margin: 0; padding: 0; }
.meter { padding: 0.55rem 0; border-top: 1px solid var(--hairline); }
.meter:first-child { border-top: 0; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.meter-name { font-weight: 600; font-size: 0.95rem; }
.meter-name button { font: inherit; background: none; border: 0; color: var(--muted); cursor: help; padding: 0 0.2rem; }
.meter-fig { font-variant-numeric: tabular-nums; font-weight: 650; }
.bar { height: 8px; border-radius: 999px; margin: 0.35rem 0 0.25rem; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.lvl-good .bar { background: var(--good-track); } .lvl-good .bar > span { background: var(--good); }
.lvl-warn .bar { background: var(--warn-track); } .lvl-warn .bar > span { background: var(--warn); }
.lvl-crit .bar { background: var(--crit-track); } .lvl-crit .bar > span { background: var(--crit); }
.meter-foot { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--ink-2); }
.status-label::before { font-weight: 700; margin-right: 0.25rem; }
.lvl-good .status-label::before { content: "✓"; color: var(--good-text); }
.lvl-warn .status-label::before { content: "!"; color: var(--warn-text); }
.lvl-crit .status-label::before { content: "▲"; color: var(--crit-text); }
.meter-help { font-size: 0.82rem; color: var(--ink-2); margin: 0.25rem 0 0; }
.delta { font-weight: 650; font-variant-numeric: tabular-nums; }
.delta.better { color: var(--good-text); }
.delta.worse { color: var(--crit-text); }

/* Scene */
.week-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand); font-weight: 700; }
@media (prefers-color-scheme: dark) { .week-label { color: var(--brand); } }
.speaker { color: var(--ink-2); font-style: italic; margin-bottom: 0.75rem; }
.developments { border-left: 4px solid var(--warn); background: var(--warn-track); padding: 0.75rem 1rem; border-radius: 0 8px 8px 0; margin-bottom: 1rem; }
.developments strong { display: block; margin-bottom: 0.25rem; }
.choices { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.6rem; }
.choice { width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--border); border-radius: 8px; padding: 0.85rem 1rem; cursor: pointer; display: flex; gap: 0.75rem; align-items: flex-start; }
.choice:hover { border-color: var(--brand); }
.choice .key { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; }
.prompt { font-weight: 650; margin-top: 1.25rem; }

/* Result */
.changes { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.changes li { border: 1px solid var(--border); border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.9rem; background: var(--surface); }

/* Ending */
.grade { display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 12px; font-size: 1.8rem; font-weight: 800; color: #fff; margin-right: 1rem; flex: none; }
.grade.good { background: #0e7a0e; } .grade.mixed { background: #8a5d00; } .grade.bad { background: #b52f2f; }
.ending-head { display: flex; align-items: center; margin-bottom: 1rem; }
.epilogue { margin: 0; }
.epilogue dt { font-weight: 650; margin-top: 0.9rem; }
.epilogue dd { margin: 0.2rem 0 0; color: var(--ink-2); }

/* Review */
.hero { display: flex; gap: 2rem; flex-wrap: wrap; align-items: center; }
.hero-fig { font-size: 3.5rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-sub { color: var(--ink-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; }
.lens-list { list-style: none; padding: 0; margin: 0; }
.lens-row { display: grid; grid-template-columns: 11rem 1fr 3.5rem; gap: 0.75rem; align-items: center; padding: 0.3rem 0; }
.lens-row .bar { background: var(--accent-track); height: 10px; margin: 0; }
.lens-row .bar > span { background: var(--accent); border-radius: 0 4px 4px 0; }
.lens-row .fig { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 36rem) { .lens-row { grid-template-columns: 1fr 3rem; } .lens-row .bar { grid-column: 1 / -1; grid-row: 2; } }
.lens-card { background: var(--brand-soft); border-radius: var(--radius); padding: 1rem 1.25rem; margin-top: 1rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.5rem; border-top: 1px solid var(--hairline); }
thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); border-top: 0; }
tbody th { font-weight: 600; }
.q { white-space: nowrap; font-weight: 650; font-size: 0.85rem; }
.q::before { margin-right: 0.3rem; }
.q-strong { color: var(--good-text); } .q-strong::before { content: "✓"; }
.q-mixed { color: var(--warn-text); } .q-mixed::before { content: "≈"; }
.q-weak { color: var(--crit-text); } .q-weak::before { content: "✗"; }
.alt { margin-top: 0.4rem; font-size: 0.9rem; color: var(--ink-2); }
.recs { padding-left: 1.2rem; }
.recs li { margin-bottom: 0.9rem; }
.law { font-size: 0.88rem; color: var(--ink-2); display: block; margin-top: 0.2rem; }
.law::before { content: "Law & policy: "; font-weight: 650; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Completion record: on-screen section with a preview, and the printed certificate + results (#print-doc). */
.record h2 { margin-bottom: 0.5rem; }
.table-scroll { overflow-x: auto; }
.cert-preview { max-width: 40rem; margin: 1.25rem auto; box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18); }
#print-doc { display: none; }

/* The certificate is paper: fixed light colors in both themes. */
.cert { background: #fff; color: #14171f; border: 2px solid #0b4fb3; outline: 1px solid #0b4fb3; outline-offset: -8px; text-align: center; font-size: 0.95rem; }
.cert-band { background: radial-gradient(ellipse at 50% 45%, #16336a 0%, #0a1428 72%); padding: 1rem 1rem 0.8rem; border-bottom: 3px solid #1f7aff; }
.cert-band img { width: 15rem; max-width: 70%; height: auto; display: block; margin: 0 auto; }
.cert-body { padding: 1.4rem 2rem 1.2rem; }
.cert p { margin: 0 0 0.35rem; }
.cert-kicker { font-size: 1.45rem; font-weight: 750; letter-spacing: 0.16em; text-transform: uppercase; color: #0b4fb3; margin-bottom: 0.8rem !important; }
.cert-small { color: #4a4f5c; font-size: 0.92rem; }
.cert-name { font-family: Georgia, "Times New Roman", serif; font-size: 2.1rem; font-weight: 700; display: inline-block; min-width: 60%; border-bottom: 1px solid #9aa6bd; padding: 0 1rem 0.2rem; margin: 0.25rem 0 0.6rem !important; }
.cert-course { font-size: 1.2rem; font-weight: 700; }
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem 1rem; margin: 1.1rem 0 1.2rem; padding: 0.9rem 0.5rem; border-top: 1px solid #d5dbe6; border-bottom: 1px solid #d5dbe6; }
.cert-grid dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: #5a6070; }
.cert-grid dd { margin: 0.1rem 0 0; font-weight: 650; font-size: 0.92rem; }
.cert-foot { display: flex; justify-content: space-around; gap: 1.5rem; margin: 1.6rem 0 0.9rem; flex-wrap: wrap; }
.cert-line { display: block; min-width: 13rem; border-bottom: 1px solid #14171f; padding-bottom: 0.2rem; font-weight: 650; }
.cert-cap { display: block; font-size: 0.75rem; color: #5a6070; margin-top: 0.2rem; }
.cert-id { font-size: 0.8rem; color: #5a6070; letter-spacing: 0.04em; }
.cert-note { font-size: 0.7rem; color: #6b7080; max-width: 32rem; margin: 0.4rem auto 0 !important; }
@media (max-width: 36rem) { .cert-grid { grid-template-columns: repeat(2, 1fr); } .cert-body { padding: 1rem; } .cert-name { font-size: 1.6rem; } }

.print-head { display: flex; align-items: center; gap: 0.8rem; background: #0a1428; color: #fff; padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.print-head img { height: 2.4rem; width: auto; }

@media print {
  @page { size: letter; margin: 0.5in; }
  :root {
    --page: #fff; --surface: #fff; --ink: #000; --ink-2: #333; --muted: #555; --hairline: #ccc; --border: #ccc;
    --brand: #0b4fb3; --brand-ink: #fff; --brand-soft: #eef3fb; --accent: #1f66d1; --accent-track: #dbe6f8;
    --good-track: #d8f1d8; --good-text: #006300; --warn-track: #fdeec8; --warn-text: #7a5200; --crit-track: #f6dada; --crit-text: #a32020;
  }
  html, body { background: #fff; color: #000; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .skip { display: none; }
  /* On the review screen, print only the record. */
  body.review-screen .site-header, body.review-screen .site-footer, body.review-screen #app > *:not(#print-doc) { display: none !important; }
  body.review-screen #app { padding: 0; min-height: 0; }
  body.review-screen .wrap { max-width: none; padding: 0; }
  body.review-screen #print-doc { display: block; }
  #print-doc .cert { height: 9.7in; overflow: hidden; display: flex; flex-direction: column; break-after: page; font-size: 11pt; }
  #print-doc .cert-body { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; padding: 0.2in 0.6in 0.15in; }
  #print-doc .cert-band img { width: 3.1in; }
  #print-doc .cert-name { font-size: 30pt; }
  .print-results { font-size: 10pt; }
  .print-results .card { border: 0; padding: 0; margin: 0 0 0.25in; background: none; }
  .print-results h2 { font-size: 14pt; border-bottom: 2px solid #0b4fb3; padding-bottom: 0.05in; break-after: avoid; }
  .print-results tr, .print-results li, .lens-card { break-inside: avoid; }
  .print-results .hero-fig { font-size: 30pt; }
}

/* License status (hosted version only; js/license.js) */
.license-status { font-size: 0.8rem; line-height: 1.35; text-align: right; opacity: 0.95; }
.license-status.soon { color: #ffd479; }
input[type=email], input[type=password] { font: inherit; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; width: min(100%, 24rem); background: var(--surface); color: var(--ink); }
.wrap.narrow { max-width: 42rem; }
.notice.warn { background: var(--warn-track); }
.notice ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.form-error { color: var(--crit-text); font-weight: 600; margin-top: 1rem; }
.key-card { text-align: center; }
.license-key { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: 0.06em; background: var(--brand-soft); border-radius: 8px; padding: 0.75rem; user-select: all; word-break: break-all; }
input + label.field, input + .hero-sub + label.field { margin-top: 1rem; }

/* Character avatars (js/avatars.js) */
.avatar { flex: none; border-radius: 50%; display: block; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.person { display: flex; align-items: center; gap: 0.75rem; }
.person-name { display: block; font-weight: 650; }
.person-title { display: block; font-size: 0.88rem; color: var(--ink-2); }
.speaker-row { margin-bottom: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--hairline); }
.panel .person.you { margin-bottom: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--hairline); }
.pick-person { display: flex; gap: 0.9rem; align-items: flex-start; }
.pick-text { display: block; min-width: 0; }
ol .person { padding: 0.25rem 0; }
.epi-row { display: flex; gap: 0.9rem; align-items: flex-start; margin-top: 1rem; }
.epi-row .avatar { margin-top: 0.15rem; }
.epi-row dt { margin-top: 0; }
