.chispa { position: relative; flex: 0 0 auto; width: 100px; }
.chispa-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; border-radius: 16px; cursor: pointer; touch-action: manipulation; }
.chispa-button img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 3px 2px #234c7815); }
.chispa-button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.chispa-message { position: absolute; z-index: 5; bottom: calc(100% + 8px); right: 0; width: min(240px, 75vw); padding: 12px 15px; border: 1px solid var(--primary-border); border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 5px 20px #0002; font-size: 14px; font-weight: 500; line-height: 1.5; letter-spacing: normal; text-align: left; }
.chispa-message[hidden] { display: none; }
.chispa-card { display: flex; align-items: center; gap: 12px; overflow: visible; }
.chispa-card[hidden] { display: none; }
.chispa-card > div:first-child { flex: 1; min-width: 0; }
.chispa-card .chispa { width: 150px; }
.chispa-card h3 { font-size: 22px; }
.practice-intro-heading h1 { margin-bottom: 0; }
.answer-feedback { display: flow-root; }
.answer-feedback > .chispa { float: right; width: 100px; margin: -4px -4px 0 12px; }
.chispa-results { float: right; margin: 0 0 12px 18px; }
.chispa-results .chispa { width: 120px; }
.results-page .result-summary { clear: both; }
.question-actions:has(.chispa-help-toggle:not([hidden])) {
  flex-direction: row;
  align-items: center;
  gap: 16px;
}
.question-actions:has(.chispa-help-toggle:not([hidden]) ~ .chispa-streak-birds) { padding-bottom: 26px; }
.chispa-help-meter {
  --help-flower-size: 36px;
  --help-pad: 8px;
  position: relative;
  display: grid;
  justify-items: center;
  flex: 0 0 auto;
}
.chispa-help-meter:has(.chispa-help-toggle[hidden]) { display: none; }
.button.chispa-help-toggle {
  position: relative;
  height: 50px;
  min-height: 0;
  margin: 0;
  padding: 0 var(--help-pad);
  gap: 5px;
  border-radius: 12px;
  font-size: 14px;
  --button-depth: 2px;
}
.chispa-help-toggle[hidden] { display: none; }
.chispa-help-flower { width: var(--help-flower-size); height: var(--help-flower-size); flex-shrink: 0; }
.chispa-help-toggle:disabled .chispa-help-flower { filter: saturate(.65); opacity: .8; }
.chispa-help-count {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  color: var(--surface);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.chispa-help-toggle:disabled .chispa-help-count { background: var(--disabled-surface); color: var(--disabled-ink); border-color: var(--disabled-border); }
.chispa-help-previous-count { visibility: hidden; }
.chispa-streak-birds {
  position: absolute;
  z-index: 1;
  top: calc(100% + 4px);
  left: calc(3px + var(--help-pad) + var(--help-flower-size) / 2);
  display: flex;
  width: max-content;
  gap: 1px;
  transform: translateX(-50%);
  pointer-events: none;
}
[data-chispa-reserve] .chispa-streak-birds { border-radius: 9px; background: var(--accent-soft); outline: 1px solid var(--accent); }
.chispa-streak-bird { width: 18px; height: 18px; --streak-in: 0px; --streak-out: 18px; --streak-delay: 0ms; }
.chispa-streak-bird:first-child { --streak-in: 19px; --streak-out: -18px; }
.chispa-streak-bird:nth-child(2) { --streak-delay: 65ms; }
.chispa-streak-bird:nth-child(3) { --streak-in: -19px; --streak-out: 30px; --streak-delay: 130ms; }
.chispa-streak-transient { visibility: hidden; }
.chispa-help-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.chispa-help-heading img { flex: 0 0 auto; width: clamp(48px, 15vw, 80px); height: auto; }
.chispa-help-heading h2 { margin: 0; }
.chispa-help-close { flex: 0 0 auto; align-self: flex-start; margin-inline-start: auto; }
.chispa-help-close .button { width: 40px; min-height: 40px; padding: 0; border-radius: 12px; --button-depth: 2px; }
.chispa-help-streak-info { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.chispa-help-streak-info p { margin: 0; }
.chispa-help-character { flex: 0 0 auto; margin: 0; color: var(--primary); text-align: center; font-size: 13px; font-weight: 750; }
.chispa-help-character img { margin-inline: auto; }
.chispa-help-actions { display: flex; justify-content: flex-end; }
.answers .answer.is-discarded {
  background: var(--disabled-surface);
  border-color: var(--disabled-border);
  border-style: dashed;
  color: var(--muted);
  cursor: not-allowed;
}
.chispa-discarded-note { position: relative; display: flex; align-items: center; gap: 6px; margin-top: 4px; scroll-margin-block: 56px 16px; font-size: 14px; font-weight: 700; }
.chispa-discarded-note img { flex: 0 0 auto; }
.chispa-discarded-cross { width: 18px; height: 18px; color: var(--danger); stroke-width: 3; }
.chispa-reserve-note { display: inline-block; color: var(--primary); }
.answer-feedback .chispa-help-earned { font-weight: 700; }
.chispa-help-discard-flower {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 56px;
  height: 56px;
  pointer-events: none;
  visibility: hidden;
}
.result-numbers:has(.chispa-help-used) { flex-wrap: wrap; gap: 12px 24px; }
@media (prefers-reduced-motion: no-preference) {
  .chispa.is-greeting img { animation: chispa-greeting 650ms ease-in-out; }
  .game-correct .chispa img, .game-passed .chispa img { animation: chispa-greeting 650ms ease-in-out; }
  .show-chispa-flight .chispa-help-discard-flower { animation: chispa-discard-bloom 1000ms ease-out; }
  .is-streak-animating[data-chispa-streak="join"] .chispa-streak-bird:last-child { animation: chispa-streak-join 480ms ease-out both; }
  .is-streak-animating[data-chispa-streak="lost"] .chispa-streak-bird { animation: chispa-streak-away 600ms var(--streak-delay) ease-in both; }
  .is-streak-pending .chispa-help-previous-count { visibility: visible; }
  .is-streak-animating:is([data-chispa-streak="earned"], [data-chispa-streak="recharged"]) .chispa-streak-bird { animation: chispa-streak-earn 650ms var(--streak-delay) ease-in-out both; }
  .is-streak-animating:is([data-chispa-streak="earned"], [data-chispa-streak="recharged"]) .chispa-help-previous-count { animation: chispa-streak-old-count 780ms step-end both; }
  .is-streak-animating:is([data-chispa-streak="earned"], [data-chispa-streak="recharged"]) .chispa-help-count:not(.chispa-help-previous-count) { animation: chispa-streak-count 400ms 780ms ease-out; }
  .is-streak-animating:is([data-chispa-streak="earned"], [data-chispa-streak="recharged"]) .chispa-help-flower { animation: chispa-flower-bloom 400ms 780ms ease-out; }
}
@keyframes chispa-streak-join {
  from { opacity: 0; transform: translate(-9px, 8px) rotate(-14deg) scale(.65); }
  to { opacity: 1; transform: none; }
}
@keyframes chispa-streak-away {
  from { visibility: visible; opacity: 1; transform: none; }
  to { visibility: hidden; opacity: 0; transform: translate(var(--streak-out), -28px) rotate(-18deg) scale(.6); }
}
@keyframes chispa-streak-earn {
  0%, 20% { visibility: visible; opacity: 1; transform: none; }
  75% { opacity: 1; }
  100% { visibility: hidden; opacity: 0; transform: translate(var(--streak-in), -42px) scale(.15); }
}
@keyframes chispa-streak-old-count {
  from { visibility: visible; }
  to { visibility: hidden; }
}
@keyframes chispa-streak-count {
  40% { transform: scale(1.3); background: var(--primary); color: var(--surface); }
}
@keyframes chispa-flower-bloom {
  42% { transform: scale(1.18) rotate(-7deg); filter: drop-shadow(0 0 3px var(--accent)); opacity: 1; }
}
@keyframes chispa-discard-bloom {
  0% { visibility: visible; opacity: 0; transform: translate(-10px, -65%) rotate(-14deg) scale(.55); }
  46%, 70% { opacity: 1; transform: translateY(-50%) rotate(4deg) scale(1.1); }
  100% { visibility: visible; opacity: 0; transform: translateY(-55%) scale(.9); }
}
@keyframes chispa-greeting {
  0%, 100% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-7px) rotate(-6deg); }
  70% { transform: translateY(-3px) rotate(5deg); }
}
@media (max-width: 600px) {
  .button.chispa-help-toggle { height: 48px; }
  .question-actions:has(.chispa-help-toggle:not([hidden])) #answer-submit { min-width: 0; gap: 8px; padding-inline: 12px; }
  .chispa-card .chispa { width: 130px; }
  .chispa-card h3 { font-size: 20px; }
  .answer-feedback > .chispa { width: 100px; }
  .chispa-results .chispa { width: 100px; }
}
