/* A+ CITY — practice UI (MCQ test engine + PBQ drills), restyle v3.
   Quiet testing software: white cards, hairline borders, neutral progress,
   light-gray explanation tint. Semantic green/red only for right/wrong.
   Loads on /a-plus/core-1/, /a-plus/core-2/, /a-plus/pbq/ on top of site.css. */

/* ---------- shared practice stage ---------- */

.practice-col {
  max-width: 50rem;
  margin: 0 auto;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.25rem;
}
.progress-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--hairline);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--navy-soft);
  transition: width 200ms ease;
}

.q-meta {
  font-size: 0.72rem; /* caps stay at tag size per the v3 type rules */
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}
.q-meta .q-id { font-weight: 400; letter-spacing: 0; text-transform: none; }

.q-stem {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 1.1rem;
  line-height: 1.5;
  letter-spacing: 0;
}

.q-options { display: grid; gap: 0.6rem; }

.q-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.q-opt:hover:not(:disabled) { border-color: var(--accent); box-shadow: var(--shadow-hover); }
.q-opt:disabled { cursor: default; opacity: 1; }
.q-letter { flex: 0 0 auto; font-weight: 600; color: var(--ink-soft); }
.q-opt.is-correct { background: var(--right-bg); border-color: var(--right); }
.q-opt.is-wrong { background: var(--wrong-bg); border-color: var(--wrong); }
.q-opt.is-dim { opacity: 0.6; }

.pbq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1.2rem;
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--accent-soft); color: var(--accent-deep); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- explanations / results (shared) ---------- */

.pbq-score { font-weight: 600; font-size: 1.05rem; margin: 0 0 1rem; }
.pbq-score.is-right { color: var(--right); }
.pbq-score.is-partial { color: var(--amber-deep); }
.pbq-score.is-wrong { color: var(--wrong); }

.pbq-summary {
  background: var(--tint);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.9rem 1.05rem;
  margin: 0 0 1.1rem;
  font-size: 1rem;
  color: var(--ink);
}
.pbq-summary strong { color: var(--navy); }

.pbq-breakdown { display: grid; gap: 0.65rem; }
.pbq-why { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.98rem; color: var(--ink-soft); margin: 0; }
.pbq-why .why-chip {
  flex: 0 0 1.35rem;
  height: 1.35rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3rem;
  text-align: center;
}
.pbq-why .why-chip.is-right { background: var(--right-bg); color: var(--right); border: 1px solid var(--right); }
.pbq-why .why-chip.is-wrong { background: var(--wrong-bg); color: var(--wrong); border: 1px solid var(--wrong); }
.pbq-why .why-chip.is-neutral { background: var(--tint); color: var(--ink-soft); border: 1px solid var(--hairline); }
.pbq-why strong { color: var(--navy); }

.q-explain { margin-top: 1.15rem; border-top: 1px solid var(--hairline); padding-top: 1.05rem; }
.q-verdict { font-weight: 600; margin: 0 0 0.75rem; }
.q-verdict.right { color: var(--right); }
.q-verdict.wrong { color: var(--wrong); }
.q-why { margin: 0 0 0.7rem; font-size: 1rem; color: var(--ink-soft); }
.q-why strong { color: var(--navy); }
.q-why.q-why-correct {
  background: var(--tint);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  color: var(--ink);
}

/* ---------- results screen ---------- */

.result-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.result-score {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--navy);
  line-height: 1;
}
.result-score small { display: block; font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); margin-top: 0.45rem; letter-spacing: 0; }

.domain-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.domain-table th, .domain-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--hairline);
}
.domain-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-soft);
}
.domain-table td.num { text-align: right; font-weight: 600; white-space: nowrap; }
.domain-bar {
  height: 6px;
  background: var(--hairline);
  border-radius: 999px;
  overflow: hidden;
  min-width: 6rem;
}
.domain-bar span { display: block; height: 100%; background: var(--navy-soft); }

@media (max-width: 560px) {
  .domain-table th:nth-child(2),
  .domain-table td:nth-child(2) { display: none; }
  .domain-table th, .domain-table td { padding: 0.55rem 0.4rem; }
}

/* ---------- typed matching ---------- */

.match-rows { display: grid; gap: 0.6rem; }
.match-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0.7rem 0.85rem;
}
.match-label { flex: 1 1 16rem; font-size: 0.98rem; color: var(--ink); }
.match-input {
  flex: 1 1 9rem;
  min-width: 0;
  max-width: 14rem;
  font: inherit;
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  min-height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}
.match-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.match-row.is-right { border-color: var(--right); background: var(--right-bg); }
.match-row.is-wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.match-verdict { font-weight: 600; font-size: 0.9rem; }
.match-row.is-right .match-verdict { color: var(--right); }
.match-row.is-wrong .match-verdict { color: var(--wrong); }

/* ---------- typed ordering ---------- */

.ord-rows { display: grid; gap: 0.6rem; }
.ord-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0.6rem 0.75rem;
}
.ord-input {
  flex: 0 0 4.25rem;
  width: 4.25rem;
  min-width: 0; /* inputs' intrinsic size must not veto the flex basis */
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  padding: 0.55rem 0.4rem;
  min-height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  color: var(--navy);
}
.ord-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ord-text { flex: 1; font-size: 0.98rem; }
.ord-row.is-right { border-color: var(--right); background: var(--right-bg); }
.ord-row.is-wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.ord-correct-pos { font-size: 0.8rem; font-weight: 600; color: var(--wrong); white-space: nowrap; }
.ord-hint { font-size: 0.9rem; font-weight: 600; color: var(--wrong); min-height: 1.4rem; margin: 0.5rem 0 0; }

/* ---------- simulated CLI (a terminal is content, not chrome) ---------- */

.cli-shell {
  background: var(--navy-deep);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}
.cli-titlebar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--navy);
  padding: 0.5rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #aab6cc;
}
.cli-titlebar .cli-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--navy-soft); }
.cli-body { padding: 0.9rem 0.5rem 1rem; overflow-x: auto; }
.cli-line {
  display: block;
  min-width: 100%;
  width: max-content;
  text-align: left;
  font-family: "Consolas", "Menlo", "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre;
  color: #d9e0ee;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  padding: 0.12rem 0.5rem;
  cursor: pointer;
}
.cli-line:hover:not(:disabled) { background: var(--navy-soft); border-left-color: #7fd4c8; }
.cli-line:disabled { cursor: default; }
.cli-line.is-blank { pointer-events: none; }
.cli-line.is-picked { background: rgba(127, 212, 200, 0.16); border-left-color: #7fd4c8; color: #fff; }
.cli-line.is-miss { animation: cliMiss 0.5s; }
@keyframes cliMiss {
  0%, 100% { background: transparent; }
  30% { background: rgba(179, 55, 47, 0.45); }
}
.cli-hint { font-size: 0.9rem; font-weight: 600; color: var(--accent-deep); margin: 0 0 0.75rem; }
.cli-hint.is-miss { color: var(--wrong); }
.cli-options { display: grid; gap: 0.6rem; }

/* ---------- simulated config (selects) ---------- */

.cfg-panel {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.cfg-titlebar {
  background: var(--tint);
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--hairline);
}
.cfg-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  border-bottom: 1px solid var(--hairline);
  padding: 0.85rem 1rem;
}
.cfg-field:last-of-type { border-bottom: none; }
.cfg-field label {
  flex: 1 1 14rem;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--navy);
}
.cfg-select {
  flex: 0 1 18rem;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.6rem;
  min-height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  max-width: 100%;
}
.cfg-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cfg-field.is-right { background: var(--right-bg); }
.cfg-field.is-wrong { background: var(--wrong-bg); }
.cfg-verdict { font-weight: 600; font-size: 0.9rem; flex-basis: 100%; }
.cfg-field.is-right .cfg-verdict { color: var(--right); }
.cfg-field.is-wrong .cfg-verdict { color: var(--wrong); }

/* ---------- identify_label ---------- */

.idl-prompt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; margin: 0 0 0.75rem; }
.idl-prompt .idl-find { font-weight: 600; color: var(--navy); font-size: 1.02rem; }
.idl-prompt .idl-count { font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); }

.idl-figure {
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: crosshair;
  line-height: 0;
}
.idl-figure img { width: 100%; height: auto; display: block; }
.idl-figure.is-locked { cursor: default; }
.idl-figure:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.idl-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.45rem;
  text-align: center;
  pointer-events: none;
}
.idl-marker.is-revealed { background: var(--wrong); }

.idl-region {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: rgba(11, 125, 114, 0.12);
  pointer-events: none;
}
.idl-region .idl-region-num {
  position: absolute;
  top: -0.05rem;
  left: -0.05rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.22rem 0.42rem;
  border-radius: 0 0 6px 0;
}

.idl-cursor {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  background: rgba(11, 125, 114, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.idl-labels-done { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.8rem; }
.idl-label-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  min-height: 38px;
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
  background: var(--card);
  cursor: pointer;
}
.idl-label-pill.is-hit { border-color: var(--right); background: var(--right-bg); color: var(--right); }
.idl-label-pill.is-missed { border-color: var(--wrong); background: var(--wrong-bg); color: var(--wrong); }
.idl-label-pill.is-active { border-color: var(--navy-soft); background: var(--navy-soft); color: #fff; }
.idl-label-pill:disabled { cursor: default; }

/* ---------- PBQ drill sets ---------- */

.drill-set { margin-bottom: 3rem; }
.drill-grid { display: grid; gap: 0.9rem; }
@media (min-width: 640px)  { .drill-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .drill-grid { grid-template-columns: repeat(3, 1fr); } }

.drill-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  font: inherit;
  padding: 1.1rem 1.2rem;
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  transition: box-shadow 140ms ease, border-color 140ms ease;
}
.drill-card:hover:not(:disabled) {
  box-shadow: var(--shadow-hover);
  border-color: #d8d5cc;
}
/* Signal "locked" with a tinted, dashed card rather than blanket opacity —
   opacity would drag the title and lock pitch below AA contrast. */
.drill-card:disabled { cursor: not-allowed; background: var(--tint); border-style: dashed; }
.drill-card:disabled .drill-title { color: var(--ink-soft); }
.drill-num {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.drill-title { font-weight: 600; color: var(--navy); font-size: 0.97rem; }
.drill-domain { font-size: 0.82rem; color: var(--ink-soft); }
.drill-state { font-size: 0.8rem; font-weight: 600; margin-top: 0.2rem; }
.drill-state.is-done { color: var(--right); }
.drill-state.is-partial { color: var(--amber-deep); }
.drill-state.is-locked { color: var(--ink-soft); }

.pbq-type-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.pbq-instruction { font-size: 0.92rem; color: var(--ink-soft); margin: 0 0 1rem; }

.pbq-pending {
  background: var(--tint);
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--ink-soft);
}
.pbq-pending strong { color: var(--navy); }

.pbq-load-error { color: var(--wrong); font-weight: 600; }

.stage-back { margin-bottom: 1rem; }
