/* academy.css: Academy pages on the meter.me brand tokens (assets/brand.css, a copy of www's). */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--mm-font); color: var(--mm-text-darkest); background: var(--mm-bone); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--mm-accent); }
a:hover { color: var(--mm-accent-dark); }
.wrap { padding: 0 clamp(16px, 5vw, 96px); }
header.site { background: var(--mm-white); border-bottom: 1px solid var(--mm-gray-pale); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
header.site img { height: 28px; display: block; }
header.site .tag { color: var(--mm-gray-med); font-size: 15px; }
.hero { background: var(--mm-dark); color: var(--mm-white); padding: clamp(40px, 8vw, 96px) 0; }
.hero h1 { font-size: clamp(32px, 6vw, 56px); line-height: 1.1; margin: 0 0 12px; font-weight: 700; }
.hero p { font-size: clamp(17px, 2.2vw, 21px); margin: 0; color: var(--mm-pale-blue); }
main { padding: clamp(32px, 5vw, 64px) 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.card { background: var(--mm-white); border: 1px solid var(--mm-gray-pale); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; min-height: 44px; }
a.card:hover { border-color: var(--mm-blue); box-shadow: 0 2px 10px rgba(47, 51, 78, 0.08); }
.card h2 { font-size: 20px; margin: 0; color: var(--mm-dark); }
.card p { margin: 0; color: var(--mm-text-dark); }
.card .go { margin-top: auto; color: var(--mm-accent); font-weight: 700; }
.panel { background: var(--mm-white); border: 1px solid var(--mm-gray-pale); border-radius: 10px; padding: 24px; }
.panel h1 { margin: 0 0 8px; color: var(--mm-dark); font-size: clamp(26px, 4vw, 36px); }
footer.site { padding: 32px 0 48px; color: var(--mm-gray-med); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Forms, buttons, pills, tables (class join, trainer pages) ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.muted { color: var(--mm-text-dark); }
.small { font-size: 14px; }
.hidden { display: none !important; }
h1.page { margin: 0; color: var(--mm-dark); font-size: clamp(26px, 4vw, 36px); line-height: 1.15; }
h2.section { margin: 0; color: var(--mm-dark); font-size: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; color: var(--mm-dark); font-size: 15px; }
.field .hint { color: var(--mm-text-dark); font-size: 14px; }
.field input { font: inherit; font-size: 17px; padding: 12px 14px; min-height: 48px; border: 1px solid var(--mm-gray-pale); border-radius: 8px; background: var(--mm-white); color: var(--mm-text-darkest); width: 100%; }
.field input:focus { outline: 2px solid var(--mm-blue); outline-offset: 1px; border-color: var(--mm-blue); }
.field.bad input { border-color: var(--mm-red); }
.field .err { color: #B3122B; font-size: 14px; display: none; }
.field.bad .err { display: block; }
.btn { font: inherit; font-weight: 700; font-size: 16px; min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--mm-blue); background: var(--mm-blue); color: var(--mm-white); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--mm-accent-dark); border-color: var(--mm-accent-dark); color: var(--mm-white); }
.btn.secondary { background: var(--mm-white); color: var(--mm-dark); border-color: var(--mm-gray-pale); }
.btn.secondary:hover { border-color: var(--mm-blue); color: var(--mm-dark); background: var(--mm-white); }
.btn.danger { background: var(--mm-white); color: #B3122B; border-color: #E8A1AC; }
.btn.danger:hover { border-color: #B3122B; }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.linkbtn { font: inherit; background: none; border: 0; padding: 8px 0; color: var(--mm-accent); cursor: pointer; text-decoration: underline; min-height: 44px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; width: 100%; padding: 18px 20px; border-radius: 10px; border: 1px solid var(--mm-gray-pale); background: var(--mm-white); color: var(--mm-dark); font: inherit; cursor: pointer; min-height: 64px; }
.choice strong { font-size: 18px; }
.choice span { color: var(--mm-text-dark); }
.choice:hover, .choice:focus-visible { border-color: var(--mm-blue); box-shadow: 0 2px 10px rgba(47, 51, 78, 0.08); }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--mm-bone); color: var(--mm-text-dark); border: 1px solid var(--mm-gray-pale); white-space: nowrap; }
.pill.open, .pill.ready { background: #E3F4E8; color: #1E6B37; border-color: #B5DEC1; }
.pill.creating, .pill.received { background: var(--mm-pale-blue); color: var(--mm-dark); border-color: #9ACBEA; }
.pill.waiting { background: #FFF4D6; color: #7A5A00; border-color: #F0D88A; }
.pill.failed { background: #FDE7EA; color: #B3122B; border-color: #F3B5BF; }
.notice { border-radius: 10px; padding: 14px 16px; background: #FFF4D6; border: 1px solid #F0D88A; color: #5C4400; }
.notice.error { background: #FDE7EA; border-color: #F3B5BF; color: #8A0E21; }
.notice.ok { background: #E3F4E8; border-color: #B5DEC1; color: #1E5C31; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--mm-dark); color: var(--mm-white); padding: 12px 18px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 20; max-width: calc(100vw - 32px); }
.toast.error { background: #8A0E21; }
table.roster { width: 100%; border-collapse: collapse; background: var(--mm-white); border: 1px solid var(--mm-gray-pale); border-radius: 10px; overflow: hidden; }
table.roster th, table.roster td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #ECECEF; vertical-align: top; }
table.roster th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--mm-gray-med); background: #FBFAF5; }
table.roster tr:last-child td { border-bottom: 0; }
table.roster td .sub { color: var(--mm-text-dark); font-size: 14px; word-break: break-word; }
table.roster td.actions { white-space: nowrap; text-align: right; }
.list { display: flex; flex-direction: column; gap: 12px; }
.list a.item { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; background: var(--mm-white); border: 1px solid var(--mm-gray-pale); border-radius: 10px; padding: 16px 20px; text-decoration: none; color: inherit; min-height: 44px; }
.list a.item:hover { border-color: var(--mm-blue); }
.list a.item strong { color: var(--mm-dark); font-size: 18px; }
.codebox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: 0.08em; background: var(--mm-bone); border: 1px solid var(--mm-gray-pale); border-radius: 8px; padding: 8px 12px; word-break: break-all; }
.confirm { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.userbar { display: flex; gap: 12px; align-items: center; color: var(--mm-text-dark); font-size: 15px; min-width: 0; }
.userbar .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.userbar .who .name { font-weight: 700; color: var(--mm-dark); overflow-wrap: anywhere; }
.userbar .who .roles { color: var(--mm-gray-med); }
.kind { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 6px; background: var(--mm-pale-blue); color: var(--mm-dark); white-space: nowrap; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 720px) {
  table.roster thead { display: none; }
  table.roster, table.roster tbody, table.roster tr, table.roster td { display: block; width: 100%; }
  table.roster tr { border-bottom: 1px solid #ECECEF; padding: 8px 0; }
  table.roster td { border: 0; padding: 4px 14px; }
  table.roster td.actions { text-align: left; }
}

/* ---------- Trainer screen (console) ---------- */
.console { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); gap: 24px; align-items: start; }
.console-preview { position: sticky; top: 16px; }
.preview-box { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; border: 1px solid var(--mm-gray-pale); background: var(--mm-dark); }
.preview-box iframe { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; border: 0; transform-origin: 0 0; pointer-events: none; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { font: inherit; font-size: 15px; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--mm-gray-pale); background: var(--mm-white); color: var(--mm-dark); cursor: pointer; position: relative; }
.seg:hover { border-color: var(--mm-blue); }
.seg.on { background: var(--mm-dark); border-color: var(--mm-dark); color: var(--mm-white); }
.seg.live::after { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #2DB45A; }
.textarea, .field textarea { font: inherit; font-size: 17px; padding: 12px 14px; border: 1px solid var(--mm-gray-pale); border-radius: 8px; width: 100%; resize: vertical; background: var(--mm-white); color: var(--mm-text-darkest); }
.codebox.small { font-size: 14px; padding: 6px 10px; }
@media (max-width: 1100px) {
  .console { grid-template-columns: 1fr; }
  .console-preview { position: static; order: -1; }
}

/* On/off switch row (trainer screen: auto-create) */
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 10px 12px; border: 1px solid var(--mm-gray-pale); border-radius: 8px; background: var(--mm-white); }
.switch input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--mm-blue); }
.switch span { display: flex; flex-direction: column; gap: 2px; }
.switch .sub { font-size: 13px; color: var(--mm-text-dark); }

/* ---------- My Academy (trainee side) ---------- */
.progress { height: 8px; background: var(--mm-bone); border: 1px solid var(--mm-gray-pale); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--mm-blue); border-radius: 999px; }
.modlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.modlist li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--mm-gray-pale); border-radius: 8px; background: var(--mm-white); }
.modlist li a { font-weight: 700; }
.modlist li.done { background: #F2FAF4; }
.modlist li.locked { background: var(--mm-bone); }
.modlist li.check .btn { margin-left: auto; }
.pill.wrap { white-space: normal; }
/* A knowledge check in place of the list: one question, lettered options, then the result. */
.check .qtext { margin: 0; font-size: 19px; font-weight: 700; color: var(--mm-dark); line-height: 1.35; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border: 1px solid var(--mm-gray-pale); border-radius: 10px; background: var(--mm-white); cursor: pointer; font-size: 17px; color: var(--mm-text-darkest); }
.opt:hover { border-color: var(--mm-blue); }
.opt.on { border-color: var(--mm-blue); background: var(--mm-pale-blue); }
.opt input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--mm-blue); }
.opt .letter { font-weight: 700; color: var(--mm-dark); min-width: 1.3em; }
.result { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 16px 20px; border-radius: 10px; border: 1px solid; }
.result.ok { background: #E3F4E8; border-color: #B5DEC1; color: #1E5C31; }
.result.no { background: #FFF4D6; border-color: #F0D88A; color: #5C4400; }
.result .score { font-size: 40px; font-weight: 700; line-height: 1; color: var(--mm-dark); font-variant-numeric: tabular-nums; }
.result strong { font-size: 18px; }
.marks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.marks li { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--mm-gray-pale); border-radius: 8px; background: var(--mm-white); }
.marks li.right strong { color: #1E6B37; }
.marks li.wrong strong { color: #B3122B; }
@media (max-width: 480px) {
  .modlist li.check .btn { width: 100%; margin-left: 0; }
  .check .row .btn { flex: 1; }
}
.gsi { display: flex; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
