:root {
  --ink: #182230;
  --muted: #667085;
  --paper: #fffaf2;
  --sky: #7fd3ff;
  --blue: #246bfe;
  --blue-dark: #1849b5;
  --green: #00a878;
  --yellow: #ffd166;
  --pink: #ff6b9a;
  --orange: #ff8c42;
  --line: rgba(24, 34, 48, 0.14);
  --shadow: 0 18px 45px rgba(24, 34, 48, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Microsoft YaHei", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(127, 211, 255, 0.34), rgba(255, 209, 102, 0.36)),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.lesson-stage {
  min-height: calc(100vh - 184px);
}

.is-hidden {
  display: none !important;
}

.topbar,
.strip-header,
.action-row,
.typed-row,
.video-controls {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow,
.level-label,
.speech-label {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.35rem, 7vw, 5.6rem);
  line-height: 0.94;
}

.score-panel {
  display: grid;
  gap: 4px;
  min-width: 118px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  text-align: center;
  box-shadow: 0 8px 18px rgba(24, 34, 48, 0.08);
}

.score-stars {
  color: var(--orange);
  letter-spacing: 2px;
}

.admin-link,
.back-button {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(24, 34, 48, 0.12);
}

.back-button {
  margin-bottom: 10px;
}

.group-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.front-group-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}

.front-group-card.active {
  border-color: var(--blue);
}

.front-group-cover {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(36, 107, 254, 0.1);
}

.front-group-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.front-group-cover span {
  color: var(--blue);
  font-size: 3rem;
  font-weight: 900;
}

.front-group-card strong {
  font-size: 1.15rem;
}

.front-group-card small {
  color: var(--muted);
  font-weight: 800;
}

.player-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.82fr);
  gap: 20px;
}

.video-player,
.answer-panel {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.video-player {
  min-height: 560px;
  isolation: isolate;
}

.video-cover,
.video-tint {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.video-cover {
  object-fit: cover;
  transform: scale(1.03);
}

.video-tint {
  z-index: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(18, 26, 46, 0.18));
}

.video-frame {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 474px;
  padding: 36px 28px 118px;
}

.lesson-object {
  position: relative;
  display: grid;
  place-items: center;
  width: min(34vw, 240px);
  aspect-ratio: 1;
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
  font-size: clamp(5rem, 17vw, 10rem);
  box-shadow: 0 16px 42px rgba(24, 34, 48, 0.22);
  transition: transform 300ms ease, filter 300ms ease;
}

.lesson-object.is-playing {
  animation: bounce 900ms ease-in-out infinite;
}

.lesson-object.is-complete,
.question-object.is-complete {
  animation: complete-pop 780ms ease both;
}

.lesson-object.is-complete::after,
.question-object.is-complete::after {
  content: "✓";
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  place-items: center;
  width: 52px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #00a878;
  color: #ffffff;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(0, 168, 120, 0.3);
  transform: translate(-50%, -50%);
}

.lesson-object img,
.question-object img,
.card-object img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lesson-object.has-image,
.question-object.has-image {
  padding: 18px;
}

.dialogue-stack {
  display: grid;
  gap: 10px;
  width: min(640px, 94%);
  margin-top: 24px;
}

.dialogue-line {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(24, 34, 48, 0.1);
}

.dialogue-line span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dialogue-line strong {
  font-size: clamp(1.35rem, 3vw, 2.45rem);
  line-height: 1.08;
}

.dialogue-line.teacher {
  justify-self: start;
  max-width: 82%;
  border-left: 6px solid var(--blue);
}

.dialogue-line.child {
  justify-self: end;
  max-width: 88%;
  border-right: 6px solid var(--green);
  text-align: right;
}

.video-controls {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 18px;
  z-index: 3;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-button,
.play-button,
.primary-button,
.secondary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(24, 34, 48, 0.12);
}

.icon-button {
  width: 48px;
  background: #ffffff;
  font-size: 1.5rem;
}

.play-button,
.primary-button {
  padding: 0 20px;
  color: #ffffff;
  background: var(--blue);
}

.primary-button {
  background: var(--green);
}

.play-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  padding: 0 16px;
  background: #ffffff;
}

.progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink));
  transition: width 180ms linear;
}

.answer-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 560px;
  padding: 24px;
}

.answer-panel h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
}

.question-object {
  position: relative;
  display: grid;
  place-items: center;
  width: min(200px, 70%);
  aspect-ratio: 1;
  justify-self: center;
  border: 3px dashed rgba(36, 107, 254, 0.28);
  border-radius: 50%;
  overflow: hidden;
  background: #ffffff;
  font-size: clamp(4.2rem, 15vw, 8rem);
}

.lesson-object.has-image img,
.question-object.has-image img {
  width: 88%;
  height: 88%;
  object-position: center;
  mix-blend-mode: multiply;
}

.speech-card {
  display: grid;
  gap: 6px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.speech-target {
  margin-bottom: 0;
  font-size: 1.34rem;
  font-weight: 900;
  line-height: 1.18;
}

.speech-result {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.28;
}

.typed-row,
.action-row {
  gap: 8px;
}

.main-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.main-actions .primary-button {
  min-height: 58px;
  font-size: 1.1rem;
}

.typed-row input {
  min-width: 0;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.typed-row .secondary-button {
  flex: 0 0 auto;
}

.action-row {
  justify-content: flex-end;
}

.feedback {
  min-height: 26px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.feedback.good {
  color: var(--green);
}

.feedback.try {
  color: #b54708;
}

.course-strip {
  padding-top: 24px;
}

.strip-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.strip-header h2,
.strip-header p {
  margin-bottom: 0;
}

.strip-header p {
  color: var(--muted);
  font-weight: 800;
}

.group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.group-chip {
  min-height: 40px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-weight: 800;
}

.group-chip.active {
  border-color: var(--blue);
  color: #ffffff;
  background: var(--blue);
}

.lesson-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.lesson-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 18px rgba(24, 34, 48, 0.08);
}

.lesson-card.active {
  border-color: var(--blue);
}

.lesson-card.done {
  background: rgba(0, 168, 120, 0.15);
}

.card-object {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  font-size: 2.3rem;
  line-height: 1;
}

.card-word {
  font-size: 1.1rem;
  font-weight: 900;
}

.card-sentence {
  color: var(--muted);
  font-size: 0.92rem;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-12px) scale(1.04);
  }
}

@keyframes complete-pop {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(0, 168, 120, 0);
  }

  42% {
    transform: scale(1.08);
    box-shadow: 0 0 0 14px rgba(0, 168, 120, 0.14);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 24px rgba(0, 168, 120, 0);
  }
}

@media (max-width: 900px) {
  .lesson-stage {
    min-height: 0;
  }

  .player-grid {
    grid-template-columns: 1fr;
  }

  .video-player,
  .answer-panel {
    min-height: auto;
  }

  .video-frame {
    min-height: 430px;
  }

  .lesson-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .score-panel {
    min-width: 96px;
    padding: 10px 8px;
  }

  .video-frame {
    min-height: 390px;
    padding-inline: 14px;
  }

  .lesson-object {
    width: min(58vw, 210px);
  }

  .dialogue-line.teacher,
  .dialogue-line.child {
    max-width: 100%;
  }

  .answer-panel {
    padding: 18px;
  }

  .main-actions,
  .typed-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .video-controls {
    left: 10px;
    right: 10px;
  }

  .group-card-grid {
    grid-template-columns: 1fr;
  }

  .play-button,
  .secondary-button,
  .primary-button {
    padding-inline: 14px;
  }
}
