:root {
  --bg: #e6edf0;
  --panel: #ffffff;
  --ink: #12303a;
  --muted: #55707a;
  --line: #c3d1d7;
  --wire: #f2c230;
  --wire-deep: #b98a00;
  --eve: #c2225b;
  --ok: #1a7f56;
  --soft: #f3f7f8;
  --ui: "Avenir Next", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --data: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--ui); }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; max-width: 68ch; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--eve); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* top bar: the cable runs under it */
.bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .7rem 1.25rem;
  background: var(--ink); color: #fff; border-bottom: 6px solid var(--wire); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand i { font-style: normal; color: var(--wire); }
.bar .grow { flex: 1; }
.chip { background: rgba(255,255,255,.12); border-radius: 999px; padding: .2rem .75rem; font-size: .9rem; white-space: nowrap; }
.chip b { color: var(--wire); }
.linkbtn { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; padding: .2rem; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 1.25rem; }
.grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 1.25rem; align-items: start; }
@media (max-width: 880px) { .grid { grid-template-columns: 1fr; } .wrap { padding: .75rem; } }
.stack > * + * { margin-top: 1rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; }
.panel > h2, .panel > h3 { margin-bottom: .6rem; }

/* mission */
.mission { background: var(--ink); color: #fff; border-radius: 10px; padding: 1.1rem 1.25rem; }
.mission .slide { color: var(--wire); font-size: .9rem; margin-bottom: .25rem; }
.mission h1 { font-size: 1.7rem; margin-bottom: .5rem; }
.mission p { color: #dbe7ea; }
.facts { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.fact { background: rgba(255,255,255,.1); border-radius: 8px; padding: .45rem .75rem; min-width: 9rem; }
.fact span { display: block; font-size: .8rem; color: #b9cdd3; }
.fact strong { font-size: 1.05rem; }
.fact.code strong { font-family: var(--data); color: var(--wire); }
.fact.good { background: var(--ok); }
.fact.bad { background: var(--eve); }
.lesson { border-left: 6px solid var(--wire); background: #fff; color: var(--ink); border-radius: 0 8px 8px 0; padding: .8rem 1rem; margin-top: .9rem; }
.lesson p { color: var(--ink); margin: 0; font-size: 1.05rem; }

/* forms */
label { display: block; font-size: .875rem; font-weight: 600; margin: .6rem 0 .2rem; }
input[type=text], input[type=password], select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 7px; padding: .5rem .65rem; background: #fff; }
textarea { font-family: var(--data); font-size: .875rem; min-height: 4.2rem; resize: vertical; word-break: break-all; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.row > .f { flex: 1; min-width: 9rem; }
.btn { border: 0; border-radius: 7px; padding: .55rem 1rem; background: var(--ink); color: #fff; font-weight: 700; cursor: pointer; }
.btn:hover { background: #0b222a; }
.btn.alt { background: var(--soft); color: var(--ink); border: 1.5px solid var(--line); }
.btn.alt:hover { border-color: var(--ink); }
.btn.wire { background: var(--wire); color: var(--ink); }
.btn.eve { background: var(--eve); }
.btn.ok { background: var(--ok); }
.btn.sm { padding: .3rem .65rem; font-size: .85rem; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.note { margin-top: .6rem; padding: .5rem .7rem; border-radius: 7px; background: var(--soft); font-size: .92rem; }
.note.good { background: #e2f3ec; color: #0e5a3b; }
.note.bad { background: #fbe4ec; color: #8a1440; }

/* tools */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .7rem; }
.tab { border: 1.5px solid var(--line); background: var(--soft); border-radius: 999px; padding: .3rem .85rem; cursor: pointer; font-weight: 600; font-size: .9rem; }
.tab[aria-selected=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.out { font-family: var(--data); font-size: .875rem; background: var(--soft); border: 1.5px dashed var(--line); border-radius: 7px; padding: .5rem .65rem; min-height: 2.4rem; word-break: break-all; white-space: pre-wrap; }
.keyline { font-family: var(--data); font-size: .85rem; }

/* the wire: one yellow cable, every message clipped to it */
.wirebox { position: sticky; top: 4.6rem; }
.wirehead { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.wire { position: relative; padding-left: 1.6rem; max-height: calc(100vh - 12rem); overflow-y: auto; }
.wire::before { content: ""; position: absolute; left: .45rem; top: 0; bottom: 0; width: 6px; border-radius: 3px; background: var(--wire); }
.msg { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; margin-bottom: .55rem; }
.msg::before { content: ""; position: absolute; left: -1.15rem; top: 1rem; width: 1.15rem; height: 3px; background: var(--wire-deep); }
.msg.mine { border-color: var(--ink); }
.msg.tome { border-left: 5px solid var(--ok); }
.msg .who { font-size: .85rem; font-weight: 700; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.msg .who .to { font-weight: 500; color: var(--muted); }
.msg .body { font-family: var(--data); font-size: .875rem; word-break: break-all; white-space: pre-wrap; margin: .25rem 0; }
.msg .sig { font-family: var(--data); font-size: .72rem; color: var(--muted); word-break: break-all; }
.msg .truth { font-size: .85rem; font-weight: 700; margin-top: .25rem; }
.msg .truth.forged { color: var(--eve); }
.msg .truth.real { color: var(--ok); }
.tag { font-size: .72rem; font-weight: 700; border-radius: 4px; padding: .05rem .35rem; background: var(--soft); border: 1px solid var(--line); }
.empty { color: var(--muted); padding: 1rem .2rem; }
@media (max-width: 880px) { .wirebox { position: static; } .wire { max-height: 60vh; } }

/* join */
.join { max-width: 30rem; margin: 6vh auto; }
.join h1 { font-size: 2.6rem; letter-spacing: -0.03em; }
.join h1 i { font-style: normal; background: linear-gradient(transparent 62%, var(--wire) 62%); }

/* poll + files */
.q { border-top: 1px solid var(--line); padding: .8rem 0; }
.q:first-of-type { border-top: 0; }
.opts { display: grid; gap: .35rem; margin-top: .4rem; }
.opt { text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 7px; padding: .45rem .7rem; cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--ink); }
.opt.chosen { border-color: var(--ink); background: var(--soft); font-weight: 700; }
.opt.right { border-color: var(--ok); background: #e2f3ec; }
.opt.wrong { border-color: var(--eve); background: #fbe4ec; }
.file { border: 1.5px solid var(--line); border-radius: 8px; padding: .7rem .8rem; margin-top: .7rem; }
.file .body { font-family: var(--data); font-size: .9rem; background: var(--soft); padding: .5rem; border-radius: 6px; margin: .4rem 0; }
.hash { font-family: var(--data); font-size: .78rem; word-break: break-all; }

/* tables (instructor) */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.rounds { display: grid; gap: .5rem; }
.roundrow { display: grid; grid-template-columns: 2rem 1fr auto; gap: .7rem; align-items: center; padding: .55rem .7rem; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; }
.roundrow.now { border-color: var(--ink); box-shadow: inset 6px 0 0 var(--wire); }
.roundrow .n { font-weight: 800; font-size: 1.2rem; text-align: center; }
.roundrow small { display: block; color: var(--muted); }
.stats { display: flex; gap: .6rem; flex-wrap: wrap; }
.stat { background: var(--soft); border-radius: 8px; padding: .5rem .8rem; min-width: 7rem; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .82rem; color: var(--muted); }
.stat.bad b { color: var(--eve); }
.stat.good b { color: var(--ok); }
.warn { background: #fff4cf; border: 1.5px solid var(--wire); border-radius: 8px; padding: .6rem .8rem; }

/* projector */
body.screen { font-size: 20px; }
.screen .wrap { max-width: none; padding: 1.5rem 2rem; }
.screen .grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2rem; }
.screen .mission h1 { font-size: 3rem; }
.screen .mission p { font-size: 1.25rem; max-width: 60ch; }
.screen .lesson p { font-size: 1.5rem; max-width: 50ch; }
.screen .wire { max-height: calc(100vh - 22rem); }
.screen .msg .body { font-size: 1rem; }
.screen .stat b { font-size: 2.6rem; }
.screen .stat { min-width: 9rem; padding: .8rem 1.1rem; }
.joincode { font-family: var(--data); font-size: 5rem; font-weight: 800; letter-spacing: .08em; background: var(--wire); color: var(--ink); display: inline-block; padding: .1em .4em; border-radius: 12px; }
.names { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.names span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .8rem; }
.lead li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.lead { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.lead li::before { counter-increment: r; content: counter(r) "."; color: var(--muted); width: 1.6rem; }
.lead li span { flex: 1; }
.lead li b { font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: .25rem; margin: .3rem 0 1rem; }
.barrow { display: grid; grid-template-columns: minmax(0, 1fr) 6rem 2.2rem; gap: .5rem; align-items: center; font-size: .85rem; }
.barrow .track { background: var(--soft); height: .9rem; border-radius: 4px; overflow: hidden; }
.barrow .fill { height: 100%; background: var(--muted); }
.barrow.right .fill { background: var(--ok); }
.barrow.right { font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .msg.new { animation: clip .35s ease-out; }
  @keyframes clip { from { transform: translateX(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
}
