/* Pulsar Learning — LMS styles. Palette and type from the Pulsar Learning brand kit v1.0. */
:root {
  --ink: #232B34;        /* Charcoal Ink */
  --midnight: #161C23;
  --panel: #232B34;
  --panel-2: #2C3540;
  --line: #3A4552;
  --yellow: #F3B80C;     /* Voltage Yellow */
  --amber: #FFCE45;      /* Amber Flash */
  --red: #A81B2F;        /* Pulse Red (decorative) */
  --red-text: #F07A8C;   /* readable tint of Pulse Red for text on dark */
  --ember: #7E1423;
  --grey: #9AA5B1;       /* Storm Grey */
  --cloud: #F1F3F5;
  --white: #FFFFFF;
  --radius: 10px;
  --display: 'Montserrat', 'Arial', sans-serif;
  --body: 'Inter', 'Arial', 'Calibri', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--midnight); color: var(--cloud); font: 15px/1.55 var(--body); }
a { color: var(--amber); }
a:hover { color: var(--yellow); }
code, pre { font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
h1, .display { font: italic 800 30px/1.1 var(--display); text-transform: uppercase; letter-spacing: -0.01em; color: var(--yellow); margin: 0 0 6px; }
h2 { font: 700 18px/1.3 var(--body); margin: 0 0 14px; color: var(--white); }
p { margin: 0 0 12px; }
.muted { color: var(--grey); }
.small { font-size: 13px; }
.sub { color: var(--grey); font-size: 13px; margin-top: 2px; }
.eyebrow { color: var(--grey); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 600; margin: 0 0 4px; }

/* ---------- top bar ---------- */
.topbar { background: var(--ink); border-bottom: 3px solid var(--yellow); display: flex; align-items: center; gap: 24px; padding: 8px 24px; position: sticky; top: 0; z-index: 10; }
.brand img { height: 56px; display: block; }
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a { color: var(--cloud); text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 500; }
.mainnav a:hover { background: var(--panel-2); color: var(--white); }
.mainnav a.on { color: var(--yellow); box-shadow: inset 0 -2px 0 var(--yellow); border-radius: 0; }
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.who a { color: var(--cloud); text-decoration: none; }
.who form { margin: 0; }

main { max-width: 1040px; margin: 0 auto; padding: 32px 24px 64px; }
main.wide { max-width: 1320px; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--white); font: 600 14px/1.2 var(--body); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--grey); color: var(--white); }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.btn.primary:hover { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--ember); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.linkbtn { background: none; border: 0; color: var(--amber); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.who .linkbtn { color: var(--grey); font-size: 14px; }

label { display: block; margin: 0 0 16px; font-weight: 600; font-size: 14px; }
label .muted { font-weight: 400; }
input:not([type=checkbox]):not([type=file]), select, textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; background: var(--midnight); color: var(--white); border: 1px solid var(--line); border-radius: 8px; font: 15px/1.4 var(--body); }
select[multiple] { padding: 6px; }
select[multiple] option { padding: 6px 8px; border-radius: 4px; }
input[type=file] { display: block; margin-top: 8px; color: var(--grey); font: 14px var(--body); }
input[type=date] { color-scheme: dark; max-width: 220px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
label.check input { margin-top: 4px; accent-color: var(--yellow); width: 16px; height: 16px; }
textarea { resize: vertical; }

/* ---------- layout pieces ---------- */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.pagehead .sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { margin: 0 0 8px; font-size: 13px; }
.crumbs a { color: var(--grey); text-decoration: none; }
.crumbs a::before { content: '← '; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.panel.narrow { max-width: 620px; }
.panelhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panelhead h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid2 .panel { margin-bottom: 0; }
.grid2 + .panel, .panel + .grid2 { margin-top: 20px; }
details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; font-weight: 600; color: var(--cloud); }
summary.danger { color: var(--red-text); }
details form { margin-top: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 18px; font-size: 14px; }
.kv dt { color: var(--grey); }
.kv dd { margin: 0; min-width: 0; }
pre.sample { background: var(--midnight); border: 1px solid var(--line); padding: 12px; border-radius: 8px; overflow-x: auto; }
.search { display: flex; gap: 8px; margin-bottom: 16px; max-width: 460px; }
.search input { margin: 0 !important; }
.inlineform { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.inlineform select, .inlineform input { width: auto !important; margin: 0 !important; max-width: 360px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--yellow); border-radius: var(--radius); padding: 16px 18px; }
.stat .num { display: block; font: italic 800 32px/1 var(--display); color: var(--white); }
.stat .lbl { display: block; margin-top: 6px; color: var(--grey); font-size: 13px; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--grey); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--panel-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .02); }
th.r, td.r { text-align: right; font-variant-numeric: tabular-nums; }
td a { color: var(--white); text-decoration: none; font-weight: 500; }
td a:hover { color: var(--amber); text-decoration: underline; }
tr.inactive td { opacity: .55; }
.rowactions { white-space: nowrap; text-align: right; }
.rowactions form { display: inline; margin-left: 10px; }
table.responses td:nth-child(-n+3) { min-width: 160px; }
td details { margin: 0; border: 0; padding: 0; }
td summary { font-weight: 500; }
.answers { list-style: none; padding: 0; margin: 8px 0 4px; max-width: 520px; }
.answers li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 8px; border-radius: 4px; font-size: 13px; }
.answers li:nth-child(odd) { background: var(--panel-2); }
.ans.ok::after { content: ' ✓'; color: var(--yellow); font-weight: 700; }
.answers .n { color: var(--grey); font-variant-numeric: tabular-nums; }

/* meter: value is the filled share; label always shown so colour isn't the only signal */
.meter { display: inline-block; width: 90px; height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.meter span { display: block; height: 100%; background: var(--yellow); border-radius: 4px; }
.meterlabel { display: inline-block; min-width: 40px; text-align: right; margin-left: 8px; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--cloud); }

/* ---------- badges ---------- */
.badge, .pill, .tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge.none { background: var(--panel-2); color: var(--grey); }
.badge.prog { border: 1px solid var(--amber); color: var(--amber); padding: 1px 9px; }
.badge.done { background: var(--amber); color: var(--ink); }
.badge.pass { background: var(--yellow); color: var(--ink); }
.badge.pass::before { content: '✓ '; }
.badge.fail { background: var(--red); color: var(--white); }
.pill.published { background: var(--yellow); color: var(--ink); }
.pill.draft { border: 1px dashed var(--grey); color: var(--grey); padding: 1px 9px; }
.pill.archived { background: var(--panel-2); color: var(--grey); }
.tag { background: transparent; border: 1px solid var(--line); color: var(--grey); font-weight: 500; padding: 1px 8px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 16px; color: var(--grey); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--white); }
.tabs a.on { color: var(--yellow); border-bottom-color: var(--yellow); }

/* ---------- flash ---------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; border-left: 4px solid var(--yellow); background: var(--panel); }
.flash.err { border-left-color: var(--red); background: rgba(168, 27, 47, .18); }
.flash.warn { border-left-color: var(--amber); background: rgba(255, 206, 69, .1); }

/* ---------- auth ---------- */
.authcard { max-width: 420px; margin: 40px auto; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--yellow); border-radius: var(--radius); padding: 32px; }
.authcard .lede { color: var(--grey); margin-bottom: 22px; }
.authcard .alt { margin: 18px 0 0; font-size: 14px; text-align: center; }

/* ---------- learner cards ---------- */
.summary { color: var(--grey); margin: 0; }
.summary strong { color: var(--yellow); font-size: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.card:hover { border-color: var(--grey); }
.cardtop { display: flex; gap: 8px; flex-wrap: wrap; }
.card h2 { font: italic 800 19px/1.2 var(--display); text-transform: uppercase; color: var(--white); margin: 4px 0 0; }
.card .desc { color: var(--grey); font-size: 14px; margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; font-size: 13px; }
.facts div { display: flex; flex-direction: column; }
.facts dt { color: var(--grey); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 0; }
.card .btn { margin-top: auto; align-self: flex-start; }
.empty { text-align: center; padding: 60px 20px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h2 { font: italic 800 22px/1.2 var(--display); text-transform: uppercase; color: var(--yellow); }

/* ---------- player ---------- */
body.player { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; background: #000; }
.playerbar { display: flex; align-items: center; gap: 12px; padding: 6px 14px; background: var(--ink); border-bottom: 2px solid var(--yellow); flex: none; }
.playericon { height: 30px; width: 30px; }
.playertitle { font: italic 800 15px/1.2 var(--display); text-transform: uppercase; color: var(--white); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.savestate { font-size: 12px; color: var(--grey); }
.savestate.err { color: var(--red-text); }
#course { flex: 1; width: 100%; border: 0; background: #000; }
.closed { position: fixed; inset: 0; background: rgba(22, 28, 35, .94); display: flex; align-items: center; justify-content: center; text-align: center; }
.closed[hidden] { display: none; }
.closed h2 { font: italic 800 26px/1.2 var(--display); text-transform: uppercase; color: var(--yellow); }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; padding: 8px 16px; gap: 8px 16px; }
  .brand img { height: 44px; }
  .mainnav { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
  main { padding: 24px 16px 48px; }
  h1 { font-size: 24px; }
  .panel { padding: 18px 16px; }
}
