/* Foundations of Computational Economics: one stylesheet for every page. */
:root {
  --ink: #1d2433;
  --ink-soft: #5a6375;
  --paper: #f7f5f0;
  --card: #ffffff;
  --line: #e2ddd2;
  --brand: #0f5c63;        /* deep teal */
  --brand-soft: #e3f0ef;
  --accent: #e08a1e;       /* saffron, used sparingly */
  --good: #23824a;
  --bad: #b3352b;
  --radius: 10px;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; }
code { font-family: var(--mono); background: var(--brand-soft); padding: 0 4px; border-radius: 4px; font-size: 0.92em; }

/* Layout */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--brand); color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .title { font-weight: 650; }
.topbar .spacer { flex: 1; }
.topbar .xp { background: rgba(255,255,255,.15); padding: 2px 10px; border-radius: 99px; font-size: .9em; }
.topbar button { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; }
main.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.narrow { width: min(440px, 100%); }
.grid { display: grid; gap: 16px; }
.grid.units { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.with-side { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .with-side { grid-template-columns: 1fr; } }

/* Forms and buttons */
label { display: block; font-size: .9em; color: var(--ink-soft); margin: 12px 0 4px; }
input, textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
textarea { font-family: var(--mono); font-size: .9em; }
button, .btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; cursor: pointer; text-decoration: none;
}
button.secondary, .btn.secondary { background: #fff; color: var(--brand); }
button:disabled { opacity: .55; cursor: wait; }
form button { margin-top: 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { flex: 1; background: #fff; color: var(--brand); }
.tabs button.active { background: var(--brand); color: #fff; }
.notice { background: var(--brand-soft); padding: 10px 12px; border-radius: 8px; }
.error { color: var(--bad); min-height: 1.4em; }
.muted { color: var(--ink-soft); }

/* Dashboard */
.unit-card h3 { margin: 0 0 4px; }
.unit-card .meta { font-size: .85em; color: var(--ink-soft); }
.unit-card ul { list-style: none; padding: 0; margin: 12px 0 0; }
.unit-card li { padding: 6px 0; border-top: 1px dashed var(--line); }
.unit-card li a { text-decoration: none; }
.tick { display: inline-block; width: 1.4em; color: var(--good); font-weight: 700; }
.tag { font-size: .75em; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); font-weight: 650; margin-left: 6px; }
.leader ol { padding-left: 1.4em; margin: 8px 0; }
.leader li.me { font-weight: 650; color: var(--brand); }

/* Exercise page */
.exercise { display: grid; grid-template-columns: minmax(300px, 0.9fr) 1.1fr; gap: 20px; align-items: start; }
@media (max-width: 960px) { .exercise { grid-template-columns: 1fr; } }
.prompt table { border-collapse: collapse; margin: 8px 0; font-size: .92em; }
.prompt th, .prompt td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }
.editor-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.CodeMirror { height: 360px; font-family: var(--mono); font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #fbfaf7; }
.toolbar .status { margin-left: auto; align-self: center; font-size: .85em; color: var(--ink-soft); }
.output { margin-top: 14px; }
.output pre { background: #1d2433; color: #e8ecf3; padding: 12px; border-radius: 8px; overflow: auto; max-height: 300px; font-size: 13px; }
.output .err { background: #fdecea; color: var(--bad); padding: 10px 12px; border-radius: 8px; }
.output img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; }
.results { list-style: none; padding: 0; }
.results li { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; background: #fff; border: 1px solid var(--line); }
.results li.pass { border-left: 4px solid var(--good); }
.results li.fail { border-left: 4px solid var(--bad); }
.results .msg { display: block; font-size: .88em; color: var(--ink-soft); }
.hintbox { background: #fff7ea; border: 1px solid #f1d6a8; border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; background: var(--good); color: #fff;
  padding: 10px 16px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.15);
}

/* Market Maker game */
.game { max-width: 760px; }
.bars { display: grid; grid-template-columns: 110px 1fr 60px; gap: 8px 12px; align-items: center; margin: 18px 0; }
.bar { height: 26px; border-radius: 6px; transition: width .35s; }
.bar.demand { background: var(--brand); }
.bar.supply { background: var(--accent); }
.verdict { font-weight: 600; min-height: 1.5em; }
.rounds { font-size: .9em; color: var(--ink-soft); }
input[type=range] { padding: 0; }

/* Faculty page */
table.data { border-collapse: collapse; width: 100%; font-size: .9em; background: #fff; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
table.data th { background: #fbfaf7; }
