/* Lively media: video, photos, voice, motion */
@keyframes pulse-soft {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: .92; }
}
@keyframes cam-flash {
  0% { opacity: 0; }
  15% { opacity: .85; }
  100% { opacity: 0; }
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 204, 104, .45); }
  50% { box-shadow: 0 0 0 14px rgba(37, 204, 104, 0); }
}
@keyframes float-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes eq-bar {
  0%, 100% { height: 6px; }
  50% { height: 18px; }
}

.hub {
  position: relative;
  overflow: hidden;
}
.hub-hero {
  width: 100%;
  max-width: 860px;
  height: 180px;
  border-radius: 16px;
  overflow: hidden;
  margin: 0 0 22px;
  position: relative;
  border: 1px solid var(--line);
}
.hub-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hub-hero .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(36,36,36,.72), rgba(36,36,36,.2));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 20px;
  color: #fff;
}
.hub-hero .overlay strong { font-size: 18px; }
.hub-hero .overlay span { font-size: 13px; opacity: .9; }

.hub-card {
  animation: float-in .45s ease both;
}
.hub-card:nth-child(1) { animation-delay: .05s; }
.hub-card:nth-child(2) { animation-delay: .12s; }
.hub-card:nth-child(3) { animation-delay: .2s; }
.hub-card .thumb {
  width: 100%;
  height: 88px;
  border-radius: 10px;
  object-fit: cover;
  margin-bottom: 12px;
  display: block;
}

.yt-frame {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 160px;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
}
.yt-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.yt-poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.yt-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.28);
}
.yt-poster .play {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  animation: pulse-soft 1.8s ease-in-out infinite;
}
.yt-poster .badge {
  position: absolute;
  z-index: 1;
  left: 10px;
  bottom: 10px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
}
.yt-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-deep);
  margin-top: 4px;
}

.photo-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: #163528;
}
.photo-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 120px;
}
.photo-stage.cam-live img {
  filter: saturate(1.05) contrast(1.05);
}
.photo-stage .cam-frame {
  position: absolute;
  inset: 16px 18px 34px;
  border: 2px dashed rgba(255,255,255,.8);
  border-radius: 12px;
  pointer-events: none;
  z-index: 2;
}
.photo-stage .cam-hint {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.photo-stage .flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}
.photo-stage.flashing .flash {
  animation: cam-flash .45s ease-out;
}
.detected-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.95);
  color: var(--primary-deep);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  position: absolute;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  animation: float-in .35s ease both;
}

.word-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;
  background: var(--primary-soft);
  border: 1px solid var(--mint);
  border-radius: 12px;
  padding: 8px;
}
.word-card img {
  width: 72px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
}

.voice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.voice-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  padding: 0 4px;
}
.voice-eq i {
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
  height: 6px;
}
html[data-speaking="1"] .voice-eq i {
  animation: eq-bar .5s ease-in-out infinite;
}
html[data-speaking="1"] .voice-eq i:nth-child(2) { animation-delay: .1s; }
html[data-speaking="1"] .voice-eq i:nth-child(3) { animation-delay: .2s; }
html[data-speaking="1"] .voice-eq i:nth-child(4) { animation-delay: .15s; }

.mic-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--vs-gradient);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  animation: mic-pulse 1.6s ease-in-out infinite;
}
.mic-btn.recording {
  background: linear-gradient(177deg, #ff8a6a, #FB552D);
}

.home-hero {
  border-radius: 12px;
  overflow: hidden;
  min-height: 90px;
  position: relative;
  flex: 1;
}
.home-hero img {
  width: 100%;
  height: 100%;
  min-height: 90px;
  object-fit: cover;
  display: block;
}
.home-hero .shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(36,36,36,.7));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px 12px;
  color: #fff;
}
.home-hero .shade .eyebrow { color: rgba(255,255,255,.85); }
.home-hero .shade .h2 { color: #fff; margin: 0; }

.subject-thumb {
  width: 100%;
  height: 40px;
  border-radius: 7px;
  object-fit: cover;
  margin-bottom: 4px;
}

.frame-tablet .chat-area .bubble { animation: float-in .3s ease both; }
.speak-status {
  font-size: 11px;
  color: var(--muted);
  min-height: 16px;
}

.media-note {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

/* Local video player */
.lesson-video-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 160px;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
}
.lesson-video-wrap video {
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: cover;
  display: block;
  background: #000;
}
.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0,0,0,.35);
  cursor: pointer;
  z-index: 2;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.video-play-overlay .play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  animation: pulse-soft 1.8s ease-in-out infinite;
}

/* Interactive quiz */
.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-choice {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
}
.quiz-choice:hover { border-color: var(--primary); }
.quiz-choice.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 600;
}
.quiz-choice.correct {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.quiz-choice.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
.quiz-choice:disabled { cursor: default; }

/* Coach panel — self-serve guidance */
.coach {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  width: min(300px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.14);
  padding: 12px 14px 14px;
  font-size: 13px;
  animation: float-in .35s ease both;
}
.coach-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.coach-head strong { font-size: 13px; color: var(--primary-deep); }
.coach-x {
  border: none;
  background: var(--canvas);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}
.coach ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.coach li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.4;
}
.coach li:last-child { border-bottom: none; }
.coach li .n {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.coach li.now { color: var(--ink); font-weight: 600; }
.coach li.now .n { background: var(--primary); color: #fff; }
.coach li.done { color: var(--primary-deep); }
.coach li.done .n { background: var(--primary-soft); color: var(--primary-deep); }
.coach-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.hub-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 0 0 22px;
}
.hub-cta .btn { padding: 12px 20px; font-size: 15px; }

#snap-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  background: rgba(26, 173, 85, .95);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
}

/* Admin CMS extras */
.cms-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #242424;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 300;
  max-width: calc(100vw - var(--guide-w, 340px) - 40px);
}
.cms-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cms-toast.warn { background: #7a4a0a; }
.cms-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.cms-stat .n { font-size: 28px; font-weight: 700; color: var(--primary-deep); line-height: 1; }
.cms-stat .l { font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 600; }
.cms-quick {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.cms-quick a {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-weight: 600;
  font-size: 14px;
}
.cms-quick a:hover { border-color: var(--primary); background: var(--primary-soft); }
.cms-quick a span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 4px; }
#cms-block-panel, #cms-quiz-editor, #cms-invite-panel, #cms-log-detail {
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed #cfe9d8;
  border-radius: 12px;
  background: #f7fbf8;
}


