/* css/components/sune-play-lesson.css — Sune Play lesson flow */

.sp-lesson,
.ve-modal-inner {
  --sp-primary: #64B5F6;
  --sp-primary-shadow: rgba(100, 181, 246, 0.35);
  --sp-primary-tint: rgba(100, 181, 246, 0.12);
  --sp-duo-blue: #1cb0f6;
  --sp-duo-blue-dark: #1899d6;
  --sp-duo-blue-light: #ddf4ff;
  --sp-duo-blue-border: #b8e8fc;
  --sp-duo-green: #58cc02;
  --sp-duo-green-dark: #46a302;
  --sp-duo-green-light: #e5f8d0;
  --sp-duo-green-border: #a8e06c;
  --sp-duo-yellow: #ffc800;
  --sp-duo-yellow-dark: #e5b400;
  --sp-duo-yellow-light: #fff8d6;
  --sp-duo-yellow-border: #ffe066;
  --sp-correct: #58cc02;
  --sp-correct-tint: rgba(88, 204, 2, 0.12);
  --sp-incorrect: #ef4444;
  --sp-incorrect-tint: rgba(239, 68, 68, 0.12);
  --sp-header-control: 40px;
  --sp-progress-height: 12px;
  --sp-card-padding: clamp(16px, 4vw, 24px);
  --sp-text-fluid: clamp(0.85rem, 0.5rem + 2.5vw, 1.25rem);
}

.sp-lesson {
  --sp-content-max: min(28rem, 100%);
  --sp-choice-max: min(100%, 22rem);
  --sp-choice-quad-max: min(100%, 30rem);
  --sp-card-padding: clamp(12px, 3vw, 28px);
  --sp-touch-target: clamp(38px, 10vw, 52px);
  --sp-header-control: clamp(34px, 8vw, 40px);
  --sp-progress-height: clamp(8px, 0.35rem + 0.6vw, 10px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 60vh;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.sp-lesson-mount {
  width: 100%;
  max-width: min(100%, 720px);
  margin: 0 auto;
  padding-inline: clamp(8px, 3vw, 24px);
  padding-block: clamp(12px, 3vw, 20px) clamp(16px, 3vw, 28px);
  box-sizing: border-box;
  min-width: 0;
}

/* ─── Theory flow ───────────────────────────────────────────────────── */

.sp-theory-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "flow flow"
    "prev next";
  align-items: stretch;
  justify-items: stretch;
  gap: clamp(8px, 2vw, 12px);
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  width: 100%;
  min-width: 0;
}

.sp-theory-flow {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  grid-area: flow;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  min-width: 0;
  height: 100%;
}

.sp-theory-flow-top {
  flex-shrink: 0;
}

.sp-theory-flow-card-wrap {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 4px;
}

.sp-theory-nav {
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sp-header-control);
  height: var(--sp-header-control);
  padding: 0;
  border: 2px solid var(--sp-duo-blue-border);
  border-radius: 50%;
  background: var(--white);
  color: var(--sp-duo-blue);
  cursor: pointer;
  box-shadow: none;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.sp-theory-nav--prev {
  grid-area: prev;
  justify-self: end;
  margin-right: clamp(4px, 2vw, 8px);
}

.sp-theory-nav--next {
  grid-area: next;
  justify-self: start;
  margin-left: clamp(4px, 2vw, 8px);
  background: var(--sp-duo-blue);
  border-color: var(--sp-duo-blue);
  color: var(--white);
}

.sp-theory-nav .material-symbols-outlined {
  font-size: clamp(1.2rem, 0.5rem + 2vw, 1.35rem);
}

.sp-theory-nav:hover:not(:disabled) {
  background: var(--sp-duo-blue-light);
}

.sp-theory-nav:active:not(:disabled) {
  opacity: 0.85;
}

.sp-theory-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.sp-theory-nav--next:hover:not(:disabled) {
  background: #2eb8f7;
}

.sp-theory-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.sp-theory-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--sp-duo-blue-border);
  cursor: pointer;
  transition: background 0.2s ease, width 0.2s ease, transform 0.15s ease;
}

.sp-theory-dot:hover {
  background: var(--sp-duo-blue);
  transform: scale(1.1);
}

.sp-theory-dot--active {
  width: 22px;
  border-radius: 999px;
  background: var(--sp-duo-blue);
}

.sp-theory-dot--active:hover {
  transform: none;
}

.sp-theory-card {
  background: var(--white);
  border: 2px solid var(--sp-duo-blue);
  border-bottom-width: 4px;
  border-bottom-color: var(--sp-duo-blue-dark);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--sp-duo-blue-dark);
  padding: var(--sp-card-padding);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 24px;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.sp-theory-card-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sp-theory-card-header-main {
  flex: 1;
  min-width: 0;
}

.sp-theory-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--sp-duo-blue-border);
  border-radius: 50%;
  background: var(--white);
  color: var(--sp-duo-blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sp-theory-close .material-symbols-outlined {
  font-size: 1.2rem;
}

.sp-theory-close:hover {
  background: var(--sp-duo-blue-light);
  border-color: var(--sp-duo-blue);
}

.sp-theory-close:active {
  transform: scale(0.95);
}

.sp-theory-card-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--primary);
}

.sp-theory-card-subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.sp-theory-card-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 12px 4px 0;
  margin-top: 4px;
  border-top: 1px solid var(--sp-duo-blue-border);
}

.sp-theory-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  margin: 0 0 10px;
}

/* Form table — stacks on mobile */
.sp-form-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sp-form-table-row {
  background: var(--bg-light);
  border-radius: 14px;
  padding: 12px 14px;
}

.sp-form-table-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--sp-primary);
  margin-bottom: 8px;
}

.sp-form-table-cols {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sp-form-table-cell {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-dark);
}

.sp-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sp-comparison-head {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  padding: 0 10px 8px;
  border-bottom: 2px solid var(--sp-duo-blue-border);
}

.sp-comparison-head:first-child {
  color: var(--sp-primary);
}

.sp-comparison-row {
  border-bottom: 1px solid var(--sp-duo-blue-border);
}

.sp-comparison-row:last-child {
  border-bottom: none;
}

.sp-comparison-cell {
  padding: 10px;
  vertical-align: top;
  line-height: 1.45;
}

.sp-comparison-cell--label {
  font-weight: 700;
  color: var(--text-dark);
  border-right: 1px solid var(--sp-duo-blue-border);
  width: 38%;
}

.sp-comparison-cell--value {
  color: var(--text-medium);
  font-style: italic;
}

.sp-comparison-cell--value strong {
  color: var(--text-dark);
  font-style: normal;
}

.sp-comparison-cell--value em {
  color: var(--text-dark);
  font-style: italic;
}

.sp-comparison-layout {
  display: block;
}

.sp-comparison-accordion {
  display: none;
  flex-direction: column;
  border: 1px solid var(--sp-duo-blue-border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.sp-comparison-accordion-item {
  border-bottom: 1px solid var(--sp-duo-blue-border);
}

.sp-comparison-accordion-item:last-child {
  border-bottom: none;
}

.sp-comparison-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.sp-comparison-accordion-label {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-dark);
}

.sp-comparison-accordion-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--sp-duo-blue-border);
  border-radius: 50%;
  background: var(--sp-duo-blue-light);
  color: #1899d6;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sp-comparison-accordion-toggle .material-symbols-outlined {
  font-size: 22px;
}

.sp-comparison-accordion-toggle:hover,
.sp-comparison-accordion-toggle:focus-visible {
  background: rgba(28, 176, 246, 0.18);
  border-color: #1899d6;
  outline: none;
}

.sp-comparison-accordion-toggle:active {
  transform: scale(0.95);
}

.sp-comparison-accordion-item--expanded .sp-comparison-accordion-toggle {
  background: #1899d6;
  border-color: #1899d6;
  color: #fff;
}

.sp-comparison-accordion-panel {
  padding: 0 14px 12px;
}

.sp-comparison-accordion-panel[hidden] {
  display: none;
}

button.sp-comparison-accordion-example.sp-speakable {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-medium);
  font-style: italic;
}

button.sp-comparison-accordion-example.sp-speakable + button.sp-comparison-accordion-example.sp-speakable {
  margin-top: 6px;
}

button.sp-comparison-accordion-example.sp-speakable strong {
  color: var(--text-dark);
  font-style: normal;
}

@media (max-width: 768px) {
  .sp-comparison-table--desktop {
    display: none;
  }

  .sp-comparison-accordion--mobile {
    display: flex;
  }
}

.sp-remember-list em,
.sp-remember-desc em {
  font-style: italic;
}

@media (min-width: 480px) {
  .sp-form-table-cols {
    flex-direction: row;
    gap: 12px;
  }
  .sp-form-table-cell {
    flex: 1;
  }

  .sp-sort-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sp-bullet-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-bullet-list li {
  font-size: 0.95rem;
  line-height: 1.45;
}

.sp-example-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-example-line {
  background: var(--editorial-blue-mist);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.sp-speakable {
  display: block;
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sp-speakable:focus-visible {
  outline: 2px solid var(--sp-duo-blue);
  outline-offset: 2px;
}

.sp-speakable-text {
  display: block;
}

.sp-speakable:hover,
.sp-speakable:focus-visible {
  background: rgba(28, 176, 246, 0.06);
}

button.sp-chip.sp-speakable {
  width: auto;
  border: 1px solid var(--sp-duo-blue-border);
}

button.sp-example-line.sp-speakable {
  border: none;
}

.sp-example-line--small {
  font-size: 0.875rem;
  padding: 8px 12px;
}

.sp-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sp-chips-desc {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-medium);
}

.sp-chip-group + .sp-chip-group {
  margin-top: 14px;
}

.sp-chip-group-title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sp-primary);
}

.sp-chips-note {
  margin: 14px 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-dark);
}

.sp-chips-examples {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

/* ─── Transformation guide (active → passive steps) ─────────────── */

.sp-transform-guide {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.sp-transform-guide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.sp-transform-guide-icon {
  font-size: 1.25rem;
  color: var(--sp-duo-blue);
  flex-shrink: 0;
}

.sp-transform-guide-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1899d6;
}

.sp-transform-guide-desc {
  margin: 0 0 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-dark);
}

.sp-transform-comparison {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.sp-transform-sentence {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--sp-duo-blue-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.sp-transform-sentence--passive {
  border-color: rgba(88, 204, 2, 0.35);
  background: rgba(88, 204, 2, 0.04);
}

.sp-transform-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-medium);
}

.sp-transform-sentence--active .sp-transform-label {
  color: #1899d6;
}

.sp-transform-sentence--passive .sp-transform-label {
  color: var(--sp-duo-green-dark);
}

button.sp-transform-sentence-text.sp-speakable {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-dark);
  cursor: pointer;
}

button.sp-transform-sentence-text.sp-speakable:hover,
button.sp-transform-sentence-text.sp-speakable:focus-visible {
  outline: none;
  opacity: 0.85;
}

.sp-transform-arrow {
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--sp-duo-blue);
  padding: 2px 0;
}

.sp-transform-arrow .material-symbols-outlined {
  font-size: 1.4rem;
}

.sp-transform-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-transform-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.sp-transform-step-num {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sp-duo-blue);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 1px;
}

.sp-transform-step--final .sp-transform-step-num {
  background: var(--sp-duo-green);
}

.sp-transform-step-body {
  flex: 1;
  min-width: 0;
}

.sp-transform-step-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dark);
}

.sp-transform-build {
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--white);
  border: 1px dashed var(--sp-duo-blue-border);
  border-radius: 8px;
}

.sp-transform-build--final {
  border-style: solid;
  border-color: rgba(88, 204, 2, 0.4);
  background: rgba(88, 204, 2, 0.06);
}

button.sp-transform-build-text.sp-speakable {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-dark);
  cursor: pointer;
}

button.sp-transform-build-text.sp-speakable:hover,
button.sp-transform-build-text.sp-speakable:focus-visible {
  outline: none;
  opacity: 0.85;
}

.sp-chip {
  display: inline-block;
  background: var(--sp-duo-blue-light);
  color: #1899d6;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--sp-duo-blue-border);
}

button.sp-chip.sp-chip--dict {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

button.sp-chip.sp-chip--dict:hover,
button.sp-chip.sp-chip--dict:focus-visible {
  background: rgba(28, 176, 246, 0.18);
  border-color: #1899d6;
  outline: none;
}

button.sp-chip.sp-chip--dict:active {
  transform: scale(0.97);
}

.sp-remember-box {
  display: flex;
  gap: 12px;
  background: var(--editorial-cream);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(236, 163, 117, 0.3);
}

.sp-remember-box--watchout {
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.28);
  border-left: 3px solid #eab308;
}

.sp-theory-remember--watchout .sp-remember-icon {
  color: #ca8a04;
}

.sp-theory-remember--watchout .sp-remember-title {
  color: #92400e;
}

.sp-remember-icon {
  color: var(--editorial-terracotta);
  flex-shrink: 0;
}

.sp-remember-icon .material-symbols-outlined {
  font-size: 1.5rem;
}

.sp-remember-title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
}

.sp-remember-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.sp-remember-list--examples {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sp-theory-example-item {
  margin: 0;
}

.sp-theory-example-item--plain {
  line-height: 1.5;
}

.sp-theory-example-item--split {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-theory-example-note {
  margin: 0;
  line-height: 1.5;
}

.sp-theory-example-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-theory-example-pill {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.45;
}

.sp-theory-example-pill--incorrect {
  background: rgba(254, 226, 226, 0.55);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.sp-theory-example-pill--correct {
  background: rgba(220, 252, 231, 0.55);
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.sp-example-mark {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.sp-example-mark--incorrect {
  color: #dc2626;
  background: rgba(254, 226, 226, 0.95);
  border: 1px solid rgba(248, 113, 113, 0.45);
}

.sp-example-mark--correct {
  color: #16a34a;
  background: rgba(220, 252, 231, 0.95);
  border: 1px solid rgba(74, 222, 128, 0.45);
}

.sp-example-text {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}

.sp-example-text--incorrect s {
  color: #64748b;
  text-decoration-color: #dc2626;
}

.sp-example-text--incorrect s strong {
  color: #64748b;
  font-weight: 600;
}

.sp-theory-example-speak {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.sp-theory-example-speak .sp-speakable-text {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.sp-theory-example-speak:focus-visible {
  outline: 2px solid var(--sp-duo-blue);
  outline-offset: 2px;
  border-radius: 8px;
}

.sp-remember-examples {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sp-remember-examples .sp-example-line {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(236, 163, 117, 0.22);
  color: var(--text-dark);
}

.sp-explanation-text {
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  color: var(--text-medium);
}

.sp-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

button.sp-vocab-word-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  min-height: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--sp-duo-blue-border);
  background: var(--bg-light);
  text-align: left;
  cursor: pointer;
}

button.sp-vocab-word-card:hover,
button.sp-vocab-word-card:focus-visible {
  background: var(--sp-duo-blue-light);
  border-color: var(--sp-duo-blue);
}

.sp-vocab-word {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
}

.sp-vocab-variant {
  font-size: 0.72rem;
  color: var(--text-medium);
}

.sp-wf-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-wf-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-light);
}

.sp-wf-base {
  flex-shrink: 0;
  min-width: 72px;
  padding-top: 4px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--sp-primary);
}

.sp-wf-chips {
  flex: 1;
  margin: 0;
}

@media (max-width: 480px) {
  .sp-vocab-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .sp-wf-item {
    flex-direction: column;
    gap: 8px;
  }

  .sp-wf-base {
    min-width: 0;
    padding-top: 0;
  }
}

.sp-compare-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-compare-item {
  border-radius: 14px;
  padding: 12px 14px;
}

.sp-compare-item p {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.sp-compare-speak {
  border: none;
  background: transparent;
  padding: 0;
  margin-top: 8px;
  width: 100%;
}

.sp-compare-speak .sp-speakable-text p {
  margin: 0;
  font-size: 0.95rem;
}

.sp-compare-item--correct {
  background: var(--sp-correct-tint);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.sp-compare-item--careful {
  background: rgba(255, 184, 173, 0.2);
  border: 1px solid rgba(255, 184, 173, 0.4);
}

.sp-compare-example-body {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.sp-compare-example-body .sp-compare-speak {
  flex: 1;
  margin-top: 0;
}

.sp-compare-example-body .sp-example-text--incorrect s {
  color: #64748b;
  text-decoration-color: #dc2626;
}

.sp-compare-example-body .sp-example-text--incorrect s strong {
  color: #64748b;
  font-weight: 600;
}

.sp-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 99px;
}

.sp-badge--correct {
  background: var(--sp-correct-tint);
  color: var(--sp-correct);
}

.sp-badge--careful {
  background: rgba(255, 184, 173, 0.4);
  color: #c45c4a;
}

/* ─── Buttons ───────────────────────────────────────────────────────── */

.sp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  border: none;
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.sp-btn[hidden] {
  display: none !important;
}

.sp-btn:active {
  transform: scale(0.98);
}

.sp-btn--primary {
  background: var(--sp-duo-blue);
  color: var(--white);
  border: 2px solid var(--sp-duo-blue);
  border-bottom-width: 4px;
  border-bottom-color: var(--sp-duo-blue-dark);
  box-shadow: 0 4px 0 var(--sp-duo-blue-dark);
}

.sp-btn--primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--sp-duo-blue-dark);
}

.sp-btn--icon .material-symbols-outlined,
.sp-btn--action .material-symbols-outlined {
  font-size: clamp(1.25rem, 0.5rem + 3vw, 1.6rem);
}

.sp-btn--action {
  min-height: var(--sp-touch-target);
}

.sp-btn--continue-mode.sp-btn--correct {
  background: var(--sp-correct);
  border-color: var(--sp-correct);
  border-bottom-color: #16a34a;
  box-shadow: 0 4px 0 #16a34a;
}

.sp-btn--continue-mode.sp-btn--incorrect {
  background: var(--sp-incorrect);
  border-color: var(--sp-incorrect);
  border-bottom-color: #dc2626;
  box-shadow: 0 4px 0 #dc2626;
}

.sp-btn--continue-mode:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #16a34a;
}

.sp-btn--continue-mode.sp-btn--correct:active:not(:disabled) {
  border-bottom-color: #16a34a;
}

.sp-btn--continue-mode.sp-btn--incorrect:active:not(:disabled) {
  border-bottom-color: #dc2626;
  box-shadow: 0 2px 0 #dc2626;
}

.sp-btn--retry-mode {
  background: var(--sp-primary);
}

.sp-btn--explain {
  width: auto;
  min-height: 44px;
  padding: 10px 18px;
  margin-top: 4px;
  align-self: flex-start;
}

.sp-btn--explain .material-symbols-outlined {
  font-size: 1.4rem;
}

.sp-btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.sp-btn--ghost {
  background: transparent;
  color: var(--text-medium);
  border: 2px solid var(--border-light);
  margin-top: 10px;
}

/* ─── Practice node list ────────────────────────────────────────────── */

.sp-node-list-header {
  text-align: center;
  padding: 8px 0 16px;
}

.sp-node-list-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.5rem;
  margin: 0;
  color: var(--primary);
}

.sp-node-list-subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.sp-node-list-hint {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--editorial-terracotta);
  font-weight: 600;
}

.sp-node-list-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sp-node-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: none;
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.15s;
}

.sp-node-card:not(:disabled):active {
  transform: scale(0.99);
}

.sp-node-card--locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.sp-node-card--done {
  border: 2px solid rgba(100, 181, 246, 0.35);
}

.sp-node-num {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary);
  flex-shrink: 0;
}

.sp-node-body {
  flex: 1;
  min-width: 0;
}

.sp-node-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.sp-node-focus {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-light);
}

.sp-node-check {
  color: var(--sp-correct);
  font-size: 1.5rem;
}

.sp-node-lock,
.sp-node-arrow {
  color: var(--text-light);
  font-size: 1.4rem;
}

.sp-review-theory-btn {
  margin-top: 16px;
  width: auto;
  min-height: 48px;
  padding: 12px 20px;
  align-self: center;
}

.sp-review-theory-btn .material-symbols-outlined {
  font-size: 1.5rem;
}

/* ─── Practice session ──────────────────────────────────────────────── */

.sp-practice-session {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 70vh;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.sp-practice-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(6px, 2vw, 10px);
  padding: clamp(6px, 1.5vw, 8px) 0 clamp(10px, 3vw, 16px);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.sp-header-btn {
  width: var(--sp-header-control);
  height: var(--sp-header-control);
  min-width: var(--sp-header-control);
  min-height: var(--sp-header-control);
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
  flex-shrink: 0;
  color: var(--sp-duo-blue-dark);
  box-sizing: border-box;
  overflow: hidden;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.1s ease;
}

.sp-header-btn .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
  display: block;
}

.sp-header-btn:hover {
  background: #c8ecff;
}

.sp-header-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--sp-duo-blue-dark);
}

.sp-session-progress {
  flex: 1 1 6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.sp-session-progress-pills {
  display: flex;
  align-items: center;
  gap: clamp(3px, 0.7vw, 7px);
  width: 100%;
  min-width: 0;
}

.sp-session-progress-pill {
  flex: 1 1 12px;
  width: auto;
  min-width: 5px;
  max-width: 24px;
  height: var(--sp-progress-height);
  border: 2px solid var(--sp-duo-blue-border);
  border-radius: 99px;
  background: var(--white);
  box-sizing: border-box;
  transition:
    flex-grow 0.25s ease,
    max-width 0.25s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.sp-session-progress-pill--correct {
  border-color: var(--sp-correct);
  background: var(--sp-correct);
  box-shadow: inset 0 -2px 0 rgba(50, 130, 0, 0.22);
}

.sp-session-progress-pill--incorrect {
  border-color: var(--sp-incorrect);
  background: var(--sp-incorrect);
  box-shadow: inset 0 -2px 0 rgba(153, 27, 27, 0.2);
}

.sp-session-progress-pill--active {
  flex-grow: 2;
  max-width: 38px;
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue);
  box-shadow: 0 0 0 2px var(--sp-duo-blue-light);
}

.sp-session-progress-pill--correct.sp-session-progress-pill--active.sp-session-progress-pill--feedback {
  border-color: var(--sp-correct);
  background: var(--sp-correct);
  box-shadow: 0 0 0 2px var(--sp-correct-tint);
}

.sp-session-progress-pill--incorrect.sp-session-progress-pill--active.sp-session-progress-pill--feedback {
  border-color: var(--sp-incorrect);
  background: var(--sp-incorrect);
  box-shadow: 0 0 0 2px var(--sp-incorrect-tint);
}

.sp-session-progress-pill--moved {
  animation: sp-progress-pill-requeued 0.4s ease both;
}

@keyframes sp-progress-pill-requeued {
  0% {
    opacity: 0.35;
    transform: translateX(-12px) scaleX(0.7);
  }
  65% {
    opacity: 1;
    transform: translateX(2px) scaleX(1.08);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sp-session-progress-pill {
    transition: none;
  }

  .sp-session-progress-pill--moved {
    animation: none;
  }
}

.sp-hearts-bar {
  display: flex;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  max-width: 100%;
  justify-content: flex-end;
}

.sp-heart-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--sp-header-control);
  height: var(--sp-header-control);
  flex-shrink: 0;
  line-height: 1;
}

.sp-heart-badge__icon {
  font-size: var(--sp-header-control);
  color: #be123c;
  font-variation-settings: 'FILL' 1;
  line-height: 1;
}

.sp-heart-badge__count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.12em;
  font-size: clamp(0.55rem, 0.4rem + 1vw, 0.72rem);
  font-weight: 800;
  color: #be123c;
  text-shadow: 0 1px 0 rgba(127, 29, 29, 0.45);
}

.sp-heart-badge--empty .sp-heart-badge__icon {
  color: #94a3b8;
  font-variation-settings: 'FILL' 0;
}

.sp-heart-badge--empty .sp-heart-badge__count {
  color: #64748b;
  text-shadow: none;
}

.sp-practice-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 20px;
  border: 2px solid var(--sp-duo-blue);
  border-bottom-width: 4px;
  border-bottom-color: var(--sp-duo-blue-dark);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--sp-duo-blue-dark);
  background: var(--white);
  overflow: hidden;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sp-practice-main--correct {
  border-color: var(--sp-correct);
  border-bottom-color: #16a34a;
  box-shadow: 0 4px 0 #16a34a;
}

.sp-practice-main--incorrect {
  border-color: var(--sp-incorrect);
  border-bottom-color: #dc2626;
  box-shadow: 0 4px 0 #dc2626;
}

.sp-practice-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sp-exercise-card {
  padding: var(--sp-card-padding);
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
}

/* Practice card — todos los formatos usan el ancho completo de la tarjeta */
.sp-practice-main {
  --sp-content-max: 100%;
}

.sp-practice-main .sp-exercise-card {
  padding: var(--sp-card-padding);
  align-items: stretch;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--sentence-build) {
  align-items: stretch;
  max-width: 100%;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--hunt) {
  align-items: stretch;
  max-width: 100%;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--passage-gap) {
  overflow: hidden;
  align-items: stretch;
  justify-content: flex-start;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--wbseq) {
  overflow: hidden;
  align-items: stretch;
  justify-content: flex-start;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--crossword) {
  align-items: stretch;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--column-match) {
  align-items: stretch;
  justify-content: flex-start;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--column-match) .sp-screen--column-match {
  max-width: 100%;
  align-self: stretch;
  margin-inline: 0;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--crossword) .sp-screen--crossword {
  max-width: 100%;
  align-self: stretch;
  margin-inline: 0;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--hunt) .sp-screen--hunt {
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
  max-width: 100%;
  align-self: stretch;
  margin-inline: 0;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--conversation-gap) {
  overflow: hidden;
  align-items: stretch;
  justify-content: flex-start;
  max-width: 100%;
  padding: 0;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--conversation-gap) .sp-screen--conversation-gap {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  justify-content: flex-start;
  max-width: 100%;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--passage-gap) .sp-screen--passage-gap {
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
  max-width: 100%;
}

.sp-practice-main .sp-screen--conversation-gap {
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
  max-width: 100%;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--wbseq) .sp-screen--wbseq {
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
  max-width: 100%;
}

.sp-practice-main .sp-screen {
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  align-self: stretch;
  box-sizing: border-box;
}

.sp-practice-main .sp-screen--choice .sp-option-grid,
.sp-practice-main .sp-screen--guided-error .sp-option-grid,
.sp-practice-main .sp-screen--meaning .sp-option-grid {
  align-self: center;
}

.sp-practice-main .sp-screen--sentence-build,
.sp-practice-main .sp-screen--sentence-rewrite {
  max-width: 100%;
  --sp-content-max: 100%;
}

.sp-practice-main .sp-screen--conversation-gap {
  max-width: 100%;
  align-self: stretch;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-inline: 0;
}

.sp-practice-main .sp-screen--comma-slots {
  max-width: 100%;
  align-self: stretch;
  min-width: 0;
  margin-inline: 0;
}

.sp-practice-main .sp-screen .sp-session-instruction,
.sp-practice-main .sp-screen .sp-prompt-sentence,
.sp-practice-main .sp-screen .sp-prompt-row,
.sp-practice-main .sp-screen .sp-display-prompt,
.sp-practice-main .sp-screen .sp-meaning-sentence,
.sp-practice-main .sp-screen .sp-gap-instruction,
.sp-practice-main .sp-screen .sp-step-label,
.sp-practice-main .sp-screen .sp-text-input,
.sp-practice-main .sp-screen .sp-passage-card,
.sp-practice-main .sp-screen .sp-hunt-counter,
.sp-practice-main .sp-screen .sp-hunt-correction,
.sp-practice-main .sp-screen .sp-guided-progress,
.sp-practice-main .sp-screen .sp-guided-prompt,
.sp-practice-main .sp-screen .sp-guided-wrong,
.sp-practice-main .sp-screen .sp-verb-bank,
.sp-practice-main .sp-screen .sp-sort-verb-pool,
.sp-practice-main .sp-screen .sp-wbt-grid-scroll,
.sp-practice-main .sp-screen .sp-gap-wordbank,
.sp-practice-main .sp-screen .sp-comma-sentence,
.sp-practice-main .sp-screen .sp-kwt-prompt,
.sp-practice-main .sp-screen .sp-kwt-target,
.sp-practice-main .sp-screen .sp-kwt-word-count,
.sp-practice-main .sp-screen .sp-sort-groups,
.sp-practice-main .sp-screen .sp-tile-answer,
.sp-practice-main .sp-screen .sp-tile-bank,
.sp-practice-main .sp-screen .sp-visual-prompt {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.sp-practice-main .sp-screen .sp-schedule-ref {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.sp-practice-main .sp-option-grid {
  width: 100%;
  max-width: var(--sp-choice-max);
  margin-inline: auto;
}

.sp-practice-main .sp-option-grid--quad {
  max-width: var(--sp-choice-quad-max);
}

.sp-session-instruction {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
  font-size: var(--sp-text-fluid);
  font-weight: 800;
  color: #3c3c3c;
  text-align: left;
  line-height: 1.35;
  margin: 0 0 20px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  flex-shrink: 0;
  overflow-wrap: anywhere;
}

.sp-exercise-card:has(.sp-screen--gap) {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
}

.sp-exercise-card:has(.sp-screen--gap:not(.sp-screen--word-bank-gap):not(.sp-screen--wbseq)) {
  flex: 0 1 auto;
  justify-content: center;
  min-height: 0;
}

.sp-screen {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  max-width: var(--sp-content-max);
  margin-inline: auto;
  min-height: 0;
  box-sizing: border-box;
}

.sp-practice-footer {
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border-light);
  background: var(--white);
  /* Keep footer buttons above the phone's bottom gesture/browser bar */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sp-practice-footer-inner {
  display: flex;
  flex-direction: column;
}

.sp-exercise-tip-mount {
  flex-shrink: 0;
  margin-top: auto;
  padding: 0 clamp(10px, 3vw, 20px);
}

.sp-exercise-tip-mount:not([hidden]) {
  padding-top: clamp(8px, 2vw, 12px);
  padding-bottom: clamp(8px, 2vw, 12px);
}

.sp-practice-main:has(.sp-exercise-tip-mount:not([hidden])) .sp-practice-footer {
  border-top: none;
}

.sp-exercise-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 2px dashed #fbbf24;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffbeb 0%, #fef9c3 100%);
  color: #713f12;
}

.sp-exercise-tip__icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  color: #ca8a04;
  margin-top: 1px;
}

.sp-exercise-tip__text {
  margin: 0;
  font-size: clamp(0.82rem, 0.5rem + 0.9vw, 0.95rem);
  line-height: 1.45;
}

.sp-exercise-tip .sp-explanation-emphasis,
.sp-explanation-section--tip .sp-explanation-emphasis {
  color: #854d0e;
  background: #fde68a;
}

.sp-explanation-emphasis {
  font-weight: 700;
  color: var(--sp-duo-blue-dark, #1e40af);
  background: var(--sp-duo-blue-light, #eff6ff);
  padding: 0 0.2em;
  border-radius: 4px;
}

.sp-explanation-term {
  display: inline;
  padding: 1px 7px;
  margin: 0 1px;
  border-radius: 8px;
  font-weight: 800;
  color: var(--ex-duo-purple-dark, #7c3aed);
  background: var(--ex-duo-purple-light, #f3e8ff);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.sp-snippet-highlight {
  font-weight: 700;
  color: var(--sp-duo-blue-dark, #1e40af);
  background: var(--sp-duo-blue-light, #eff6ff);
  padding: 0 0.15em;
  border-radius: 4px;
}

.sp-practice-footer-actions {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: clamp(6px, 2vw, 12px);
  padding: clamp(8px, 2.5vw, 16px) clamp(10px, 3vw, 20px);
  border-top: 1px solid var(--border-light);
}

.sp-footer-actions-right {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: clamp(6px, 2vw, 10px);
  margin-left: auto;
  flex: 0 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

.sp-btn--skip {
  width: auto;
  min-width: clamp(68px, 18vw, 96px);
  min-height: var(--sp-touch-target);
  padding: clamp(7px, 2vw, 14px) clamp(10px, 3vw, 20px);
  background: var(--white);
  color: var(--text-medium);
  border: 2px solid var(--sp-duo-blue-border);
  border-bottom-width: 3px;
  border-bottom-color: #dce3f0;
  border-radius: clamp(14px, 3vw, 16px);
  box-shadow: 0 3px 0 #dce3f0;
  font-size: clamp(0.78rem, 0.5rem + 1vw, 0.95rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.1s ease;
}

.sp-btn--skip:hover:not(:disabled) {
  background: var(--sp-duo-blue-light);
  border-color: var(--sp-duo-blue);
  color: var(--sp-duo-blue-dark);
}

.sp-btn--skip:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #dce3f0;
}

.sp-btn--skip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sp-practice-footer--feedback .sp-btn--skip {
  display: none !important;
}

.sp-practice-footer:not(.sp-practice-footer--feedback):not(.sp-practice-footer--explain-available) .sp-btn--explain-icon {
  display: none !important;
}

.sp-practice-footer:not(.sp-practice-footer--hint-available) .sp-btn--hint-icon {
  display: none !important;
}

.sp-btn--hint-icon {
  width: var(--sp-touch-target);
  min-width: var(--sp-touch-target);
  min-height: var(--sp-touch-target);
  padding: 0;
  background: var(--white);
  color: #ca8a04;
  border: 2px solid #fbbf24;
  border-bottom-width: 3px;
  border-bottom-color: #d97706;
  border-radius: clamp(14px, 3vw, 16px);
  box-shadow: 0 3px 0 #d97706;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.1s ease;
}

.sp-btn--hint-icon:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #d97706;
}

.sp-btn--hint-icon .material-symbols-outlined {
  font-size: clamp(1.2rem, 0.5rem + 2.5vw, 1.5rem);
}

.sp-btn--hint-icon:hover {
  background: #fffbeb;
  border-color: #f59e0b;
}

.sp-btn--hint-icon.sp-btn--hint-active {
  background: #fef9c3;
  color: #a16207;
  border-color: #f59e0b;
  border-bottom-color: #d97706;
  box-shadow: 0 3px 0 #d97706;
}

.sp-btn--hint-icon.sp-btn--hint-active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.sp-btn--explain-icon {
  width: var(--sp-touch-target);
  min-width: var(--sp-touch-target);
  min-height: var(--sp-touch-target);
  padding: 0;
  background: var(--white);
  color: var(--text-medium);
  border: 2px solid var(--sp-duo-blue-border);
  border-bottom-width: 3px;
  border-bottom-color: #dce3f0;
  border-radius: clamp(14px, 3vw, 16px);
  box-shadow: 0 3px 0 #dce3f0;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.1s ease;
}

.sp-btn--explain-icon:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #dce3f0;
}

.sp-btn--explain-icon .material-symbols-outlined {
  font-size: clamp(1.2rem, 0.5rem + 2.5vw, 1.5rem);
}

.sp-btn--explain-icon:hover {
  background: var(--bg-light);
  border-color: var(--text-light);
}

.sp-btn--explain-icon.sp-btn--explain-active {
  background: var(--white);
  color: var(--sp-duo-blue);
  border-color: var(--sp-duo-blue);
  border-bottom-color: var(--sp-duo-blue-dark);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
}

.sp-btn--explain-icon.sp-btn--explain-active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.sp-btn--explain-icon.sp-btn--explain-active:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--sp-duo-blue-dark);
}

/* ── In-card explanation view (Duo style) ─────────────────────────────────── */

.sp-practice-main .sp-exercise-card--explanation,
.sp-practice-main .sp-exercise-card.sp-exercise-card--explanation {
  align-items: stretch;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sp-exercise-card--explanation {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  background: var(--white);
}

.sp-exercise-card--explanation > .sp-screen[hidden] {
  display: none !important;
}

.sp-explanation-card-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: none;
  align-self: stretch;
  animation: spExplanationCardIn 0.28s cubic-bezier(0.34, 1.1, 0.64, 1) both;
}

@keyframes spExplanationCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.sp-explanation-card-view-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-height: 0;
  padding-bottom: clamp(12px, 3vw, 20px);
}

.sp-cm-explanation-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: clamp(14px, 3vw, 18px) clamp(18px, 4vw, 26px);
  border-bottom: 2px solid var(--sp-duo-blue-border);
  background: var(--white);
}

.sp-cm-explanation-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0 0.55rem;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #94a3b8;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  cursor: default;
  user-select: none;
}

button.sp-cm-explanation-tile {
  cursor: pointer;
  border-color: var(--sp-duo-blue-border);
  background: var(--sp-duo-blue-light);
  color: var(--sp-duo-blue-dark);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

button.sp-cm-explanation-tile:hover:not(:disabled) {
  border-color: var(--sp-duo-blue);
  background: #dff0ff;
}

button.sp-cm-explanation-tile:active:not(:disabled) {
  transform: translateY(1px);
}

.sp-cm-explanation-tile--active {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue);
  color: var(--white);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
}

.sp-cm-explanation-tile--disabled {
  opacity: 0.55;
}

.sp-cm-explanation-tile--preview.sp-cm-explanation-tile--active {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
  color: var(--sp-duo-blue-dark);
  box-shadow: inset 0 0 0 2px var(--sp-duo-blue);
}

.sp-cm-explanation-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.sp-explanation-card-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sp-explanation-card-context--with-badge .sp-explanation-card-context-header {
  margin-bottom: 10px;
}

.sp-cm-explanation-pair-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: 2px solid var(--sp-duo-blue-border);
  background: var(--sp-duo-blue-light);
  color: var(--sp-duo-blue-dark);
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
}

.sp-cm-explanation-scroller {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sp-cm-explanation-mobile {
  display: none;
  width: 100%;
}

.sp-cm-explanation-desktop {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.sp-cm-explanation-scroller::-webkit-scrollbar {
  display: none;
}

.sp-cm-explanation-track {
  display: flex;
  width: max-content;
  min-width: 100%;
}

.sp-cm-explanation-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.sp-cm-explanation-slide-placeholder {
  min-height: 1px;
}

.sp-explanation-card-context,
.sp-explanation-card-answer,
.sp-explanation-card-why {
  width: 100%;
  box-sizing: border-box;
  padding: clamp(16px, 3.5vw, 22px) clamp(18px, 4vw, 26px);
  border: none;
  border-bottom: 2px solid var(--sp-duo-blue-border);
  border-radius: 0;
  background: var(--white);
}

.sp-explanation-card-context-label,
.sp-explanation-card-answer-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-duo-blue-dark);
  background: var(--sp-duo-blue-light);
  border: 2px solid var(--sp-duo-blue-border);
}

.sp-explanation-card-context-label .material-symbols-outlined,
.sp-explanation-card-answer-label .material-symbols-outlined {
  font-size: 0.95rem;
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 20;
  color: var(--sp-duo-blue);
}

.sp-explanation-card-context-text,
.sp-explanation-card-answer-text {
  margin: 0;
  padding: 12px 14px;
  border: 2px solid var(--sp-duo-blue-border);
  border-bottom-width: 3px;
  border-bottom-color: var(--sp-duo-blue-dark);
  border-radius: 14px;
  background: var(--white);
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(1rem, 0.5rem + 2vw, 1.12rem);
  font-weight: 700;
  line-height: 1.55;
  color: #3c3c3c;
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
}

.sp-explanation-gap {
  display: inline-block;
  min-width: 2.8em;
  min-height: 1.2em;
  padding: 0 0.35em;
  margin: 0 0.1em;
  border-bottom: 2px dashed var(--sp-duo-blue);
  vertical-align: baseline;
}

.sp-explanation-context-label {
  display: inline-block;
  margin-right: 0.15em;
  padding: 0.1em 0.55em;
  border-radius: 999px;
  background: var(--sp-duo-blue-light);
  border: 1px solid var(--sp-duo-blue-border);
  font-size: 0.78em;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sp-duo-blue-dark);
  vertical-align: baseline;
}

.sp-explanation-strike {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  color: #b91c1c;
}

.sp-explanation-card-answer-text {
  color: var(--sp-duo-blue-dark);
  font-weight: 800;
}

.sp-explanation-card-why {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-bottom: none;
  background: var(--white);
}

.sp-explanation-card-why-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sp-explanation-card-why-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sp-duo-blue);
  color: var(--white);
  border: 2px solid var(--sp-duo-blue);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
  flex-shrink: 0;
}

.sp-explanation-card-why-icon .material-symbols-outlined {
  font-size: 1.05rem;
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.sp-explanation-card-why-title {
  font-family: 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-duo-blue-dark);
}

.sp-explanation-card-why-body {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid var(--sp-duo-blue-border);
  border-bottom-width: 3px;
  border-bottom-color: var(--sp-duo-blue-dark);
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 1.02rem;
  line-height: 1.62;
  color: #3c3c3c;
  background: var(--white);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
}

.sp-explanation-card-why-body strong {
  font-weight: 800;
  color: var(--sp-duo-blue-dark);
}

/* Structured explanation sections (Sune Play v2) */
.sp-explanation-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.sp-explanation-section {
  width: 100%;
  box-sizing: border-box;
  padding: clamp(14px, 3vw, 20px) clamp(18px, 4vw, 26px);
  border: none;
  border-bottom: 2px solid var(--sp-duo-blue-border);
  border-radius: 0;
  background: var(--white);
}

.sp-explanation-section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sp-explanation-section-body {
  font-family: 'Nunito', sans-serif;
  font-size: 1.02rem;
  line-height: 1.55;
  color: #3c3c3c;
}

.sp-explanation-section-body strong {
  font-weight: 800;
  color: var(--sp-duo-blue-dark);
}

.sp-explanation-section--answer .sp-explanation-section-label {
  background: #dcfce7;
  color: #166534;
}

.sp-explanation-section--answer .sp-explanation-section-body {
  font-weight: 800;
  font-size: 1.12rem;
  color: #166534;
}

.sp-explanation-section--mistake .sp-explanation-section-label {
  background: #fee2e2;
  color: #991b1b;
}

.sp-explanation-section--mistake .sp-explanation-section-body {
  font-weight: 800;
  font-size: 1.08rem;
  color: #991b1b;
}

.sp-explanation-section--mistake-note .sp-explanation-section-label {
  background: #ffedd5;
  color: #9a3412;
}

.sp-option-contrast-term {
  display: inline;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 8px;
  font-weight: 800;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.sp-option-contrast-term--wrong {
  color: #991b1b;
  background: #fee2e2;
}

.sp-option-contrast-term--correct {
  color: #166534;
  background: #dcfce7;
}

.sp-explanation-section--teach .sp-explanation-section-label {
  background: var(--sp-duo-blue-light);
  color: var(--sp-duo-blue-dark);
}

.sp-explanation-section--teach .sp-explanation-section-body {
  padding: 12px 14px;
  border: 2px solid var(--sp-duo-blue-border);
  border-bottom-width: 3px;
  border-bottom-color: var(--sp-duo-blue-dark);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
}

.sp-explanation-section--neutral .sp-explanation-section-label {
  background: #f3f4f6;
  color: #374151;
}

.sp-explanation-section--neutral .sp-explanation-section-body {
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  font-style: italic;
  color: #4b5563;
}

.sp-explanation-section--tip .sp-explanation-section-label {
  background: #fef9c3;
  color: #854d0e;
}

.sp-explanation-section--tip .sp-explanation-section-body {
  padding: 10px 14px;
  border: 2px dashed #facc15;
  border-radius: 14px;
  font-size: 0.95rem;
  color: #713f12;
}

.sp-explanation-inline-block.sp-explanation-section--teach .sp-explanation-inline-block-text,
.sp-explanation-inline-block.sp-explanation-section--neutral .sp-explanation-inline-block-text {
  padding: 12px 14px;
  border-radius: 14px;
}

/* Hide exercise tip while in-card explanation is open */
.sp-practice-main:has(.sp-exercise-card--explanation) .sp-exercise-tip-mount {
  display: none;
}

/* When explanation is open, swap green/red feedback chrome for Duo blue */
.sp-practice-session:has(.sp-exercise-card--explanation) .sp-practice-main--correct,
.sp-practice-session:has(.sp-exercise-card--explanation) .sp-practice-main--incorrect {
  border-color: var(--sp-duo-blue);
  border-bottom-color: var(--sp-duo-blue-dark);
  box-shadow: 0 4px 0 var(--sp-duo-blue-dark);
}

.sp-practice-session:has(.sp-exercise-card--explanation) .sp-practice-footer--feedback.sp-practice-footer--correct,
.sp-practice-session:has(.sp-exercise-card--explanation) .sp-practice-footer--feedback.sp-practice-footer--incorrect {
  background: var(--sp-duo-blue-light);
  border-color: var(--sp-duo-blue-border);
}

.sp-practice-session:has(.sp-exercise-card--explanation) .sp-practice-footer--feedback.sp-practice-footer--incorrect .sp-practice-footer-inner {
  background: transparent;
}

.sp-practice-session:has(.sp-exercise-card--explanation) .sp-btn--continue-mode.sp-btn--correct,
.sp-practice-session:has(.sp-exercise-card--explanation) .sp-btn--continue-mode.sp-btn--incorrect {
  background: var(--sp-duo-blue);
  border-color: var(--sp-duo-blue);
  border-bottom-color: var(--sp-duo-blue-dark);
  box-shadow: 0 4px 0 var(--sp-duo-blue-dark);
}

.sp-practice-session:has(.sp-exercise-card--explanation) .sp-btn--continue-mode.sp-btn--correct:active:not(:disabled),
.sp-practice-session:has(.sp-exercise-card--explanation) .sp-btn--continue-mode.sp-btn--incorrect:active:not(:disabled) {
  border-bottom-color: var(--sp-duo-blue-dark);
  box-shadow: 0 2px 0 var(--sp-duo-blue-dark);
}

.sp-practice-session:has(.sp-exercise-card--explanation) .sp-feedback--correct .sp-feedback-icon,
.sp-practice-session:has(.sp-exercise-card--explanation) .sp-feedback--incorrect .sp-feedback-icon,
.sp-practice-session:has(.sp-exercise-card--explanation) .sp-feedback--correct .sp-feedback-title,
.sp-practice-session:has(.sp-exercise-card--explanation) .sp-feedback--incorrect .sp-feedback-title {
  color: var(--sp-duo-blue);
}

.sp-practice-footer .sp-btn--action {
  width: auto;
  min-width: clamp(80px, 22vw, 140px);
  flex: 0 1 auto;
}

.sp-practice-footer .sp-btn--action[data-mode="check"]:not(:disabled) {
  background: var(--sp-correct);
  border-color: var(--sp-correct);
  border-bottom-color: #16a34a;
  box-shadow: 0 4px 0 #16a34a;
}

.sp-practice-footer .sp-btn--action[data-mode="check"]:not(:disabled):active {
  transform: translateY(2px);
  border-bottom-color: #16a34a;
  box-shadow: 0 2px 0 #16a34a;
}

/* Check with no answer chosen yet: muted look; clicking shakes instead of costing a life. */
.sp-practice-footer .sp-btn--action[data-mode="check"].sp-btn--action--idle,
.sp-practice-footer .sp-btn--action[data-mode="check"].sp-btn--action--idle:not(:disabled) {
  background: #e2e8f4;
  border-color: #e2e8f4;
  border-bottom-color: #cbd5e1;
  box-shadow: 0 4px 0 #cbd5e1;
  color: #94a3b8;
}

.sp-practice-footer .sp-btn--action[data-mode="check"].sp-btn--action--idle:not(:disabled):active {
  transform: none;
  border-bottom-color: #cbd5e1;
  box-shadow: 0 4px 0 #cbd5e1;
}

@keyframes sp-btn-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
}

.sp-btn--shake {
  animation: sp-btn-shake 0.3s ease;
}

.sp-practice-footer--feedback .sp-practice-footer-inner {
  padding: clamp(10px, 2.5vw, 16px) clamp(10px, 3vw, 20px);
  gap: clamp(10px, 2.5vw, 16px);
}

.sp-practice-footer--feedback .sp-feedback-mount {
  padding: 0;
}

.sp-practice-footer--feedback .sp-practice-footer-actions {
  padding: 0;
  border-top: none;
}

/* Feedback footer: row layout needs a bit more width than 480px so text + actions fit side by side */
@media (min-width: 520px) {
  .sp-practice-footer--feedback .sp-practice-footer-inner {
    flex-direction: row;
    align-items: center;
  }

  .sp-practice-footer--feedback .sp-feedback-mount {
    flex: 1;
    min-width: 0;
  }

  .sp-practice-footer--feedback .sp-practice-footer-actions {
    flex-shrink: 0;
    margin-left: auto;
  }
}

.sp-practice-footer--feedback.sp-practice-footer--correct {
  background: var(--sp-correct-tint);
  border-color: rgba(34, 197, 94, 0.25);
}

.sp-practice-footer--feedback.sp-practice-footer--incorrect {
  background: var(--sp-incorrect-tint);
  border-color: rgba(239, 68, 68, 0.25);
}

.sp-practice-footer--feedback.sp-practice-footer--incorrect .sp-practice-footer-inner {
  background: var(--sp-incorrect-tint);
  border-radius: 12px;
}

.sp-practice-footer--feedback.sp-practice-footer--incorrect .sp-practice-footer-actions {
  background: transparent;
}

.sp-practice-footer--feedback.sp-practice-footer--retry {
  background: var(--sp-primary-tint);
  border-color: rgba(100, 181, 246, 0.3);
}

.sp-feedback-mount:empty {
  display: none;
}

/* ─── Screen formats ────────────────────────────────────────────────── */

.sp-prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.sp-prompt-row--choice {
  display: block;
  text-align: left;
  width: 100%;
}

.sp-prompt-row--choice .sp-prompt-sentence {
  display: block;
  margin-bottom: 0;
  text-align: left;
}

.sp-prompt-row .sp-prompt-sentence,
.sp-prompt-row .sp-meaning-sentence {
  flex: 1;
  margin-bottom: 0;
}

.sp-gap-anchor {
  display: inline;
  vertical-align: baseline;
}

.sp-speakable-sentence {
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.sp-speakable-sentence:hover,
.sp-speakable-sentence:focus-visible {
  background: rgba(28, 176, 246, 0.06);
  outline: none;
}

.sp-prompt-sentence,
.sp-display-prompt,
.sp-meaning-sentence {
  font-size: var(--sp-text-fluid);
  line-height: 1.55;
  margin: 0 0 20px;
  color: var(--text-dark);
}

.sp-prompt-row--same-meaning {
  display: block;
  width: 100%;
}

.sp-line-label {
  flex-shrink: 0;
  width: clamp(26px, 6vw, 30px);
  height: clamp(26px, 6vw, 30px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(28, 176, 246, 0.28);
  border-bottom-width: 3px;
  border-bottom-color: rgba(28, 79, 156, 0.28);
  border-radius: 9px;
  background: rgba(28, 176, 246, 0.1);
  box-shadow: 0 2px 0 rgba(28, 176, 246, 0.18);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.78rem, 0.5rem + 0.8vw, 0.86rem);
  font-weight: 800;
  line-height: 1;
  color: var(--sp-duo-blue-dark, #1c4f9c);
  text-transform: lowercase;
}

.sp-labeled-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.sp-labeled-line__text {
  flex: 1;
  min-width: 0;
}

.sp-same-meaning-prompt {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.sp-same-meaning-prompt:hover,
.sp-same-meaning-prompt:focus-visible {
  outline: none;
}

.sp-same-meaning-prompt .sp-labeled-line {
  margin-bottom: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(28, 176, 246, 0.06);
  border: 1px solid rgba(28, 176, 246, 0.14);
}

.sp-same-meaning-prompt .sp-meaning-question {
  background: rgba(28, 176, 246, 0.04);
  border-color: rgba(28, 176, 246, 0.1);
}

.sp-same-meaning-prompt .sp-labeled-line__text {
  font-size: var(--sp-text-fluid);
  line-height: 1.55;
  color: var(--text-dark);
}

.sp-same-meaning-prompt .sp-meaning-question .sp-labeled-line__text {
  font-weight: 600;
}

.sp-meaning-question {
  font-size: var(--sp-text-fluid);
  line-height: 1.5;
  margin: 0 0 20px;
  padding: 0 4px;
  color: var(--text-dark);
  font-weight: 600;
}

.sp-screen--gap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}

.sp-gap-instruction {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--text-medium);
  max-width: 100%;
}

.sp-prompt-row--gap {
  display: block;
  text-align: left;
  width: 100%;
}

.sp-prompt-sentence--inline-gap {
  font-size: var(--sp-text-fluid);
  line-height: 1.8;
  margin: 0;
  width: 100%;
  max-width: 100%;
  display: block;
  text-align: left;
  overflow-wrap: break-word;
  word-break: normal;
}

.sp-prompt-row--gap .sp-prompt-sentence--inline-gap {
  flex: none;
}

.sp-prompt-sentence--multi-gap .sp-gap-verb-ref--trailing {
  margin-left: 2px;
  vertical-align: baseline;
}

.sp-gap-slot {
  display: inline-block;
  min-width: 80px;
  min-height: 1.4em;
  border-bottom: 2px dashed var(--sp-primary);
  color: var(--sp-primary);
  font-weight: 700;
  text-align: center;
  vertical-align: baseline;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.sp-gap-anchor .sp-gap-slot {
  display: inline-block;
  width: 2.5em;
  min-width: 2.5em;
  min-height: 1.2em;
  text-align: left;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sp-gap-anchor--filled .sp-gap-slot {
  display: inline;
  width: auto;
  min-width: 0;
  max-width: 100%;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.sp-gap-anchor--stacked {
  display: inline;
  vertical-align: baseline;
  position: relative;
  z-index: 1;
}

/* Needs higher specificity than ".sp-gap-anchor .sp-gap-slot" (width: 2.5em),
   otherwise the narrow slot clips the tile stack and the sentence text
   following the gap is drawn on top of the tiles. */
.sp-gap-anchor .sp-gap-slot.sp-gap-slot--stacked {
  border-bottom: none;
  min-width: 0;
  width: auto;
  min-height: 0;
  display: inline;
  vertical-align: baseline;
  padding: 0;
  color: inherit;
  font-weight: inherit;
  text-align: left;
}

.sp-choice-tile-stack {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  vertical-align: baseline;
  margin: 0 2px;
  position: relative;
  z-index: 2;
}

.sp-choice-tile-stack .sp-choice-tile {
  width: auto;
  min-width: 0;
  max-width: none;
  min-height: 0;
  padding: 3px 12px;
  line-height: 1.5;
  font-size: inherit;
  font-weight: 700;
  border-radius: 10px;
  flex: 0 0 auto;
  vertical-align: baseline;
  transition: opacity 0.18s ease, border-color 0.15s, background 0.15s, transform 0.1s ease, box-shadow 0.1s ease;
}

.sp-choice-tile-stack .sp-choice-tile .sp-option-label {
  text-align: center;
  flex: 0 1 auto;
  white-space: nowrap;
}

.sp-choice-tile:focus-visible {
  outline: 2px solid var(--sp-duo-blue);
  outline-offset: 2px;
}

/* Both tiles stay visible after a pick so the user can switch options;
   the unchosen one is dimmed but remains tappable. */
.sp-choice-tile-stack--selected .sp-choice-tile:not(.sp-option-btn--selected) {
  opacity: 0.45;
}

.sp-choice-tile-stack--selected .sp-choice-tile:not(.sp-option-btn--selected):hover,
.sp-choice-tile-stack--selected .sp-choice-tile:not(.sp-option-btn--selected):focus-visible {
  opacity: 0.9;
}

.sp-screen--locked .sp-choice-tile-stack .sp-choice-tile {
  cursor: default;
}

.sp-gap-anchor--stacked.sp-gap-anchor--filled .sp-gap-slot--stacked {
  display: inline;
}

.sp-screen--stacked-choice .sp-option-grid {
  display: none;
}

.sp-inline-gap:empty {
  display: inline-block;
  min-width: 60px;
  min-height: 1.4em;
  border-bottom: 2px dashed var(--sp-primary);
  vertical-align: baseline;
}

.sp-inline-gap-group {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 4px;
  margin: 0 2px;
  vertical-align: baseline;
  max-width: 100%;
}

.sp-gap-verb-ref {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 2px;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
  flex-shrink: 1;
}

.sp-hint-word {
  display: inline-block;
  padding: 2px 9px;
  margin: 0 2px;
  background: var(--white);
  border: 2px solid #e2e8f4;
  border-bottom-width: 3px;
  border-bottom-color: #dce3f0;
  border-radius: 999px;
  box-shadow: 0 2px 0 #dce3f0;
  color: var(--text-dark);
  font-family: 'Nunito', sans-serif;
  font-size: 0.85em;
  font-weight: 700;
  font-style: normal;
  line-height: 1.35;
  vertical-align: baseline;
  white-space: nowrap;
}

.sp-wf-root-row {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.sp-wf-root-tile {
  display: inline-block;
  padding: 6px 16px;
  background: #fff;
  border: 2px solid #fecdd3;
  border-bottom-width: 3px;
  border-bottom-color: #fda4af;
  border-radius: 12px;
  box-shadow: 0 2px 0 #fda4af;
  color: #be185d;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.sp-screen--wf-mc .sp-wf-root-tile {
  text-transform: lowercase;
}

.sp-gap-verb-ref .sp-wf-root-tile {
  font-size: 0.75rem;
  padding: 3px 10px;
  text-transform: uppercase;
  border-radius: 10px;
}

/* Word formation: underline input with root word badge to the right */
.sp-inline-gap-group--wf-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  vertical-align: baseline;
  margin: 0 2px;
}

.sp-inline-gap-group--wf-inline .sp-wf-inline-input {
  min-width: 5ch;
  padding: 2px 4px 4px !important;
  text-align: left;
  border: none;
  border-bottom: 2px solid #94a3b8;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sp-inline-gap-group--wf-inline .sp-wf-inline-input:focus {
  outline: none;
  border-bottom-color: var(--sp-duo-blue);
  background: rgba(28, 176, 246, 0.06);
  box-shadow: none;
}

.sp-inline-gap-group--wf-inline.sp-gap-slot--correct .sp-wf-inline-input,
.sp-wbseq-gap--correct .sp-wf-inline-input {
  border-bottom-color: #22c55e;
  color: #15803d;
}

.sp-inline-gap-group--wf-inline.sp-gap-slot--incorrect .sp-wf-inline-input,
.sp-wbseq-gap--incorrect .sp-wf-inline-input {
  border-bottom-color: #ef4444;
  color: #991b1b;
}

.sp-wf-root-badge {
  flex-shrink: 0;
  font-family: 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--sp-duo-blue);
  border: 2px solid var(--sp-duo-blue-dark);
  border-radius: 10px;
  padding: 2px 8px;
  line-height: 1.4;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.sp-inline-gap-group--wf-inline.sp-gap-slot--correct .sp-wf-root-badge,
.sp-wbseq-gap--correct .sp-wf-root-badge {
  background: var(--sp-duo-green);
  border-color: var(--sp-duo-green-dark);
}

.sp-inline-gap-group--wf-inline.sp-gap-slot--incorrect .sp-wf-root-badge,
.sp-wbseq-gap--incorrect .sp-wf-root-badge {
  background: #ff4b4b;
  border-color: #ea2b2b;
}

.sp-hint-slash-sep {
  color: #94a3b8;
  font-weight: 700;
  user-select: none;
  padding: 0 2px;
  vertical-align: baseline;
  font-size: 0.9em;
}

.sp-inline-gap-group--with-ok {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  vertical-align: baseline;
}

.sp-gap-ok-btn {
  flex-shrink: 0;
  min-width: 52px;
  min-height: 36px;
  padding: 6px 12px;
  border: 2px solid #dce3f0;
  border-radius: 12px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--sp-duo-blue-dark);
  cursor: pointer;
  vertical-align: baseline;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.sp-gap-ok-btn:hover:not(:disabled) {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-gap-ok-btn--selected {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
  color: var(--sp-duo-blue-dark);
}

.sp-gap-ok-btn--correct {
  border-color: var(--sp-duo-green, #58cc02);
  background: rgba(88, 204, 2, 0.15);
  color: var(--sp-duo-green-dark, #3d8f00);
}

.sp-gap-ok-btn--incorrect {
  border-color: #ef4444;
  background: rgba(255, 120, 120, 0.15);
  color: #b91c1c;
}

.sp-gap-ok-btn:disabled {
  cursor: default;
  opacity: 1;
}

.sp-screen--locked .sp-gap-ok-btn {
  pointer-events: none;
  cursor: default;
}

.sp-gap-inline-input {
  display: inline-block;
  width: 2ch;
  min-width: 2ch;
  max-width: none;
  margin: 0;
  padding: 2px 2px 4px;
  border: none;
  border-bottom: 2px solid #94a3b8;
  border-radius: 0;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.95rem, 0.65rem + 1.1vw, 1.15rem);
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  vertical-align: baseline;
  box-sizing: content-box;
  box-shadow: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.sp-gap-inline-input:focus {
  outline: none;
  border-bottom-color: var(--sp-duo-blue);
  background: transparent;
  box-shadow: none;
}

/* Solo gap fields (error correction, standalone inline gaps): underline line input. */
.sp-inline-gap-group--solo:not(.sp-kwt-gap-wrap):not(.sp-wbseq-gap-wrap) .sp-gap-underline-input {
  min-width: 5ch;
  padding: 2px 4px 4px;
  border: none;
  border-bottom: 2px solid #94a3b8;
  border-radius: 0;
  background: transparent;
  text-align: left;
  box-shadow: none;
}

.sp-inline-gap-group--solo:not(.sp-kwt-gap-wrap):not(.sp-wbseq-gap-wrap) .sp-gap-underline-input::placeholder {
  color: #94a3b8;
  font-weight: 600;
  opacity: 1;
}

.sp-inline-gap-group--solo:not(.sp-kwt-gap-wrap):not(.sp-wbseq-gap-wrap) .sp-gap-underline-input:focus {
  outline: none;
  border-bottom-color: var(--sp-duo-blue);
  background: rgba(28, 176, 246, 0.06);
  box-shadow: none;
}

.sp-screen--locked .sp-gap-inline-input {
  pointer-events: none;
  cursor: default;
}

.sp-screen--locked .sp-gap-inline-input:focus {
  outline: none;
  box-shadow: none;
}

.sp-inline-gap-group.sp-gap-slot--correct .sp-gap-inline-input {
  border-bottom-color: #22c55e;
  background: transparent;
  color: #15803d;
  box-shadow: none;
}

.sp-inline-gap-group.sp-gap-slot--incorrect .sp-gap-inline-input {
  border-bottom-color: #ef4444;
  background: transparent;
  color: #b91c1c;
  box-shadow: none;
}

.sp-gap-slot--correct {
  color: var(--sp-correct);
  border-bottom-color: var(--sp-correct);
}

.sp-gap-slot--incorrect {
  color: var(--sp-incorrect);
  border-bottom-color: var(--sp-incorrect);
}

.sp-screen--passage-gap {
  width: 100%;
  min-height: 0;
  justify-content: flex-start;
}

.sp-screen--passage-gap .sp-session-instruction {
  flex-shrink: 0;
}

.sp-screen--passage-gap .sp-passage-wordbank {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
}

.sp-passage-gap-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

.sp-passage-gap-scroll .sp-passage-card {
  flex: 1 1 auto;
  min-height: 100%;
}

.sp-passage-wordbank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.sp-passage-wordbank-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--sp-duo-blue-light);
  color: var(--sp-duo-blue-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

.sp-passage-card--gap-fill {
  line-height: 2;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sp-passage-card--justified {
  text-align: justify;
  hyphens: auto;
}

.sp-passage-para {
  margin: 0 0 18px;
  text-align: justify;
  hyphens: auto;
}

.sp-passage-para:last-child {
  margin-bottom: 0;
}

.sp-passage-dialogue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.sp-dialogue-bubble {
  display: flex;
  flex-direction: column;
  max-width: min(88%, 520px);
}

.sp-dialogue-bubble--left {
  align-self: flex-start;
  align-items: flex-start;
}

.sp-dialogue-bubble--right {
  align-self: flex-end;
  align-items: flex-end;
}

.sp-dialogue-speaker {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--sp-duo-blue-dark);
  margin-bottom: 3px;
  padding: 0 6px;
  letter-spacing: 0.02em;
}

.sp-dialogue-bubble__body {
  background: #f1f5f9;
  border: 1px solid #e2e8f4;
  border-radius: 16px;
  padding: 10px 14px;
  line-height: 1.75;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  width: 100%;
  box-sizing: border-box;
}

.sp-dialogue-bubble--right .sp-dialogue-bubble__body {
  background: var(--sp-duo-blue-light);
  border-color: #c8ecff;
}

.sp-dialogue-bubble--left .sp-dialogue-bubble__body {
  border-bottom-left-radius: 4px;
}

.sp-dialogue-bubble--right .sp-dialogue-bubble__body {
  border-bottom-right-radius: 4px;
}

.sp-passage-wordbank-chip--selectable {
  border: 2px solid transparent;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.sp-passage-wordbank-chip--selectable:hover:not(:disabled) {
  border-color: var(--sp-duo-blue);
  transform: translateY(-1px);
}

.sp-passage-wordbank-chip--selectable.sp-passage-wordbank-chip--used,
.sp-passage-wordbank-chip--selectable:disabled,
.sp-passage-wordbank-chip--used {
  opacity: 0.5;
  cursor: default;
  background: #e2e8f0;
  color: #94a3b8;
  border-color: #cbd5e1;
  text-decoration: line-through;
  transform: none;
}

.sp-passage-gap-wrap {
  display: inline;
  margin: 0 2px;
  vertical-align: baseline;
  white-space: normal;
}

/* Word formation passage — C1 Reading Part 3 Duolingo pills */
.sp-passage-card.c1-reading3 .sp-passage-para {
  line-height: 2.75;
}

/* Sequential word formation: deactivated (future) gaps */
.sp-screen--passage-wf-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading3.sp-passage-gap-wrap--future .reading-type3-wf-pill {
  background: #e8edf3;
  border-color: #c5d0dc;
  box-shadow: 0 2px 0 #b0bcc9;
  opacity: 0.78;
  pointer-events: none;
  padding: 2px 4px 2px 3px;
  gap: 2px;
}

.sp-screen--passage-wf-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading3.sp-passage-gap-wrap--future .cu-hint-pill-num,
.sp-screen--passage-wf-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading3.sp-passage-gap-wrap--future .cu-hint-pill-word.cu-wf-pill-word {
  background: #94a3b8;
  border-color: #7b8da0 !important;
  color: #f8fafc;
}

.sp-screen--passage-wf-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading3.sp-passage-gap-wrap--future .reading-type3-pill-input {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #94a3b8 !important;
  pointer-events: none;
  min-width: 1.25ch !important;
  width: 1.25ch !important;
  max-width: 1.25ch !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  flex: 0 0 auto;
}

.sp-screen--passage-wf-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading3.sp-passage-gap-wrap--future .reading-type3-pill-input::placeholder {
  color: transparent;
}

/* Active gap — full colour */
.sp-screen--passage-wf-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading3.sp-passage-gap-wrap--active .reading-type3-wf-pill {
  opacity: 1;
}

/* Completed gaps stay visible but non-interactive */
.sp-screen--passage-wf-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading3.sp-passage-gap-wrap--done,
.sp-screen--passage-wf-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading3.sp-passage-gap-wrap--failed {
  pointer-events: none;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .sp-passage-card.c1-reading3 .sp-passage-para {
    line-height: 2.4;
  }
}

/* Open cloze passage — C1 Reading Part 2 Duolingo pills */
.sp-passage-card.c1-reading2 .sp-passage-para {
  line-height: 2.75;
}

.sp-passage-card .sp-explanation-strike {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #dc2626;
  color: #b91c1c;
  font-weight: 700;
}

.sp-screen--passage-oc-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading2.sp-passage-gap-wrap--future .reading-type2-oc-pill {
  background: #e8edf3;
  border-color: #c5d0dc;
  box-shadow: 0 2px 0 #b0bcc9;
  opacity: 0.78;
  pointer-events: none;
  padding: 2px 4px 2px 3px;
  gap: 2px;
}

.sp-screen--passage-oc-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading2.sp-passage-gap-wrap--future .cu-hint-pill-num {
  background: #94a3b8;
  border-color: #7b8da0 !important;
  color: #f8fafc;
}

.sp-screen--passage-oc-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading2.sp-passage-gap-wrap--future .reading-type2-pill-input {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #94a3b8 !important;
  pointer-events: none;
  min-width: 1.25ch !important;
  width: 1.25ch !important;
  max-width: 1.25ch !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  flex: 0 0 auto;
}

.sp-screen--passage-oc-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading2.sp-passage-gap-wrap--future .reading-type2-pill-input::placeholder {
  color: transparent;
}

.sp-screen--passage-oc-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading2.sp-passage-gap-wrap--active .reading-type2-oc-pill {
  opacity: 1;
}

.sp-screen--passage-oc-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading2.sp-passage-gap-wrap--done,
.sp-screen--passage-oc-c1.sp-screen--passage-sequential .sp-passage-gap-wrap--reading2.sp-passage-gap-wrap--failed {
  pointer-events: none;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .sp-passage-card.c1-reading2 .sp-passage-para {
    line-height: 2.4;
  }
}

.sp-passage-gap-wrap--future {
  opacity: 0.42;
  pointer-events: none;
}

.sp-passage-gap-wrap--future .sp-passage-gap-num {
  background: #94a3b8;
}

.sp-passage-gap-wrap--active .sp-passage-gap-num {
  background: var(--sp-duo-blue);
  box-shadow: 0 0 0 2px rgba(28, 176, 246, 0.25);
}

.sp-passage-gap-wrap--done .sp-passage-gap-num,
.sp-passage-gap--correct .sp-passage-gap-num {
  background: #22c55e;
}

.sp-passage-gap-wrap--failed .sp-passage-gap-num,
.sp-passage-gap--incorrect .sp-passage-gap-num {
  background: #ef4444;
}

.sp-passage-gap-wrap--active .sp-gap-underline-input {
  border-bottom-color: var(--sp-duo-blue);
}

.sp-passage-gap-wrap--active .sp-gap-underline-input:focus {
  outline: none;
  border-bottom-color: var(--sp-duo-blue-dark);
  box-shadow: none;
}

.sp-passage-gap-wrap--done .sp-gap-underline-input,
.sp-passage-gap--correct .sp-gap-underline-input {
  border-bottom-color: #22c55e;
  color: #15803d;
}

.sp-passage-gap-wrap--failed .sp-gap-underline-input,
.sp-passage-gap--incorrect .sp-gap-underline-input {
  border-bottom-color: #ef4444;
  color: #b91c1c;
}

/* Passage word formation — underline input + root badge (Progress Test style) */
.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: baseline;
  opacity: 1;
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap-wrap--future {
  opacity: 1;
  pointer-events: none;
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline .sp-wf-inline-input {
  min-width: 2ch;
  padding: 2px 4px 4px !important;
  text-align: center;
  border: none;
  border-bottom: 2px solid #cbd5e1;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #64748b;
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline .sp-wf-root-badge {
  background: #94a3b8;
  border-color: #7b8da0;
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap-wrap--active .sp-wf-inline-input {
  border-bottom-color: var(--sp-duo-blue);
  color: var(--sp-text, #1e293b);
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap-wrap--active .sp-wf-inline-input:focus {
  outline: none;
  border-bottom-color: var(--sp-duo-blue-dark);
  background: rgba(28, 176, 246, 0.06);
  box-shadow: none;
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap-wrap--active .sp-wf-root-badge {
  background: var(--sp-duo-blue);
  border-color: var(--sp-duo-blue-dark);
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap-wrap--done .sp-wf-inline-input,
.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap--correct .sp-wf-inline-input {
  border-bottom-color: #22c55e;
  color: #15803d;
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap-wrap--done .sp-wf-root-badge,
.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap--correct .sp-wf-root-badge {
  background: var(--sp-duo-green);
  border-color: var(--sp-duo-green-dark);
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap-wrap--failed .sp-wf-inline-input,
.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap--incorrect .sp-wf-inline-input {
  border-bottom-color: #ef4444;
  color: #b91c1c;
}

.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap-wrap--failed .sp-wf-root-badge,
.sp-screen--passage-wf-inline .sp-passage-gap-wrap.sp-inline-gap-group--wf-inline.sp-passage-gap--incorrect .sp-wf-root-badge {
  background: #ff4b4b;
  border-color: #ea2b2b;
}

.sp-screen--inline-gap-sequential .sp-inline-gap-group--future {
  opacity: 0.35;
  pointer-events: none;
}

.sp-screen--inline-gap-sequential .sp-inline-gap-group--future .sp-gap-inline-input {
  border-bottom-color: #cbd5e1;
}

.sp-screen--inline-gap-sequential .sp-inline-gap-group--active .sp-gap-underline-input {
  border-bottom-color: var(--sp-duo-blue);
}

.sp-screen--inline-gap-sequential .sp-inline-gap-group--done .sp-gap-underline-input {
  border-bottom-color: #22c55e;
  color: #15803d;
}

.sp-screen--inline-gap-sequential .sp-inline-gap-group--failed .sp-gap-underline-input {
  border-bottom-color: #ef4444;
  color: #b91c1c;
}

.sp-screen--mc-passage .reading-type5-gap-wrap {
  margin: 0 2px;
}

.sp-screen--mc-passage .reading-type5-gap-trigger {
  font-size: clamp(0.82rem, 0.5rem + 1.2vw, 0.95rem);
}

.sp-screen--mc-passage .reading-type5-gap-choice {
  white-space: nowrap;
  width: 100%;
  box-sizing: border-box;
}

.sp-screen--mc-passage .reading-type5-gap-choice .reading-type5-opt-word {
  white-space: nowrap;
}

.sp-screen--mc-passage .reading-type5-gap-panel {
  width: max-content;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  overflow: hidden;
  border: 2px solid var(--ex-duo-blue, #1cb0f6);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.sp-screen--mc-passage .reading-type5-gap-wrap.reading-type5-gap-open .reading-type5-gap-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sp-screen--mc-passage .reading-type5-gap-panel-options {
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
  border-radius: 0;
  background: #ffffff;
}

/* Blocked (future) gaps: same pill shape, greyed out */
.sp-screen--mc-passage .sp-mc-gap-wrap--future {
  pointer-events: none;
}

.sp-screen--mc-passage .sp-mc-gap-wrap--future .reading-type5-gap-trigger {
  border-color: #d1d5db;
  background: #f3f4f6;
  color: #9ca3af;
  box-shadow: 0 2px 0 #d1d5db;
  cursor: default;
  pointer-events: none;
}

.sp-screen--mc-passage .sp-mc-gap-wrap--active .reading-type5-gap-trigger:not(:disabled) {
  box-shadow:
    0 2px 0 var(--ex-duo-blue-dark, #1899d6),
    0 0 0 2px rgba(28, 176, 246, 0.2);
}

/* Failed gap: red background + red text */
.sp-screen--mc-passage .sp-mc-gap-wrap--failed .reading-type5-gap-trigger,
.sp-screen--mc-passage .reading-type5-gap-trigger.incorrect {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  box-shadow: 0 2px 0 #dc2626;
}

.sp-screen--mc-passage .sp-mc-gap-wrap--done .reading-type5-gap-trigger:disabled,
.sp-screen--mc-passage .reading-type5-gap-trigger.correct {
  border-color: #58a700;
  background: #f0fdf4;
  color: #166534;
  box-shadow: 0 2px 0 #58a700;
}

.sp-screen--mc-passage .reading-type5-gap-trigger.filled:not(:disabled):not(.incorrect) {
  border-color: var(--ex-duo-blue, #1cb0f6);
  background: var(--ex-duo-blue-light, #ddf4ff);
  color: var(--ex-duo-blue-dark, #1899d6);
  box-shadow: 0 2px 0 var(--ex-duo-blue-dark, #1899d6);
}


.sp-screen--passage-sequential .sp-passage-gap-wrap .sp-gap-inline-input:not(.sp-gap-underline-input) {
  min-width: 2ch;
}

/* Pill gap inputs: grow width with typed text (JS sets inline width) */
.sp-screen--passage-gap .c1-reading2 .reading-type2-pill-input,
.sp-screen--passage-gap .c1-reading3 .reading-type3-pill-input {
  width: auto;
  min-width: 52px;
  max-width: 100%;
  box-sizing: border-box;
  flex: 0 1 auto;
}

.sp-passage-gap-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  margin-right: 4px;
  border-radius: 999px;
  background: var(--sp-duo-blue);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: baseline;
}

.sp-passage-gap-wrap .sp-gap-inline-input {
  display: inline-block;
  min-width: 2ch;
  width: 2ch;
  max-width: min(12ch, 28vw);
  font-size: inherit;
  line-height: inherit;
  vertical-align: baseline;
}

.sp-passage-gap-wrap .sp-gap-inline-input.sp-gap-underline-input {
  max-width: none;
  min-width: 2ch;
  text-align: center;
}

.sp-screen--passage-sequential .sp-passage-gap--correct .sp-gap-inline-input,
.sp-screen--passage-sequential .sp-passage-gap--incorrect .sp-gap-inline-input {
  background: transparent !important;
  box-shadow: none;
}

/* ── Find extra word ─────────────────────────────────────────────── */
.sp-screen--few {
  padding: 4px 0;
}

.sp-screen--fewseq .sp-few-row {
  align-items: flex-start;
}

.sp-screen--fewseq .sp-wbseq-sentence .sp-few-sentence {
  text-align: left;
}

.sp-few-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sp-few-sentence {
  flex: 1;
  min-width: 0;
  font-size: clamp(0.9rem, 0.5rem + 1.1vw, 1rem);
  line-height: 2;
  color: var(--text-primary, #1e293b);
}

.sp-few-token {
  display: inline;
  margin: 0;
  padding: 1px 3px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  color: inherit;
  vertical-align: baseline;
}

.sp-few-token--clickable {
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sp-few-token--clickable:hover:not(:disabled) {
  background: var(--sp-duo-blue-light);
  border-color: rgba(28, 176, 246, 0.35);
}

.sp-few-token--selected {
  background: var(--sp-duo-blue-light);
  border-color: var(--sp-duo-blue);
  color: var(--sp-duo-blue-dark);
  text-decoration: line-through;
  font-weight: 600;
}

.sp-few-token--correct {
  background: rgba(88, 204, 2, 0.15);
  border-color: var(--sp-duo-green, #58cc02);
  color: var(--sp-duo-green-dark, #3d8f00);
  text-decoration: line-through;
  cursor: default;
}

.sp-few-token--incorrect {
  background: rgba(255, 120, 120, 0.2);
  border-color: #ef4444;
  color: #b91c1c;
  text-decoration: line-through;
  cursor: default;
}

.sp-few-token--reveal {
  background: rgba(88, 204, 2, 0.12);
  border-color: var(--sp-duo-green, #58cc02);
  color: var(--sp-duo-green-dark, #3d8f00);
  text-decoration: line-through;
  font-weight: 700;
  cursor: default;
}

.sp-few-token--clickable:disabled {
  cursor: default;
}

.sp-few-ok-btn {
  flex-shrink: 0;
  min-width: 52px;
  min-height: 40px;
  padding: 8px 14px;
  border: 2px solid #dce3f0;
  border-radius: 12px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--sp-duo-blue-dark);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.sp-few-ok-btn:hover:not(:disabled) {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-few-ok-btn--selected {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
  color: var(--sp-duo-blue-dark);
}

.sp-few-ok-btn--correct {
  border-color: var(--sp-duo-green, #58cc02);
  background: rgba(88, 204, 2, 0.15);
  color: var(--sp-duo-green-dark, #3d8f00);
}

.sp-few-ok-btn--incorrect {
  border-color: #ef4444;
  background: rgba(255, 120, 120, 0.15);
  color: #b91c1c;
}

.sp-few-ok-btn:disabled {
  cursor: default;
  opacity: 1;
}

@media (max-width: 480px) {
  .sp-few-row {
    flex-direction: column;
    align-items: stretch;
  }

  .sp-few-ok-btn {
    align-self: flex-end;
  }
}

/* ── Keyword transformation ───────────────────────────────────────── */
.sp-screen--kwt {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

.sp-kwt-prompt {
  font-size: clamp(0.92rem, 0.55rem + 1.1vw, 1rem);
  line-height: 1.55;
  color: #64748b;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  width: 100%;
  box-sizing: border-box;
}

.sp-kwt-part {
  display: block;
  width: 100%;
}

.sp-kwt-part__content {
  width: 100%;
  min-width: 0;
}

.sp-kwt-part--b .sp-kwt-target {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-sizing: border-box;
}

.sp-kwt-keyword-row {
  display: flex;
  justify-content: flex-start;
  margin: 6px 0 8px;
  position: relative;
  z-index: 2;
}

.sp-kwt-keyword {
  display: inline-block;
  padding: 7px 16px;
  border: 2px solid #c7daf5;
  border-bottom-width: 3px;
  border-bottom-color: rgba(28, 79, 156, 0.35);
  border-radius: 10px;
  background: var(--white, #fff);
  box-shadow: 0 3px 0 rgba(59, 130, 246, 0.38);
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sp-duo-blue-dark, #1c4f9c);
}

.sp-kwt-target {
  width: 100%;
  align-self: stretch;
  box-sizing: border-box;
}

.sp-kwt-target-sentence {
  margin: 0;
  font-size: clamp(0.88rem, 0.52rem + 1vw, 0.98rem);
  line-height: 1.65;
  color: #64748b;
  width: 100%;
}

/* ── Sentence transformation (statement → question) ─────────────── */
.sp-screen--sentence-transform {
  gap: clamp(10px, 2.5vw, 14px);
  justify-content: center;
  flex: 0 1 auto;
}

.sp-stf-source,
.sp-stf-target {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.sp-stf-label {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.68rem, 0.45rem + 0.55vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-duo-blue-dark, #1899d6);
}

.sp-screen--sentence-transform .sp-kwt-prompt {
  margin: 0;
  padding: clamp(12px, 2.5vw, 16px) clamp(14px, 3vw, 18px);
  font-size: clamp(1.15rem, 0.85rem + 1.4vw, 1.42rem);
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-dark, #334155);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #e2e8f0;
  border-bottom-width: 3px;
  border-bottom-color: #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 2px 0 #e2e8f0;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sp-screen--sentence-transform .sp-kwt-prompt:hover,
.sp-screen--sentence-transform .sp-kwt-prompt:focus-visible {
  border-color: var(--sp-duo-blue-border);
  background: var(--sp-duo-blue-light);
  outline: none;
}

.sp-sentence-transform-bridge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2px 0;
}

.sp-sentence-transform-bridge__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sp-duo-blue-light);
  border: 2px solid var(--sp-duo-blue-border);
  color: var(--sp-duo-blue-dark);
  font-size: 1.15rem;
}

.sp-screen--sentence-transform .sp-kwt-target {
  margin: 0;
  padding: clamp(12px, 2.5vw, 16px) clamp(14px, 3vw, 18px);
  background: var(--white);
  border: 2px solid var(--sp-duo-blue-border);
  border-bottom-width: 4px;
  border-bottom-color: var(--sp-duo-blue-dark);
  border-radius: 16px;
  box-shadow: 0 3px 0 rgba(24, 153, 214, 0.18);
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.sp-screen--sentence-transform .sp-kwt-target-sentence {
  font-size: clamp(1.05rem, 0.75rem + 1.3vw, 1.28rem);
  font-weight: 700;
  line-height: 1.75;
  color: var(--text-dark, #1e293b);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.sp-screen--sentence-transform .sp-inline-gap-group--solo .sp-gap-underline-input {
  min-width: 7ch;
  padding: 6px 12px 8px;
  border: 2px solid var(--sp-duo-blue);
  border-bottom-width: 3px;
  border-bottom-color: var(--sp-duo-blue-dark);
  border-radius: 12px;
  background: var(--sp-duo-blue-light);
  font-size: clamp(1rem, 0.7rem + 1.1vw, 1.2rem);
  font-weight: 800;
  color: var(--sp-duo-blue-dark);
  text-align: left;
  box-shadow: 0 2px 0 rgba(24, 153, 214, 0.2);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.sp-screen--sentence-transform .sp-inline-gap-group--solo .sp-gap-underline-input::placeholder {
  color: #7dd3fc;
  font-weight: 700;
  opacity: 1;
}

.sp-screen--sentence-transform .sp-inline-gap-group--solo .sp-gap-underline-input:focus {
  outline: none;
  border-color: var(--sp-duo-blue-dark);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.22), 0 2px 0 rgba(24, 153, 214, 0.2);
}

.sp-screen--sentence-transform .sp-inline-gap-group.sp-gap-slot--correct .sp-gap-underline-input {
  border-color: var(--sp-duo-green);
  border-bottom-color: var(--sp-duo-green-dark);
  background: var(--sp-duo-green-light);
  color: #3d8f00;
  box-shadow: 0 2px 0 rgba(70, 163, 2, 0.25);
}

.sp-screen--sentence-transform .sp-inline-gap-group.sp-gap-slot--incorrect .sp-gap-underline-input {
  border-color: var(--sp-incorrect);
  border-bottom-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: 0 2px 0 rgba(220, 38, 38, 0.2);
}

.sp-practice-main:has(.sp-screen--sentence-transform) .sp-exercise-card {
  flex: 0 1 auto;
  justify-content: center;
  padding-top: clamp(10px, 2.5vw, 18px);
  padding-bottom: clamp(8px, 2vw, 14px);
}

.sp-practice-body:has(.sp-screen--sentence-transform) {
  justify-content: flex-start;
}

.sp-practice-body:has(.sp-screen--sentence-transform) .sp-exercise-tip-mount:not([hidden]) {
  margin-top: auto;
  padding-top: clamp(6px, 1.5vw, 10px);
}

.sp-kwt-gap-wrap {
  display: inline-flex;
  vertical-align: baseline;
  max-width: 100%;
}

.sp-kwt-gap-input {
  width: 2ch;
  min-width: 2ch;
  max-width: none;
}

/* Phones: never let the growing gap input push the sentence off-screen. */
@media (max-width: 768px) {
  .sp-kwt-gap-input {
    max-width: 100%;
    box-sizing: border-box;
  }
}

.sp-kwt-gap-input--correct {
  border-color: var(--sp-duo-green, #58cc02) !important;
  background: rgba(88, 204, 2, 0.1) !important;
}

.sp-kwt-gap-input--incorrect {
  border-color: #ef4444 !important;
  background: rgba(255, 120, 120, 0.12) !important;
}

.sp-kwt-word-count {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
  color: #64748b;
}

.sp-kwt-word-count--valid {
  color: var(--sp-duo-green-dark, #3d8f00);
}

.sp-kwt-word-count--invalid {
  color: #dc2626;
}

/* ── Column matching ───────────────────────────────────────────────── */
.sp-screen--column-match {
  padding: 0;
}

.sp-cm-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-cm-head-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.sp-cm-mobile-label {
  display: none;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.sp-cm-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

@media (min-width: 769px) {
  .sp-cm-body {
    row-gap: 8px;
    align-items: stretch;
  }

  .sp-cm-beginnings,
  .sp-cm-endings {
    display: contents;
  }

  .sp-cm-left-cell {
    grid-column: 1;
  }

  .sp-cm-right-cell {
    grid-column: 2;
  }

  .sp-cm-beginnings .sp-cm-left-cell:nth-child(1),
  .sp-cm-endings .sp-cm-right-cell:nth-child(1) { grid-row: 1; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(2),
  .sp-cm-endings .sp-cm-right-cell:nth-child(2) { grid-row: 2; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(3),
  .sp-cm-endings .sp-cm-right-cell:nth-child(3) { grid-row: 3; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(4),
  .sp-cm-endings .sp-cm-right-cell:nth-child(4) { grid-row: 4; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(5),
  .sp-cm-endings .sp-cm-right-cell:nth-child(5) { grid-row: 5; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(6),
  .sp-cm-endings .sp-cm-right-cell:nth-child(6) { grid-row: 6; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(7),
  .sp-cm-endings .sp-cm-right-cell:nth-child(7) { grid-row: 7; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(8),
  .sp-cm-endings .sp-cm-right-cell:nth-child(8) { grid-row: 8; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(9),
  .sp-cm-endings .sp-cm-right-cell:nth-child(9) { grid-row: 9; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(10),
  .sp-cm-endings .sp-cm-right-cell:nth-child(10) { grid-row: 10; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(11),
  .sp-cm-endings .sp-cm-right-cell:nth-child(11) { grid-row: 11; }
  .sp-cm-beginnings .sp-cm-left-cell:nth-child(12),
  .sp-cm-endings .sp-cm-right-cell:nth-child(12) { grid-row: 12; }
}

.sp-cm-beginnings,
.sp-cm-endings {
  min-width: 0;
}

.sp-cm-left-cell,
.sp-cm-right-cell {
  display: flex;
  min-width: 0;
  min-height: 100%;
}

.sp-cm-right-cell {
  min-height: 2.75rem;
  border: 2px dashed #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sp-cm-left-cell .sp-cm-left-item,
.sp-cm-right-cell .sp-cm-right-item {
  flex: 1;
}

.sp-cm-right-cell--filled:not(.sp-cm-right-cell--locked) {
  border-color: transparent;
  background: transparent;
  padding: 0;
}

.sp-cm-right-cell--locked {
  border-style: solid;
  border-color: #dce3f0;
  background: var(--white);
  padding: 0;
}

.sp-cm-right-cell--locked .sp-cm-right-item {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.sp-cm-right-cell--locked .sp-cm-right-item:hover:not(:disabled) {
  border-color: transparent;
  background: transparent;
}

.sp-cm-right-cell--locked .sp-cm-right-item--locked {
  font-weight: 700;
  cursor: default;
}

.sp-cm-column-title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.sp-cm-left-item,
.sp-cm-right-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 2px solid #dce3f0;
  border-radius: 12px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.84rem, 0.5rem + 1vw, 0.95rem);
  line-height: 1.45;
  color: var(--text-primary, #1e293b);
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sp-cm-left-item:hover:not(:disabled),
.sp-cm-right-item:hover:not(:disabled) {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-cm-left-item--selected {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
  box-shadow: inset 0 -2px 0 var(--sp-duo-blue);
}

.sp-cm-left-item--paired,
.sp-cm-right-item--paired {
  font-weight: 700;
}

.sp-cm-num,
.sp-cm-letter {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  min-height: 1.6rem;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--sp-duo-blue-dark);
  font-weight: 800;
  font-size: 0.78rem;
}

.sp-cm-letter {
  background: #fff7ed;
  color: #c2410c;
}

.sp-cm-left-item--correct .sp-cm-num,
.sp-cm-left-item--locked.sp-cm-left-item--correct .sp-cm-num {
  background: rgba(88, 204, 2, 0.2);
  color: #3d8f00;
}

.sp-cm-left-item--incorrect .sp-cm-num,
.sp-cm-left-item--wrong-flash .sp-cm-num {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.sp-cm-right-item--correct .sp-cm-letter,
.sp-cm-right-item--locked.sp-cm-right-item--correct .sp-cm-letter,
.sp-cm-right-item--reveal .sp-cm-letter {
  background: rgba(88, 204, 2, 0.2);
  color: #3d8f00;
}

.sp-cm-right-item--wrong-flash .sp-cm-letter {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.sp-cm-left-text,
.sp-cm-right-text {
  flex: 1;
  min-width: 0;
}

.sp-cm-left-item--correct {
  border-color: var(--sp-duo-green, #58cc02);
  background: rgba(88, 204, 2, 0.12);
}

.sp-cm-left-item--incorrect {
  border-color: #ef4444;
  background: rgba(255, 120, 120, 0.12);
}

.sp-cm-right-item--reveal {
  border-color: var(--sp-duo-green, #58cc02);
  box-shadow: inset 0 0 0 1px rgba(88, 204, 2, 0.35);
}

.sp-cm-right-item--wrong-flash {
  border-color: #ef4444 !important;
  background: rgba(255, 120, 120, 0.28) !important;
  animation: sp-cm-shake 0.5s ease;
}

.sp-cm-left-item--wrong-flash {
  border-color: #ef4444 !important;
  background: rgba(255, 120, 120, 0.18) !important;
  animation: sp-cm-shake 0.5s ease;
}

.sp-cm-left-item--active {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
  box-shadow: inset 0 -2px 0 var(--sp-duo-blue);
}

.sp-cm-left-item--future {
  opacity: 0.45;
  border-color: #e2e8f0;
  background: #f8fafc;
  cursor: default;
}

.sp-cm-left-item--future:hover:not(:disabled) {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.sp-cm-left-item--skipped,
.sp-cm-left-item--skipped:hover:not(:disabled) {
  opacity: 0.45;
  border-color: #e2e8f0;
  background: #f8fafc;
  cursor: default;
}

.sp-cm-right-item--pending {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
  box-shadow: inset 0 -2px 0 var(--sp-duo-blue);
}

.sp-cm-right-item--future {
  opacity: 0.55;
}

.sp-cm-right-item--future:hover:not(:disabled) {
  border-color: #dce3f0;
  background: var(--white);
}

.sp-cm-right-item--swap-anim {
  transition: transform 0.25s ease;
  z-index: 2;
}

.sp-cm-left-item--locked.sp-cm-left-item--correct,
.sp-cm-right-item--locked.sp-cm-right-item--correct {
  border-color: var(--sp-duo-green, #58cc02);
  background: rgba(88, 204, 2, 0.12);
}

.sp-cm-right-item--locked.sp-cm-right-item--correct {
  font-weight: 700;
  cursor: default;
}

@keyframes sp-cm-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.sp-cm-left-item:disabled,
.sp-cm-right-item:disabled {
  cursor: default;
}

@media (max-width: 768px) {
  .sp-cm-head-row {
    display: none;
  }

  .sp-cm-explanation-desktop {
    display: none;
  }

  .sp-cm-explanation-mobile {
    display: block;
  }

  .sp-explanation-card-view-inner--cm {
    padding-bottom: 0;
  }

  .sp-cm-mobile-label {
    display: block;
  }

  .sp-cm-mobile-label--beginnings {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
  }

  .sp-cm-mobile-progress {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--sp-duo-blue-dark);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
  }

  .sp-cm-mobile-label--endings {
    margin-top: 4px;
    margin-bottom: 6px;
  }

  .sp-cm-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .sp-cm-beginnings,
  .sp-cm-endings {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .sp-cm-beginnings {
    gap: 6px;
  }

  .sp-cm-left-cell {
    min-height: 0;
  }

  /* Sequential mode: show only the current beginning (kept visible in green
     during post-check feedback) and drop endings already matched. Hide the
     whole cell, not just the button, so no empty row keeps taking space. */
  .sp-cm-board[data-sequential="true"] .sp-cm-left-cell--future,
  .sp-cm-board[data-sequential="true"] .sp-cm-left-cell--skipped:not(.sp-cm-left-cell--current),
  .sp-cm-board[data-sequential="true"] .sp-cm-left-cell--locked:not(.sp-cm-left-cell--current) {
    display: none;
  }

  .sp-cm-board[data-sequential="true"] .sp-cm-right-cell--done {
    display: none;
  }

  .sp-cm-board[data-sequential="true"] .sp-cm-left-item--active,
  .sp-cm-board[data-sequential="true"] .sp-cm-left-item--locked.sp-cm-left-item--current {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .sp-cm-board[data-sequential="true"] .sp-cm-left-item--active {
    box-shadow: inset 0 -2px 0 var(--sp-duo-blue), 0 3px 10px rgba(20, 70, 120, 0.12);
  }

  .sp-cm-endings {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .sp-cm-right-cell {
    min-height: auto;
    border: none;
    background: transparent;
    padding: 0;
  }

  .sp-cm-right-cell--filled:not(.sp-cm-right-cell--locked) {
    border: none;
    background: transparent;
  }

  .sp-cm-right-cell--locked {
    border: none;
    background: transparent;
    padding: 0;
  }

  .sp-cm-left-item,
  .sp-cm-right-item {
    padding: 8px 10px;
    font-size: 0.86rem;
    line-height: 1.4;
  }

  .sp-practice-main .sp-exercise-card:has(.sp-screen--column-match) {
    padding-bottom: 8px;
  }
}

/* ── Column matching: description box + options ───────────────────── */
.sp-screen--cm-desc-options {
  padding: 0;
}

.sp-cm-desc-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-cm-desc-header {
  display: flex;
  justify-content: flex-end;
}

.sp-cm-desc-progress {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.sp-cm-desc-card-wrap {
  width: 100%;
}

.sp-cm-desc-card {
  margin: 0;
  padding: 18px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.sp-cm-desc-card--changing {
  animation: sp-cm-desc-fade 0.28s ease;
}

.sp-cm-desc-card--wrong-flash {
  border-color: #f87171;
  background: #fef2f2;
  animation: sp-cm-shake 0.5s ease;
}

@keyframes sp-cm-desc-fade {
  0% { opacity: 0.45; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.sp-cm-desc-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #1e293b;
  text-align: justify;
}

.sp-cm-desc-prompt {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.sp-cm-desc-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-cm-desc-option {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
}

.sp-cm-desc-option .sp-cm-letter {
  flex-shrink: 0;
}

.sp-cm-desc-option .sp-cm-right-text {
  flex: 1;
  min-width: 0;
}

.sp-cm-desc-option.sp-cm-right-item--locked {
  opacity: 0.45;
}

@media (max-width: 768px) {
  .sp-cm-desc-card {
    padding: 14px 16px;
  }

  .sp-cm-desc-text {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .sp-cm-desc-option {
    padding: 10px 12px;
    font-size: 0.86rem;
  }
}

/* ── Crossword clues (letter boxes) ────────────────────────────────── */
.sp-screen--crossword {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-cw-clue-card {
  width: 100%;
  box-sizing: border-box;
  padding: 16px 18px;
  border-radius: 16px;
  background: #ffffff;
  border: 2px solid #d8ecff;
  box-shadow: 0 4px 16px rgba(20, 70, 120, 0.1);
}

.sp-cw-clue-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sp-cw-clue-text {
  margin: 0;
  font-size: clamp(0.95rem, 0.6rem + 1vw, 1.05rem);
  line-height: 1.5;
  color: var(--text-primary, #1e293b);
}

.sp-cw-clue-text--definition {
  font-weight: 650;
  color: #1f2937;
}

.sp-cw-clue-text--phrase {
  font-weight: 600;
  color: #4b5563;
  font-size: clamp(0.9rem, 0.55rem + 0.95vw, 1rem);
}

.sp-cw-letter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
  padding: 12px;
  border-radius: 20px;
  background: #eaf6ff;
}

.sp-screen--crossword .sp-cw-letter-row .vocab-cw-cells {
  justify-content: center;
}

.sp-screen--crossword .sp-cw-letter.sp-cw-letter,
.sp-screen--crossword input.vocab-cw-cell.sp-cw-letter {
  cursor: text;
}

.sp-screen--crossword .sp-cw-letter:disabled,
.sp-screen--crossword input.vocab-cw-cell.sp-cw-letter:disabled {
  cursor: default;
}

.sp-cw-letter {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid #9cc8f5;
  border-radius: 12px;
  background: white;
  box-shadow: 0 5px 0 #c6def8;
  text-align: center;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 23px;
  font-weight: 900;
  line-height: 44px;
  color: #1f2937;
  text-transform: uppercase;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.sp-cw-letter:focus {
  outline: none;
  transform: translateY(2px);
  box-shadow: 0 3px 0 #c6def8;
  border-color: #1cb0f6;
}

.sp-cw-letter--correct,
.sp-cw-letter.vocab-cw-cell-correct {
  border-color: #58cc02 !important;
  background: #d7ffb8 !important;
  color: #2b6b00;
  box-shadow: 0 5px 0 #8ee000 !important;
}

.sp-cw-letter--incorrect,
.sp-cw-letter.vocab-cw-cell-incorrect {
  border-color: #dc2626 !important;
  background: #fee2e2 !important;
  color: #991b1b;
  box-shadow: 0 5px 0 #fecaca !important;
}

.sp-cw-letter:disabled {
  cursor: default;
}

/* ── Letter swap unscramble ────────────────────────────────────────── */
.sp-screen--letter-swap .sp-letter-swap-group {
  display: inline-flex;
  vertical-align: middle;
}

.sp-screen--letter-swap .sp-letter-swap-cells {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.sp-letter-swap-cell {
  width: 36px;
  height: 40px;
  padding: 0;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  background: #e2e8f0;
  box-shadow: 0 4px 0 #cbd5e1;
  text-align: center;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 900;
  line-height: 36px;
  color: #64748b;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.sp-letter-swap-cell:hover:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 3px 0 #cbd5e1;
}

.sp-letter-swap-cell--selected {
  border-color: #1cb0f6 !important;
  background: #eaf6ff !important;
  color: #0369a1 !important;
  box-shadow: 0 4px 0 #9cc8f5 !important;
}

.sp-letter-swap-cell--correct {
  border-color: #58cc02 !important;
  background: #d7ffb8 !important;
  color: #2b6b00 !important;
  box-shadow: 0 4px 0 #8ee000 !important;
}

.sp-letter-swap-cell--incorrect {
  border-color: #dc2626 !important;
  background: #fee2e2 !important;
  color: #991b1b !important;
  box-shadow: 0 4px 0 #fecaca !important;
}

.sp-letter-swap-cell:disabled {
  cursor: default;
}

/* ── Synced gap fill ───────────────────────────────────────────────── */
.sp-screen--sync-gap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sp-sync-sentences {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sp-sync-sentence {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 1.15rem;
  line-height: 1.9;
  text-align: justify;
  hyphens: auto;
  color: #3c3c3c;
}

.sp-sync-gap-group .sp-sync-input {
  min-width: 2ch;
}

.sp-sync-input--correct {
  border-bottom-color: var(--sp-duo-green, #58cc02) !important;
  background: rgba(88, 204, 2, 0.1) !important;
  color: var(--sp-duo-green-dark, #3d8f00) !important;
}

.sp-sync-input--incorrect {
  border-bottom-color: #ef4444 !important;
  background: rgba(255, 120, 120, 0.1) !important;
  color: #b91c1c !important;
}

.sp-sync-hint {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  text-align: center;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--comma-slots) {
  align-items: stretch;
  max-width: 100%;
}

.sp-practice-main .sp-exercise-card:has(.sp-screen--comma-slots) .sp-screen--comma-slots {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-self: stretch;
  margin-inline: 0;
}

.sp-screen--comma-slots {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ── Comma placement (tap slots + rewrite) ───────────────────────────── */
.sp-comma-sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  line-height: 1.85;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  color: var(--text-primary, #1e293b);
  padding: 18px 20px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sp-comma-token {
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.sp-comma-slot {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 1.5px dashed #cbd5e1;
  background: #fff;
  color: transparent;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s;
}

.sp-comma-slot:hover:not(:disabled) {
  border-color: #94a3b8;
  transform: scale(1.08);
}

.sp-comma-slot--selected {
  border-style: solid;
  border-color: var(--sp-duo-blue, #1cb0f6);
  background: rgba(28, 176, 246, 0.12);
  color: var(--sp-duo-blue, #1cb0f6);
}

.sp-screen--comma-correct .sp-comma-sentence {
  border-color: var(--sp-duo-green, #58cc02);
  background: rgba(88, 204, 2, 0.08);
}

.sp-screen--comma-incorrect .sp-comma-sentence {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

.sp-comma-slot--correct {
  border-color: var(--sp-duo-green, #58cc02) !important;
  background: rgba(88, 204, 2, 0.14) !important;
  color: var(--sp-duo-green-dark, #3d8f00) !important;
}

.sp-comma-slot--incorrect {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.12) !important;
  color: #b91c1c !important;
}

.sp-comma-slot--reveal {
  border-style: solid;
  border-color: var(--sp-duo-green, #58cc02) !important;
  background: rgba(88, 204, 2, 0.08) !important;
  color: var(--sp-duo-green-dark, #3d8f00) !important;
}

.sp-comma-slot:disabled {
  cursor: default;
}

.sp-comma-prompt {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary, #1e293b);
}

.sp-comma-rewrite-input--correct {
  border-color: var(--sp-duo-green, #58cc02) !important;
  background: rgba(88, 204, 2, 0.08) !important;
}

.sp-comma-rewrite-input--incorrect {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

/* ── Word bank tick (multi-select chip grid) ───────────────────────────── */
.sp-screen--word-bank-tick {
  align-items: stretch;
  min-height: 0;
  width: 100%;
}

.sp-wbt-grid-scroll {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: clamp(8px, 2vw, 12px);
  border: 1.5px solid #e2e8f0;
  border-radius: clamp(12px, 3vw, 16px);
  background: #f8fafc;
  box-sizing: border-box;
}

.sp-wbt-grid {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(6px, 2vw, 10px);
  align-content: flex-start;
  width: 100%;
}

.sp-wbt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--sp-touch-target);
  padding: clamp(5px, 1.5vw, 8px) clamp(8px, 2.5vw, 14px);
  border: 2px solid #e2e8f4;
  border-bottom-width: 3px;
  border-bottom-color: #dce3f0;
  border-radius: clamp(8px, 2vw, 12px);
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.78rem, 0.5rem + 1vw, 0.95rem);
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s;
}

.sp-wbt-chip:hover:not(:disabled) {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.sp-wbt-chip--selected {
  border-color: var(--sp-duo-blue, #1cb0f6);
  border-bottom-color: #1899d6;
  background: rgba(28, 176, 246, 0.12);
  color: #1899d6;
}

.sp-wbt-chip--correct {
  border-color: var(--sp-duo-green, #58cc02) !important;
  border-bottom-color: #46a302 !important;
  background: rgba(88, 204, 2, 0.14) !important;
  color: var(--sp-duo-green-dark, #3d8f00) !important;
}

.sp-wbt-chip--incorrect {
  border-color: #ef4444 !important;
  border-bottom-color: #dc2626 !important;
  background: rgba(239, 68, 68, 0.12) !important;
  color: #b91c1c !important;
}

.sp-wbt-chip--reveal {
  border-color: var(--sp-duo-green, #58cc02) !important;
  border-bottom-color: #46a302 !important;
  background: rgba(88, 204, 2, 0.08) !important;
  color: var(--sp-duo-green-dark, #3d8f00) !important;
}

.sp-wbt-chip:disabled {
  cursor: default;
  transform: none;
}

.sp-verb-prompt,
.sp-step-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  margin: 0 0 12px;
}

.sp-preselected-verb {
  font-size: 0.95rem;
  margin: 0 0 14px;
  color: var(--text-medium);
}

.sp-text-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #dce3f0;
  border-bottom-width: 3px;
  border-bottom-color: #c8d4e8;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  color: var(--text-dark);
  background: #f4f7fb;
  box-sizing: border-box;
  box-shadow: 0 2px 0 #dce3f0;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sp-text-input::placeholder {
  color: #9ca8bc;
  font-weight: 600;
}

.sp-text-input:hover:not(:focus) {
  border-color: #c8d4e8;
  background: #f8fafc;
}

.sp-text-input:focus {
  outline: none;
  border-color: var(--sp-duo-blue);
  border-bottom-color: var(--sp-duo-blue-dark);
  background: var(--white);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark), 0 0 0 3px rgba(28, 176, 246, 0.18);
}

.sp-text-input--large {
  min-height: 100px;
  resize: vertical;
}

.sp-text-input--sentence {
  line-height: 1.55;
}

/* Full-sentence write: cue tiles + free sentence, or inline conjugation scaffold */
.sp-screen--sentence-build,
.sp-screen--sentence-rewrite,
.sp-screen--sentence-cue {
  width: 100%;
  max-width: min(100%, 52rem);
  --sp-content-max: min(100%, 52rem);
}

.sp-screen--sentence-cue {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sp-cue-description {
  margin: 0 0 16px;
  padding: 0;
  color: var(--text-dark);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.sp-screen--sentence-cue .sp-cue-bank {
  cursor: pointer;
}

.sp-screen--sentence-cue .sp-text-input--sentence {
  width: 100%;
  min-height: 3.25rem;
  margin-top: 0;
}

.sp-screen--sentence-build .sp-session-instruction {
  max-width: 100%;
}

.sp-prompt-row--sentence-build {
  width: 100%;
  max-width: 100%;
}

.sp-screen--sentence-build .sp-sentence-scaffold {
  width: 100%;
  max-width: 100%;
}

.sp-screen--sentence-build .sp-sentence-chip {
  font-size: var(--sp-text-fluid);
}

.sp-screen--sentence-build .sp-inline-gap-group {
  margin: 0 4px;
}

.sp-cue-bank {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 6px;
  margin: 0 0 24px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--sp-duo-blue-light);
  border: 2px solid var(--sp-duo-blue-border);
}

.sp-cue-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid var(--sp-duo-blue);
  border-bottom-width: 3px;
  border-bottom-color: var(--sp-duo-blue-dark);
  box-shadow: 0 2px 0 var(--sp-duo-blue-dark);
  color: var(--sp-duo-blue-dark);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.sp-cue-sep {
  color: #8ba3bf;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  user-select: none;
}

.sp-sentence-scaffold {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0;
  line-height: 1.6;
}

.sp-sentence-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 14px;
  background: #eef2f8;
  border: 2px solid #dce3f0;
  color: var(--text-dark);
  font-size: var(--sp-text-fluid);
  font-weight: 700;
  line-height: 1.35;
}

.sp-sentence-verb-slot {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
}

.sp-sentence-verb-input {
  display: inline-block;
  width: auto;
  min-width: 7rem;
  max-width: min(100%, 18rem);
  margin: 0;
  padding: 10px 14px;
  border: 2px solid #c8d4e8;
  border-bottom-width: 3px;
  border-bottom-color: #b0bdd4;
  border-radius: 14px;
  background: #f4f7fb;
  box-shadow: 0 2px 0 #dce3f0;
  font-family: 'Nunito', sans-serif;
  font-size: var(--sp-text-fluid);
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sp-sentence-verb-input::placeholder {
  color: #9ca8bc;
  font-weight: 600;
}

.sp-sentence-verb-input:hover:not(:focus) {
  border-color: #b8c6dc;
  background: #f8fafc;
}

.sp-sentence-verb-input:focus {
  outline: none;
  border-color: var(--sp-duo-blue);
  border-bottom-color: var(--sp-duo-blue-dark);
  background: var(--white);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark), 0 0 0 3px rgba(28, 176, 246, 0.18);
}

.sp-rewrite-prompt {
  margin: 0 0 20px;
  padding: 16px 18px;
  border-radius: 16px;
  background: #eef2f8;
  border: 2px solid #dce3f0;
  border-left: 4px solid var(--sp-duo-blue);
}

.sp-rewrite-prompt__text {
  margin: 0;
  font-size: var(--sp-text-fluid);
  line-height: 1.55;
  color: var(--text-dark);
  font-weight: 600;
}

.sp-rewrite-prompt__text strong {
  font-weight: 800;
  color: var(--sp-duo-blue-dark, #1899d6);
}

.sp-screen--given-word-write .sp-kwt-keyword-row {
  margin: 0 0 20px;
}

.sp-given-word-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 20px;
}

.sp-screen--inline-choice {
  width: 100%;
  max-width: var(--sp-content-max);
}

.sp-screen--inline-choice .sp-prompt-row {
  display: block;
  width: 100%;
  margin-bottom: 0;
}

.sp-prompt-sentence--inline-choice {
  width: 100%;
  max-width: 100%;
  font-size: var(--sp-text-fluid);
  line-height: 1.8;
  font-weight: 600;
  color: var(--text-dark);
}

.sp-inline-choice-group {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  margin: 0 2px;
  max-width: 100%;
}

.sp-screen--inline-choice .sp-option-grid {
  display: none;
}

.sp-option-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2vw, 10px);
  width: 100%;
  max-width: var(--sp-choice-max, var(--sp-content-max));
  margin-inline: auto;
  box-sizing: border-box;
}

.sp-option-grid--quad {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 12px);
  max-width: var(--sp-choice-quad-max, min(100%, 30rem));
}

.sp-option-grid--multi .sp-option-btn {
  min-height: 3.25rem;
}

@media (max-width: 360px) {
  .sp-option-grid--quad {
    grid-template-columns: 1fr;
  }
}

.sp-option-btn {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 12px);
  width: 100%;
  min-height: clamp(44px, 10vw, 56px);
  padding: clamp(10px, 2.5vw, 14px) clamp(12px, 3vw, 20px);
  border: 2px solid #e2e8f4;
  border-bottom-width: 3px;
  border-bottom-color: #dce3f0;
  border-radius: clamp(14px, 3vw, 16px);
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.88rem, 0.5rem + 1.5vw, 1.05rem);
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: 0 3px 0 #dce3f0;
  transition: border-color 0.15s, background 0.15s, transform 0.1s ease, box-shadow 0.1s ease;
}

.sp-option-num {
  flex-shrink: 0;
  width: clamp(24px, 6vw, 28px);
  height: clamp(24px, 6vw, 28px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #dce3f0;
  border-radius: 8px;
  font-size: clamp(0.78rem, 0.5rem + 1vw, 0.85rem);
  font-weight: 700;
  color: var(--text-medium);
  line-height: 1;
}

.sp-option-label {
  flex: 1;
  text-align: left;
}

.sp-option-btn:hover {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-option-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #dce3f0;
}

.sp-option-btn--selected {
  border-color: var(--sp-duo-blue);
  border-bottom-color: var(--sp-duo-blue-dark);
  background: var(--sp-duo-blue-light);
  color: var(--sp-duo-blue-dark);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
}

.sp-option-btn--selected .sp-option-num {
  border-color: var(--sp-duo-blue-dark);
  color: var(--sp-duo-blue-dark);
  background: var(--white);
}

.sp-option-btn--selected:active {
  box-shadow: 0 1px 0 var(--sp-duo-blue-dark);
}

.sp-option-btn--correct,
.sp-option-btn--selected.sp-option-btn--correct {
  border-color: var(--sp-correct);
  border-bottom-color: #2ea872;
  background: #e8f8f0;
  color: #1a7a52;
  box-shadow: 0 3px 0 #2ea872;
}

.sp-option-btn--correct .sp-option-num,
.sp-option-btn--selected.sp-option-btn--correct .sp-option-num {
  border-color: #2ea872;
  background: var(--sp-correct);
  color: #fff;
}

.sp-option-btn--incorrect,
.sp-option-btn--selected.sp-option-btn--incorrect {
  border-color: var(--sp-incorrect);
  border-bottom-color: #c0392b;
  background: #fdecea;
  color: #a93226;
  box-shadow: 0 3px 0 #c0392b;
}

.sp-option-btn--incorrect .sp-option-num,
.sp-option-btn--selected.sp-option-btn--incorrect .sp-option-num {
  border-color: #fff;
  background: var(--sp-incorrect);
  color: #fff;
}

.sp-option-btn.sp-option-btn--inline {
  width: auto;
  max-width: 100%;
  flex: 0 0 auto;
  min-height: auto;
  min-width: 0;
  padding: 4px 12px;
  display: inline-flex;
  gap: 0;
  box-shadow: 0 2px 0 #dce3f0;
}

.sp-option-btn.sp-option-btn--inline .sp-option-label {
  flex: 0 1 auto;
  text-align: center;
  white-space: nowrap;
}

.sp-choice-tile-stack .sp-option-btn.sp-option-btn--inline.sp-choice-tile {
  min-height: 0;
  padding: 3px 12px;
  line-height: 1.5;
  border-radius: 10px;
}

.sp-explanation-inline-mount {
  position: relative;
  min-height: 280px;
}

.sp-explanation-inline-mount > :not(.sp-explanation-inline) {
  pointer-events: none;
}

.sp-explanation-inline-mount > .sp-explanation-inline {
  position: absolute;
  inset: 0;
  z-index: 2;
  min-height: 0;
  height: 100%;
}

.sp-practice-session.sp-explanation-inline-mount {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
}

.sp-lesson-mount.sp-explanation-inline-mount {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.sp-practice-session.sp-explanation-inline-mount > .sp-explanation-inline {
  border-radius: 20px;
}

@keyframes spExplanationInlineIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spExplanationBlockIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Inline explanation container ─────────────────────────────────────────── */

.sp-explanation-inline {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 300px;
  border-radius: 24px;
  background: #ffffff;
  border: 2.5px solid #ff9600;
  border-bottom-width: 5px;
  border-bottom-color: #e68600;
  box-shadow: 0 6px 0 #e68600, 0 16px 48px rgba(255, 150, 0, 0.16);
  overflow: hidden;
  animation: spExplanationInlineIn 0.3s cubic-bezier(0.34, 1.1, 0.64, 1) both;
}

.sp-lesson-mount.sp-explanation-inline-mount > .sp-explanation-inline {
  border-radius: 20px;
}

/* ── Minimal header ───────────────────────────────────────────────────────── */

.sp-explanation-inline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 2px solid #ffe0b8;
  background: #fffaf3;
  flex-shrink: 0;
}

.sp-explanation-inline-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid #e8e8e8;
  border-radius: 50%;
  background: #ffffff;
  color: #9ca3af;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sp-explanation-inline-close:hover {
  background: #f5f5f5;
  color: #4b4b4b;
}

.sp-explanation-inline-close:active {
  transform: scale(0.92);
}

.sp-explanation-inline-close .material-symbols-outlined {
  font-size: 1.2rem;
  font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.sp-explanation-inline-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ff9600;
  color: #ffffff;
  flex-shrink: 0;
}

.sp-explanation-inline-header-icon .material-symbols-outlined {
  font-size: 1.2rem;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* ── Body ─────────────────────────────────────────────────────────────────── */

.sp-explanation-inline-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #ffffff;
}

.sp-explanation-inline-body > .sp-explanation-inline-block {
  animation: spExplanationBlockIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.sp-explanation-inline-body > .sp-explanation-inline-block:nth-child(1) { animation-delay: 0.08s; }
.sp-explanation-inline-body > .sp-explanation-inline-block:nth-child(2) { animation-delay: 0.15s; }
.sp-explanation-inline-body > .sp-explanation-inline-block:nth-child(3) { animation-delay: 0.22s; }

/* ── Block label pill ─────────────────────────────────────────────────────── */

.sp-explanation-inline-block-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 5px 13px 5px 6px;
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #fff;
  border: 2px solid transparent;
  border-bottom-width: 3px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

.sp-explanation-inline-block-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.92);
}

.sp-explanation-inline-block-icon .material-symbols-outlined {
  font-size: 0.95rem;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}

/* ── Question block ───────────────────────────────────────────────────────── */

.sp-explanation-inline .lesson-explanation-question {
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff4e6;
  border: 2.5px solid #ff9600;
  border-bottom-width: 4px;
  border-bottom-color: #e68600;
  box-shadow: 0 4px 0 #e68600;
}

.sp-explanation-inline .lesson-explanation-question .sp-explanation-inline-block-label {
  background: #ff9600;
  border-color: #e68600;
  border-bottom-color: #cc6f00;
}

.sp-explanation-inline .lesson-explanation-question .sp-explanation-inline-block-icon {
  color: #ff9600;
}

.sp-explanation-inline .lesson-explanation-question-text {
  margin: 0;
  padding: 11px 14px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 1.06rem;
  font-weight: 800;
  line-height: 1.45;
  color: #1f2937;
  background: #ffffff;
  border: 2px solid #ffc266;
  border-bottom-width: 3px;
  border-bottom-color: #e68600;
  box-shadow: 0 2px 0 rgba(255, 150, 0, 0.14);
}

/* ── Answer block ─────────────────────────────────────────────────────────── */

.sp-explanation-inline .lesson-explanation-answer {
  padding: 14px 16px;
  border-radius: 16px;
  background: #e8ffd6;
  border: 2.5px solid #58cc02;
  border-bottom-width: 4px;
  border-bottom-color: #46a302;
  box-shadow: 0 4px 0 #46a302;
}

.sp-explanation-inline .lesson-explanation-answer .sp-explanation-inline-block-label {
  background: #58cc02;
  border-color: #46a302;
  border-bottom-color: #368201;
}

.sp-explanation-inline .lesson-explanation-answer .sp-explanation-inline-block-icon {
  color: #46a302;
}

.sp-explanation-inline .lesson-explanation-answer-text {
  display: block;
  margin: 0;
  padding: 10px 18px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.35;
  color: #46a302;
  background: #ffffff;
  border: 2px solid #a8e06c;
  border-bottom-width: 3px;
  border-bottom-color: #46a302;
  box-shadow: 0 3px 0 rgba(70, 163, 2, 0.25);
}

/* ── WHY / Tips card ──────────────────────────────────────────────────────── */

.sp-explanation-inline-card {
  padding: 16px;
  border-radius: 16px;
  background: #fffbe6;
  border: 2.5px solid #ffc800;
  border-bottom-width: 4px;
  border-bottom-color: #e5b400;
  box-shadow: 0 4px 0 #e5b400;
}

.sp-explanation-inline-card .sp-explanation-inline-block-icon--why {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #c99000;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
}

.sp-explanation-inline-card .sp-explanation-inline-block-icon--why .material-symbols-outlined {
  font-size: 1.2rem;
  font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 24;
  color: #c99000;
}

.sp-explanation-inline-card-label {
  background: #ffc800;
  color: #5c3f00;
  border-color: #e5b400;
  border-bottom-color: #c49800;
  font-weight: 900;
}

.sp-explanation-inline-text {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  line-height: 1.62;
  color: #3a2900;
  background: rgba(255, 255, 255, 0.65);
  border: 2px solid rgba(255, 200, 0, 0.28);
}

.sp-explanation-inline-text strong {
  font-weight: 800;
  color: #8c6800;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.sp-explanation-inline-footer {
  flex-shrink: 0;
  padding: 14px 16px 18px;
  border-top: 2px solid #ffe0b8;
  background: #fffaf3;
}

.sp-explanation-inline-continue {
  width: 100%;
  border: none;
  border-bottom: 4px solid #e68600;
  border-radius: 16px;
  padding: 16px 20px;
  min-height: 54px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #ffffff;
  background: #ff9600;
  cursor: pointer;
  box-shadow: 0 4px 0 #e68600;
  transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.sp-explanation-inline-continue:hover {
  filter: brightness(1.07);
}

.sp-explanation-inline-continue:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #e68600;
}

/* ── Mobile full-screen overrides ────────────────────────────────────────── */

@media (max-width: 768px) {
  .sp-practice-session.sp-explanation-inline-mount > .sp-explanation-inline {
    border-radius: 16px;
  }

  .sp-practice-session.sp-explanation-inline-mount .sp-explanation-inline-header {
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }

  .sp-practice-session.sp-explanation-inline-mount .sp-explanation-inline-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
}

.dashboard-layout--lesson-focus .sp-practice-session.sp-explanation-inline-mount {
  min-height: 0;
  max-height: 100%;
}

.sp-screen--tiles {
  text-align: left;
  width: 100%;
  align-items: stretch;
  justify-content: flex-start;
}

.sp-screen--tiles .sp-visual-prompt {
  flex-shrink: 0;
}

.sp-screen--tiles .sp-tile-answer {
  flex-shrink: 0;
  align-self: stretch;
  overflow: visible;
}

.sp-screen--tiles .sp-tile-bank {
  flex-shrink: 0;
  align-self: stretch;
}

.sp-visual-prompt {
  width: 100%;
  max-width: 32rem;
  margin: 0 auto 20px;
}

.sp-visual-prompt__image-wrap {
  border-radius: 16px;
  overflow: hidden;
  background: #f4f7fb;
  margin-bottom: 14px;
}

.sp-visual-prompt__image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: center;
}

.sp-visual-prompt__question {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  font-size: var(--sp-text-fluid);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-dark);
  text-align: left;
}

/* ─── Schedule reference (day-trip timeline) ───────────────────────── */

.sp-screen--with-schedule {
  gap: 0;
}

.sp-schedule-view-toolbar {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin: 0 0 14px;
  flex-shrink: 0;
}

.sp-schedule-view-toggle {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 3px;
  border-radius: 999px;
  border: 2px solid var(--sp-duo-blue-border);
  background: #fff;
  box-shadow: 0 4px 12px rgba(28, 176, 246, 0.1);
}

.sp-schedule-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5b7a8c;
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sp-schedule-view-btn .material-symbols-outlined {
  font-size: 1.05rem;
}

.sp-schedule-view-btn--active {
  background: linear-gradient(135deg, #1cb0f6 0%, #64b5f6 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(28, 176, 246, 0.28);
}

.sp-schedule-view-btn:not(.sp-schedule-view-btn--active):hover {
  background: var(--sp-duo-blue-light);
  color: #1899d6;
}

.sp-schedule-view-panel--schedule {
  width: 100%;
  min-width: 0;
}

.sp-schedule-view-panel--schedule .sp-schedule-ref {
  margin-bottom: 0;
}

.sp-schedule-ref--full .sp-schedule-ref__timeline {
  max-height: none;
  overflow: visible;
}

.sp-screen[data-schedule-view="schedule"] .sp-schedule-view-panel--schedule {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sp-schedule-ref {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto 20px;
  border-radius: 18px;
  border: 2px solid var(--sp-duo-blue-border);
  background: linear-gradient(180deg, #f8fcff 0%, #ffffff 100%);
  box-shadow: 0 8px 24px rgba(28, 176, 246, 0.08);
  overflow: hidden;
}

.sp-schedule-ref__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #1cb0f6 0%, #64b5f6 100%);
  color: #fff;
}

.sp-schedule-ref__header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.sp-schedule-ref__header-icon .material-symbols-outlined {
  font-size: 1.5rem;
}

.sp-schedule-ref__header-text {
  min-width: 0;
}

.sp-schedule-ref__title {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(1rem, 0.85rem + 1vw, 1.2rem);
  font-weight: 700;
  line-height: 1.2;
}

.sp-schedule-ref__date {
  margin: 4px 0 0;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.92;
}

.sp-schedule-ref__timeline {
  list-style: none;
  margin: 0;
  padding: 14px 14px 10px;
}

.sp-schedule-ref__item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.sp-schedule-ref__marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 14px;
}

.sp-schedule-ref__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sp-duo-blue);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(28, 176, 246, 0.25);
  flex-shrink: 0;
  z-index: 1;
}

.sp-schedule-ref__line {
  flex: 1;
  width: 2px;
  min-height: 12px;
  margin-top: 4px;
  background: linear-gradient(180deg, rgba(28, 176, 246, 0.45), rgba(28, 176, 246, 0.12));
}

.sp-schedule-ref__card {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(184, 232, 252, 0.9);
}

.sp-schedule-ref__card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.sp-schedule-ref__time {
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #1899d6;
  white-space: nowrap;
}

.sp-schedule-ref__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--sp-duo-blue-light);
  color: #1899d6;
  flex-shrink: 0;
}

.sp-schedule-ref__icon .material-symbols-outlined {
  font-size: 1.05rem;
}

.sp-schedule-ref__activity {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.84rem, 0.78rem + 0.4vw, 0.95rem);
  font-weight: 600;
  line-height: 1.35;
  color: #334155;
}

.sp-schedule-ref__item--travel .sp-schedule-ref__dot {
  background: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.22);
}

.sp-schedule-ref__item--travel .sp-schedule-ref__icon {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.sp-schedule-ref__item--arrival .sp-schedule-ref__dot {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.sp-schedule-ref__item--arrival .sp-schedule-ref__icon {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.sp-schedule-ref__item--activity .sp-schedule-ref__dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
}

.sp-schedule-ref__item--activity .sp-schedule-ref__icon {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
}

.sp-schedule-ref__item--food .sp-schedule-ref__dot {
  background: #ec4899;
  box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.22);
}

.sp-schedule-ref__item--food .sp-schedule-ref__icon {
  background: rgba(236, 72, 153, 0.12);
  color: #db2777;
}

.sp-schedule-ref__item--last .sp-schedule-ref__card {
  margin-bottom: 0;
}

.sp-tile-answer {
  width: 100%;
  max-width: 32rem;
  min-height: 52px;
  border: 2.5px dashed var(--sp-duo-blue-border);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
  box-sizing: border-box;
  overflow: visible;
  background: rgba(221, 244, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(28, 176, 246, 0.08);
}

.sp-tile-bank {
  width: 100%;
  max-width: 32rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-content: flex-start;
  align-items: flex-start;
  gap: 8px;
  padding-top: 4px;
}

.sp-tile {
  padding: 10px 16px;
  border: 2px solid #e2e8f4;
  border-bottom-width: 3px;
  border-bottom-color: #dce3f0;
  border-radius: 12px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: var(--sp-text-fluid);
  font-weight: 600;
  cursor: pointer;
  color: var(--text-dark);
  box-shadow: 0 3px 0 #dce3f0;
  box-sizing: border-box;
  flex: 0 1 auto;
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.sp-tile:hover {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-tile--seed {
  cursor: default;
  background: var(--sp-duo-blue-light);
  border-color: var(--sp-duo-blue-border);
  box-shadow: 0 2px 0 #b8e8fc;
  pointer-events: none;
}

.sp-tile--seed:hover {
  border-color: var(--sp-duo-blue-border);
  background: var(--sp-duo-blue-light);
}

.sp-tile:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #dce3f0;
}

.sp-screen--error-inline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}

.sp-prompt-row--error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
}

.sp-prompt-sentence--error-original {
  margin: 0;
}

.sp-prompt-sentence--error-gap {
  margin: 0;
}

.sp-prompt-row--error .sp-prompt-sentence--inline-gap {
  flex: none;
}

.sp-error-mark {
  background: rgba(255, 184, 173, 0.5);
  border-radius: 4px;
  padding: 0 2px;
}

.sp-explanation-card-context-text .sp-error-mark,
.sp-explanation-section--question .sp-error-mark,
.lesson-explanation-question-text .sp-error-mark,
.sp-explanation-section--neutral .sp-error-mark {
  font-style: normal;
  font-weight: 700;
  color: inherit;
}

.sp-explanation-section--why-explain {
  border-bottom: none;
}

.sp-verb-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sp-verb-chip {
  padding: 10px 18px;
  border: 2px solid var(--border-light);
  border-radius: 99px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.sp-verb-chip--selected {
  border-color: var(--sp-primary);
  background: var(--sp-primary-tint);
  color: var(--primary);
}

/* ── Word bank gap fill (Duolingo-style chips) ───────────────────────── */
.sp-screen--word-bank-gap {
  align-items: stretch;
}

.sp-screen--word-bank-gap:not(.sp-screen--gcseq) .sp-gap-verb-ref,
.sp-screen--word-bank-gap:not(.sp-screen--gcseq) .sp-wf-root-badge {
  display: none !important;
}

.sp-screen--wfseq .sp-wbseq-sentence--future .sp-wf-root-badge {
  display: none !important;
}

.sp-screen--wfseq .sp-wbseq-sentence--active .sp-wf-root-badge,
.sp-screen--wfseq .sp-wbseq-sentence--done .sp-wf-root-badge,
.sp-screen--wfseq .sp-wbseq-sentence--failed .sp-wf-root-badge {
  display: inline-flex !important;
}

.sp-gap-wordbank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: var(--sp-content-max);
  margin: 0 auto 16px;
  padding: 10px 12px;
  background: var(--white);
  border: 2px solid #e2e8f4;
  border-radius: 14px;
  box-shadow: 0 2px 0 #dce3f0;
  box-sizing: border-box;
}

.sp-gap-wordbank-chip {
  padding: 8px 14px;
  border: 2px solid #e2e8f4;
  border-bottom-width: 3px;
  border-bottom-color: #dce3f0;
  border-radius: 999px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.82rem, 0.5rem + 1.2vw, 0.95rem);
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: 0 2px 0 #dce3f0;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.sp-gap-wordbank-chip:hover:not(.sp-gap-wordbank-chip--used) {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-gap-wordbank-chip:active:not(.sp-gap-wordbank-chip--used) {
  transform: translateY(2px);
  box-shadow: 0 0 0 #dce3f0;
}

.sp-gap-wordbank-chip--used {
  opacity: 0.45;
  cursor: default;
  border-color: #dce3f0;
  background: #f4f7fb;
  box-shadow: none;
  text-decoration: line-through;
}

.sp-gap-wordbank-chip--selected:not(.sp-gap-wordbank-chip--used) {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
  box-shadow: 0 0 0 2px rgba(28, 176, 246, 0.2);
}

/* ── Word bank sequential sentences ───────────────────────────────────── */
.sp-screen--wbseq {
  align-items: stretch;
  width: 100%;
  min-height: 0;
  justify-content: flex-start;
}

.sp-screen--wbseq .sp-session-instruction {
  flex-shrink: 0;
}

.sp-screen--wbseq .sp-gap-wordbank {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
}

.sp-gap-wordbank-chip--hint {
  pointer-events: none;
  cursor: default;
}

.sp-screen--gcseq .sp-gcseq-sentence--done .sp-gcseq-gap-input {
  font-weight: 600;
  color: var(--sp-color-success, #16a34a);
}

.sp-screen--scseq .sp-wbseq-sentence--done .sp-choice-tile.sp-option-btn--selected {
  border-color: #22c55e;
  background: #dcfce7;
  color: #15803d;
}

.sp-screen--scseq .sp-wbseq-sentence--failed .sp-choice-tile.sp-option-btn--selected {
  border-color: #ef4444;
  background: #fee2e2;
  color: #b91c1c;
}

.sp-screen--scseq .sp-wbseq-sentence--future .sp-choice-tile-stack {
  opacity: 0.65;
}

.sp-wbseq-sentences-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sp-wbseq-sentences {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding-bottom: 4px;
}

.sp-wbseq-sentence {
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--white);
  transition: opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.sp-wbseq-sentence .sp-prompt-sentence {
  margin: 0;
  text-align: left;
}

.sp-wbseq-sentence--future {
  opacity: 0.42;
  pointer-events: none;
}

.sp-wbseq-sentence--active {
  opacity: 1;
  border-color: var(--sp-duo-blue);
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(28, 176, 246, 0.15);
}

.sp-wbseq-sentence--done {
  opacity: 1;
  border-color: #86efac;
  background: #f0fdf4;
  box-shadow: none;
}

.sp-wbseq-sentence--failed {
  opacity: 1;
  border-color: #fca5a5;
  background: #fef2f2;
  box-shadow: none;
}

.sp-wbseq-sentence--done .sp-gap-underline-input {
  border-bottom-color: #22c55e;
  color: #15803d;
}

.sp-wbseq-gap--incorrect .sp-gap-underline-input {
  border-bottom-color: #ef4444;
  color: #b91c1c;
}

.sp-wbseq-sentence--active .sp-gap-underline-input:focus {
  outline: none;
  border-bottom-color: var(--sp-duo-blue-dark);
}

.sp-screen--kwtseq .sp-kwt-seq-item {
  width: 100%;
}

.sp-screen--kwtseq .sp-kwt-prompt {
  margin-bottom: 8px;
  font-size: clamp(0.84rem, 0.5rem + 0.95vw, 0.94rem);
  line-height: 1.45;
}

.sp-screen--kwtseq .sp-kwt-target-sentence {
  font-size: clamp(0.84rem, 0.5rem + 0.95vw, 0.94rem);
  line-height: 1.55;
}

.sp-screen--kwtseq .sp-wbseq-sentence--future {
  display: none;
}

.sp-screen--kwtseq .sp-wbseq-sentence--active .sp-kwt-keyword-row {
  display: flex;
}

.sp-screen--sgfseq .sp-sgfseq-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-screen--sgfseq .sp-sgfseq-situation,
.sp-screen--sgfseq .sp-sgfseq-phrase,
.sp-screen--sgfseq .sp-sgfseq-gap {
  margin: 0;
  text-align: left;
  line-height: 1.55;
}

.sp-screen--sgfseq .sp-sgfseq-situation {
  font-size: clamp(0.88rem, 0.52rem + 0.98vw, 0.98rem);
  color: var(--text-light, #64748b);
}

.sp-screen--sgfseq .sp-sgfseq-phrase {
  font-size: clamp(0.84rem, 0.5rem + 0.95vw, 0.94rem);
  font-weight: 700;
  color: var(--text-light, #64748b);
}

.sp-screen--sgfseq .sp-sgfseq-gap {
  font-size: clamp(0.9rem, 0.55rem + 1vw, 1rem);
}

.sp-screen--sgfseq .sp-wbseq-sentence--future,
.sp-screen--sgfseq .sp-wbseq-sentence--done {
  display: none;
}

.sp-hunt-instruction {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-light);
  margin: 0 0 12px;
}

.sp-hunt-counter {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--sp-primary, var(--primary));
  margin-bottom: 12px;
  text-align: left;
  width: 100%;
  align-self: stretch;
}

.sp-screen--hunt .sp-passage-card {
  width: 100%;
  box-sizing: border-box;
  text-align: justify;
  hyphens: auto;
}

.sp-passage-card {
  font-family: 'Nunito', sans-serif;
  font-size: 1.15rem;
  line-height: 1.9;
  color: #3c3c3c;
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px 24px;
}

.sp-passage-selectable {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.sp-passage-selectable--wrong {
  animation: sp-hunt-shake 0.45s ease;
  background: rgba(255, 120, 120, 0.15);
}

.sp-hunt-mark {
  background: var(--sp-duo-blue-light);
  box-shadow: inset 0 -2px 0 var(--sp-duo-blue);
  border-radius: 2px;
  padding: 0 1px;
  cursor: pointer;
  color: inherit;
}

.sp-hunt-phrase,
.sp-hunt-word {
  display: inline;
  padding: 1px 2px;
  margin: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.sp-hunt-phrase:hover,
.sp-hunt-word:hover {
  background: var(--sp-duo-blue-light);
}

.sp-hunt-phrase--selected {
  background: var(--sp-duo-blue-light);
  box-shadow: inset 0 -2px 0 var(--sp-duo-blue);
  color: var(--sp-duo-blue-dark);
}

.sp-hunt-word--selected {
  background: var(--sp-duo-blue-light);
  box-shadow: inset 0 -2px 0 var(--sp-duo-blue);
  color: var(--sp-duo-blue-dark);
  font-weight: 600;
}

.sp-hunt-word--wrong {
  animation: sp-hunt-shake 0.45s ease;
  background: rgba(255, 120, 120, 0.25);
}

@keyframes sp-hunt-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

.sp-hunt-selected-panel {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--white);
  border: 2px solid var(--border-light);
  border-radius: 14px;
}

.sp-hunt-selected-label {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sp-hunt-selected-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-hunt-selected-list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: 8px;
}

.sp-hunt-selected-slot {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  padding: 8px 10px;
  background: var(--bg-light);
  border: 1px dashed var(--border-light);
  border-radius: 8px;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sp-hunt-selected-slot--empty {
  background: var(--sp-duo-blue-light);
  border: 2px dashed var(--sp-duo-blue-border);
  color: var(--sp-duo-blue);
}

.sp-hunt-selected-slot--pending {
  background: var(--sp-duo-blue-light);
  border: 2px solid var(--sp-duo-blue);
  color: var(--sp-duo-blue-dark);
  box-shadow: 0 2px 0 var(--sp-duo-blue-border);
}

.sp-hunt-selected-slot--pending .sp-hunt-selected-text {
  color: var(--sp-duo-blue-dark);
}

.sp-hunt-selected-slot--correct {
  background: var(--sp-duo-green-light);
  border: 2px solid var(--sp-duo-green-border);
  color: var(--sp-duo-green-dark);
  box-shadow: none;
}

.sp-hunt-selected-slot--correct .sp-hunt-selected-text {
  color: var(--sp-duo-green-dark);
  font-weight: 700;
}

.sp-hunt-selected-slot--correct .sp-hunt-selected-num {
  color: var(--sp-duo-green);
}

.sp-hunt-corrected {
  font-weight: 700;
  color: var(--sp-duo-green-dark);
  background: var(--sp-duo-green-light);
  border-radius: 3px;
  padding: 0 2px;
}

.sp-hunt-marked {
  display: inline;
  background: rgba(220, 80, 80, 0.14);
  border-radius: 4px;
  padding: 0 2px;
}

.sp-hunt-fixed {
  display: inline;
}

.sp-hunt-order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  margin-right: 0.2em;
  border-radius: 50%;
  background: var(--sp-duo-green, #58cc02);
  color: #fff;
  font-size: 0.72em;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.sp-hunt-marked-wrong {
  text-decoration: line-through;
  color: #c0392b;
  font-weight: 600;
}

.sp-hunt-selected-slot--marked {
  border-color: rgba(220, 80, 80, 0.35);
  background: rgba(220, 80, 80, 0.08);
}

.sp-hunt-selected-slot--marked .sp-hunt-selected-text {
  color: #c0392b;
}

.sp-hunt-fix-wrong {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.sp-hunt-fix-wrong s {
  color: #c0392b;
}

.sp-screen--guided-error .sp-guided-progress {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--sp-primary, var(--primary));
  margin-bottom: 12px;
  text-align: center;
}

.sp-screen--guided-error .sp-guided-prompt {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text);
}

.sp-screen--guided-error .sp-guided-wrong {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 16px;
  text-align: center;
}

.sp-screen--guided-error .sp-guided-wrong s {
  color: #c0392b;
  text-decoration: line-through;
}

.sp-hunt-reveal {
  display: inline;
}

.sp-hunt-reveal-wrong {
  text-decoration: line-through;
  color: #c45c26;
  font-weight: 600;
}

.sp-hunt-reveal-correct {
  font-weight: 700;
  color: var(--sp-duo-green-dark);
  margin-left: 0.2em;
}

.sp-hunt-selected-slot--empty .sp-hunt-selected-text {
  color: var(--sp-duo-blue);
  font-style: italic;
  font-weight: 500;
}

.sp-hunt-selected-item {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sp-duo-blue-dark);
  padding: 8px 10px;
  background: var(--sp-duo-blue-light);
  border: 2px solid var(--sp-duo-blue-border);
  border-radius: 8px;
}

.sp-hunt-selected-num {
  color: var(--text-light);
  font-weight: 700;
}

.sp-hunt-selected-empty {
  font-size: 0.9rem;
  color: var(--text-light);
  font-style: italic;
}

.sp-hunt-corrections {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--white);
  border: 2px solid var(--sp-primary, var(--primary));
  border-radius: 14px;
}

.sp-hunt-corrections-title {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.sp-hunt-corrections-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sp-hunt-correction-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sp-hunt-correction-wrong {
  font-weight: 600;
  color: #c45c26;
  text-decoration: line-through;
}

.sp-hunt-correction-arrow {
  color: var(--text-light);
}

.sp-hunt-correction-row .sp-text-input {
  flex: 1 1 140px;
  min-width: 120px;
}

.sp-hunt-correction {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.sp-hunt-correction .sp-hunt-correction-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
}

.sp-practice-main .sp-screen .sp-hunt-correction .sp-hunt-correction-row .sp-text-input,
.sp-hunt-correction .sp-hunt-correction-row .sp-text-input {
  flex: 0 1 14rem;
  min-width: 8rem;
  width: 14rem;
  max-width: min(14rem, 100%);
  margin: 0;
}

.sp-hunt-correction-error-box {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 46%;
  padding: 8px 12px;
  background: rgba(220, 80, 80, 0.08);
  border: 1px solid rgba(220, 80, 80, 0.35);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
  text-align: center;
}

.sp-hunt-correction-error-box s {
  color: #c0392b;
  text-decoration: line-through;
}

.sp-screen--sort {
  align-items: stretch;
}

.sp-sort-verb-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  width: 100%;
  margin-bottom: 20px;
  min-height: 56px;
  padding: 12px;
  background: var(--bg-light);
  border: 2px dashed var(--border-light);
  border-radius: 14px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sp-sort-verb-pool--over {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-sort-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

.sp-sort-group {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.sp-sort-group-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  text-align: center;
}

.sp-sort-dropzone {
  flex: 1;
  width: 100%;
  min-height: 120px;
  border: 2.5px dashed var(--sp-duo-blue-border);
  border-radius: 14px;
  padding: 10px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  background: rgba(221, 244, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(28, 176, 246, 0.08);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sp-sort-dropzone--over {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-sort-verb {
  padding: 9px 14px;
  border: 2px solid #e2e8f4;
  border-bottom-width: 3px;
  border-bottom-color: #dce3f0;
  border-radius: 12px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: grab;
  color: var(--text-dark);
  box-shadow: 0 3px 0 #dce3f0;
  touch-action: none;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
}

.sp-sort-verb:hover {
  border-color: var(--sp-duo-blue);
  background: var(--sp-duo-blue-light);
}

.sp-sort-verb:active {
  cursor: grabbing;
  transform: translateY(2px);
  box-shadow: 0 1px 0 #dce3f0;
}

.sp-sort-verb--dragging {
  opacity: 0.45;
}

.sp-sort-verb--selected {
  border-color: var(--sp-primary);
  background: var(--sp-primary-tint);
  color: var(--primary);
  box-shadow: 0 3px 0 rgba(28, 176, 246, 0.25);
}

.sp-sort-verb--correct {
  border-color: var(--sp-correct);
  border-bottom-color: #2ea872;
  background: #e8f8f0;
  color: #1a7a52;
  box-shadow: 0 3px 0 #2ea872;
  cursor: default;
}

.sp-sort-verb--incorrect {
  border-color: var(--sp-incorrect);
  border-bottom-color: #c0392b;
  background: #fdecea;
  color: #a93226;
  box-shadow: 0 3px 0 #c0392b;
  cursor: default;
}

/* ─── Feedback sheet ────────────────────────────────────────────────── */

.sp-feedback-sheet {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sp-feedback-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  background: none;
}

.sp-feedback-svg {
  width: 2.75rem;
  height: 2.75rem;
  transform-origin: center;
  animation: sp-feedback-icon-zoom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes sp-feedback-icon-zoom {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.sp-feedback--correct .sp-feedback-icon {
  color: var(--sp-correct);
}

.sp-feedback--incorrect .sp-feedback-icon {
  color: var(--sp-incorrect);
}

.sp-feedback-body {
  flex: 1;
  min-width: 0;
}

.sp-feedback--correct .sp-feedback-title {
  color: var(--sp-correct);
}

.sp-feedback--incorrect .sp-feedback-title {
  color: var(--sp-incorrect);
}

.sp-feedback-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 4px;
  line-height: 1.3;
}

.sp-feedback-answer {
  font-size: 0.9rem;
  margin: 0;
  color: var(--text-dark);
  line-height: 1.45;
}

.sp-feedback-answer span {
  font-weight: 700;
  color: var(--text-light);
}

/* ─── Result screens ────────────────────────────────────────────────── */

@keyframes spResultPopIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spConfettiFall {
  0% {
    opacity: 0;
    transform: translateY(-12px) rotate(0deg);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(72px) rotate(180deg);
  }
}

.sp-result-screen {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 44px 24px 32px;
  background: var(--white);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(45, 46, 95, 0.1);
  border: 2px solid var(--sp-duo-blue-border);
  animation: spResultPopIn 0.45s ease;
  box-sizing: border-box;
  width: 100%;
  max-width: min(420px, 100%);
  margin-inline: auto;
}

.sp-lesson:has(.sp-result-screen--complete),
.sp-lesson:has(.sp-result-screen--failed),
.sp-lesson:has(.sp-result-screen--retry) {
  justify-content: center;
  align-items: center;
  min-width: 0;
  box-sizing: border-box;
  padding-inline: clamp(12px, 4vw, 20px);
  overflow-x: hidden;
  overflow-y: auto;
}

.sp-result-screen--complete {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fcff 100%);
}

.sp-result-screen--failed,
.sp-result-screen--retry {
  width: 100%;
  max-width: 420px;
}

.sp-result-screen--failed {
  background: linear-gradient(180deg, #ffffff 0%, #fff8fb 100%);
}

.sp-result-celebration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sp-result-confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  opacity: 0;
  animation: spConfettiFall 2.4s ease-in infinite;
}

.sp-result-confetti--1 {
  top: 18%;
  left: 14%;
  background: #f472b6;
  animation-delay: 0.1s;
}

.sp-result-confetti--2 {
  top: 12%;
  right: 18%;
  background: #fbbf24;
  animation-delay: 0.5s;
}

.sp-result-confetti--3 {
  top: 22%;
  left: 48%;
  background: #34d399;
  animation-delay: 0.9s;
}

.sp-result-confetti--4 {
  top: 16%;
  right: 36%;
  background: var(--sp-duo-blue);
  animation-delay: 1.3s;
}

.sp-result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--sp-primary-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--sp-primary);
  position: relative;
  z-index: 1;
}

.sp-result-icon .material-symbols-outlined {
  font-size: 2.75rem;
}

.sp-result-icon--success {
  background: linear-gradient(145deg, var(--sp-duo-blue-light), #ffffff);
  color: var(--sp-duo-blue);
  box-shadow: 0 8px 24px rgba(28, 176, 246, 0.2);
}

.sp-result-icon--failed {
  background: linear-gradient(145deg, rgba(244, 114, 182, 0.18), #ffffff);
  color: #f472b6;
  box-shadow: 0 8px 24px rgba(244, 114, 182, 0.18);
}

.sp-result-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.65rem;
  margin: 0 0 8px;
  color: var(--primary);
  position: relative;
  z-index: 1;
}

.sp-result-subtitle {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-light);
  margin: 0 0 28px;
  position: relative;
  z-index: 1;
}

.sp-result-subtitle strong {
  color: var(--primary);
  font-weight: 800;
}

.sp-result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.sp-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--sp-duo-blue-border);
}

.sp-stat-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.sp-stat--correct .sp-stat-icon {
  color: var(--sp-correct);
}

.sp-stat--lives .sp-stat-icon {
  color: #f472b6;
}

.sp-stat--xp .sp-stat-icon {
  color: #f59e0b;
}

.sp-stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.sp-stat-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sp-result-screen .sp-btn {
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.sp-result-actions {
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.sp-result-actions .sp-btn {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  margin: 0;
  min-height: 48px;
  padding: 12px 14px;
}

.sp-result-actions .sp-btn--ghost {
  margin-top: 0;
  background: var(--white);
  color: var(--primary);
  border-color: var(--sp-duo-blue-border);
}

.sp-result-actions .sp-btn--ghost:active:not(:disabled) {
  background: var(--sp-duo-blue-light);
}

.sp-btn--labeled {
  flex-direction: row;
  gap: 8px;
}

.sp-result-actions .sp-btn--labeled .sp-btn-label {
  font-size: 0.92rem;
}

.sp-btn--labeled .sp-btn-label {
  font-size: 1.05rem;
}

.sp-btn--labeled .material-symbols-outlined {
  font-size: 1.4rem;
}

.sp-result-actions .sp-btn--labeled .material-symbols-outlined {
  font-size: 1.25rem;
}

/* ─── Lesson focus layout ───────────────────────────────────────────── */

body:has(.sp-lesson-mount) {
  background: transparent;
}

body:has(.sp-lesson-mount)::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url('../../Assets/images/Background.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.42s ease;
}

body:has(.sp-lesson-mount.sp-lesson-mount--enter-active)::before,
body:has(.sp-lesson-mount:not(.sp-lesson-mount--enter))::before {
  opacity: 1;
}

body:has(.sp-lesson-mount) #app,
body:has(.sp-lesson-mount) .app-container,
body:has(.sp-lesson-mount) #main-content,
body:has(.sp-lesson-mount) #courseDashboardCenter,
body:has(.sp-lesson-mount) #courseCenterScroll,
body:has(.sp-lesson-mount) .cw-page-content,
body:has(.sp-lesson-mount) .course-hub-page,
body:has(.sp-lesson-mount) #courseCenterSection,
body:has(.sp-lesson-mount) #feCenterSection.fe-section--vocab-exercise,
body:has(.sp-lesson-mount) .dashboard-layout--lesson-focus,
body:has(.sp-lesson-mount) .dashboard-layout--lesson-focus > .dashboard-center,
body:has(.sp-lesson-mount) .dashboard-center--course,
body:has(.sp-lesson-mount) .course-center--lesson-focus,
body:has(.sp-lesson-mount) .course-center--lesson-focus .course-unit-content,
body:has(.sp-lesson-mount) .sp-lesson-mount,
body:has(.sp-lesson-mount) .sp-lesson {
  background: transparent !important;
}

body:has(.sp-lesson-mount) #app,
body:has(.sp-lesson-mount) .app-container,
body:has(.sp-lesson-mount) #main-content,
body:has(.sp-lesson-mount) .dashboard-layout--lesson-focus {
  position: relative;
  z-index: 1;
}

body:has(.dashboard-layout--lesson-focus) #courseCenterSection.course-center--lesson-focus:has(.sp-lesson-mount),
body:has(.dashboard-layout--lesson-focus) #feCenterSection.fe-section--vocab-exercise:has(.sp-lesson-mount),
body:has(.dashboard-layout--lesson-focus) .dashboard-center--course:has(.sp-lesson-mount) {
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
}

.course-center--lesson-focus:has(.sp-lesson-mount) {
  max-width: 880px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
}

.course-center--lesson-focus:has(.sp-lesson--theory) {
  max-width: none;
  width: 100%;
  min-width: 0;
  padding: 0;
}

.course-center--lesson-focus:has(.sp-lesson-mount) > .course-unit-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0;
  gap: 0;
}

.course-center--lesson-focus:has(.sp-lesson-mount) .sp-lesson-mount.course-unit-content {
  min-height: 0;
  max-height: none;
  height: 100%;
}

@media (min-width: 768px) {
  .course-center--lesson-focus:has(.sp-lesson-mount) {
    max-width: 960px;
    width: 100%;
    min-width: 0;
  }

  .course-center--lesson-focus:has(.sp-lesson--theory) {
    max-width: none;
    width: 100%;
    min-width: 0;
  }
}

.dashboard-layout--lesson-focus .sp-lesson-mount {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-height: 100dvh;
  height: 100%;
  max-width: none;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.dashboard-layout--lesson-focus .sp-lesson {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  max-height: 100dvh;
  gap: 0;
}

.dashboard-layout--lesson-focus .sp-lesson-mount:has(.sp-lesson--theory) {
  padding: 0;
}

.dashboard-layout--lesson-focus .sp-lesson--theory {
  padding: max(12px, env(safe-area-inset-top, 0px)) 16px max(20px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.dashboard-layout--lesson-focus .sp-theory-shell {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 48px);
  padding-top: 12px;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
}

.dashboard-layout--lesson-focus .sp-practice-session {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.dashboard-layout--lesson-focus .sp-practice-header {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .sp-practice-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: clamp(4px, 1.5vw, 8px);
    padding: clamp(6px, 1.5vw, 8px) 0 clamp(8px, 2vw, 12px);
  }

  .sp-practice-header .sp-header-exit,
  .sp-practice-header .sp-header-theory {
    flex-shrink: 0;
  }

  .sp-practice-header .sp-session-progress {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }

  .sp-practice-header .sp-session-progress-pills {
    justify-content: stretch;
    gap: clamp(2px, 0.5vw, 5px);
  }

  .sp-practice-header .sp-session-progress-pill {
    min-width: 4px;
    max-width: 16px;
  }

  .sp-practice-header .sp-session-progress-pill--active {
    max-width: 24px;
  }

  .sp-practice-header .sp-hearts-bar {
    flex: 0 0 auto;
    justify-content: flex-end;
    max-width: none;
  }

  .sp-practice-header.ve-modal-header--video {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 10px;
  }

  .sp-practice-header.ve-modal-header--video .ve-modal-header-title {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* ─── Practice session — mobile ─────────────────────────────────────── */

.sp-practice-main .sp-exercise-card:has(.sp-screen--tiles) {
  align-items: stretch;
  justify-content: flex-start;
}

.sp-practice-main .sp-screen--tiles .sp-tile-answer,
.sp-practice-main .sp-screen--tiles .sp-tile-bank,
.sp-practice-main .sp-screen--tiles .sp-visual-prompt {
  max-width: 100%;
}

@media (max-width: 768px) {
  .dashboard-layout--lesson-focus .sp-lesson-mount:has(.sp-result-screen) {
    padding-inline: max(10px, env(safe-area-inset-left, 0px)) max(10px, env(safe-area-inset-right, 0px));
    padding-block: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
    overflow: visible;
  }

  body:has(.dashboard-layout--lesson-focus) #feCenterSection.fe-section--vocab-exercise:has(.sp-result-screen),
  body:has(.dashboard-layout--lesson-focus) #courseCenterSection.course-center--lesson-focus:has(.sp-result-screen) {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .sp-result-screen {
    padding: 28px 16px 22px;
    border-radius: 20px;
  }

  .sp-result-title {
    font-size: 1.4rem;
  }

  .sp-result-stats {
    gap: 8px;
  }

  .sp-result-icon {
    width: 68px;
    height: 68px;
    margin-bottom: 16px;
  }

  .sp-result-icon .material-symbols-outlined {
    font-size: 2.35rem;
  }

  .sp-session-instruction {
    margin-bottom: 12px;
    line-height: 1.3;
  }

  .sp-prompt-sentence,
  .sp-display-prompt,
  .sp-meaning-sentence {
    line-height: 1.5;
    margin-bottom: 14px;
  }

  .sp-prompt-sentence--inline-gap {
    line-height: 1.65;
  }

  .sp-practice-main .sp-exercise-card {
    justify-content: flex-start;
  }

  .sp-practice-main .sp-exercise-card:has(.sp-screen--passage-gap) {
    padding-bottom: 8px;
  }

  .sp-practice-main .sp-exercise-card:has(.sp-screen--wbseq) {
    padding-bottom: 8px;
  }

  .sp-screen--passage-gap .sp-passage-wordbank {
    margin-bottom: 0;
    padding: 8px 10px;
    gap: 6px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  }

  .sp-screen--passage-gap .sp-passage-wordbank-chip {
    padding: 5px 10px;
    font-size: 0.78rem;
  }

  .sp-screen--passage-gap .sp-passage-gap-scroll {
    margin-top: 10px;
    border-radius: 12px;
  }

  .sp-screen--wbseq .sp-gap-wordbank {
    margin-bottom: 0;
  }

  .sp-screen--wbseq .sp-wbseq-sentences-scroll {
    margin-top: 10px;
  }

  .sp-screen--passage-gap .sp-passage-gap-scroll .sp-passage-card {
    min-height: 100%;
    border-radius: 12px;
    padding: 18px 20px 22px;
    font-size: 1.02rem;
    line-height: 1.75;
  }

  .sp-screen--passage-gap .sp-passage-gap-num {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.68rem;
  }

  .sp-visual-prompt {
    margin-bottom: 12px;
  }

  .sp-visual-prompt__image {
    max-height: 150px;
  }

  .sp-tile-answer {
    min-height: 44px;
    padding: 8px;
    gap: 6px;
    margin-bottom: 16px;
    border-radius: 12px;
  }

  .sp-tile-bank {
    gap: 6px;
    padding-top: 2px;
  }

  .sp-tile {
    padding: 7px 11px;
    border-radius: 10px;
    box-shadow: 0 2px 0 #dce3f0;
  }

  .sp-feedback-svg {
    width: 2.25rem;
    height: 2.25rem;
  }

  .sp-feedback-title {
    font-size: 1rem;
  }

  .sp-feedback-answer {
    font-size: 0.85rem;
  }

  .sp-screen--word-bank-tick {
    min-height: 0;
  }

  .sp-wbt-grid-scroll {
    max-height: min(48vh, 360px);
    padding: 8px;
  }

  .sp-wbt-grid {
    gap: 6px;
  }

  .sp-wbt-chip {
    padding: 5px 10px;
    font-size: 0.78rem;
  }

  .sp-gap-wordbank {
    margin-bottom: 12px;
    padding: 8px 10px;
    gap: 6px;
    max-height: min(28vh, 180px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sp-gap-wordbank-chip {
    padding: 6px 11px;
    font-size: 0.8rem;
  }

  .sp-screen--hunt .sp-passage-card {
    max-height: min(42vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sp-screen--verb-bank .sp-verb-bank {
    gap: 6px;
    justify-content: center;
  }

  .sp-verb-chip {
    padding: 8px 14px;
    font-size: clamp(0.82rem, 0.5rem + 1.2vw, 0.92rem);
    min-height: var(--sp-touch-target, 44px);
  }

  .sp-screen--guided-error .sp-guided-wrong {
    font-size: clamp(0.95rem, 0.55rem + 1.5vw, 1.1rem);
    margin-bottom: 14px;
  }

  .sp-screen--meaning .sp-option-grid {
    max-width: var(--sp-choice-max);
  }

  .sp-screen--sort .sp-sort-verb-pool {
    min-height: 48px;
    padding: 8px;
    gap: 6px;
    margin-bottom: 14px;
  }

  .sp-screen--sort .sp-sort-dropzone {
    min-height: 96px;
    padding: 8px;
  }

  .sp-sort-verb {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-height: var(--sp-touch-target, 40px);
  }
}

@media (max-width: 480px) {
  .sp-theory-card-body {
    padding-top: 12px;
    padding-right: 8px;
  }

  .dashboard-layout--lesson-focus .sp-lesson--theory {
    padding: max(8px, env(safe-area-inset-top, 0px)) 12px max(16px, env(safe-area-inset-bottom, 0px));
  }

  .sp-session-instruction {
    margin-bottom: 10px;
  }

  .sp-prompt-sentence,
  .sp-display-prompt,
  .sp-meaning-sentence,
  .sp-prompt-sentence--inline-gap {
    line-height: 1.5;
    margin-bottom: 12px;
  }

  .sp-visual-prompt__image {
    max-height: 120px;
  }

  .sp-schedule-ref {
    margin-bottom: 14px;
  }

  .sp-schedule-view-toolbar {
    margin-bottom: 10px;
  }

  .sp-schedule-view-btn {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .sp-schedule-view-btn__label {
    display: none;
  }

  .sp-schedule-ref__header {
    padding: 12px 14px;
  }

  .sp-schedule-ref__timeline {
    max-height: min(42vh, 280px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 10px 8px;
  }

  .sp-schedule-ref--full .sp-schedule-ref__timeline {
    max-height: none;
    overflow: visible;
  }

  .sp-schedule-ref__card {
    padding: 8px 10px;
    margin-bottom: 8px;
  }

  .sp-schedule-ref__time {
    font-size: 0.78rem;
  }

  .sp-tile {
    padding: 6px 9px;
    border-radius: 9px;
  }

  .sp-tile-answer {
    padding: 6px;
    gap: 5px;
  }

  .sp-tile-bank {
    gap: 5px;
  }
}

/* Phones: let the correction row wrap so the input and the wrong-word box
   are always fully visible instead of overflowing the screen. */
@media (max-width: 768px) {
  .sp-hunt-correction {
    width: 100%;
  }

  .sp-hunt-correction .sp-hunt-correction-row {
    flex-wrap: wrap;
    width: 100%;
  }

  .sp-practice-main .sp-screen .sp-hunt-correction .sp-hunt-correction-row .sp-text-input,
  .sp-hunt-correction .sp-hunt-correction-row .sp-text-input {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }

  .sp-hunt-correction-error-box {
    max-width: 100%;
    width: 100%;
  }
}

/* Narrow screens: stack footer/result actions; hunt slots single column */
@media (max-width: 360px) {
  .sp-result-actions {
    flex-direction: column;
  }

  .sp-result-actions .sp-btn {
    width: 100%;
  }

  .sp-hunt-correction .sp-hunt-correction-row {
    flex-wrap: wrap;
  }

  .sp-hunt-correction-error-box {
    max-width: 100%;
    width: 100%;
  }

  .sp-practice-footer-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: clamp(4px, 1.5vw, 8px);
    padding: clamp(8px, 2vw, 12px) clamp(8px, 2.5vw, 16px);
  }

  .sp-footer-actions-right {
    margin-left: auto;
    width: auto;
    flex: 0 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: clamp(4px, 1.5vw, 8px);
    min-width: 0;
  }

  .sp-practice-footer .sp-btn--skip {
    min-width: 0;
    width: auto;
    flex: 0 0 auto;
    padding: clamp(7px, 1.5vw, 10px) clamp(8px, 2vw, 14px);
    font-size: clamp(0.72rem, 0.5rem + 0.8vw, 0.85rem);
  }

  .sp-practice-footer .sp-btn--hint-icon,
  .sp-practice-footer .sp-btn--explain-icon {
    width: clamp(36px, 9vw, 44px);
    min-width: clamp(36px, 9vw, 44px);
    min-height: clamp(36px, 9vw, 44px);
  }

  .sp-footer-actions-right .sp-btn--action {
    flex: 0 0 auto;
    min-width: clamp(36px, 9vw, 44px);
    width: clamp(36px, 9vw, 44px);
    min-height: clamp(36px, 9vw, 44px);
  }
}

/* Tablet/desktop: theory side-nav layout + lesson mount spacing (768px unified breakpoint) */
@media (min-width: 768px) {
  .sp-theory-shell {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
  }

  .sp-theory-flow {
    flex: 0 1 60vw;
    width: 60vw;
    max-width: 60%;
  }

  .sp-theory-nav--prev,
  .sp-theory-nav--next {
    margin: 0;
    justify-self: auto;
  }

  .sp-lesson-mount {
    padding-bottom: 32px;
    padding-top: clamp(12px, 3vw, 20px);
  }

  .dashboard-layout--lesson-focus .sp-lesson-mount:not(:has(.sp-lesson--theory)) {
    max-width: none;
  }

  .dashboard-layout--lesson-focus .sp-lesson--theory {
    padding: max(16px, env(safe-area-inset-top, 0px)) clamp(12px, 3vw, 28px) max(24px, env(safe-area-inset-bottom, 0px));
  }

  .sp-theory-card {
    gap: 28px;
  }

  .sp-theory-card-body {
    padding: 20px 16px 8px 0;
  }
}

/* ─── Course theory study experience ────────────────────────────────── */

.dashboard-layout--lesson-focus .sp-lesson-mount:has(.sp-lesson--theory) {
  max-width: 1120px;
  padding: clamp(10px, 2vw, 20px) clamp(12px, 3vw, 32px) clamp(16px, 2vw, 28px);
}

.dashboard-layout--lesson-focus .sp-lesson--theory {
  min-height: calc(100dvh - clamp(26px, 5vw, 48px));
}

.sp-lesson--theory .sp-theory-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "flow flow"
    "prev next";
  gap: 14px;
}

.sp-lesson--theory .sp-theory-flow {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-area: flow;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  gap: 10px;
}

.sp-theory-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "copy dots"
    "track track";
  align-items: center;
  gap: 7px 18px;
  padding: 0 4px;
}

.sp-theory-progress-copy {
  grid-area: copy;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sp-theory-progress-label,
.sp-theory-progress-count {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.sp-theory-progress-label {
  color: var(--primary, #2d2e5f);
}

.sp-theory-progress-count {
  color: #64748b;
}

.sp-theory-progress-track {
  grid-area: track;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eef7;
}

.sp-theory-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sp-duo-blue), #7c8cf8);
  box-shadow: 0 0 12px rgba(28, 176, 246, 0.24);
  transition: width 0.3s ease;
}

.sp-theory-progress .sp-theory-dots {
  grid-area: dots;
  justify-content: flex-end;
  gap: 6px;
  padding: 0;
}

.sp-theory-progress .sp-theory-dot {
  width: 8px;
  height: 8px;
  box-shadow: none;
}

.sp-theory-progress .sp-theory-dot--active {
  width: 22px;
}

.sp-theory-card {
  position: relative;
  gap: 16px;
  border: 1px solid rgba(28, 176, 246, 0.34);
  border-bottom: 1px solid rgba(28, 176, 246, 0.34);
  border-radius: 24px;
  padding: clamp(18px, 2.5vw, 30px);
  background:
    radial-gradient(circle at 100% 0%, rgba(221, 244, 255, 0.72), transparent 30%),
    var(--white, #fff);
  box-shadow:
    0 18px 50px rgba(45, 46, 95, 0.1),
    0 2px 8px rgba(45, 46, 95, 0.05);
}

.sp-theory-card-header {
  align-items: center;
  padding-right: 2px;
}

.sp-theory-card-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--sp-duo-blue-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sp-theory-card-eyebrow .material-symbols-outlined {
  font-size: 1rem;
}

.sp-theory-card-count {
  display: none;
  margin-left: auto;
  color: #64748b;
}

.sp-theory-card-title {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.85rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.sp-theory-card-subtitle {
  max-width: 60ch;
  margin-top: 6px;
  font-size: clamp(0.84rem, 0.78rem + 0.2vw, 0.96rem);
  line-height: 1.4;
  color: #64748b;
}

.sp-theory-close {
  width: 40px;
  height: 40px;
  border: 1px solid #dbe7f3;
  background: rgba(255, 255, 255, 0.82);
  color: #64748b;
  box-shadow: 0 2px 8px rgba(45, 46, 95, 0.06);
}

.sp-theory-close:hover {
  border-color: #fca5a5;
  background: #fff1f2;
  color: #e11d48;
}

.sp-theory-card-body {
  gap: 14px;
  margin-top: 0;
  padding: 18px 15px 12px 1px;
  border-top-color: #e7eef7;
  scrollbar-gutter: stable;
}

.sp-theory-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid #e5edf6;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.68);
}

.sp-theory-section.sp-theory-transformation {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.sp-theory-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  color: #475569;
}

.sp-theory-section-title .material-symbols-outlined {
  font-size: 1.08rem;
  color: var(--sp-duo-blue);
}

.sp-form-table-row,
.sp-wf-item {
  border: 1px solid #e5edf6;
  background: #fff;
}

.sp-form-table-label {
  color: var(--sp-duo-blue-dark);
}

.sp-chip-group-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: default;
}

.sp-chip-group-toggle .material-symbols-outlined {
  display: none;
  color: var(--sp-duo-blue-dark);
  transition: transform 0.18s ease;
}

.sp-chip-group-title {
  margin: 0;
  color: var(--sp-duo-blue-dark);
}

.sp-chip {
  min-height: 34px;
  padding: 7px 13px;
  background: #eef8ff;
}

.sp-speakable {
  position: relative;
}

.sp-speakable-icon {
  flex-shrink: 0;
  align-self: center;
  margin-left: 8px;
  font-size: 1.05rem;
  color: var(--sp-duo-blue);
  opacity: 0.65;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.sp-speakable:hover .sp-speakable-icon,
.sp-speakable:focus-visible .sp-speakable-icon,
.sp-speakable--speaking .sp-speakable-icon {
  opacity: 1;
}

.sp-speakable--speaking .sp-speakable-icon {
  animation: spTheorySpeakPulse 0.9s ease-in-out infinite;
}

button.sp-example-line.sp-speakable,
button.sp-comparison-accordion-example.sp-speakable,
button.sp-transform-sentence-text.sp-speakable,
button.sp-transform-build-text.sp-speakable {
  display: flex;
  align-items: center;
}

button.sp-chip.sp-speakable {
  display: inline-flex;
  align-items: center;
}

button.sp-chip.sp-speakable .sp-speakable-icon {
  margin-left: 5px;
  font-size: 0.9rem;
}

@keyframes spTheorySpeakPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.sp-lesson--theory .sp-theory-nav {
  width: auto;
  min-width: min(170px, 44vw);
  height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  gap: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 3px 0 #d6e4ef;
}

.sp-lesson--theory .sp-theory-nav--prev {
  justify-self: end;
  margin: 0;
  border-color: #dbe7f3;
  color: #64748b;
}

.sp-lesson--theory .sp-theory-nav--next {
  justify-self: start;
  margin: 0;
  border-color: var(--sp-duo-blue);
  box-shadow: 0 3px 0 var(--sp-duo-blue-dark);
}

.sp-lesson--theory .sp-theory-nav:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #d6e4ef;
}

.sp-lesson--theory .sp-theory-nav--next:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--sp-duo-blue-dark);
}

@media (min-width: 900px) {
  .course-center--lesson-focus:has(.sp-lesson--theory) {
    width: min(78%, 1180px);
    min-width: min(78%, 1180px);
    max-width: 1180px;
  }
}

@media (max-width: 767px) {
  .sp-theory-progress {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "copy"
      "track";
  }

  .sp-theory-progress .sp-theory-dots {
    display: none;
  }

  .sp-theory-card-count {
    display: inline;
  }

  .sp-theory-card {
    border-radius: 20px;
    padding: 16px;
  }

  .sp-theory-card-header {
    align-items: flex-start;
  }

  .sp-theory-card-body {
    padding-right: 8px;
  }

  .sp-theory-section {
    padding: 14px;
  }

  .sp-chip-group-toggle {
    min-height: 42px;
    margin: 0;
    padding: 4px 2px;
    cursor: pointer;
  }

  .sp-chip-group-toggle .material-symbols-outlined {
    display: block;
  }

  .sp-chip-group-toggle[aria-expanded="true"] .material-symbols-outlined {
    transform: rotate(180deg);
  }

  .sp-chip-group-toggle[aria-expanded="false"] + .sp-chip-group-content {
    display: none;
  }

  .sp-chip-group + .sp-chip-group {
    margin-top: 6px;
    border-top: 1px solid #e5edf6;
  }

  .sp-lesson--theory .sp-theory-nav {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: 46px;
    padding: 0 8px;
    gap: 6px;
    font-size: clamp(0.58rem, 2.7vw, 0.72rem);
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .sp-lesson--theory .sp-theory-nav .material-symbols-outlined {
    font-size: 1.05rem;
    flex-shrink: 0;
  }

  .sp-lesson--theory .sp-theory-nav .sp-theory-nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

}

@media (prefers-reduced-motion: reduce) {
  .sp-theory-progress-fill,
  .sp-speakable-icon,
  .sp-chip-group-toggle .material-symbols-outlined {
    transition: none;
  }

  .sp-speakable--speaking .sp-speakable-icon {
    animation: none;
  }
}
