:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --ink: #101522;
  --soft: #485366;
  --muted: #738095;
  --line: #d9e0ea;
  --line-strong: #c1ccda;
  --blue: #235fd6;
  --blue-2: #1746a2;
  --green: #177a55;
  --gold: #a86d00;
  --red: #b42318;
  --shadow: 0 14px 34px rgba(31, 42, 68, 0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    linear-gradient(180deg, #eef3fb 0, #f6f7fb 260px),
    var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { max-width: 1180px; margin: 0 auto; padding: 18px 18px 56px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 8px 0 18px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  width: 40px; height: 40px; border-radius: 8px; background: #101522; color: #fff;
  display: grid; place-items: center; font-weight: 900; letter-spacing: 0;
}
.brand h1 { margin: 0; font-size: 21px; line-height: 1.1; letter-spacing: 0; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav button, .button {
  min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: rgba(255,255,255,.82); color: var(--soft);
  border-radius: 7px; padding: 8px 12px; font: inherit; font-size: 14px; font-weight: 750;
  cursor: pointer; text-decoration: none;
}
.nav a.active, .button.primary {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.button.primary:hover { background: var(--blue-2); }
.button.secondary { background: var(--surface); color: var(--ink); }
.button.danger { background: #fff5f4; color: var(--red); border-color: #f1b8b3; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr); align-items: start; }
.grid.admin { grid-template-columns: minmax(280px, .8fr) minmax(0, 1.35fr); align-items: start; }
.card {
  background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 18px;
}
.card.tight { padding: 14px; }
.section-title { margin: 0 0 4px; font-size: 24px; letter-spacing: 0; }
.kicker {
  display: inline-flex; align-items: center; gap: 7px; color: var(--blue);
  font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase;
}
.lead { color: var(--soft); margin: 8px 0 0; max-width: 760px; }
.muted { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.stat {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px;
  padding: 12px; min-height: 74px;
}
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }
.list { display: grid; gap: 10px; margin-top: 12px; }
.item {
  display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 10px; align-items: start;
  padding: 11px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
}
.num {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: #e7eefc; color: var(--blue); font-weight: 900; font-size: 13px;
}
.item b { display: block; }
.item span { color: var(--muted); font-size: 14px; }
label { display: block; margin: 13px 0 6px; color: var(--soft); font-size: 13px; font-weight: 800; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 7px;
  background: #fff; color: var(--ink); padding: 11px 12px; font: inherit; font-size: 15px;
}
textarea { min-height: 190px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(35,95,214,.18); border-color: var(--blue); }
.field-row { display: flex; gap: 10px; align-items: center; }
.field-row input { flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pill {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px;
  background: #eef3ff; color: var(--blue); font-size: 12px; font-weight: 850;
}
.answer {
  min-height: 430px; max-height: 72vh; overflow: auto; white-space: pre-wrap;
  background: #fbfcff; border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; font-size: 15px;
}
.memory, .notice {
  background: #f7f9fd; border: 1px solid var(--line); border-radius: 8px;
  padding: 11px; color: var(--soft); font-size: 14px;
}
.preview { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; display: none; }
.choice {
  width: 100%; text-align: left; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer;
}
.choice:hover { border-color: var(--blue); }
.choice.right { border-color: #78c7a9; background: #f0fbf6; }
.choice.wrong { border-color: #efa5a0; background: #fff5f4; }
.work { white-space: pre-wrap; background: #fbfcff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 12px; }
.good { color: var(--green); }
.bad { color: var(--red); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border-top: 1px solid var(--line); padding: 9px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
pre { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; }
.admin-token { display: flex; gap: 8px; }
@media (max-width: 900px) {
  .topbar { display: block; }
  .nav { justify-content: flex-start; margin-top: 14px; }
  .grid.two, .grid.admin { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .answer { min-height: 260px; max-height: none; }
}
@media (max-width: 520px) {
  .shell { padding: 14px 12px 44px; }
  .stats { grid-template-columns: 1fr; }
  .field-row, .admin-token { display: grid; }
  .nav a, .nav button { flex: 1; }
}
