/* EMBER confidence-based metacognition control. Theme-var driven so it inherits
   any tenant palette; includes standalone fallbacks so it reads correctly even
   on a page that hasn't loaded the shared variables. */
.ec-confidence {
  --ec-bg: var(--panel2, #1c232d);
  --ec-line: var(--line, #2a323d);
  --ec-ink: var(--ink, #e7edf3);
  --ec-muted: var(--muted, #93a1b0);
  --ec-brand: var(--brand, #ff7a18);
  --ec-accent: var(--brand2, #7ec9ff);
  --ec-good: var(--good, #3fb950);
  --ec-bad: var(--bad, #f85149);
  --ec-warn: var(--partial, #d29922);
  margin: 16px 0;
  color: var(--ec-ink);
}

.ec-q {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ec-ink);
}

.ec-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 420px) {
  .ec-group { grid-template-columns: 1fr; }
}

.ec-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  text-align: center;
  cursor: pointer;
  background: var(--ec-bg);
  color: var(--ec-ink);
  border: 1px solid var(--ec-line);
  border-radius: 10px;
  padding: 12px 10px;
  font: inherit;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.ec-opt:hover:not(:disabled) {
  border-color: var(--ec-accent);
  background: color-mix(in srgb, var(--ec-bg) 88%, var(--ec-accent) 12%);
}
.ec-opt:focus-visible {
  outline: 2px solid var(--ec-accent);
  outline-offset: 2px;
}
.ec-opt:active:not(:disabled) { transform: translateY(1px); }

.ec-opt-label { font-size: 15px; font-weight: 600; }
.ec-opt-hint { font-size: 11px; color: var(--ec-muted); }

.ec-opt.is-chosen,
.ec-opt[aria-checked="true"] {
  border-color: var(--ec-brand);
  box-shadow: 0 0 0 1px var(--ec-brand) inset;
  background: color-mix(in srgb, var(--ec-bg) 84%, var(--ec-brand) 16%);
}
.ec-opt.is-chosen .ec-opt-hint { color: var(--ec-ink); }

.ec-confidence.is-answered .ec-opt:not(.is-chosen) { opacity: .55; }
.ec-opt:disabled { cursor: default; }

/* Metacognitive feedback chip — a host page renders calibrate()/summary() text
   inside one of these for a consistent, themed look. */
.ec-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  padding: 9px 13px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.45;
  background: var(--panel2, #1c232d);
  border: 1px solid var(--line, #2a323d);
  border-left: 3px solid var(--brand2, #7ec9ff);
  color: var(--ink, #e7edf3);
}
.ec-chip::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand2, #7ec9ff);
}
.ec-chip.is-good { border-left-color: var(--good, #3fb950); }
.ec-chip.is-good::before { background: var(--good, #3fb950); }
.ec-chip.is-bad { border-left-color: var(--bad, #f85149); }
.ec-chip.is-bad::before { background: var(--bad, #f85149); }
.ec-chip.is-warn { border-left-color: var(--partial, #d29922); }
.ec-chip.is-warn::before { background: var(--partial, #d29922); }

@media (prefers-reduced-motion: reduce) {
  .ec-opt { transition: none; }
  .ec-opt:active:not(:disabled) { transform: none; }
}

@media (prefers-contrast: more) {
  .ec-opt { border-width: 2px; }
}

/* ── Confidence SLIDER (v2) ────────────────────────────────────────────────
   Gradient track (sad→neutral→smiley), a live face that morphs with the value,
   and the three anchor labels. One gesture: settling the slider auto-advances. */
.ec-slider {
  background: var(--ec-bg);
  border: 1px solid var(--ec-line);
  border-radius: 12px;
  padding: 14px 16px 12px;
}
.ec-slider .ec-q { text-align: center; margin-bottom: 6px; }

.ec-live {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  margin: 2px 0 8px;
}
.ec-live-face { display: inline-flex; line-height: 0; }
.ec-live-face svg { transition: none; }
.ec-live-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--ec-ink);
}

.ec-slot {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ec-end { flex: 0 0 auto; line-height: 0; opacity: .9; }
.ec-end svg { width: 26px; height: 26px; }

/* The range itself — a persistent red→amber→green gradient so the meaning of the
   scale is always visible; the thumb slides across it. */
.ec-range {
  --ec-fill: 50%;
  flex: 1 1 auto;
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    hsl(8 72% 46%) 0%, hsl(45 85% 50%) 50%, hsl(130 62% 42%) 100%);
  outline: none;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--ec-line) 70%, transparent);
}
.ec-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ec-brand);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  cursor: grab;
  transition: transform .1s ease;
}
.ec-range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.08); }
.ec-range::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ec-brand);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  cursor: grab;
}
.ec-range:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ec-accent) 55%, transparent); }
.ec-range:disabled { opacity: .8; cursor: default; }

.ec-scale {
  display: flex;
  justify-content: space-between;
  margin: 8px 2px 0;
  font-size: 11px;
  color: var(--ec-muted);
}
.ec-scale span:nth-child(2) { text-align: center; }
.ec-scale span:last-child { text-align: right; }

.ec-continue {
  display: block;
  margin: 12px auto 2px;
  padding: 7px 16px;
  font: inherit;
  font-size: 13px;
  color: var(--ec-muted);
  background: transparent;
  border: 1px solid var(--ec-line);
  border-radius: 8px;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease;
}
.ec-continue:hover:not(:disabled) { color: var(--ec-ink); border-color: var(--ec-accent); }
.ec-continue:focus-visible { outline: 2px solid var(--ec-accent); outline-offset: 2px; }
.ec-slider.is-touched .ec-continue { opacity: .6; }   /* de-emphasise once the slider IS the control */
.ec-slider.is-answered { opacity: .85; }

@media (prefers-reduced-motion: reduce) {
  .ec-range::-webkit-slider-thumb { transition: none; }
}
@media (prefers-contrast: more) {
  .ec-range { border-width: 2px; }
  .ec-range::-webkit-slider-thumb { border-width: 4px; }
}
