@font-face { font-family: "Cormorant Garamond"; src: url("fonts/cormorant-garamond.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/SourceSans3-VariableFont_wght.ttf") format("truetype"); font-weight: 200 900; font-display: swap; }
:root {
  --navy: #0E1C2F; --crimson: #8C1F2B; --crimson-dark: #701822; --ivory: #F4EFE6; --paper: #FBFAF6;
  --gold: #C6A15B; --gold-dark: #A88444; --ink: #1B1916; --slate: #5C574E; --stone: #E6DFD2;
  --green: #1F5135; --green-bg: #E3EFE6; --red-bg: #F6E3E5; --warn-bg: #FBF1DC;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tap: 52px; --radius: 4px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ivory); color: var(--ink); font-family: var(--sans); font-size: 18px; line-height: 1.5; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 2.1rem; } h2 { font-size: 1.7rem; } h3 { font-size: 1.35rem; }
p { margin: 0 0 .8em; }
a { color: var(--navy); text-underline-offset: 2px; word-break: break-word; }
.muted { color: var(--slate); }
.small { font-size: .9rem; }

.site-header { background: var(--navy); color: var(--ivory); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 3px solid var(--gold); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 48px; height: 48px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.kicker { font-family: var(--sans); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; color: var(--gold); font-weight: 600; }
.brand-title { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; line-height: 1.1; }
.pilot-banner { background: var(--warn-bg); border-bottom: 2px solid var(--gold-dark); color: var(--ink); padding: 10px 16px; font-size: 1rem; text-align: center; }

.tabs { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--paper); border-bottom: 1px solid var(--stone); position: sticky; top: 0; z-index: 5; }
.tabs button { min-height: var(--tap); border: 0; background: none; font: 600 .95rem var(--sans); color: var(--navy); padding: 6px 2px; border-bottom: 4px solid transparent; cursor: pointer; }
.tabs button[aria-current="page"] { border-bottom-color: var(--crimson); color: var(--crimson); }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; outline: none; }
.site-footer { max-width: 960px; margin: 0 auto; padding: 16px 16px 32px; color: var(--slate); font-size: .85rem; border-top: 1px solid var(--stone); }
.site-footer p { margin: 0 0 .3em; }

.card { background: var(--paper); border: 1px solid var(--stone); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.rule { width: 64px; height: 2px; background: var(--gold); border: 0; margin: 0 0 14px; }

label { display: block; font-weight: 600; margin: 0 0 6px; color: var(--navy); }
.field { margin: 0 0 16px; }
.hint { font-weight: 400; color: var(--slate); font-size: .9rem; display: block; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: var(--tap); font: 400 1.05rem var(--sans); color: var(--ink); background: #fff;
  border: 1.5px solid #B9B0A0; border-radius: var(--radius); padding: 10px 12px; }
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--gold-dark); outline-offset: 2px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; color: var(--ink); min-height: var(--tap); padding: 6px 0; cursor: pointer; }
.check input { width: 26px; height: 26px; flex: none; margin: 2px 0 0; accent-color: var(--navy); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 10px 20px; border-radius: 2px; border: 1.5px solid var(--navy);
  background: var(--paper); color: var(--navy); font: 600 .98rem var(--sans); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: var(--crimson); border-color: var(--crimson); color: var(--ivory); }
.btn-primary:hover { background: var(--crimson-dark); }
.btn-navy { background: var(--navy); color: var(--ivory); }
.btn-danger { border-color: var(--crimson); color: var(--crimson); }
.btn-lock { background: transparent; color: var(--ivory); border-color: var(--gold); min-height: 48px; padding: 8px 14px; flex: none; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 0; }
.btn-row .btn { flex: 1 1 200px; }
.after-form { margin-top: 14px; }
.zero-skills { font-size: .95rem; }
.edit-block-gap { margin: 0 0 24px; }
.linkish { background: none; border: 0; color: var(--navy); text-decoration: underline; font: inherit; cursor: pointer; padding: 12px 0; min-height: 44px; }

.error { background: var(--red-bg); border-left: 5px solid var(--crimson); padding: 10px 14px; margin: 0 0 14px; color: #5A111A; font-weight: 600; }
.notice { background: var(--warn-bg); border-left: 5px solid var(--gold-dark); padding: 10px 14px; margin: 0 0 14px; }
.ok { background: var(--green-bg); border-left: 5px solid var(--green); padding: 10px 14px; margin: 0 0 14px; }

.list { list-style: none; margin: 0; padding: 0; }
.pick { display: flex; width: 100%; text-align: left; gap: 12px; align-items: center; min-height: 64px; padding: 12px 14px; margin: 0 0 10px; background: #fff; border: 1.5px solid var(--stone); border-radius: var(--radius); font: inherit; color: inherit; cursor: pointer; }
.pick:hover { border-color: var(--navy); }
.pick[aria-pressed="true"] { border-color: var(--crimson); box-shadow: inset 5px 0 0 var(--crimson); }
.pick .code { font-weight: 700; color: var(--navy); min-width: 84px; font-size: .95rem; letter-spacing: .03em; }
.pick .grow { flex: 1; min-width: 0; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 2px; background: var(--stone); color: var(--navy); }
.badge { display: inline-block; font-weight: 700; padding: 3px 10px; border-radius: 2px; font-size: .9rem; letter-spacing: .04em; }
.badge.pass { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.badge.fail { background: var(--red-bg); color: var(--crimson); border: 1px solid var(--crimson); }

.attempt-head { position: sticky; top: var(--tap); z-index: 4; background: var(--navy); color: var(--ivory); border-radius: var(--radius); padding: 8px 14px; margin: 0 0 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.attempt-head .who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attempt-head .what { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #D9D2C3; }
.attempt-head .clock { text-align: right; }
.attempt-head .clock .small { font-size: .78rem; color: #D9D2C3; }
.timer { font: 700 1.6rem/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--gold); }
.timer.over { color: #FFB4B4; }
.step { background: #fff; border: 1.5px solid var(--stone); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.step.met { border-color: var(--green); background: var(--green-bg); }
.step.notmet { border-color: var(--crimson); background: var(--red-bg); }
.step-text { margin: 0 0 10px; font-size: 1.08rem; }
.step-num { font-weight: 700; color: var(--navy); margin-right: 6px; }
.step-meta { font-size: .85rem; color: var(--slate); margin: 8px 0 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button { min-height: 56px; font: 700 1.05rem var(--sans); border-radius: var(--radius); border: 2px solid #B9B0A0; background: var(--paper); color: var(--ink); cursor: pointer; }
.seg button.on-met { background: var(--green); border-color: var(--green); color: #fff; }
.seg button.on-notmet { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.crit { background: #fff; border: 1.5px solid var(--stone); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.crit.flagged { border-color: var(--crimson); background: var(--red-bg); }
.crit p { margin: 0; flex: 1; }
.crit button { min-height: var(--tap); min-width: 108px; flex: none; }
.autofail { background: var(--crimson); color: #fff; padding: 12px 14px; border-radius: var(--radius); font-weight: 700; margin: 0 0 14px; }
.summary-line { font-size: 1.1rem; font-weight: 600; }

.source { background: var(--paper); border: 1px solid var(--stone); border-left: 4px solid var(--gold); padding: 12px 14px; font-size: .9rem; color: var(--ink); margin: 14px 0; }
.source h4 { margin: 0 0 6px; font: 600 .82rem var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--slate); }
.source p { margin: 0 0 .5em; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 16px; }
.tile { background: var(--paper); border: 1px solid var(--stone); border-top: 3px solid var(--gold); padding: 14px; border-radius: var(--radius); }
.tile .num { font: 700 2rem/1.1 var(--sans); color: var(--navy); font-variant-numeric: tabular-nums; }
.tile .lbl { color: var(--slate); font-size: .92rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--stone); border-radius: var(--radius); background: #fff; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: .98rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--stone); text-align: left; vertical-align: top; }
th { background: var(--navy); color: var(--ivory); font-weight: 600; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.matrix td, .matrix th { text-align: center; white-space: nowrap; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.skillcards { display: none; }
.skillcard { background: #fff; border: 1px solid var(--stone); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; }
.skillcard .kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: .98rem; }
.skillcard .kv span:nth-child(even) { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 220px; }
.edit-step { display: grid; grid-template-columns: 1fr; gap: 8px; background: #fff; border: 1px solid var(--stone); padding: 10px; border-radius: var(--radius); margin: 0 0 10px; }
.edit-step .btn-row .btn { flex: 1 1 90px; min-height: 48px; padding: 8px 10px; font-size: .85rem; }
details.card > summary { cursor: pointer; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--navy); min-height: 44px; display: flex; align-items: center; }
.legal p, .legal li { font-size: .98rem; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--navy); color: var(--ivory); padding: 12px 18px; border-radius: var(--radius); font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .3s; max-width: 90vw; z-index: 20; border: 1px solid var(--gold); }
.toast.show { opacity: 1; }

/* printable record */
.record { background: #fff; border: 1px solid var(--stone); padding: 22px; }
.record .rec-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--gold); padding-bottom: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.record table { font-size: .92rem; }
.record th { background: var(--stone); color: var(--navy); }
.sigline { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.sigline div { border-top: 1px solid var(--ink); padding-top: 4px; font-size: .9rem; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  h1 { font-size: 1.8rem; } h2 { font-size: 1.5rem; }
  main { padding: 16px 12px 32px; }
  .tabs button { font-size: .82rem; }
  .brand-title { font-size: 1.2rem; }
  .brand-mark { width: 40px; height: 40px; }
  .wide-table { display: none; }
  .skillcards { display: block; }
  .crit { flex-direction: column; align-items: stretch; }
  .crit button { width: 100%; }
  .record { padding: 14px; }
}
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .site-header, .tabs, .site-footer, .no-print, .toast { display: none !important; }
  .pilot-banner { border: 1px solid #000; background: #fff; }
  main { max-width: none; padding: 0; }
  .record { border: 0; padding: 0; }
  .record th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr { page-break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.selected-summary { border-left: 5px solid var(--crimson); font-size: 1.05rem; }
.record h3 { margin-top: 1.2em; }
.matrix th, .matrix td { padding: 8px 6px; font-size: .9rem; }
.record td:nth-child(3) { white-space: nowrap; }
@media print { html, body { width: auto; } .pilot-banner { margin: 0 0 10px; padding: 6px 10px; } }
