:root {
  --blue: #5b9bd5;
  --blue-dark: #4a83b8;
  --blue-btn: #5a7fb0;
  --green: #a8d5a8;
  --green-dark: #2e7d32;
  --red: #f2c0c0;
  --red-dark: #c0392b;
  --light: #eaf4fb;
  --border: #e0e0e0;
  --text: #333;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f6f8;
  color: var(--text);
  line-height: 1.5;
}

#app { max-width: 820px; margin: 0 auto; padding: 20px 14px 60px; }

.screen.hidden { display: none; }
.hidden { display: none !important; }

.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  margin-bottom: 28px;
  overflow: hidden;
}

.card-head {
  background: var(--blue);
  color: #fff;
  text-align: center;
  padding: 18px 16px;
}
.card-head h1 { margin: 0; font-size: 1.7rem; font-weight: 600; }
.card-head h2 { margin: 4px 0 0; font-size: 1.4rem; font-weight: 400; }

.card-body { padding: 22px 20px; }

.lead { font-size: 1.05rem; }
.center { text-align: center; color: var(--blue-dark); font-weight: 600; font-size: 1.15rem; }

/* Buttons */
.btn-primary, .cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: var(--blue-btn);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 16px 18px;
  border-radius: 6px;
  cursor: pointer;
  margin: 10px 0;
  transition: background .15s;
}
.btn-primary:hover, .cat-btn:hover { background: var(--blue-dark); }
.btn-primary.big { justify-content: center; font-size: 1.15rem; }
.btn-primary span#general-label, .cat-btn .cat-name { flex: 1; text-align: center; }
.pct { font-weight: 700; opacity: .95; min-width: 56px; text-align: left; }

.cat-btn { justify-content: space-between; }

/* Jump box */
.jump { margin-top: 18px; text-align: center; }
.jump-row { display: flex; gap: 0; margin-top: 8px; }
.jump-row input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  font-size: 1rem;
}
.btn-search {
  background: var(--blue-btn);
  color: #fff;
  border: none;
  padding: 0 18px;
  font-size: 1.2rem;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
}

.reset-wrap { text-align: center; }
.btn-link {
  background: none;
  border: none;
  color: var(--blue-dark);
  cursor: pointer;
  font-size: .95rem;
  text-decoration: underline;
}

/* Quiz */
.quiz-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--light);
  border-bottom: 1px solid var(--border);
}
.progress-wrap { flex: 1; display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 12px; background: #d6e4ef; border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--green-dark); transition: width .3s; }
.progress-text { font-weight: 700; color: var(--green-dark); min-width: 44px; text-align: right; }

.qcounter { color: var(--blue-dark); font-weight: 600; margin: 0 0 10px; }
.qtext { font-size: 1.3rem; margin: 0 0 20px; line-height: 1.4; }

.option {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 12px;
  cursor: pointer;
  overflow: hidden;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.option:hover { border-color: var(--blue); }
.option.selected { border-color: var(--blue); background: var(--light); }
.option .letter {
  background: #9e9e9e;
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  text-transform: uppercase;
}
.option .otext { padding: 14px 16px; display: flex; align-items: center; }

.option.correct { border-color: var(--green-dark); }
.option.correct .letter { background: var(--green-dark); }
.option.wrong { border-color: var(--red-dark); background: #fff0f0; }
.option.wrong .letter { background: var(--red-dark); }
.option .tag {
  align-self: center;
  margin-left: auto;
  margin-right: 12px;
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
}
.tag.t-correct { background: var(--green-dark); }
.tag.t-wrong { background: var(--red-dark); }
.option.locked { cursor: default; }

.feedback { padding: 14px 16px; border-radius: 6px; margin: 8px 0 4px; font-weight: 600; }
.feedback.ok { background: #e6f4ea; color: var(--green-dark); border: 1px solid var(--green); }
.feedback.no { background: #fdecea; color: var(--red-dark); border: 1px solid var(--red); }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.btn-submit, .btn-next {
  flex: 1;
  min-width: 200px;
  border: none;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
}
.btn-submit { background: var(--green); color: #2c532c; }
.btn-submit:hover { background: #98c998; }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; }
.btn-next { background: var(--blue-btn); }
.btn-next:hover { background: var(--blue-dark); }

.done-msg { text-align: center; padding: 30px 10px; }
.done-msg .big-pct { font-size: 3rem; font-weight: 700; color: var(--green-dark); }

@media (max-width: 560px) {
  .card-head h1 { font-size: 1.35rem; }
  .card-head h2 { font-size: 1.15rem; }
  .qtext { font-size: 1.1rem; }
}
