:root {
  --bg: #f2f5fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #1c2433;
  --muted: #657084;
  --line: #dfe5ef;
  --line-strong: #c8d2e1;
  --primary: #2458d6;
  --primary-dark: #1b43a8;
  --primary-soft: #e8efff;
  --teal: #0f8f7e;
  --green: #1f8a53;
  --green-soft: #e4f6ec;
  --amber: #a96500;
  --amber-soft: #fff2d9;
  --red: #bb2d3b;
  --red-soft: #fde8ea;
  --blue-soft: #e5efff;
  --shadow: 0 8px 28px rgba(28, 36, 51, 0.07);
  --shadow-soft: 0 2px 8px rgba(28, 36, 51, 0.05);
  --radius: 14px;
  --radius-small: 9px;
  --mono: "DejaVu Sans Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "TeX Gyre Heros", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.55rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
}

p {
  margin: 0 0 0.85rem;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.9em;
}

code {
  background: #eef2f8;
  border: 1px solid #e1e7f1;
  border-radius: 5px;
  padding: 0.08em 0.32em;
  color: #27364f;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 1.6rem auto 2.2rem;
  flex: 1;
}

.container-wide {
  width: min(1420px, calc(100% - 2rem));
  margin: 1.6rem auto 2.2rem;
  flex: 1;
}

/* ------------------------------------------------------------- Topbar */

.topbar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
}

.topbar-inner {
  width: min(1420px, calc(100% - 2rem));
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2458d6, #0f8f7e);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(36, 88, 214, 0.28);
}

.brand-mark-large {
  width: 52px;
  height: 52px;
  font-size: 1.05rem;
  border-radius: 14px;
}

.brand-text {
  font-size: 1rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.18rem;
  flex: 1;
  flex-wrap: wrap;
}

.nav-link {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.nav-link:hover {
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.user-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: auto;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.user-name {
  font-weight: 650;
  font-size: 0.9rem;
}

.user-role {
  font-size: 0.74rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.56rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: var(--panel-soft);
  border-color: #aebbd0;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.btn-danger {
  background: #fff;
  color: var(--red);
  border-color: #f0bdc4;
}

.btn-danger:hover {
  background: var(--red-soft);
}

.btn-small {
  padding: 0.35rem 0.62rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.button-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------- Panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
}

.page-head h1 {
  margin-bottom: 0.2rem;
}

.page-subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 0.92rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.35rem;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0.45rem;
}

.back-link:hover {
  color: var(--primary);
}

.flash {
  border-radius: var(--radius-small);
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.flash-ok {
  background: var(--green-soft);
  border-color: #bfe8cd;
  color: #145d39;
}

.flash-error {
  background: var(--red-soft);
  border-color: #f3c4c9;
  color: #8d1e29;
}

.flash-info {
  background: var(--blue-soft);
  border-color: #c6d9ff;
  color: #1c4699;
}

.empty-state {
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 2rem 1.2rem;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.error-state .btn {
  margin-top: 0.8rem;
}

/* ------------------------------------------------------------- Login */

.login-body {
  background:
    radial-gradient(circle at 12% 18%, rgba(36, 88, 214, 0.14), transparent 32%),
    radial-gradient(circle at 88% 82%, rgba(15, 143, 126, 0.13), transparent 30%),
    var(--bg);
}

.login-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0 4rem;
}

.login-card {
  width: min(430px, 100%);
  padding: 2rem;
}

.login-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.login-head h1 {
  font-size: 1.5rem;
  margin-bottom: 0;
}

.login-head p {
  margin: 0;
}

.login-hint {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

/* ------------------------------------------------------------- Forms */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  font-size: 0.86rem;
  font-weight: 650;
  color: #33405a;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  font: inherit;
  font-weight: 400;
  font-size: 0.92rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 3rem;
}

textarea.mono,
input.mono {
  font-family: var(--mono);
  font-size: 0.86rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 88, 214, 0.14);
}

input[disabled] {
  background: var(--panel-soft);
  color: var(--muted);
}

.check-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

input[type="checkbox"] {
  width: 1.02rem;
  height: 1.02rem;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

.form-section {
  border-top: 1px solid var(--line);
  margin-top: 1.1rem;
  padding-top: 1rem;
}

.form-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
}

.form-section-head h2,
.form-section h2 {
  margin-bottom: 0.45rem;
}

.input-with-button {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.input-with-button input {
  flex: 1;
}

.question-form > label,
.question-form > .form-section,
.question-form > .form-grid,
.test-form > label {
  margin-bottom: 0.9rem;
}

.option-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.6rem;
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem;
}

.option-row .check-inline {
  white-space: nowrap;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.8rem;
}

.filter-bar input[type="search"] {
  flex: 1 1 220px;
  width: auto;
}

.filter-bar select {
  width: auto;
  min-width: 160px;
}

/* ------------------------------------------------------------- Tables */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.89rem;
}

.table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: var(--muted);
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 0.68rem 0.7rem;
  border-bottom: 1px solid #edf1f7;
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #fbfcfe;
}

.row-error {
  background: var(--red-soft);
}

.question-excerpt {
  max-width: 420px;
  color: #3d4a61;
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  justify-content: flex-end;
}

.actions-cell form {
  display: inline-flex;
}

/* ------------------------------------------------------------- Badges */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.16rem 0.55rem;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-gray {
  background: #eef1f6;
  color: #58647a;
}

.badge-blue {
  background: var(--blue-soft);
  color: #1c4699;
}

.badge-green {
  background: var(--green-soft);
  color: #14623b;
}

.badge-amber {
  background: var(--amber-soft);
  color: #8a5300;
}

.badge-red {
  background: var(--red-soft);
  color: #981f2b;
}

.badge-score {
  margin-left: 0.25rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text);
}

.category-chip {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  background: #f0f3f9;
  color: #58647a;
  font-size: 0.73rem;
  font-weight: 600;
}

.category-none {
  background: #f4f1ea;
  color: #7a6a4d;
}

.points-chip {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
}

/* ------------------------------------------------------------- Stats */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  box-shadow: var(--shadow-soft);
}

a.stat-card:hover {
  border-color: #b9c8e0;
  text-decoration: none;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.stat-label {
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 600;
}

/* ------------------------------------------------------------- Tests */

.test-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 0.8rem;
}

.test-card-main p:last-of-type {
  margin-bottom: 0.45rem;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.83rem;
}

.test-card-action {
  flex: 0 0 auto;
}

/* ------------------------------------------------------------- Testdurchführung */

.test-page {
  background: #eef2f8;
}

.test-page .container-wide {
  width: min(1480px, calc(100% - 1.6rem));
  margin-top: 1.2rem;
}

.test-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}

.test-sidebar-inner {
  position: sticky;
  top: 82px;
  padding: 1.05rem;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.test-sidebar h1 {
  font-size: 1.12rem;
  margin-bottom: 0.3rem;
}

.test-sidebar .btn-block {
  margin-top: 0.9rem;
}

.question-nav {
  margin-top: 1rem;
}

.question-nav h2 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.question-nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.32rem;
}

.question-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: #4b5870;
  font-size: 0.8rem;
  font-weight: 700;
}

.question-nav a:hover {
  border-color: #aab9d2;
  text-decoration: none;
}

.question-nav a.is-current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.question-nav a.is-done:not(.is-current) {
  background: var(--green-soft);
  border-color: #bfe5cf;
  color: #14623b;
}

.nav-state {
  display: none;
}

.test-legend {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
}

.dot-current {
  background: var(--primary);
}

.dot-done {
  background: var(--green);
}

.test-main {
  min-width: 0;
}

.test-mobile-head {
  display: none;
}

.question-stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.question-card {
  padding: 1.4rem 1.5rem;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.question-head-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.question-number {
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
}

.question-text {
  font-size: 1.02rem;
  color: #263247;
}

.question-text strong {
  color: var(--text);
}

.code-block {
  margin: 0.85rem 0 1rem;
  padding: 0.9rem 1rem;
  background: #1c2433;
  color: #e7ecf5;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.5;
  border: 1px solid #111827;
}

.code-block code {
  white-space: pre;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.question-type-hint {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.55rem;
}

.answer-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.answer-option {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.65rem;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-weight: 500;
  font-size: 0.94rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.answer-option:hover {
  border-color: #b9c8e0;
  background: #f5f8fd;
}

.answer-option:has(input:checked) {
  border-color: #9fb8ea;
  background: #f2f6ff;
}

.answer-option input {
  margin-top: 0.18rem;
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.answer-text {
  min-height: 120px;
}

.question-hint {
  margin-top: 1rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.7rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.question-hint summary {
  cursor: pointer;
  font-weight: 650;
}

.hint-body {
  margin-top: 0.45rem;
}

.test-actions {
  position: sticky;
  bottom: 0.8rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.8rem;
  box-shadow: var(--shadow);
}

.test-actions-center {
  flex: 1;
  text-align: center;
}

/* ------------------------------------------------------------- Ergebnis */

.result-summary {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.result-score {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.result-max {
  color: var(--muted);
  font-weight: 600;
}

.result-answer {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.7rem 0.85rem;
  font-size: 0.92rem;
}

.points-awarded {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
}

.result-question .question-text {
  font-size: 0.95rem;
}

/* ------------------------------------------------------------- Kategorien */

.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0.9rem;
}

.category-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
}

.category-card form {
  margin: 0;
}

.category-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.category-default {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: #fbfaf6;
  border-style: dashed;
}

.category-default p {
  margin: 0;
}

.inline-create {
  margin-bottom: 1.1rem;
}

.danger-zone {
  margin-top: 1rem;
  border-color: #f0c3c8;
  background: #fffafa;
}

.danger-zone h2 {
  color: #8d1e29;
}

/* ------------------------------------------------------------- Testformular */

.test-form-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 1rem;
  margin-top: 1rem;
}

.pick-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  background: var(--panel-soft);
}

.pick-search {
  margin-bottom: 0.6rem;
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.pick-group {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.6rem;
}

.pick-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.1rem 0.25rem 0.45rem;
  border-bottom: 1px solid #edf1f7;
  margin-bottom: 0.35rem;
}

.pick-group-head h3 {
  margin: 0;
  font-size: 0.86rem;
}

.pick-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.42rem 0.3rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.86rem;
  cursor: pointer;
}

.pick-row:hover {
  background: #f7f9fd;
}

.pick-row input {
  margin-top: 0.16rem;
}

.pick-main {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.pick-main > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participants-list {
  max-height: 620px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--line);
  padding: 0.8rem 0;
  margin-bottom: 0;
}

/* ------------------------------------------------------------- Bewertung */

.grade-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  position: sticky;
  top: 76px;
  z-index: 15;
}

.grade-card .question-text {
  font-size: 0.96rem;
}

.grade-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 210px;
  gap: 0.8rem;
  margin-top: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.answer-box {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  min-height: 2.7rem;
  font-size: 0.9rem;
}

.answer-correct {
  background: var(--green-soft);
  border-color: #c5e8d3;
}

.grade-points {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.points-input {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.points-input input {
  width: 84px;
}

.grade-points .btn {
  align-self: flex-start;
}

/* ------------------------------------------------------------- Footer */

.site-footer {
  width: min(1420px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 1.6rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ------------------------------------------------------------- JS / Responsive */

html.js .test-question {
  display: none;
}

html.js .test-question.is-active {
  display: block;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grade-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .grade-points {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding: 0.55rem 0;
    gap: 0.4rem 1rem;
  }

  .main-nav {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
  }

  .nav-link {
    white-space: nowrap;
  }

  .test-layout {
    grid-template-columns: 1fr;
  }

  .test-sidebar-inner {
    position: static;
    max-height: none;
  }

  .question-nav ol {
    grid-template-columns: repeat(10, 1fr);
  }

  .test-mobile-head {
    display: none;
  }

  .test-form-columns {
    grid-template-columns: 1fr;
  }

  .test-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 14px;
  }

  .container,
  .container-wide,
  .test-page .container-wide {
    width: calc(100% - 1rem);
    margin-top: 0.8rem;
  }

  .topbar-inner {
    width: calc(100% - 1rem);
  }

  .brand-text {
    font-size: 0.92rem;
  }

  .user-meta {
    display: none;
  }

  .page-head {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .category-list {
    grid-template-columns: 1fr;
  }

  .question-nav ol {
    grid-template-columns: repeat(6, 1fr);
  }

  .question-card {
    padding: 1rem;
  }

  .test-actions {
    flex-wrap: wrap;
  }

  .test-actions-center {
    order: -1;
    flex-basis: 100%;
  }

  .test-actions .btn {
    flex: 1;
  }

  #submit-test {
    flex-basis: 100%;
  }

  .grade-grid {
    grid-template-columns: 1fr;
  }

  .option-row {
    grid-template-columns: 1fr auto;
  }

  .option-row .option-text {
    grid-column: 1 / -1;
  }

  .actions-cell {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .site-footer {
    flex-direction: column;
    width: calc(100% - 1rem);
  }
}
