:root {
  --ink: #17324d;
  --muted: #678097;
  --paper: #fffdf8;
  --sky: #e9f6ff;
  --blue: #4089ff;
  --blue-dark: #2368dc;
  --yellow: #ffd76a;
  --coral: #ff8e82;
  --shadow:
    0 18px 55px rgba(46, 99, 145, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 9% 8%,
      rgba(255, 215, 106, 0.28),
      transparent 18rem
    ),
    radial-gradient(
      circle at 92% 18%,
      rgba(111, 210, 255, 0.2),
      transparent 21rem
    ),
    var(--paper);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-shell {
  min-height: 100vh;
}

/* Top navigation */

.topbar {
  width: min(1240px, calc(100% - 40px));
  min-height: 78px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.watch-back-nav {
  display: flex;
  align-items: center;
  gap: 7px;
}

.watch-back-button,
.watch-home-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  color: #45647e;
  border: 1px solid rgba(64, 137, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.watch-back-button:hover,
.watch-home-button:hover {
  color: var(--blue-dark);
  border-color: rgba(64, 137, 255, 0.35);
  background: #edf6ff;
  transform: translateY(-1px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px 14px 18px 18px;
  color: #fff;
  background:
    linear-gradient(
      145deg,
      #65a2ff,
      #3476ec
    );
  box-shadow:
    0 8px 18px rgba(52, 118, 236, 0.25);
  transform: rotate(-4deg);
}

.top-nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  border:
    1px solid rgba(64, 137, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  color: var(--muted);
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.nav-item.active {
  color: #fff;
  background: var(--blue);
}

.parent-link {
  display: inline-flex;
  align-items: center;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

/* Main page */

.main-grid {
  width: min(1240px, calc(100% - 40px));
  margin: 18px auto 0;
  display: grid;
  grid-template-columns:
    minmax(0, 1.65fr)
    minmax(330px, 0.75fr);
  gap: 24px;
}

.lesson-column,
.buddy-column {
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow:
    0 0 0 5px rgba(255, 142, 130, 0.17);
}

.lesson-title {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.lesson-lead {
  max-width: 700px;
  margin: 14px 0 22px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

/* Video */

.video-card {
  position: relative;
  overflow: hidden;
  min-height: 490px;
  border: 8px solid #fff;
  border-radius: 30px;
  background: #12253d;
  box-shadow: var(--shadow);
}

.lesson-video {
  width: 100%;
  height: 474px;
  min-height: 474px;
  display: block;
  object-fit: contain;
  background: #12253d;
}

.parent-video-lock {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 34px;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(
      circle at 50% 24%,
      rgba(93, 189, 172, 0.24),
      transparent 18rem
    ),
    rgba(16, 35, 56, 0.96);
  backdrop-filter: blur(12px);
}

.parent-video-lock[hidden] {
  display: none;
}

.parent-video-lock-icon {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 27px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 43px;
}

.parent-video-lock strong {
  margin-top: 20px;
  font-size: clamp(25px, 4vw, 37px);
}

.parent-video-lock p {
  max-width: 520px;
  margin: 13px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  line-height: 1.7;
}

.parent-video-lock small {
  margin-top: 11px;
  color: #ffd76a;
  font-size: 11px;
  font-weight: 900;
}

.parent-video-lock a {
  margin-top: 22px;
  padding: 11px 18px;
  color: #17324d;
  border-radius: 13px;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}
.video-badge,
.video-buffer-status {
  position: absolute;
  top: 18px;
  z-index: 2;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.video-badge {
  left: 20px;
  padding: 8px 13px;
  color: #153c62;
  background: var(--yellow);
}

.video-buffer-status {
  right: 20px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(17, 37, 61, 0.76);
  backdrop-filter: blur(8px);
}

.video-buffer-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation:
    pulse 0.9s ease-in-out infinite alternate;
}

.video-buffer-status[hidden] {
  display: none;
}

.video-credit {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.video-credit a {
  color: var(--blue-dark);
}

@keyframes pulse {
  to {
    opacity: 0.35;
    transform: scale(0.72);
  }
}

/* Chapters */

.chapter-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.chapter-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: left;
  border:
    1px solid rgba(42, 104, 161, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.chapter-card:hover,
.chapter-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(64, 137, 255, 0.35);
  box-shadow:
    0 10px 24px rgba(46, 99, 145, 0.12);
}

.chapter-number {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--blue-dark);
  background: var(--sky);
  font-weight: 900;
}

.chapter-copy,
.chapter-copy strong,
.chapter-copy span {
  display: block;
}

.chapter-copy strong {
  font-size: 14px;
}

.chapter-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

/* AI companion */

.buddy-card {
  position: sticky;
  top: 18px;
  overflow: hidden;
  border:
    1px solid rgba(64, 137, 255, 0.13);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.buddy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 12px;
}

.buddy-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.buddy-name strong,
.buddy-name span {
  display: block;
}

.buddy-name span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #43c98e;
  box-shadow:
    0 0 0 5px rgba(67, 201, 142, 0.14);
}

.stage-pill {
  padding: 7px 11px;
  color: #7c5a00;
  border-radius: 999px;
  background: #fff2bd;
  font-size: 11px;
  font-weight: 900;
}

.human-stage {
  position: relative;
  height: 430px;
  margin: 0 14px;
  overflow: hidden;
  border-radius: 24px;
  background:
    radial-gradient(
      circle at 50% 78%,
      rgba(64, 137, 255, 0.18),
      transparent 36%
    ),
    linear-gradient(
      180deg,
      #eef9ff,
      #f9fdff 62%,
      #e7f3f8
    );
}

.human-stage::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 18px;
  width: 190px;
  height: 36px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(39, 88, 124, 0.11);
  filter: blur(7px);
}

.digital-human-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.digital-human-canvas,
.digital-human-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.digital-human-wrap.is-speaking
.human-status {
  color: #fff;
  background: var(--blue);
}

.human-status {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 12px;
  min-width: 150px;
  padding: 8px 13px;
  transform: translateX(-50%);
  color: #34536f;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 6px 18px rgba(45, 91, 130, 0.13);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.human-retry {
  position: absolute;
  z-index: 4;
  right: 12px;
  top: 12px;
  padding: 8px 11px;
  color: var(--blue-dark);
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 800;
}

/* Conversation */

.chat-preview {
  padding: 16px 18px 20px;
}

.conversation-panel {
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid rgba(64, 137, 255, 0.16);
  border-radius: 18px;
  background: #fbfdff;
}

.conversation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(64, 137, 255, 0.12);
  background: #fff;
}

.conversation-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.conversation-head strong {
  color: var(--ink);
  font-size: 13px;
}

.conversation-head span {
  color: var(--muted);
  font-size: 10px;
}

.conversation-clear {
  flex: 0 0 auto;
  padding: 7px 9px;
  color: #b54d49;
  border: 1px solid rgba(240, 110, 102, 0.22);
  border-radius: 10px;
  background: #fff6f5;
  font-size: 10px;
  font-weight: 800;
}

.conversation-clear:hover:not(:disabled) {
  color: #963a36;
  background: #ffebe9;
}

.conversation-clear:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.conversation-history {
  min-height: 150px;
  max-height: min(340px, 42vh);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  scroll-behavior: smooth;
  scrollbar-color: rgba(64, 137, 255, 0.3) transparent;
}

.conversation-message {
  width: fit-content;
  max-width: 88%;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 15px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.conversation-message.is-user {
  align-self: flex-end;
  color: #fff;
  border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, #4c94ff, #2f7be7);
}

.conversation-message.is-assistant {
  align-self: flex-start;
  color: #36556f;
  border-bottom-left-radius: 5px;
  background: var(--sky);
}

.conversation-speaker {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.03em;
  opacity: 0.76;
  text-transform: uppercase;
}

.conversation-content {
  white-space: pre-wrap;
}

.conversation-empty {
  margin: auto;
  padding: 18px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.speech-bubble {
  min-height: 0;
  margin-bottom: 10px;
  padding: 9px 12px;
  color: #536f87;
  border-radius: 12px;
  background: #f4f8fc;
  font-size: 11px;
  line-height: 1.5;
}

.chat-note {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.ai-call-panel {
  margin-bottom: 11px;
  padding: 11px;
  border:
    1px solid rgba(64, 137, 255, 0.16);
  border-radius: 17px;
  background: #fbfdff;
}

.parent-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 9px;
  color: #536f87;
  font-size: 11px;
  line-height: 1.45;
}

.parent-consent input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--blue);
}

.call-actions {
  display: flex;
  gap: 7px;
}

.call-start-button {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--blue-dark);
  border:
    1px solid rgba(64, 137, 255, 0.22);
  border-radius: 14px;
  background: #f2f8ff;
  font-size: 13px;
  font-weight: 900;
}

.call-start-button:hover:not(:disabled) {
  background: #e7f2ff;
}

.call-start-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.call-control-button,
.call-end-button {
  min-height: 39px;
  flex: 1;
  padding: 7px 8px;
  border: 0;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 900;
}

.call-control-button {
  color: var(--blue-dark);
  background: #eaf3ff;
}

.call-end-button {
  color: #fff;
  background: #f06e66;
}

.call-live-row {
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #36556f;
  font-size: 12px;
}

.call-live-row > span:last-child {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.call-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #43c98e;
  box-shadow:
    0 0 0 4px rgba(67, 201, 142, 0.14);
  animation:
    pulse 0.9s ease-in-out infinite alternate;
}

.call-live-hint {
  margin: -2px 0 9px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.call-privacy-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.question-form {
  display: flex;
  gap: 8px;
  padding: 7px;
  border:
    1px solid rgba(64, 137, 255, 0.18);
  border-radius: 18px;
  background: #fff;
}

.question-form input {
  min-width: 0;
  flex: 1;
  padding: 8px 9px;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
}

.question-form button {
  width: 44px;
  height: 44px;
  color: #fff;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  font-size: 18px;
  font-weight: 900;
}

.question-form button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.footer-note {
  width: min(1240px, calc(100% - 40px));
  margin: 32px auto 26px;
  color: #7890a5;
  font-size: 12px;
  text-align: center;
}

[hidden] {
  display: none !important;
}

/* Responsive */

@media (max-width: 1180px) {
  .watch-button-text {
    display: none;
  }

  .watch-back-button,
  .watch-home-button {
    width: 38px;
    padding: 0;
  }
}

@media (max-width: 980px) {
  .top-nav {
    display: none;
  }

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

  .buddy-card {
    position: static;
    display: grid;
    grid-template-columns:
      minmax(280px, 0.9fr)
      1fr;
  }

  .buddy-head {
    grid-column: 1 / -1;
  }

  .human-stage {
    height: 390px;
    margin-bottom: 14px;
  }

  .chat-preview {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

@media (max-width: 760px) {
  .parent-link {
    display: none;
  }

  .topbar-left {
    gap: 8px;
  }

  .watch-back-nav {
    gap: 5px;
  }

  .watch-back-button,
  .watch-home-button {
    width: 34px;
    min-height: 34px;
  }

  .topbar-left .brand {
    gap: 7px;
    font-size: 18px;
  }

  .topbar-left .brand-mark {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 680px) {
  .topbar,
  .main-grid,
  .footer-note {
    width: min(100% - 24px, 1240px);
  }

  .topbar {
    min-height: 66px;
  }

  .lesson-title {
    font-size: 34px;
  }

  .video-card,
  .lesson-video {
    min-height: 360px;
  }

  .lesson-video {
    height: 360px;
  }

  .chapter-row {
    grid-template-columns: 1fr;
  }

  .buddy-card {
    display: block;
  }

  .human-stage {
    height: 440px;
  }

  .call-actions {
    flex-wrap: wrap;
  }

  .call-control-button,
  .call-end-button {
    min-width: 30%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Compact borderless tutor rail */
.topbar,
.footer-note {
  width: min(1480px, calc(100% - 40px));
}

.main-grid {
  width: min(1480px, calc(100% - 40px));
  grid-template-columns:
    minmax(0, 1.8fr)
    minmax(360px, 0.72fr);
  gap: 30px;
  align-items: start;
}

.buddy-column {
  align-self: start;
}

.buddy-card {
  position: sticky;
  top: 12px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.buddy-head {
  padding: 2px 4px 9px;
}

.human-stage {
  height: clamp(190px, 26vh, 285px);
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
}

.human-stage::after {
  bottom: 8px;
  width: 160px;
  height: 25px;
  background: rgba(39, 88, 124, 0.09);
}

.human-status {
  bottom: 6px;
  padding: 6px 11px;
  font-size: 10px;
}

.chat-preview {
  display: flex;
  flex-direction: column;
  padding: 9px 0 0;
}

.conversation-panel {
  height: clamp(260px, 32vh, 360px);
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: rgba(251, 253, 255, 0.96);
  box-shadow: 0 12px 30px rgba(46, 99, 145, 0.08);
}

.conversation-history {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
}

.conversation-panel .question-form {
  flex: 0 0 auto;
  gap: 7px;
  padding: 7px 8px;
  border: 0;
  border-top: 1px solid rgba(64, 137, 255, 0.14);
  border-radius: 0;
  background: #fff;
}

.conversation-panel .question-form button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.speech-bubble {
  margin: 8px 0 0;
}

.ai-call-panel {
  margin: 8px 0 0;
  padding: 10px;
}

.chat-note {
  margin: 7px 0 0;
  font-size: 9px;
}

@media (max-width: 1100px) and (min-width: 981px) {
  .main-grid {
    grid-template-columns:
      minmax(0, 1.55fr)
      minmax(330px, 0.72fr);
    gap: 20px;
  }

  .stage-pill {
    display: none;
  }
}

@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .buddy-card {
    position: static;
    display: grid;
    grid-template-columns:
      minmax(250px, 0.75fr)
      minmax(0, 1.25fr);
    gap: 16px;
  }

  .buddy-head {
    grid-column: 1 / -1;
  }

  .human-stage {
    height: clamp(280px, 42vw, 380px);
    margin: 0;
  }

  .chat-preview {
    justify-content: flex-start;
    padding: 0;
  }

  .conversation-panel {
    height: clamp(320px, 48vh, 420px);
  }
}

@media (max-width: 680px) {
  .topbar,
  .main-grid,
  .footer-note {
    width: min(100% - 24px, 1480px);
  }

  .buddy-card {
    display: block;
  }

  .buddy-head {
    padding: 4px 2px 8px;
  }

  .human-stage {
    height: 300px;
    margin-bottom: 8px;
  }

  .conversation-panel {
    height: min(390px, 54vh);
  }
}
/* Expandable tutor drawer layout */
.topbar,
.footer-note {
  width: min(1480px, calc(100% - 40px));
}

.main-grid {
  width: min(1480px, calc(100% - 40px));
  grid-template-columns:
    minmax(640px, 960px)
    minmax(350px, 1fr);
  justify-content: center;
  gap: 30px;
}

.main-grid.is-tutor-chat-open {
  width: min(1760px, calc(100% - 40px));
  grid-template-columns:
    minmax(700px, 920px)
    minmax(700px, 1fr);
  gap: 26px;
}

.lesson-column {
  width: 100%;
  max-width: 960px;
}

.video-card {
  min-height: 0;
  aspect-ratio: 16 / 9;
}

.lesson-video {
  height: 100%;
  min-height: 0;
}

.buddy-column,
.buddy-card,
.tutor-avatar-pane {
  min-width: 0;
}

.buddy-card {
  position: sticky;
  top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 0;
  overflow: visible;
}

.main-grid.is-tutor-chat-open .buddy-card {
  grid-template-columns:
    minmax(280px, 330px)
    minmax(370px, 1fr);
  gap: 18px;
}

.tutor-avatar-pane {
  display: flex;
  flex-direction: column;
}

.buddy-head {
  min-height: 56px;
  padding: 3px 5px 8px;
}

.human-stage {
  height: clamp(390px, 50vh, 520px);
  overflow: hidden;
  background: transparent;
}

.main-grid.is-tutor-chat-open .human-stage {
  height: clamp(390px, 47vh, 480px);
}

.human-status {
  bottom: 10px;
  min-width: 165px;
  padding: 7px 12px;
  font-size: 11px;
}

.tutor-chat-launcher {
  width: calc(100% - 20px);
  min-height: 58px;
  margin: 10px auto 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #fff;
  border: 0;
  border-radius: 18px;
  background:
    linear-gradient(135deg, #4f96ff, #2676e9 58%, #2869d2);
  box-shadow: 0 13px 30px rgba(47, 123, 231, 0.27);
  text-align: left;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.tutor-chat-launcher:hover,
.tutor-chat-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 17px 34px rgba(47, 123, 231, 0.32);
}

.tutor-chat-launcher > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.17);
  font-size: 17px;
}

.tutor-chat-launcher strong {
  font-size: 11px;
  letter-spacing: 0.035em;
}

.tutor-chat-launcher small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 9px;
  font-weight: 800;
}

.tutor-chat-launcher.is-open {
  background: linear-gradient(135deg, #307bdc, #1f62bf);
}

.tutor-chat-drawer {
  height: min(680px, calc(100vh - 104px));
  min-height: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(64, 137, 255, 0.18);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(108, 178, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 255, 0.98));
  box-shadow: 0 24px 60px rgba(40, 83, 122, 0.18);
  backdrop-filter: blur(18px);
}

.tutor-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tutor-drawer-head > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tutor-drawer-head > div > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tutor-drawer-head strong,
.tutor-drawer-head span {
  display: block;
}

.tutor-drawer-head strong {
  font-size: 18px;
}

.tutor-drawer-head div div span {
  color: var(--muted);
  font-size: 10px;
}

.tutor-chat-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #5f7890;
  border: 0;
  border-radius: 13px;
  background: #edf4fa;
  font-size: 24px;
  line-height: 1;
}

.tutor-chat-close:hover,
.tutor-chat-close:focus-visible {
  color: #255f9f;
  background: #e1effd;
}

.tutor-chat-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 5px;
  border-radius: 15px;
  background: #eaf1f7;
}

.tutor-chat-modes button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #678097;
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 11px;
  font-weight: 900;
}

.tutor-chat-modes button.is-active {
  color: var(--blue-dark);
  background: #fff;
  box-shadow: 0 5px 15px rgba(46, 99, 145, 0.1);
}

.tutor-chat-drawer .conversation-panel {
  min-height: 0;
  flex: 1 1 auto;
  height: auto;
  margin: 0;
  border-color: rgba(64, 137, 255, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

.tutor-chat-drawer .conversation-head {
  min-height: 49px;
  padding: 10px 13px;
  background: rgba(255, 255, 255, 0.92);
}

.tutor-chat-drawer .conversation-head > strong {
  font-size: 13px;
}

.tutor-chat-drawer .conversation-history {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(240, 248, 255, 0.62), rgba(251, 253, 255, 0.92));
}

.tutor-chat-drawer .conversation-message {
  max-width: 90%;
  padding: 10px 12px;
  box-shadow: 0 5px 14px rgba(46, 99, 145, 0.07);
}

.tutor-chat-drawer .question-form {
  margin: 0;
  padding: 8px;
  border-top: 1px solid rgba(64, 137, 255, 0.13);
  background: #fff;
}

.tutor-chat-drawer .question-form input {
  font-size: 13px;
}

.tutor-chat-drawer .question-form button {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.tutor-screen-reader-status {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  padding: 0 !important;
  border: 0 !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.tutor-chat-drawer .ai-call-panel {
  min-height: 0;
  flex: 1 1 auto;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: clamp(20px, 4vw, 32px);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(78, 150, 255, 0.17), transparent 42%),
    rgba(255, 255, 255, 0.84);
}

.tutor-voice-intro {
  display: grid;
  justify-items: center;
  gap: 9px;
  text-align: center;
}

.tutor-voice-intro > span {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 23px;
  background: linear-gradient(145deg, #e6f2ff, #d7eaff);
  font-size: 31px;
  box-shadow: 0 12px 28px rgba(55, 125, 218, 0.16);
}

.tutor-voice-intro strong {
  font-size: 19px;
}

.tutor-voice-intro p {
  max-width: 330px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.tutor-chat-drawer .parent-consent {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(64, 137, 255, 0.14);
  border-radius: 14px;
  background: #f6faff;
}

@media (max-width: 1500px) {
  .main-grid,
  .main-grid.is-tutor-chat-open {
    width: min(1320px, calc(100% - 40px));
    grid-template-columns:
      minmax(0, 1fr)
      minmax(300px, 360px);
    gap: 24px;
  }

  .main-grid.is-tutor-chat-open .buddy-card {
    grid-template-columns: 1fr;
  }

  .tutor-chat-drawer {
    position: fixed;
    z-index: 40;
    top: 88px;
    right: 18px;
    width: min(430px, calc(100vw - 36px));
  }
}

@media (max-width: 980px) {
  .main-grid,
  .main-grid.is-tutor-chat-open {
    width: min(100% - 30px, 960px);
    grid-template-columns: 1fr;
  }

  .lesson-column {
    max-width: none;
  }

  .buddy-card,
  .main-grid.is-tutor-chat-open .buddy-card {
    display: block;
  }

  .human-stage,
  .main-grid.is-tutor-chat-open .human-stage {
    height: clamp(390px, 58vw, 520px);
  }

  .tutor-chat-launcher {
    width: min(460px, calc(100% - 20px));
  }
}

@media (max-width: 680px) {
  .topbar,
  .main-grid,
  .main-grid.is-tutor-chat-open,
  .footer-note {
    width: min(100% - 24px, 960px);
  }

  .video-card {
    min-height: 0;
    border-width: 5px;
    border-radius: 22px;
  }

  .lesson-video {
    height: 100%;
    min-height: 0;
  }

  .human-stage,
  .main-grid.is-tutor-chat-open .human-stage {
    height: 380px;
  }

  .tutor-chat-drawer {
    top: auto;
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    height: min(680px, calc(100vh - 20px));
    min-height: 0;
    border-radius: 24px;
  }
}
/* Video-aligned tutor and shared conversation */
@media (min-width: 981px) {
  .tutor-avatar-pane .human-stage {
    margin-top: var(--tutor-stage-offset, 140px);
    transition: margin-top 0.24s ease;
  }
}

.tutor-chat-drawer {
  gap: 10px;
}

.tutor-chat-modes {
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(64, 137, 255, 0.1);
  background: #eaf2f9;
}

.tutor-chat-modes button {
  min-height: 39px;
  border-radius: 10px;
}

.tutor-chat-modes button.is-active {
  box-shadow: 0 4px 14px rgba(46, 99, 145, 0.12);
}

.tutor-chat-drawer .conversation-panel {
  height: auto;
  min-height: 270px;
  flex: 1 1 320px;
  margin: 0;
}

.tutor-chat-drawer .conversation-history {
  flex: 1 1 auto;
  min-height: 210px;
}

.tutor-text-composer {
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(64, 137, 255, 0.17);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(46, 99, 145, 0.08);
}

.tutor-text-composer .question-form {
  margin: 0;
  padding: 8px;
  border: 0;
  background: transparent;
}

.tutor-chat-drawer .ai-call-panel {
  min-height: 0;
  flex: 0 0 auto;
  margin: 0;
  display: grid;
  justify-content: stretch;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(64, 137, 255, 0.17);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(241, 248, 255, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow: 0 10px 24px rgba(46, 99, 145, 0.08);
}

.tutor-chat-drawer .tutor-voice-intro {
  grid-template-columns: 42px minmax(0, 1fr);
  justify-items: start;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.tutor-chat-drawer .tutor-voice-intro > span {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 20px;
  box-shadow: 0 8px 18px rgba(55, 125, 218, 0.13);
}

.tutor-chat-drawer .tutor-voice-intro strong {
  font-size: 14px;
}

.tutor-chat-drawer .parent-consent {
  padding: 10px;
  border-radius: 12px;
  font-size: 10px;
}

.tutor-chat-drawer .call-actions {
  flex-wrap: wrap;
}

.tutor-chat-drawer .call-start-button {
  min-height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, #eef6ff, #e4f0ff);
}

@media (max-width: 980px) {
  .tutor-avatar-pane .human-stage {
    margin-top: 0;
  }

  .tutor-chat-drawer .conversation-panel {
    min-height: 250px;
  }
}


/*
 * Proportional lesson canvas
 *
 * Keep the lesson, tutor, and conversation in one horizontal row. Narrow
 * desktop windows scale the complete canvas continuously. Phones stop at a
 * readable scale and can swipe horizontally instead of stacking or covering
 * the video with the conversation drawer.
 */
.lesson-scale-viewport,
.lesson-scale-canvas {
  width: 100%;
}

body.lesson-layout-scaled {
  overflow-x: hidden;
}

body.lesson-layout-scaled .lesson-scale-viewport {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(64, 137, 255, 0.48) transparent;
  -webkit-overflow-scrolling: touch;
}

body.lesson-layout-scaled .lesson-scale-canvas {
  position: relative;
  min-width: 100%;
}

body.lesson-layout-scaled .site-shell {
  position: absolute;
  top: 0;
  transform-origin: top left;
}

body.lesson-layout-scaled .topbar,
body.lesson-layout-scaled .footer-note {
  width: min(1480px, calc(100% - 40px));
}

body.lesson-layout-scaled .watch-button-text {
  display: inline;
}

body.lesson-layout-scaled .watch-back-button,
body.lesson-layout-scaled .watch-home-button {
  width: auto;
  min-height: 38px;
  padding: 0 12px;
}

body.lesson-layout-scaled .topbar-left {
  gap: 14px;
}

body.lesson-layout-scaled .watch-back-nav {
  gap: 7px;
}

body.lesson-layout-scaled .topbar-left .brand {
  gap: 12px;
  font-size: 23px;
}

body.lesson-layout-scaled .topbar-left .brand-mark {
  width: 42px;
  height: 42px;
}

body.lesson-layout-scaled .top-nav {
  display: flex;
}

body.lesson-layout-scaled .parent-link {
  display: inline-flex;
}

body.lesson-layout-scaled .main-grid,
body.lesson-layout-scaled .main-grid.is-tutor-chat-open {
  justify-content: center;
  align-items: start;
}

body.lesson-layout-scaled .main-grid {
  width: min(1480px, calc(100% - 40px));
  grid-template-columns:
    minmax(640px, 960px)
    minmax(350px, 1fr);
  gap: 30px;
}

body.lesson-layout-scaled .main-grid.is-tutor-chat-open {
  width: min(1760px, calc(100% - 40px));
  grid-template-columns:
    minmax(700px, 920px)
    minmax(700px, 1fr);
  gap: 26px;
}

body.lesson-layout-scaled .lesson-column {
  width: 100%;
  max-width: 960px;
}

body.lesson-layout-scaled .lesson-title {
  font-size: 48px;
}

body.lesson-layout-scaled .video-card {
  min-height: 0;
  aspect-ratio: 16 / 9;
  border-width: 8px;
  border-radius: 30px;
}

body.lesson-layout-scaled .lesson-video {
  height: 100%;
  min-height: 0;
}

body.lesson-layout-scaled .buddy-card,
body.lesson-layout-scaled .main-grid.is-tutor-chat-open .buddy-card {
  position: sticky;
  top: 12px;
  display: grid;
  align-items: start;
  overflow: visible;
}

body.lesson-layout-scaled .buddy-card {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

body.lesson-layout-scaled .main-grid.is-tutor-chat-open .buddy-card {
  grid-template-columns:
    minmax(280px, 330px)
    minmax(370px, 1fr);
  gap: 18px;
}

body.lesson-layout-scaled .tutor-avatar-pane .human-stage {
  height: 520px;
  margin-top: var(--tutor-stage-offset, 140px);
  margin-bottom: 0;
}

body.lesson-layout-scaled
  .main-grid.is-tutor-chat-open
  .tutor-avatar-pane .human-stage {
  height: 480px;
}

body.lesson-layout-scaled .tutor-chat-launcher {
  width: calc(100% - 20px);
}

body.lesson-layout-scaled .tutor-chat-drawer {
  position: static;
  z-index: auto;
  inset: auto;
  width: auto;
  height: min(680px, calc(100vh - 104px));
  min-height: 520px;
  border-radius: 28px;
}

body.lesson-layout-scaled .tutor-chat-drawer .conversation-panel {
  min-height: 270px;
}
/* Storyverse summonable tutor experience */
body {
  overflow-x: clip;
}

.lesson-scale-viewport,
.lesson-scale-canvas,
.site-shell {
  width: 100%;
}

.main-grid,
.main-grid.is-tutor-chat-open {
  position: relative;
  width: min(1480px, calc(100% - 40px));
  min-height: 680px;
  display: block;
  margin-inline: auto;
}

.lesson-column,
body.lesson-layout-scaled .lesson-column {
  width: min(1180px, calc(100% - 150px));
  max-width: none;
}

.video-card,
body.lesson-layout-scaled .video-card {
  min-height: 0;
  aspect-ratio: 16 / 9;
}

.lesson-video,
body.lesson-layout-scaled .lesson-video {
  height: 100%;
  min-height: 0;
}

.buddy-column {
  position: absolute;
  z-index: 30;
  top: var(--tutor-anchor-top, 220px);
  left: min(var(--tutor-anchor-left, calc(100% - 310px)), calc(100% - 215px));
  width: 280px;
  align-self: auto;
  pointer-events: none;
}

.buddy-card,
body.lesson-layout-scaled .buddy-card,
body.lesson-layout-scaled .main-grid.is-tutor-chat-open .buddy-card {
  position: relative;
  top: auto;
  display: block;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}

.tutor-avatar-pane {
  position: relative;
  min-height: 300px;
  display: block;
  pointer-events: none;
}

.tutor-avatar-pane .buddy-head {
  position: absolute;
  z-index: 4;
  top: -42px;
  left: 26px;
  width: 230px;
  min-height: 0;
  padding: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 280ms ease, transform 320ms ease;
  pointer-events: none;
}

.is-summoned .tutor-avatar-pane .buddy-head {
  opacity: 1;
  transform: translateY(0);
}

.tutor-avatar-pane .buddy-name span {
  font-size: 10px;
}

.tutor-avatar-pane .stage-pill {
  padding: 6px 9px;
  font-size: 9px;
}

.tutor-avatar-pane .human-stage,
body.lesson-layout-scaled .tutor-avatar-pane .human-stage,
body.lesson-layout-scaled .main-grid.is-tutor-chat-open .tutor-avatar-pane .human-stage {
  position: relative;
  width: 170px;
  height: 210px;
  margin: 0;
  overflow: hidden;
  border-radius: 48% 48% 34% 48%;
  background: transparent;
  transform: translate(-20px, 14px) rotate(-40deg) scale(0.78);
  transform-origin: 54% 58%;
  transition:
    width 360ms ease,
    height 360ms ease,
    transform 390ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 260ms ease;
  opacity: 0.98;
  pointer-events: none;
}

.tutor-avatar-pane .human-stage::after {
  display: none;
}

.tutor-avatar-pane .digital-human-wrap {
  position: absolute;
  left: 0;
  top: 0;
  width: 250px;
  height: 360px;
  transform: translate(-43px, -15px) scale(0.88);
  transform-origin: 50% 12%;
  transition: transform 390ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.is-summoned .tutor-avatar-pane .human-stage,
body.lesson-layout-scaled .is-summoned .tutor-avatar-pane .human-stage {
  width: 235px;
  height: 350px;
  border-radius: 0;
  transform: translate(0, 0) rotate(0deg) scale(0.94);
  opacity: 1;
}

.is-summoned .tutor-avatar-pane .digital-human-wrap {
  width: 235px;
  height: 350px;
  transform: translate(0, 0) scale(1);
}

.tutor-avatar-pane .human-status {
  bottom: 4px;
  min-width: 138px;
  padding: 6px 9px;
  font-size: 9px;
  opacity: 0;
  transition: opacity 220ms ease;
}

.is-summoned .tutor-avatar-pane .human-status {
  opacity: 1;
}

.tutor-summon-button,
.tutor-voice-launch,
.tutor-history-launch,
.tutor-collapse-button,
.tutor-live-history,
.tutor-text-toggle {
  pointer-events: auto;
  font-family: inherit;
}

.tutor-summon-button {
  position: absolute;
  z-index: 6;
  top: 164px;
  left: 4px;
  width: 154px;
  min-height: 48px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  padding: 8px 11px;
  color: #fff;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #4f96ff, #2676e9 58%, #2869d2);
  box-shadow: 0 13px 28px rgba(47, 123, 231, 0.28);
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.tutor-summon-button:hover,
.tutor-summon-button:focus-visible {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 17px 34px rgba(47, 123, 231, 0.34);
}

.tutor-summon-button > span {
  grid-row: 1 / 3;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.18);
}

.tutor-summon-button strong {
  font-size: 12px;
}

.tutor-summon-button small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 9px;
  font-weight: 700;
}

.tutor-summoned-actions {
  position: absolute;
  z-index: 7;
  top: 350px;
  left: 4px;
  width: 225px;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(64, 137, 255, 0.16);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 40px rgba(40, 83, 122, 0.17);
  backdrop-filter: blur(16px);
  animation: tutor-controls-in 300ms ease both;
  pointer-events: auto;
}

@keyframes tutor-controls-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tutor-voice-launch,
.tutor-history-launch {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 0;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 900;
  text-align: left;
}

.tutor-voice-launch {
  color: #fff;
  background: linear-gradient(135deg, #4f96ff, #2676e9);
  box-shadow: 0 9px 20px rgba(47, 123, 231, 0.23);
}

.tutor-history-launch {
  color: #34536f;
  background: #f3f8fd;
}

.tutor-history-launch span:last-child {
  margin-left: auto;
  font-size: 20px;
}

.tutor-collapse-button {
  justify-self: center;
  padding: 4px 9px;
  color: #758ca0;
  border: 0;
  background: transparent;
  font-size: 9px;
  font-weight: 800;
}

.tutor-live-panel,
body.lesson-layout-scaled .tutor-live-panel {
  position: absolute;
  z-index: 8;
  top: 338px;
  right: 18px;
  width: 335px;
  min-height: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(64, 137, 255, 0.18);
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 48px rgba(40, 83, 122, 0.2);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  animation: tutor-controls-in 280ms ease both;
}

.tutor-live-panel .tutor-voice-intro {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
}

.tutor-live-panel .tutor-voice-intro > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tutor-live-panel .tutor-voice-intro strong,
.tutor-live-panel .tutor-voice-intro small {
  display: block;
}

.tutor-live-panel .tutor-voice-intro strong {
  font-size: 13px;
}

.tutor-live-panel .tutor-voice-intro small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.tutor-voice-orb {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 15px;
  background: linear-gradient(145deg, #e8f4ff, #d8eaff);
  box-shadow: 0 8px 20px rgba(55, 125, 218, 0.14);
}

.tutor-voice-orb i {
  width: 3px;
  height: 8px;
  border-radius: 99px;
  background: var(--blue);
  animation: tutor-wave 0.8s ease-in-out infinite alternate;
}

.tutor-voice-orb i:nth-child(2) { animation-delay: -0.25s; height: 15px; }
.tutor-voice-orb i:nth-child(3) { animation-delay: -0.5s; height: 21px; }
.tutor-voice-orb i:nth-child(4) { animation-delay: -0.15s; height: 12px; }

@keyframes tutor-wave {
  to { transform: scaleY(0.35); opacity: 0.5; }
}

.tutor-live-panel[data-activity="thinking"] .tutor-voice-orb i {
  animation-duration: 1.25s;
}

.tutor-live-panel[data-activity="speaking"] .tutor-voice-orb {
  background: linear-gradient(145deg, #4f96ff, #2676e9);
}

.tutor-live-panel[data-activity="speaking"] .tutor-voice-orb i {
  background: #fff;
  animation-duration: 0.5s;
}

.tutor-live-subtitles {
  max-height: 142px;
  display: grid;
  gap: 7px;
  overflow: hidden;
  padding: 9px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f3f9ff, #fbfdff);
}

.tutor-live-subtitles > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.tutor-subtitle-line {
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 11px;
  font-size: 10px;
  line-height: 1.45;
  animation: tutor-subtitle-in 220ms ease both;
}

.tutor-subtitle-line.is-user {
  margin-left: 30px;
  color: #fff;
  background: linear-gradient(135deg, #4d94ff, #2f7be7);
}

.tutor-subtitle-line.is-assistant {
  margin-right: 18px;
  color: #36556f;
  background: #e7f4ff;
}

.tutor-subtitle-line strong {
  font-size: 8px;
  opacity: 0.72;
}

.tutor-subtitle-line span {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

@keyframes tutor-subtitle-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.tutor-live-panel .parent-consent {
  display: none;
}

.tutor-live-panel .call-live-row {
  margin: 0;
  font-size: 10px;
}

.tutor-live-panel .call-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tutor-live-panel .call-start-button {
  min-height: 48px;
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, #4f96ff, #2676e9);
}

.tutor-live-panel .call-control-button,
.tutor-live-panel .call-end-button {
  min-height: 40px;
  border-radius: 12px;
}

.tutor-live-panel .call-end-button {
  flex: 1.2;
}

.tutor-live-history {
  justify-self: center;
  padding: 5px 10px;
  color: #56758f;
  border: 0;
  background: transparent;
  font-size: 9px;
  font-weight: 900;
}

.tutor-drawer-backdrop {
  position: fixed;
  z-index: 79;
  inset: 0;
  border: 0;
  background: rgba(28, 50, 72, 0.28);
  opacity: 0;
  transition: opacity 280ms ease;
  pointer-events: auto;
}

.tutor-drawer-backdrop.is-open {
  opacity: 1;
}

.tutor-chat-drawer,
body.lesson-layout-scaled .tutor-chat-drawer {
  position: fixed;
  z-index: 80;
  inset: 0 0 0 auto;
  width: clamp(360px, 28vw, 420px);
  height: 100dvh;
  min-height: 0;
  display: flex;
  padding: 18px;
  border: 0;
  border-left: 1px solid rgba(64, 137, 255, 0.18);
  border-radius: 28px 0 0 28px;
  transform: translateX(105%);
  opacity: 0.98;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 220ms ease;
  pointer-events: auto;
}

.tutor-chat-drawer.is-open {
  transform: translateX(0);
  opacity: 1;
}

.tutor-chat-drawer .conversation-panel {
  min-height: 0;
  flex: 1 1 auto;
}

.tutor-chat-drawer .conversation-history {
  min-height: 0;
  max-height: none;
}

.tutor-text-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--blue-dark);
  border: 1px solid rgba(64, 137, 255, 0.2);
  border-radius: 14px;
  background: #eef6ff;
  font-size: 11px;
  font-weight: 900;
}

.tutor-text-toggle.is-open {
  background: #e2f0ff;
}

@media (max-width: 1180px) {
  .lesson-column,
  body.lesson-layout-scaled .lesson-column {
    width: calc(100% - 72px);
  }

  .buddy-column {
    left: min(var(--tutor-anchor-left, calc(100% - 220px)), calc(100% - 190px));
    width: 235px;
  }

  .tutor-avatar-pane .human-stage,
  body.lesson-layout-scaled .tutor-avatar-pane .human-stage {
    transform: translate(-22px, 20px) rotate(-40deg) scale(0.7);
  }

  .is-summoned .tutor-avatar-pane .human-stage,
  body.lesson-layout-scaled .is-summoned .tutor-avatar-pane .human-stage {
    transform: translate(8px, 4px) rotate(0deg) scale(0.84);
  }

  .tutor-live-panel,
  body.lesson-layout-scaled .tutor-live-panel {
    right: 0;
    width: 315px;
  }
}

@media (max-width: 760px) {
  .main-grid,
  .main-grid.is-tutor-chat-open {
    width: min(100% - 24px, 720px);
    min-height: 0;
  }

  .lesson-column,
  body.lesson-layout-scaled .lesson-column {
    width: 100%;
  }

  .lesson-title {
    font-size: clamp(28px, 8vw, 38px);
  }

  .lesson-lead {
    margin-bottom: 16px;
  }

  .video-card,
  body.lesson-layout-scaled .video-card {
    min-height: 0;
    border-width: 5px;
    border-radius: 22px;
  }

  .buddy-column {
    top: var(--tutor-mobile-top, 520px);
    left: auto;
    right: -4px;
    width: 180px;
  }

  .tutor-avatar-pane {
    min-height: 210px;
  }

  .tutor-avatar-pane .human-stage,
  body.lesson-layout-scaled .tutor-avatar-pane .human-stage {
    width: 132px;
    height: 166px;
    transform: translate(16px, 8px) rotate(-38deg) scale(0.68);
  }

  .tutor-avatar-pane .digital-human-wrap {
    width: 210px;
    height: 310px;
    transform: translate(-39px, -12px) scale(0.82);
  }

  .is-summoned .tutor-avatar-pane .human-stage,
  body.lesson-layout-scaled .is-summoned .tutor-avatar-pane .human-stage {
    width: 170px;
    height: 245px;
    transform: translate(0, -70px) rotate(0deg) scale(0.82);
  }

  .is-summoned .tutor-avatar-pane .digital-human-wrap {
    width: 170px;
    height: 245px;
  }

  .tutor-summon-button {
    top: 126px;
    left: 0;
    width: 140px;
  }

  .tutor-avatar-pane .buddy-head {
    display: none;
  }

  .tutor-summoned-actions {
    top: 174px;
    left: -22px;
    width: 190px;
  }

  .main-grid.is-tutor-voice-open .buddy-column {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    margin-top: 18px;
  }

  .main-grid.is-tutor-voice-open .tutor-avatar-pane {
    min-height: 460px;
  }

  .main-grid.is-tutor-voice-open .tutor-avatar-pane .human-stage {
    margin-left: auto;
    transform: translate(0, 0) rotate(0deg) scale(0.82);
  }

  .tutor-live-panel,
  body.lesson-layout-scaled .tutor-live-panel {
    top: 232px;
    right: 0;
    left: 0;
    width: 100%;
  }

  .tutor-chat-drawer,
  body.lesson-layout-scaled .tutor-chat-drawer {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    padding: 14px;
  }
}

@media (max-width: 430px) {
  .topbar,
  .main-grid,
  .footer-note {
    width: min(100% - 16px, 430px);
  }

  .topbar {
    min-height: 62px;
  }

  .lesson-title {
    font-size: 29px;
  }

  .video-badge {
    top: 11px;
    left: 12px;
  }

  .tutor-chat-drawer,
  body.lesson-layout-scaled .tutor-chat-drawer {
    padding: 10px;
  }

  .tutor-drawer-head strong {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tutor-avatar-pane .human-stage,
  .tutor-avatar-pane .digital-human-wrap,
  .tutor-chat-drawer,
  .tutor-drawer-backdrop,
  .tutor-subtitle-line {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
/* Refine the tucked-away and summoned tutor states. */
.video-card,
body.lesson-layout-scaled .video-card {
  position: relative;
  z-index: 20;
}

.buddy-column {
  z-index: auto;
}

.tutor-avatar-pane .buddy-head,
.tutor-avatar-pane .human-status {
  display: none;
}

.tutor-avatar-pane .human-stage,
body.lesson-layout-scaled .tutor-avatar-pane .human-stage {
  z-index: 10;
  transform: translate(28px, 10px) rotate(40deg) scale(0.78);
  transform-origin: 48% 58%;
}

.is-summoned .tutor-avatar-pane .human-stage,
body.lesson-layout-scaled .is-summoned .tutor-avatar-pane .human-stage {
  z-index: 30;
  transform: translate(0, 0) rotate(0deg) scale(0.94);
}

.tutor-summon-button {
  z-index: 32;
  top: 28px;
  left: 76px;
  width: 112px;
  height: 176px;
  min-height: 0;
  display: block;
  padding: 0;
  color: #fff;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  cursor: pointer;
}

.tutor-summon-button > span,
.tutor-summon-button small {
  display: none;
}

.tutor-summon-button strong {
  position: absolute;
  right: 0;
  bottom: 8px;
  min-width: 92px;
  padding: 8px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f96ff, #2676e9);
  box-shadow: 0 10px 24px rgba(47, 123, 231, 0.25);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.tutor-summon-button:hover,
.tutor-summon-button:focus-visible {
  transform: none;
  box-shadow: none;
  outline: none;
}

.tutor-summon-button:hover strong,
.tutor-summon-button:focus-visible strong {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tutor-summon-button:focus-visible strong {
  outline: 3px solid rgba(79, 150, 255, 0.34);
  outline-offset: 3px;
}

.tutor-summoned-actions {
  left: 60px;
  width: 168px;
  gap: 5px;
  padding: 6px;
  border-radius: 16px;
}

.tutor-voice-launch,
.tutor-history-launch {
  min-height: 38px;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 11px;
  font-size: 10px;
}

.tutor-collapse-button {
  padding-block: 2px;
  font-size: 8px;
}

@media (max-width: 1180px) {
  .tutor-avatar-pane .human-stage,
  body.lesson-layout-scaled .tutor-avatar-pane .human-stage {
    transform: translate(30px, 14px) rotate(40deg) scale(0.7);
  }

  .is-summoned .tutor-avatar-pane .human-stage,
  body.lesson-layout-scaled .is-summoned .tutor-avatar-pane .human-stage {
    transform: translate(8px, 4px) rotate(0deg) scale(0.84);
  }

  .tutor-summoned-actions {
    left: 52px;
    width: 164px;
  }
}

@media (max-width: 760px) {
  .tutor-avatar-pane .human-stage,
  body.lesson-layout-scaled .tutor-avatar-pane .human-stage {
    transform: translate(24px, 8px) rotate(38deg) scale(0.68);
  }

  .is-summoned .tutor-avatar-pane .human-stage,
  body.lesson-layout-scaled .is-summoned .tutor-avatar-pane .human-stage {
    transform: translate(0, -70px) rotate(0deg) scale(0.82);
  }

  .tutor-summon-button {
    top: 18px;
    left: 72px;
    width: 100px;
    height: 148px;
  }

  .tutor-summoned-actions {
    top: 174px;
    right: -2px;
    left: auto;
    width: 166px;
  }
}
.tutor-summoned-actions { z-index: 32; }
.tutor-live-panel,
body.lesson-layout-scaled .tutor-live-panel { z-index: 34; }

/* 2026-08-18: refined tutor peek, summoned controls, and draggable voice card. */
.buddy-card:not(.is-summoned) .tutor-avatar-pane .human-stage,
body.lesson-layout-scaled .buddy-card:not(.is-summoned) .tutor-avatar-pane .human-stage {
  overflow: visible;
  border-radius: 0;
}

.buddy-card:not(.is-summoned) .tutor-avatar-pane .digital-human-wrap {
  clip-path: none;
}

.is-summoned .tutor-avatar-pane .digital-human-wrap {
  clip-path: none;
}

.tutor-summon-button strong {
  min-width: 106px;
  padding: 9px 14px 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(135deg, #62a9ff 0%, #347ff0 48%, #2568d8 100%);
  box-shadow:
    0 12px 26px rgba(47, 123, 231, 0.32),
    0 0 0 7px rgba(79, 150, 255, 0.1);
  letter-spacing: 0.01em;
}

.tutor-summon-button strong::before {
  content: "✦";
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  margin-right: 6px;
  border-radius: 7px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  vertical-align: -1px;
}

.tutor-summoned-actions {
  padding: 7px;
  border: 1px solid rgba(93, 151, 236, 0.24);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(240, 247, 255, 0.95));
  box-shadow: 0 16px 36px rgba(40, 83, 122, 0.18), 0 2px 8px rgba(79, 150, 255, 0.08);
}

.tutor-voice-launch,
.tutor-history-launch {
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  transition: transform 170ms ease, box-shadow 170ms ease, background 170ms ease;
}

.tutor-voice-launch {
  justify-content: flex-start;
  background: linear-gradient(135deg, #5aa3ff 0%, #347ff0 50%, #2469db 100%);
  box-shadow: 0 9px 20px rgba(47, 123, 231, 0.26);
}

.tutor-voice-launch:hover,
.tutor-voice-launch:focus-visible,
.tutor-history-launch:hover,
.tutor-history-launch:focus-visible {
  transform: translateY(-1px);
}

.tutor-history-launch {
  color: #35566f;
  border-color: rgba(92, 151, 225, 0.17);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 5px 13px rgba(44, 90, 132, 0.07);
}

.tutor-collapse-button {
  color: #6f879a;
  border-radius: 999px;
}

.tutor-collapse-button:hover,
.tutor-collapse-button:focus-visible {
  color: #2f72cf;
  background: rgba(79, 150, 255, 0.09);
}

.tutor-live-panel,
body.lesson-layout-scaled .tutor-live-panel {
  overflow: hidden;
  border-color: rgba(74, 139, 232, 0.24);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(32, 70, 105, 0.24), 0 4px 18px rgba(64, 137, 255, 0.1);
}

.tutor-live-panel .tutor-voice-intro {
  min-height: 62px;
  margin: -13px -13px 0;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(70, 137, 230, 0.13);
  background: linear-gradient(135deg, #f3f9ff, #eef6ff 55%, #fffaf0);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.tutor-live-panel .tutor-voice-intro:active,
.tutor-live-panel.is-dragging .tutor-voice-intro {
  cursor: grabbing;
}

.tutor-drag-grip {
  width: 28px;
  height: 28px;
  margin-left: auto;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #8aa3b9;
  border: 1px solid rgba(74, 139, 232, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  letter-spacing: 2px;
}

.tutor-live-panel.is-user-positioned,
body.lesson-layout-scaled .tutor-live-panel.is-user-positioned {
  position: fixed;
  z-index: 95;
  right: auto;
  bottom: auto;
  max-width: calc(100vw - 24px);
  margin: 0;
}

.tutor-live-panel.is-dragging {
  animation: none;
  transition: none;
  box-shadow: 0 30px 72px rgba(32, 70, 105, 0.3), 0 0 0 4px rgba(79, 150, 255, 0.12);
}

body.is-dragging-tutor-panel {
  cursor: grabbing;
  user-select: none;
}

.tutor-live-panel .call-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.tutor-live-panel .call-control-button,
.tutor-live-panel .call-end-button {
  min-width: 0;
  min-height: 46px;
  padding: 8px 7px;
  border-radius: 13px;
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
}

.tutor-live-panel .call-control-button {
  color: #2468d0;
  border-color: rgba(61, 132, 231, 0.15);
  background: linear-gradient(180deg, #f3f8ff, #eaf3ff);
}

.tutor-live-panel .call-end-button {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #ff837c, #ec625f);
  box-shadow: 0 8px 18px rgba(227, 85, 83, 0.2);
}

.tutor-live-history {
  min-height: 30px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(238, 246, 255, 0.72);
}

@media (max-width: 760px) {
  .tutor-live-panel .tutor-voice-intro {
    cursor: default;
    touch-action: auto;
  }

  .tutor-drag-grip {
    display: none;
  }
}
/* Show summoned tutor controls only while the character/control area is engaged. */
.is-summoned .tutor-summoned-actions:not([hidden]) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.97);
  animation: none;
  transition:
    opacity 180ms ease,
    transform 200ms ease,
    visibility 0s linear 200ms;
}

.is-summoned .tutor-avatar-pane:hover .tutor-summoned-actions:not([hidden]),
.is-summoned .tutor-summoned-actions:not([hidden]):hover,
.is-summoned .tutor-summoned-actions:not([hidden]):focus-within,
.is-summoned .tutor-avatar-pane:focus-within .tutor-summoned-actions:not([hidden]) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

@media (hover: none), (pointer: coarse) {
  .is-summoned .tutor-summoned-actions:not([hidden]) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }
}
/* Restore hover hit-testing on the summoned character only. */
.is-summoned .tutor-avatar-pane .human-stage,
body.lesson-layout-scaled .is-summoned .tutor-avatar-pane .human-stage,
.is-summoned .tutor-avatar-pane .digital-human-wrap,
.is-summoned .tutor-avatar-pane .digital-human-canvas {
  pointer-events: auto;
}