:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f8;
  color: #172026;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

main {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0;
}

.quest-main {
  width: min(680px, calc(100% - 32px));
}

.panel,
.quest {
  background: #ffffff;
  border: 1px solid #dbe2e7;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 32, 0.08);
}

.quest {
  padding: 28px;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.1;
}

p {
  line-height: 1.55;
}

.quest-image {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  margin: 18px 0;
  border-radius: 6px;
}

.answer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e4eaee;
}

.field {
  margin-bottom: 16px;
}

.login-main {
  width: min(420px, calc(100% - 32px));
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.answer-row {
  display: flex;
  gap: 10px;
}

input:not([type="checkbox"]),
textarea {
  min-width: 0;
  flex: 1;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #aab7c0;
  border-radius: 6px;
  font: inherit;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
  margin: 0;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #175c4c;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  background: #4e5b64;
}

button.danger,
.button.danger {
  background: #9b2f23;
}

.result {
  min-height: 24px;
  margin: 12px 0 0;
  font-weight: 700;
}

.solved .result {
  color: #175c4c;
}

.wrong .result {
  color: #a33021;
}

.success-content {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #b7d8c7;
  border-radius: 8px;
  background: #eff8f2;
}

.success-content[hidden] {
  display: none;
}

.success-content > :first-child {
  margin-top: 0;
}

.success-content > :last-child {
  margin-bottom: 0;
}

.master-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.master-head p {
  margin: 0;
  color: #51616d;
}

.master-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.logout-form {
  margin: 0;
}

.error {
  color: #a33021;
}

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

.quest-row {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

.quest-row img {
  width: 112px;
  height: 112px;
  image-rendering: pixelated;
}

.quest-row h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.quest-row code {
  overflow-wrap: anywhere;
  color: #51616d;
}

.row-actions,
.editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.editor-panel {
  padding: 18px;
}

.editor-form {
  display: grid;
  gap: 4px;
}

.delete-form {
  margin: 20px 0 0;
  padding-top: 20px;
  border-top: 1px solid #e4eaee;
}

.current-file {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  color: #51616d;
  overflow-wrap: anywhere;
}

.current-file img {
  width: 92px;
  height: 64px;
  object-fit: contain;
  border: 1px solid #dbe2e7;
  border-radius: 6px;
  background: #f5f7f8;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 700;
}

.progress-panel {
  padding: 16px;
  overflow-x: auto;
}

.progress-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.progress-table th,
.progress-table td {
  padding: 10px;
  border-bottom: 1px solid #e4eaee;
  text-align: left;
}

.progress-table th {
  color: #51616d;
  font-size: 0.9rem;
}

.status-cell {
  text-align: center;
  color: #87949d;
}

.status-cell.done {
  color: #175c4c;
  font-weight: 700;
}

@media (max-width: 680px) {
  main {
    width: min(100% - 20px, 920px);
    padding: 20px 0;
  }

  .quest {
    padding: 20px;
  }

  .answer-row,
  .master-head,
  .quest-row {
    display: grid;
  }

  .quest-row {
    grid-template-columns: 96px 1fr;
  }

  .quest-row .row-actions {
    grid-column: 1 / -1;
  }

  .row-actions,
  .editor-actions,
  .current-file {
    justify-content: start;
  }

  .quest-row img {
    width: 96px;
    height: 96px;
  }
}