.learning-mode-control {
  display: flex;
  justify-content: center;
  margin: 0 0 18px;
}

.learning-mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 360px);
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.learning-mode-switch::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 5px 18px rgba(91, 127, 255, .28);
  transition: transform .24s ease;
}

.learning-mode-switch[data-target="ja"]::before {
  transform: translateX(100%);
}

.learning-mode-option {
  position: relative;
  z-index: 1;
  padding: 8px 10px;
  color: inherit;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
  transition: color .2s ease;
}

.learning-mode-switch[data-target="en"] .ui-primary,
.learning-mode-switch[data-target="ja"] .ui-secondary {
  color: #fff;
}

.learning-mode-panel {
  animation: learningModeFade .28s ease both;
}

.learning-mode-kicker {
  margin-bottom: 9px;
  color: var(--accent2);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.learning-mode-title {
  margin-bottom: 12px;
  color: var(--text);
  font-size: clamp(25px, 7vw, 34px);
  font-weight: 850;
  line-height: 1.3;
}

.learning-mode-lead,
.learning-mode-copy {
  color: var(--text2);
  font-size: 14px;
  line-height: 1.85;
}

.learning-mode-copy strong {
  color: var(--text);
}

.learning-mode-card {
  margin: 16px 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}

.learning-mode-card h2,
.learning-mode-card h3 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

.learning-mode-scene-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-sm);
  background: var(--surface2);
}

.learning-mode-target {
  margin: 16px 0 6px;
  color: var(--text);
  font-size: clamp(20px, 6vw, 28px);
  font-weight: 850;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.learning-mode-gloss {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.7;
}

.learning-mode-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.learning-mode-list li {
  padding: 12px 14px;
  border-left: 3px solid var(--accent2);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  background: var(--surface2);
  color: var(--text2);
  font-size: 13px;
  line-height: 1.7;
}

.learning-mode-list li strong {
  color: var(--text);
}

.learning-mode-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.learning-mode-actions > * {
  flex: 1;
}

.learning-mode-feedback {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.7;
}

.learning-mode-feedback.ok {
  border: 1px solid rgba(61, 214, 140, .4);
  background: rgba(61, 214, 140, .09);
  color: var(--text);
}

.learning-mode-feedback.fail {
  border: 1px solid rgba(255, 184, 77, .35);
  background: rgba(255, 184, 77, .08);
  color: var(--text2);
}

.learning-mode-panel .choice-expression {
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.5;
}

.learning-mode-panel .choice-gloss {
  margin-top: 3px;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.5;
}

.learning-mode-panel textarea {
  width: 100%;
  min-height: 240px;
  resize: vertical;
}

.scene-image-fallback {
  display: grid;
  gap: 6px;
  min-height: 180px;
  place-content: center;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  background: var(--surface2);
  color: var(--text2);
  text-align: center;
}

.scene-image-fallback strong {
  color: var(--text);
}

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

@media (max-width: 390px) {
  .learning-mode-switch {
    width: 100%;
  }

  .learning-mode-option {
    padding-inline: 6px;
    font-size: 11px;
  }

  .learning-mode-actions {
    flex-direction: column;
  }

  /* Legacy English-learning completion rows can contain HOME, previous, and
     next controls. Stack only that row so the preserved experience stays
     within the 390px release viewport. */
  #step-done .btn-row {
    flex-direction: column;
  }

  #step-done .btn-row > * {
    width: 100%;
    min-width: 0;
  }
}
