:root {
  color-scheme: dark;
  --bg: #020617;
  --panel: #08111f;
  --panel-2: #0c1728;
  --line: rgba(148, 163, 184, 0.18);
  --text: #f8fafc;
  --muted: #94a3b8;
  --blue: #3b82f6;
  --yellow: #facc15;
  --red: #ef4444;
  --green: #22c55e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.12;
}

h3 {
  font-size: 18px;
  line-height: 1.3;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--blue);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.subtitle,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: clamp(20px, 4vw, 36px);
}

.stack {
  display: grid;
  gap: 22px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.login {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #030816;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
}

button {
  min-height: 46px;
  border: 0;
  cursor: pointer;
  padding: 0 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 800;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

.primary {
  background: var(--blue);
  color: white;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.small {
  min-height: 32px;
  margin-left: 12px;
  padding: 0 10px;
  font-size: 10px;
}

.notice {
  border: 1px solid rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.08);
  padding: 16px;
  line-height: 1.5;
}

.hidden {
  display: none;
}

.error {
  color: var(--red);
  min-height: 20px;
}

.admin-head,
.row,
.row-head,
.row-actions,
.question-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-head,
.row,
.question-top {
  justify-content: space-between;
}

.list {
  display: grid;
  gap: 12px;
}

.row {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 16px;
}

.archived-row {
  opacity: 0.72;
}

.row > div:first-child {
  min-width: 0;
}

.link {
  display: block;
  margin-top: 8px;
  color: var(--blue);
  overflow-wrap: anywhere;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.icon-button.liked {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
  color: #fb7185;
}

.empty-state {
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 16px;
  line-height: 1.45;
}

.attempt-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 8px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.badge.ok {
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--green);
}

.badge.warn {
  border-color: rgba(250, 204, 21, 0.45);
  color: var(--yellow);
}

.answer-card,
.contact-box,
.test-card,
.question-bank-item {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 18px;
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

.answer-grid > div {
  border: 1px solid var(--line);
  padding: 14px;
}

.timer {
  display: grid;
  place-items: center;
  min-width: 64px;
  height: 64px;
  border: 1px solid var(--blue);
  color: var(--blue);
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer.danger {
  border-color: var(--red);
  color: var(--red);
}

.test-card {
  display: grid;
  gap: 22px;
}

.question-bank {
  display: grid;
  gap: 12px;
}

.question-bank.hidden {
  display: none;
}

.question-bank-item.disabled {
  opacity: 0.58;
}

.question-item-head,
.question-controls,
.question-actions,
.form-actions,
.inline-check {
  display: flex;
  align-items: center;
  gap: 12px;
}

.question-item-head {
  justify-content: space-between;
}

.question-controls,
.question-actions,
.form-actions {
  flex-wrap: wrap;
}

.inline-check {
  cursor: pointer;
}

.inline-check input {
  width: auto;
  accent-color: var(--blue);
}

.inline-check span {
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.question-form {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.08);
  padding: 18px;
}

.option-editors {
  display: grid;
  gap: 10px;
}

.option-editor {
  display: grid;
  grid-template-columns: auto 96px 1fr;
  align-items: center;
  gap: 10px;
}

.option-editor input[type="radio"] {
  width: auto;
  accent-color: var(--green);
}

.danger-button {
  border: 1px solid rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

.option-list {
  margin: 14px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.45;
}

.option-list li {
  margin: 6px 0;
}

.option-list .correct {
  color: var(--green);
  font-weight: 700;
}

.choice-list {
  display: grid;
  gap: 12px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  background: #030816;
  padding: 14px;
  cursor: pointer;
  line-height: 1.35;
}

.choice:hover {
  border-color: rgba(59, 130, 246, 0.75);
}

.choice input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--blue);
}

.choice span {
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}

.result-ok {
  color: var(--green);
  font-weight: 700;
}

.result-bad {
  color: var(--red);
  font-weight: 700;
}

@media (max-width: 760px) {
  .grid-form,
  .answer-grid {
    grid-template-columns: 1fr;
  }

  .row,
  .admin-head,
  .question-top,
  .question-item-head,
  .question-controls,
  .question-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .option-editor input[type="text"],
  .option-editor input:not([type]) {
    grid-column: 1 / -1;
  }

  .row-actions {
    width: 100%;
  }

  .row-actions button {
    flex: 1;
  }
}
