/* Colors, type and header follow the Mooselen publication (mooselen.com). */
:root {
  --navy: #0e2a47;
  --navy-hover: #204463;
  --deep: #081b2e;
  --ink: #142738;
  --white: #ffffff;
  --hover: #f3f5f8;
  --selected: #e9eef4;
  --gold: #aa8f5c;
  --gold-text: #806a41;
  --gold-light: #d1b883;
  --cream: #faf4e8;
  --line: #d9dbda;
  --muted: #596673;
  --soft: #465464;
  --ok: #285a42;
  --stop: #853a3a;
  --serif: "Iowan Old Style", "Baskerville", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: "Optima", "Avenir Next", "Segoe UI", Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { background: var(--white); scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection { background: #dcc49c; color: #092238; }

[hidden] { display: none !important; }

/* ---- Header (as on Mooselen) ---- */

.site-header { background: var(--deep); color: #f3efe6; border-bottom: 1px solid #4b6070; }

.utility {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 1340px;
  margin: auto;
  padding: 11px 35px;
  border-bottom: 1px solid #627387;
  color: #c5c7ca;
  font: 10px/1.4 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.utility .issue { color: var(--gold-light); text-decoration: none; }
.utility .issue:hover { color: #dfc18a; }

.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 1340px;
  min-height: 155px;
  margin: auto;
  padding: 20px 35px;
}
.masthead .brand {
  font: 400 clamp(36px, 4.6vw, 64px)/1 var(--serif);
  letter-spacing: 0.13em;
  text-decoration: none;
  color: var(--cream);
  white-space: nowrap;
}
.masthead .brand::first-letter { font-size: 1.06em; }
.masthead .motto {
  font: 10px/1.8 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b5c2c9;
}
.masthead .right {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 18px;
  font-size: 12px;
}
.masthead .who { color: #b5c2c9; }
.masthead .right a {
  color: #d8c095;
  text-decoration: none;
  border-bottom: 1px solid #6a7c8c;
  padding-bottom: 5px;
}
.masthead .right a:hover { color: #dfc18a; }
.masthead .signout {
  padding: 0 0 5px;
  font: 12px var(--sans);
  letter-spacing: 0;
  text-transform: none;
  color: #d8c095;
  background: none;
  border: 0;
  border-bottom: 1px solid #6a7c8c;
}
.masthead .signout:hover { color: #dfc18a; background: none; }

.mainnav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(14px, 3vw, 43px);
  max-width: 1340px;
  margin: auto;
  padding: 15px 35px;
  border-top: 1px solid #627387;
}
.mainnav a {
  font: 11px/1.4 var(--sans);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  color: #f6f0e7;
}
.mainnav a:hover { color: #dfc18a; }
.mainnav a[aria-current="page"] { color: var(--gold-light); box-shadow: inset 0 -1px 0 var(--gold); padding-bottom: 4px; }
.mainnav .count {
  display: inline-block;
  min-width: 18px;
  margin-left: 8px;
  padding: 1px 6px;
  font: 10px/1.5 var(--sans);
  letter-spacing: 0;
  text-align: center;
  color: var(--deep);
  background: var(--gold-light);
  border-radius: 9px;
}

/* ---- Page ---- */

main { max-width: 1080px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 35px) 84px; }
main:focus { outline: none; }
.page-status { padding: 56px 0; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px 40px;
  padding: 52px 0 8px;
}
h1 {
  margin: 0;
  font: 400 clamp(32px, 4vw, 46px)/1.14 var(--serif);
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.lede { margin: 14px 0 0; max-width: 640px; font: clamp(16px, 1.25vw, 18px)/1.55 var(--serif); color: #384656; }
.head-actions { display: flex; gap: 14px; }
.crumbs { margin: 40px 0 -36px; }

.panel {
  margin-top: 28px;
  padding: clamp(22px, 3.6vw, 40px);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--navy);
}

h2 { margin: 0 0 22px; font: 400 26px/1.2 var(--serif); letter-spacing: -0.02em; }
h3 { margin: 0 0 10px; font: italic 22px/1.2 var(--serif); }

.fields { display: flex; flex-wrap: wrap; gap: 0 20px; }
.field { display: flex; flex-direction: column; gap: 8px; flex: 1 1 320px; min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.field.narrow { flex: 0 1 200px; }
.label {
  padding: 0;
  font: 700 10px var(--sans);
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink);
}

input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #a5b0b8;
  border-radius: 0;
  outline: none;
  transition: border-color 0.15s ease;
}
textarea { font: 14px/1.5 var(--sans); }
input:focus, select:focus, textarea:focus { border-color: var(--navy); }
#command { font-family: var(--mono); font-size: 14px; }

.source { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.source code { font-family: var(--mono); font-size: 12px; color: var(--soft); }
.source.bad { color: var(--stop); }

.tree { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tree li { border-bottom: 1px solid var(--line); }
.tree label { display: flex; align-items: center; gap: 12px; padding: 10px 6px; cursor: pointer; }
.tree label:hover { background: var(--hover); }
.tree input { width: 15px; height: 15px; margin: 0; accent-color: var(--navy); flex: none; }
.tree .name { font-family: var(--mono); font-size: 13px; }
.tree .folder .name::after { content: "/"; color: var(--muted); }
.tree .size { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tree .implied { opacity: 0.55; }

.actions, .ending { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 20px; margin-top: 24px; }
.ending { margin-top: 0; }
.ending .hint { margin: 0; flex: 1 1 260px; }

/* ---- Buttons and links ---- */

button, a.button {
  display: inline-block;
  padding: 15px 27px;
  font: 11px/1.2 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
button:hover, a.button:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
button:disabled { opacity: 0.45; cursor: wait; }
button.quiet { color: var(--stop); background: transparent; border-color: var(--stop); }
button.quiet:hover, button.quiet.armed { color: #fff; background: var(--stop); }
button.small { padding: 10px 18px; }
button.link, a.go, a.back {
  padding: 0;
  font: 11px var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--navy);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--gold);
}
button.link:hover, a.go:hover, a.back:hover { color: var(--gold-text); background: none; }
button.link.danger { color: var(--stop); border-color: var(--stop); }
button.link.danger.armed { color: #fff; background: var(--stop); padding: 2px 6px; }
a.back { border: 0; }
a.back::before { content: "← "; }
.hint a, .facts dd a, .status a { color: var(--navy); text-decoration-color: var(--gold); text-underline-offset: 3px; }

.tabs { display: flex; gap: 0; margin: 0 0 22px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 10px 18px;
  color: var(--soft);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--navy); background: var(--hover); border-color: transparent; border-bottom-color: var(--line); }
.tab[aria-pressed="true"] { color: var(--navy); border-bottom-color: var(--navy); }

.status { margin: 0; font-size: 13px; color: var(--soft); }
.status.bad { color: var(--stop); }
.status.good { color: var(--ok); }

/* ---- Lists and tables ---- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  padding: 0 12px 10px 0;
  text-align: left;
  font: 700 10px/1.5 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #596b7c;
  border-bottom: 2px solid var(--navy);
  white-space: nowrap;
}
td { padding: 13px 12px 13px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.linked, li.linked { cursor: pointer; }
tr.linked:hover td, li.linked:hover { background: var(--hover); }
tr.linked:focus-visible, li.linked:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.list td:first-child { font: 16px/1.35 var(--serif); }
.empty { margin: 4px 0 0; color: var(--muted); font: italic 16px var(--serif); }
.more { margin: 18px 0 0; }
.row-actions { display: flex; align-items: baseline; justify-content: flex-end; flex-wrap: wrap; gap: 18px; white-space: nowrap; }
.list td.mono { font: 13px/1.4 var(--mono); }
.nowrap { white-space: nowrap; }
.hint + .table-wrap, .status + .table-wrap, .empty + .table-wrap, .hint + .files-and-editor, .hint + .empty { margin-top: 18px; }
.table-wrap + .status { margin-top: 12px; }

.state { display: inline-block; font: 10px var(--sans); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.state.open { color: var(--ok); }
.state.open::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
.state.waiting { color: var(--gold-text); }
.state.good { color: var(--ok); }
.state.ended { color: var(--muted); }
.state.failed { color: var(--stop); }
.time-left { font-size: 13px; color: var(--soft); white-space: nowrap; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px 28px; margin: 0 0 26px; }
.facts div { border-top: 1px solid var(--line); padding-top: 10px; }
.facts dt { font: 700 10px/1.6 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: #596b7c; }
.facts dd { margin: 4px 0 0; font-size: 14px; overflow-wrap: anywhere; }

.plain-list { list-style: none; margin: 0 0 6px; padding: 0; border-top: 1px solid var(--line); }
.plain-list li { display: flex; align-items: baseline; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.inline-form input { flex: 1 1 200px; width: auto; padding: 10px 12px; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.small-caps { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---- Home ---- */

.checklist { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.checklist li { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.checklist li:first-child { border-top: 1px solid var(--line); }
.checklist .tick { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; font-size: 12px; color: var(--ok); }
.checklist li.done .tick { background: #eef5f0; border-color: var(--ok); }
.checklist li.done strong { color: var(--muted); font-weight: 400; }
.checklist .hint { margin: 2px 0 0; }

.inbox { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.inbox li { display: grid; grid-template-columns: 84px 1fr auto; align-items: baseline; gap: 16px; padding: 14px 8px; border-bottom: 1px solid var(--line); }
.inbox .what { font: 17px/1.35 var(--serif); overflow-wrap: anywhere; }
.inbox .muted { font-size: 12px; white-space: nowrap; }
.kind { font: 10px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-text); }
.kind.warn { color: var(--stop); }

/* ---- Open a room ---- */

.steps { list-style: none; margin: 0; padding: 0; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 18px; padding: 0 0 26px; margin: 0 0 26px; border-bottom: 1px solid var(--line); }
.step-num { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; font: italic 18px var(--serif); color: var(--gold-text); }
.step h2 { margin: 4px 0 16px; font-size: 22px; }
.step .field { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--soft); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--navy); }

/* ---- A room ---- */

.files-and-editor { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 22px; }
.files { border-top: 2px solid var(--navy); min-width: 0; }
.files-head, .editor-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; }
.file-list { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; border-top: 1px solid var(--line); }
.file-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.file-list li:hover { background: var(--hover); }
.file-list li.current { background: var(--selected); }
.file-list .name { font: 12.5px/1.4 var(--mono); overflow-wrap: anywhere; }
.file-list .size { font-size: 11px; color: var(--muted); white-space: nowrap; }
.new-file { display: flex; gap: 8px; margin-top: 12px; }
.new-file input { padding: 10px 12px; font: 12.5px var(--mono); }
.editor { border-top: 2px solid var(--navy); min-width: 0; display: flex; flex-direction: column; }
.editor-path { font: 12.5px var(--mono); overflow-wrap: anywhere; }
.editor-state { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-text); white-space: nowrap; }
#editor {
  min-height: 440px;
  padding: 16px 18px;
  font: 13px/1.6 var(--mono);
  resize: vertical;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}
#editor:disabled { color: var(--muted); background: var(--hover); }
.editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.editor > .status { margin-top: 10px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 28px;
  padding: 26px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.topbar-task { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px 20px; min-width: 0; }
.topbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; }
.topbar h1 { font-size: clamp(24px, 2.6vw, 32px); }
.handin { margin: 0 0 22px; padding: 22px; border: 1px solid var(--gold); background: #fffdf8; }
.welcome { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 28px; margin: 0 0 22px; padding: 18px 22px; border: 1px solid var(--gold); background: #fffdf8; }
.welcome p { margin: 0; max-width: 820px; }
.handin .hint { margin: 0 0 12px; }
.console { margin-top: 26px; padding-top: 18px; border-top: 2px solid var(--navy); }
.run { display: flex; gap: 12px; margin-top: 8px; }

.output { margin-top: 18px; background: var(--deep); color: #ece6da; border: 1px solid #1f3348; }
.output-head {
  margin: 0;
  padding: 12px 18px;
  font: 10px var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-light);
  border-bottom: 1px solid #1f3348;
}
.output pre {
  margin: 0;
  padding: 16px 18px;
  max-height: 420px;
  overflow: auto;
  font: 12.5px/1.55 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}
.output pre:empty { display: none; }
.output .stderr { color: #e3a79c; border-top: 1px solid #1f3348; }

details.fold > summary { display: flex; align-items: baseline; gap: 16px; cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary::after { content: "Show"; margin-left: auto; font: 11px var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--navy); border-bottom: 1px solid var(--gold); }
details.fold[open] > summary::after { content: "Hide"; }
details.fold[open] > summary { margin-bottom: 20px; }
.chain { margin: 0 0 16px; font-size: 13px; }
.chain.good { color: var(--ok); }
.chain.bad { color: var(--stop); font-weight: 600; }
.entries td:nth-child(1), .entries td:nth-child(2) { white-space: nowrap; color: var(--muted); }
.entries td:nth-child(3) { white-space: nowrap; }
.entries td:nth-child(4), .entries td:nth-child(5) { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.entries td:nth-child(4) { min-width: 200px; }

/* The person working in a room gets the whole width and a slimmer header. */
body.workspace-mode main { max-width: 1440px; }
body.workspace-mode .utility { display: none; }
body.workspace-mode .masthead { min-height: 0; padding-top: 14px; padding-bottom: 14px; }
body.workspace-mode .masthead .brand { font-size: 30px; }
body.workspace-mode .masthead .motto { visibility: hidden; }
body.workspace-mode .mainnav { padding: 10px 35px; }

/* ---- Reviews ---- */

.decide { border-top-color: var(--gold); }
.decide h2 { font-size: 22px; }
.file-index { list-style: none; margin: 0 0 8px; padding: 0; }
.file-index li { display: flex; align-items: baseline; gap: 14px; padding: 6px 0; }
.file-index .link { font: 12.5px var(--mono); letter-spacing: 0; text-transform: none; }
.change { font: 10px var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-text); }
.change.deleted { color: var(--stop); }
.change.added { color: var(--ok); }
.change.runs { color: var(--stop); }
.decide .tick { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; font-size: 14px; line-height: 1.5; }
.decide .tick input { flex: none; width: 15px; height: 15px; margin: 4px 0 0; padding: 0; accent-color: var(--navy); }
.diff { margin: 22px 0 0; border: 1px solid var(--line); scroll-margin-top: 20px; }
.diff-head { display: flex; align-items: baseline; gap: 14px; padding: 10px 14px; background: var(--hover); border-bottom: 1px solid var(--line); }
.diff > p { margin: 0; padding: 12px 14px; }
.diff-table { width: 100%; border-collapse: collapse; font: 12.5px/1.5 var(--mono); }
.diff-table td { padding: 1px 10px; border: 0; vertical-align: top; }
.diff-table td.num { width: 1%; color: var(--muted); text-align: right; user-select: none; white-space: nowrap; }
.diff-table td.code { white-space: pre-wrap; word-break: break-word; }
.diff-table tr.added td { background: #e8f3ec; }
.diff-table tr.removed td { background: #f8e9e9; }
.diff-table tr.gap td { color: var(--muted); text-align: center; background: var(--hover); }

/* ---- Footer (as on Mooselen) ---- */

.site-footer { background: var(--deep); color: #e7e7e2; padding: 40px 35px; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  max-width: 1080px;
  margin: auto;
  font: 10px var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b3bbc1;
}
.footer-brand { font: 28px var(--serif); letter-spacing: 0.12em; text-transform: none; text-decoration: none; color: var(--cream); }
.footer-brand:hover { color: #dfc18a; }

/* ---- Setup guide ---- */

.guide { margin: 12px 0 0; padding-left: 22px; font-size: 14px; line-height: 1.6; }
.guide li { margin-bottom: 6px; }

.spaced { margin-top: 16px; }

/* ---- Left out of a hand-in ---- */

.left-out { list-style: none; margin: 0; padding: 0; }
.left-out li { display: flex; gap: 18px; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.left-out li .muted { font-size: 13px; text-align: right; }
.left-out li .mono { overflow-wrap: anywhere; }

/* ---- Sign in ---- */

.signin { max-width: 520px; margin: 0 auto; padding: 64px 0 40px; }
.signin h1 { margin-bottom: 0; }
.signin .lede { margin-bottom: 30px; }
.signin-form { display: flex; flex-direction: column; gap: 4px; }
.signin-form .field { flex: none; margin-bottom: 14px; }
.signin-form button[type="submit"] { align-self: flex-start; }
.signin-form .hint { margin: 0 0 14px; font-size: 13px; }
.signin-form .hint .link { font-size: 11px; }
.signin #code { font: 22px/1 var(--mono); letter-spacing: 0.35em; }
.signin > .status { margin-top: 18px; }
.signin-page .masthead .brand { cursor: default; }

@media (max-width: 900px) {
  .masthead { grid-template-columns: 1fr; min-height: 110px; gap: 14px; text-align: center; }
  .masthead .motto { display: none; }
  .masthead .right { justify-content: center; }
  .utility { padding: 11px 18px; }
  .utility span:nth-child(2) { display: none; }
  .files-and-editor { grid-template-columns: 1fr; }
  .inbox li { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 640px) {
  .run { flex-direction: column; }
  .page-head { padding-top: 34px; }
  .mainnav { gap: 12px 17px; padding: 14px 12px; }
  .step { grid-template-columns: 1fr; }
  .checklist li { grid-template-columns: 30px 1fr; }
  .checklist li > :last-child { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
