/* Speech debrief summary (speech-debrief.js).
   Results: "From your debrief" card under Talk to KoLi.
   Setup: "From your last debrief" note in the Script card.
   Dark styles first (guarded so they never reach light), then light. */

/* ---------------------------------------------------------------- shared */

.kd-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  text-align: left;
}

.kd-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.kd-headline {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  text-wrap: pretty;
}

.kd-group {
  width: 100%;
  margin: 16px 0 0;
}

.kd-label {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
}

.kd-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.kd-list li {
  position: relative;
  margin: 0 0 6px;
  padding-left: 14px;
  font-size: 14px;
  line-height: 1.45;
}

.kd-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: .62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}

.kd-line {
  margin: 0 0 10px;
  padding: 0 0 0 12px;
  border-left: 2px solid;
}

.kd-line-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
}

.kd-line-part {
  margin: 2px 0 0;
  font-size: 12px;
}

.kd-note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.kd-retry {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  min-height: 0;
  margin: 10px 0 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.kd-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.kd-skel {
  display: block;
  height: 14px;
  margin: 10px 0 0;
  border-radius: 6px;
  animation: kd-pulse 1.4s ease-in-out infinite;
}

.kd-skel--title { width: 80%; height: 22px; margin-top: 12px; }
.kd-skel--line { width: 92%; }
.kd-skel--short { width: 55%; }

@keyframes kd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

@media (prefers-reduced-motion: reduce) {
  .kd-skel { animation: none; }
}

/* Setup note — collapsed by default so the script stays in view. */
.kd-setup {
  flex: none;
  margin: 0 0 12px;
  border-radius: 14px;
  box-sizing: border-box;
  text-align: left;
}

.kd-setup-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.kd-setup-summary::-webkit-details-marker { display: none; }

.kd-setup-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.kd-setup-when {
  font-size: 12px;
}

.kd-setup .kd-headline {
  display: block;
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.kd-setup-more::before {
  content: 'Show what to change';
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.kd-setup[open] .kd-setup-more::before {
  content: 'Hide';
}

.kd-setup-body {
  padding: 0 14px 12px;
}

.kd-setup .kd-group {
  margin-top: 10px;
}

/* ------------------------------------------------------------------ dark */

:where(html:not([data-kouli-theme='light'])) .kd-card {
  padding: 16px 17px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.92);
}

:where(html:not([data-kouli-theme='light'])) .kd-kicker,
:where(html:not([data-kouli-theme='light'])) .kd-line-part,
:where(html:not([data-kouli-theme='light'])) .kd-note,
:where(html:not([data-kouli-theme='light'])) .kd-setup-when {
  color: #7a99ab;
}

:where(html:not([data-kouli-theme='light'])) .kd-headline,
:where(html:not([data-kouli-theme='light'])) .kd-label,
:where(html:not([data-kouli-theme='light'])) .kd-line-text,
:where(html:not([data-kouli-theme='light'])) .kd-retry {
  color: rgba(255, 255, 255, 0.96);
}

:where(html:not([data-kouli-theme='light'])) .kd-list li {
  color: #b8cdd8;
}

:where(html:not([data-kouli-theme='light'])) .kd-line {
  border-color: rgba(255, 255, 255, 0.18);
}

:where(html:not([data-kouli-theme='light'])) .kd-skel {
  background: rgba(255, 255, 255, 0.08);
}

:where(html:not([data-kouli-theme='light'])) .kd-setup {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.92);
}

/* ----------------------------------------------------------------- light */

html[data-kouli-theme='light'] .kd-card {
  padding: 20px;
  border: 1px solid #E8E3DC;
  border-radius: 20px;
  background: #FAF8F5;
  color: #1E2224;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

html[data-kouli-theme='light'] .kd-kicker,
html[data-kouli-theme='light'] .kd-line-part,
html[data-kouli-theme='light'] .kd-note,
html[data-kouli-theme='light'] .kd-setup-when {
  color: #6B6762;
}

html[data-kouli-theme='light'] .kd-headline,
html[data-kouli-theme='light'] .kd-line-text {
  font-family: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  font-weight: 500;
  color: #1E2224;
}

html[data-kouli-theme='light'] .kd-line-text {
  font-weight: 400;
}

html[data-kouli-theme='light'] .kd-label {
  color: #1E2224;
}

html[data-kouli-theme='light'] .kd-list li {
  color: #4A4743;
}

html[data-kouli-theme='light'] .kd-line {
  border-color: #E2DCD3;
}

html[data-kouli-theme='light'] .kd-retry,
html[data-kouli-theme='light'] .kd-retry:hover:not(:disabled) {
  background: none;
  box-shadow: none;
  color: #1E2224;
}

html[data-kouli-theme='light'] .kd-retry:focus-visible,
html[data-kouli-theme='light'] .kd-setup-summary:focus-visible {
  outline: 2px solid #1E2224;
  outline-offset: 2px;
}

html[data-kouli-theme='light'] .kd-skel {
  background: #EAE4DB;
}

html[data-kouli-theme='light'] .kd-setup {
  border: 1px solid #E8E3DC;
  background: #F1ECE5;
  color: #1E2224;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}
