* {
  box-sizing: border-box;
}

:root {
  --brand: #16a34a;
  --brand-light: #dcfce7;
  --slate: #334155;
}

html {
  min-height: 100%;
}

body {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1e293b;
  background: #ecfdf5;
}

body::before {
  content: "";
  position: fixed;
  inset: -8px;
  z-index: -1;
  background: linear-gradient(rgba(236, 253, 245, .3), rgba(248, 250, 252, .2)), url("images/pfirsich.jpg") center/cover no-repeat;
  filter: blur(3px);
  transform: scale(1.03);
}

hr {
  border: 0;
  border-top: 2px solid #10592d69;
  margin: 16px 0;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

main {
  flex: 1;
  max-width: 1024px;
  width: 100%;
  margin: auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.site-footer {
  padding: 16px;
  color: #fff;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 14px;
}

.site-footer a {
  color: #bbf7d0;
  font-weight: 700;
}

.panel {
  background: #fff8e5f2;
  backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0cc;
  border-radius: 16px;
  box-shadow: 0 10px 30px #0f172a18;
}

.start-panel, .quiz-panel {
  width: 100%;
  max-width: 768px;
  margin: auto;
  padding: 32px;
}

.welcome {
  padding: 0px;
  border-radius: 0 12px 12px 0;
}

.welcome h2 {
  margin: 0 0 4px;
  color: #064e3b;
  font-size: 1.8em;
}

.welcome p {
  margin: 0 0 12px;
  color: #065f46;
  font-size: 14px;
}

.hint {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #d1fae5cc;
  border: 1px solid #86efac;
  border-radius: 8px;
  color: #064e3b;
  font-size: 14px;
  font-weight: 600;
}

.config {
  margin-top: 24px;
  display: grid;
  gap: 24px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #334155;
}

.field-label i {
  color: var(--brand);
  margin-right: 6px;
}

.round-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.round-options label {
  cursor: pointer;
  background: #f8fafcaa
}

.round-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}


.round-options span {
  display: block;
  padding: 12px;
  text-align: center;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  transition: .15s;
}

.round-options input:checked + span {
  border-color: var(--brand);
  background: #f0fdf4;
  color: #166534;
  font-weight: 700;
}

.category-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.category-heading .field-label {
  margin: 0;
}

.category-heading button {
  border: 0;
  background: none;
  color: #15803d;
  font-size: 12px;
  font-weight: 700;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.category-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafcaa;
  transition: .15s;
  cursor: pointer;
}

.category-grid label:hover {
  border-color: #22c55e;
  background: #f0fdf4;
}

.category-grid input {
  accent-color: var(--brand);
}

.error {
  color: #e11d48;
  font-size: 12px;
  font-weight: 700;
  margin: 8px 0 0;
}

.primary-button, .primary-small {
  border: 0;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  border-radius: 10px;
  box-shadow: 0 6px 16px #16a34a33;
  transition: .15s;
}

.primary-button {
  width: 100%;
  padding: 16px;
  font-size: 18px;
}

.primary-button:hover, .primary-small:hover {
  background: #15803d;
}

.primary-button i, .primary-small i {
  margin-left: 6px;
}

.progress-area {
  margin-bottom: 24px;
}

.progress-area > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}

.category-badge {
  background: #dcfce7;
  color: #166534;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.progress-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

#quiz-progress-bar {
  height: 100%;
  background: #22c55e;
  width: 0;
  transition: .3s;
}

.question-area {
  display: grid;
  gap: 16px;
}

.question-area h3 {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.3;
}

.question-image {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  max-height: 256px;
  text-align: center;
}

.question-image img {
  width: 100%;
  max-height: 256px;
  object-fit: cover;
  display: block;
}

.answers {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.answer-card {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: .15s;
}

.answer-card:hover {
  border-color: #cbd5e1;
}

.answer-card.selected {
  border-color: var(--brand);
  background: #f0fdf4cc;
  box-shadow: 0 2px 8px #16a34a18;
}

.answer-card input {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  accent-color: var(--brand);
}

.answer-key {
  font-weight: 800;
  color: #64748b;
  margin-right: 8px;
}

.answer-text {
  font-weight: 600;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
}

.text-button {
  border: 0;
  background: none;
  color: #94a3b8;
  font-weight: 700;
}

.text-button:hover {
  color: #475569;
}

.primary-small, .secondary-button {
  padding: 12px 20px;
}

.results {
  width: 100%;
  max-width: 896px;
  margin: auto;
  display: grid;
  gap: 24px;
}

.result-panel {
  padding: 32px;
  text-align: center;
}

.result-icon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #d1fae5;
  color: #059669;
  font-size: 30px;
  box-shadow: inset 0 2px 5px #0001;
}

.result-panel h2 {
  margin: 16px 0 4px;
  font-size: 30px;
}

.result-panel > p {
  color: #64748b;
  margin: 0 auto;
  max-width: 520px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 560px;
  margin: 20px auto;
}

.stats div {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.stats strong {
  display: block;
  font-size: 24px;
  color: #16a34a;
}

.stats span {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.secondary-button {
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
}

.table-panel {
  padding: 24px;
  overflow: hidden;
}

.table-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.table-heading h3 {
  margin: 0;
  font-size: 18px;
}

.table-heading p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 12px;
}

.legend {
  display: flex;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.legend .right {
  color: #047857;
}

.legend .wrong {
  color: #be123c;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  padding: 12px;
  text-align: left;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
}

td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
}

tbody tr {
  cursor: pointer;
}

.table-row:hover {
  background: #f8fafc;
}

.status {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status.right {
  background: #d1fae5;
  color: #065f46;
}

.status.wrong {
  background: #ffe4e6;
  color: #9f1239;
}

.popover {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  width: min(350px, calc(100vw - 30px));
  background: #fffffff7;
  backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 15px 35px #0f172a2a;
  padding: 16px;
  font-size: 12px;
}

.popover-head {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
  font-weight: 800;
}

#popover-category {
  color: #166534;
  background: #f0fdf4;
  padding: 2px 7px;
  border-radius: 5px;
}

#popover-question {
  font-size: 14px;
  font-weight: 700;
}

#popover-options {
  display: grid;
  gap: 4px;
}

.pop-option {
  padding: 6px;
  border: 1px solid;
  border-radius: 4px;
  display: flex;
  gap: 5px;
}

.explanation {
  margin-top: 8px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
}

.explanation strong {
  display: block;
  color: #334155;
  margin-bottom: 3px;
}

.explanation i {
  color: #f59e0b;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .start-panel, .quiz-panel, .result-panel, .table-panel {
    padding: 20px;
  }
  .round-options, .category-grid, .stats {
    grid-template-columns: 1fr;
  }
  .table-heading {
    flex-direction: column;
    align-items: flex-start;
  }
  .legend {
    white-space: normal;
  }
  .quiz-actions {
    margin-top: 24px;
  }
  .question-area h3 {
    font-size: 21px;
  }
}
