:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel2: #1f2330;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --green: #2ecc71;
  --red: #ff5c5c;
  --gold: #f1c40f;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 880px; margin: 1.5rem auto 3rem; padding: 0 1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); background: var(--panel2); padding: .1em .35em; border-radius: 4px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 1.2rem; background: var(--panel); border-bottom: 1px solid #262b38;
}
.brand { font-weight: 800; font-size: 1.25rem; color: var(--text); }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 1rem; align-items: center; }
.whoami { color: var(--muted); }
.inline { display: inline; }
.linklike {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font: inherit; padding: 0;
}
.linklike:hover { text-decoration: underline; }

footer { text-align: center; color: var(--muted); padding: 2rem 0; font-size: .85rem; }

.flash {
  background: var(--panel2); border-left: 4px solid var(--accent);
  padding: .6rem 1rem; margin: 0 0 1rem; border-radius: 6px;
  overflow-wrap: anywhere;
}

.card { background: var(--panel); border: 1px solid #262b38; border-radius: 10px; padding: 1.2rem; }
.narrow { max-width: 420px; margin: 3rem auto; }
label { display: block; margin: .8rem 0; color: var(--muted); font-size: .9rem; }
input {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .7rem;
  background: var(--panel2); color: var(--text);
  border: 1px solid #2c3242; border-radius: 6px; font-size: 1rem;
}
button.primary {
  background: var(--accent); color: white; border: none; border-radius: 6px;
  padding: .55rem 1.1rem; font-size: 1rem; cursor: pointer; margin-top: .5rem;
}
button.primary:hover { filter: brightness(1.1); }
a.primary {
  display: inline-block; background: var(--accent); color: white; text-decoration: none;
  border-radius: 6px; padding: .55rem 1.1rem; font-size: 1rem; margin-top: .5rem;
}
a.primary:hover { filter: brightness(1.1); text-decoration: none; }

/* setup / onboarding page */
.setup .card { margin-top: 1rem; }
.setup .card:first-of-type { margin-top: 0; }
.setup .card h2 { margin-top: 0; font-size: 1.1rem; }
.setup ol { padding-left: 1.2rem; }
.setup li { margin: .3rem 0; }

.world h2 { margin: 1.6rem 0 .6rem; }
details.level {
  background: var(--panel); border: 1px solid #262b38; border-radius: 10px;
  margin: .5rem 0; overflow: hidden;
}
details.level[open] { border-color: #34405c; }
details.level.locked { opacity: .6; }
details.level summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 1rem; cursor: pointer; list-style: none;
}
details.level summary::-webkit-details-marker { display: none; }
.lvlname { font-weight: 650; }
.badges { display: flex; gap: .4rem; }
.badge { font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; background: var(--panel2); }
.badge.pass { color: var(--green); border: 1px solid var(--green); }
.badge.sel { color: var(--accent); border: 1px solid var(--accent); }
.badge.lock { color: var(--muted); }
.badge.pct { color: var(--gold); }
.levelbody { padding: 0 1rem 1rem; border-top: 1px solid #262b38; }

.muted { color: var(--muted); }
pre.output {
  background: #0b0d11; border: 1px solid #262b38; border-radius: 8px;
  padding: .8rem 1rem; overflow-x: auto; font-family: var(--mono);
  font-size: .82rem; max-height: 420px; overflow-y: auto; white-space: pre-wrap;
}

.statusline { font-size: 1.1rem; margin-bottom: 1rem; }
.statusline.allpass { border-left: 4px solid var(--green); }
.statusline.somefail { border-left: 4px solid var(--gold); }

table.tests { width: 100%; border-collapse: collapse; margin: 1rem 0; }
table.tests th, table.tests td {
  text-align: left; padding: .45rem .6rem; border-bottom: 1px solid #262b38;
  font-size: .9rem; vertical-align: top;
}
table.tests tr.pass td:first-child { color: var(--green); }
table.tests tr.fail td:first-child { color: var(--red); }
table.tests td:last-child { color: var(--muted); overflow-wrap: anywhere; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; }
.stat { text-align: center; color: var(--muted); padding: .8rem; }
.stat .big { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.inlineform { display: flex; gap: .6rem; align-items: center; margin: .6rem 0 1.2rem; }
.inlineform input { width: auto; margin: 0; }
.inlineform button { margin: 0; }
