:root {
  --bg: #0f1419;
  --fg: #e8eef4;
  --muted: #9aabbc;
  --ok: #3ecf8e;
  --bad: #ff6b6b;
  --line: rgba(255, 255, 255, 0.1);
  --card: #182231;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #1c2a3a, var(--bg));
  color: var(--fg);
}
a { color: #9fd0ff; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(255, 255, 255, 0.06); padding: 0.1rem 0.35rem; border-radius: 4px; }
.muted { color: var(--muted); }
.error { color: #ff8e8e; }
.notice { color: var(--ok); }

.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.page { width: min(860px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.page.narrow { width: min(560px, calc(100% - 2rem)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  width: 100%;
}
.center .card { max-width: 380px; }
.card h1, .card h2 { margin: 0 0 0.75rem; letter-spacing: -0.02em; }
.card h2 { font-size: 1.15rem; }

label { display: block; margin: 0 0 0.9rem; color: var(--muted); font-size: 0.92rem; }
input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%;
  padding: 0.7rem;
  margin-top: 0.3rem;
  border: 1px solid #334;
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
textarea { resize: vertical; }
label.check { display: flex; align-items: center; gap: 0.5rem; }
label.check input { margin: 0; }

button, .btn {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: 8px;
  background: var(--ok);
  color: #062016;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary, button.secondary { background: #2a3a4e; color: var(--fg); }
button.link {
  background: none;
  color: #9fd0ff;
  padding: 0;
  font-weight: 400;
}
button.link:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.topbar h1 { margin: 0; letter-spacing: -0.03em; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }

.timer {
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.timer.low { color: var(--bad); border-color: var(--bad); }

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  color: var(--fg);
  cursor: pointer;
}
.option:hover { border-color: #4a5b70; }
.option input { margin-top: 0.2rem; }
.option:has(input:checked) { border-color: var(--ok); background: rgba(62, 207, 142, 0.08); }

.navrow { display: flex; gap: 0.75rem; margin: 1rem 0; }
.dots { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.dot {
  width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}
.dot.answered { background: rgba(62, 207, 142, 0.15); color: var(--fg); }
.dot.current { border-color: var(--ok); color: var(--ok); }

.optrow { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.optrow input[type="text"] { margin-top: 0; }
.opts { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--muted); }
.opts .correct { color: var(--ok); }
.qhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.qhead span { white-space: nowrap; display: flex; gap: 0.75rem; align-items: center; }

table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.88rem; }

form.inline { display: inline-flex; gap: 0.4rem; align-items: center; }
form.inline input[type="password"] { width: 10rem; margin: 0; padding: 0.4rem 0.6rem; }
form.rowform { display: flex; gap: 0.6rem; flex-wrap: wrap; }
form.rowform input { flex: 1; min-width: 10rem; margin: 0; }

.result { text-align: center; }
.score { font-size: 3rem; font-weight: 800; margin: 0.5rem 0; letter-spacing: -0.03em; }

.btn.danger, button.danger { background: var(--bad); color: #200606; }

.console { background: #0a0e13; border-color: #1e2c3a; }
.console-cmd { color: var(--muted); margin: 0 0 0.5rem; font-family: ui-monospace, Consolas, monospace; }
.console pre {
  margin: 0;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ok);
  white-space: pre-wrap;
  word-break: break-word;
}
.status-table td.done { color: var(--ok); }
.status-table td code { background: none; padding: 0; }

.console-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.copy-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: #2a3a4e;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  white-space: nowrap;
}
.error-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.error-block pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }

.cli { display: flex; align-items: center; gap: 0.6rem; }
.cli-prompt { color: var(--ok); font-family: ui-monospace, Consolas, monospace; font-size: 0.9rem; white-space: nowrap; }
.cli input[type="text"] {
  flex: 1;
  margin: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--fg);
}
.cli input[type="text"]:focus { outline: none; border-bottom-color: var(--ok); }
