:root {
  --bg: #f1eadf;
  --bg-soft: #fff8f0;
  --panel: rgba(255, 251, 244, 0.9);
  --line: rgba(84, 68, 49, 0.12);
  --ink: #2f241a;
  --muted: #6a5b4c;
  --accent: #4da8e8;
  --accent-deep: #2f78ac;
  --mint: #7fc4d8;
  --warn: #d29a4f;
  --ok: #6b9f7e;
  --shadow: 0 22px 60px rgba(73, 54, 35, 0.12);
  --radius: 24px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Baloo 2", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(77, 168, 232, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(127, 196, 216, 0.26), transparent 35%),
    linear-gradient(180deg, #f7fbff 0%, #eef6fb 52%, #e8f3fa 100%);
  min-height: 100vh;
}
h1, h2, h3, strong, .brand-mark { font-family: "Baloo 2", "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
textarea, input, select {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.85);
  color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; }
code { word-break: break-all; }

.site-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 18px 20px;
}
.site-header, .site-footer, .panel, .stat-card, .flash-item {
  backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.site-header, .site-footer, .panel { border-radius: var(--radius); }
.site-header {
  display: flex; justify-content: space-between; gap: 18px; align-items: center;
  padding: 20px 24px; position: relative; z-index: 40; margin-bottom: 18px;
  overflow: visible;
}
.brand-mark {
  font-size: 1.8rem;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 14px;
  box-shadow: 0 10px 20px rgba(73, 54, 35, 0.12);
}
.brand-copy, .muted, .inline-note, small, .session-copy p, .feature-item span { color: var(--muted); }
.brand-copy { display: none; }
.header-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "nav avatar";
  gap: 12px 18px;
  align-items: start;
  flex: 1;
  min-width: 0;
  overflow: visible;
}
.nav-grid {
  grid-area: nav;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: none;
  justify-content: flex-end;
}
.nav-link, .ghost-button, .primary-button, .status-pill, .step-chip {
  border-radius: 16px; padding: 0.75rem 1.1rem; display: inline-flex; align-items: center; justify-content: center;
}
.nav-link, .ghost-button { border: 1px solid var(--line); background: rgba(255,255,255,0.85); }
.nav-link {
  flex: 0 0 112px;
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  box-shadow: 0 10px 18px rgba(74, 56, 38, 0.08);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}
.nav-link:hover { transform: translateY(-1px); }
.nav-link.is-active { background: linear-gradient(135deg, rgba(77, 168, 232, 0.18), rgba(127, 196, 216, 0.24)); color: var(--accent-deep); }
.login-cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.25rem;
  border-radius: 16px;
  border: 1px solid rgba(77, 168, 232, 0.5);
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 14px 24px rgba(47, 120, 172, 0.24);
  white-space: nowrap;
}

.login-cta-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(47, 120, 172, 0.28);
}
.auth-landing {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(520px, 0.9fr);
  gap: 24px;
  align-items: start;
}
.auth-landing-copy {
  min-height: 100%;
}
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(47, 36, 26, 0.36);
  backdrop-filter: blur(10px);
  z-index: 60;
}
.auth-modal {
  width: min(620px, 100%);
  max-height: min(88vh, 980px);
  overflow: auto;
  padding: 26px;
  border-radius: 28px;
  background: rgba(255, 251, 246, 0.98);
  border: 1px solid rgba(84, 68, 49, 0.12);
  box-shadow: 0 30px 90px rgba(47, 36, 26, 0.2);
  position: relative;
}
.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  font-size: 1.4rem;
}
.auth-modal-head { margin-bottom: 16px; }
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(77, 168, 232, 0.08);
  margin-bottom: 16px;
}
.auth-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-weight: 700;
  cursor: pointer;
}
.auth-tab.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 14px 24px rgba(47, 120, 172, 0.22);
}
.auth-panels {
  display: grid;
}
.auth-panel {
  display: none;
  gap: 14px;
}
.auth-panel.is-active {
  display: grid;
}
.auth-form {
  display: grid;
  gap: 12px;
}
.auth-form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.auth-google-button {
  width: 100%;
}
.auth-modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
.avatar-logout-form {
  grid-area: avatar;
  display: flex;
  align-items: center;
  justify-self: end;
}

.avatar-menu {
  grid-area: avatar;
  position: relative;
  justify-self: end;
  z-index: 90;
}

.avatar-menu > summary {
  list-style: none;
}

.avatar-menu > summary::-webkit-details-marker {
  display: none;
}

.avatar-logout-button {
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid rgba(77, 168, 232, 0.42);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(77, 168, 232, 0.14), rgba(127, 196, 216, 0.22));
  box-shadow: 0 16px 28px rgba(74, 56, 38, 0.12);
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.avatar-logout-button:hover {
  transform: translateY(-1px);
  border-color: rgba(77, 168, 232, 0.62);
}

.avatar-logout-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-logout-fallback {
  font-weight: 800;
  color: var(--accent-deep);
  font-size: 1.35rem;
}

.avatar-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255, 252, 246, 0.98);
  border: 1px solid rgba(84, 68, 49, 0.12);
  box-shadow: 0 20px 40px rgba(74, 56, 38, 0.16);
  display: grid;
  gap: 8px;
  z-index: 120;
}

.avatar-menu:not([open]) .avatar-menu-panel {
  display: none;
}

.avatar-menu-user {
  display: grid;
  gap: 2px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid rgba(84, 68, 49, 0.1);
}

.avatar-menu-user strong {
  font-size: 0.98rem;
}

.avatar-menu-user span {
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-word;
}

.avatar-menu-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.82rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
}

.avatar-menu-link:hover {
  background: rgba(77, 168, 232, 0.12);
}

.avatar-menu-link.is-danger {
  width: 100%;
  color: #a04a2e;
  font-weight: 700;
}

.avatar-menu-form {
  margin: 0;
}
.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; border: none; cursor: pointer;
}
.ghost-button { color: var(--ink); cursor: pointer; }
.small-button { padding: 0.68rem 1rem; }
.page-wrap {
  display: grid;
  gap: 24px;
  width: min(1240px, 100%);
  margin: 0 auto;
}
.hero-grid, .dashboard-grid, .assistant-layout { display: grid; gap: 24px; grid-template-columns: 1.5fr 1fr; }
.stats-grid { display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { border-radius: 22px; padding: 20px; }
.stat-card span { color: var(--muted); display: block; margin-bottom: 6px; }
.stat-card strong { font-size: 2rem; }
.panel { padding: 24px; }
.page-panel { min-height: 100%; }
.side-panel { align-self: start; }
.panel-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.15em; color: var(--accent-deep); font-size: 0.78rem; margin: 0 0 8px; }
.lede { font-size: 1.05rem; line-height: 1.6; color: var(--muted); }
.feature-grid, .card-list, .chart-stack, .reward-feed, .form-stack, .plain-list, .reward-form { display: grid; gap: 14px; }
.feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 24px; }
.feature-item, .list-card, .consent-card, .toggle-card, .chat-bubble, .reward-card {
  border-radius: 20px; padding: 18px; background: rgba(255,255,255,0.55); border: 1px solid var(--line);
}
.list-card { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.inbox-card {
  display: grid;
  gap: 10px;
  align-items: start;
}
.inbox-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.inbox-reply {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid rgba(84, 68, 49, 0.1);
}
.inbox-admin-card {
  display: grid;
  gap: 16px;
  align-items: start;
}
.inbox-admin-main {
  display: grid;
  gap: 10px;
}
.inbox-admin-form {
  padding-top: 4px;
}
.field { display: grid; gap: 10px; }
.form-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-wide { grid-column: 1 / -1; }
.toggle-row, .button-row, .stat-inline, .step-line { display: flex; gap: 12px; flex-wrap: wrap; }
.consent-grid { display: grid; gap: 12px; }
.consent-card.optional { background: rgba(127, 196, 216, 0.14); }
.consent-card { display: flex; gap: 14px; align-items: flex-start; }
.consent-card input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 4px; }
.consent-copy { display: grid; gap: 4px; }
.consent-copy strong { font-size: 1.02rem; }
.consent-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(47, 36, 26, 0.36);
  backdrop-filter: blur(10px);
}
.consent-modal {
  width: min(860px, 100%);
  max-height: min(88vh, 980px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 251, 246, 0.98);
  border: 1px solid rgba(84, 68, 49, 0.12);
  box-shadow: 0 30px 90px rgba(47, 36, 26, 0.2);
}
.login-modal {
  width: min(560px, 100%);
}
.consent-modal-head { margin-bottom: 16px; }
.consent-grid-modal { gap: 14px; }
.consent-card-modal {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
}
.consent-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.flash-stack { display: grid; gap: 12px; }
.divider-line {
  height: 1px;
  background: rgba(84, 68, 49, 0.12);
  margin: 2px 0;
}
.flash-item { border-radius: 18px; padding: 14px 18px; }
.flash-success { border-color: rgba(107, 159, 126, 0.25); }
.flash-error { border-color: rgba(77, 168, 232, 0.26); }
.step-chip, .status-pill { background: rgba(255,255,255,0.7); border: 1px solid var(--line); }
.step-chip.done, .status-pill.ok { background: rgba(107, 159, 126, 0.18); }
.status-pill.warn { background: rgba(77, 168, 232, 0.16); }
.camera-stage, .session-stage {
  position: relative; min-height: 340px; overflow: hidden;
  border-radius: 26px; background: linear-gradient(160deg, rgba(143,184,169,0.25), rgba(255,255,255,0.7));
  border: 1px solid var(--line); margin: 18px 0;
}
.camera-placeholder, .session-copy { position: absolute; inset: auto 20px 20px 20px; z-index: 2; }
#permissionVideo { width: 100%; height: 100%; object-fit: cover; display: none; }
.calibration-grid {
  display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(80px, 1fr)); justify-items: center; margin: 30px 0;
}
.calibration-dot {
  width: 72px; height: 72px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(77,168,232,0.16); box-shadow: inset 0 0 0 1px rgba(77,168,232,0.22);
}
.calibration-dot.is-active, .calibration-dot.is-complete { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); }
.safe-zone {
  position: absolute; inset: 18% 22%; border-radius: 28px;
  border: 2px dashed rgba(47,36,26,0.25); background: rgba(255,255,255,0.25);
}
.gaze-dot {
  width: 22px; height: 22px; border-radius: 50%; position: absolute; top: 52%; left: 54%;
  background: var(--accent); box-shadow: 0 0 0 12px rgba(77,168,232,0.18); transition: transform 0.35s ease;
}
.chat-thread { display: grid; gap: 12px; max-height: 420px; overflow: auto; margin-bottom: 18px; }
.chat-bubble.user { justify-self: end; background: rgba(201, 111, 67, 0.16); }
.chat-bubble.assistant { justify-self: start; }
.chat-form { display: grid; gap: 12px; }
.table-shell { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); }
.code-block {
  margin: 0; padding: 18px; border-radius: 22px; overflow: auto;
  background: rgba(47,36,26,0.92); color: #f8f3eb;
}
.bar-track { height: 10px; border-radius: 999px; background: rgba(47,36,26,0.08); }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--accent)); }
.reward-card { display: flex; justify-content: space-between; gap: 12px; }
.site-footer { margin-top: 24px; padding: 22px 24px; }
.plain-list { padding-left: 1.1rem; margin: 0; }

.guide-assistant {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  gap: 14px;
  max-width: 320px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 40;
}
.guide-assistant.is-collapsed .guide-content { display: none; }
.guide-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.guide-title { margin: 0 0 6px; font-weight: 700; }
.guide-text { margin: 0 0 12px; color: var(--muted); }
.guide-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.guide-status { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.avatar-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  padding: 12px;
  display: grid;
  gap: 10px;
  cursor: pointer;
  text-align: center;
}

.avatar-card.is-selected {
  border-color: rgba(201, 111, 67, 0.6);
  box-shadow: 0 14px 24px rgba(201, 111, 67, 0.2);
}
.avatar-card.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.avatar-card.is-disabled .avatar-square {
  filter: grayscale(0.1);
}

.avatar-square {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: rgba(201, 111, 67, 0.2);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.avatar-square.warm {
  background-color: transparent;
  background-image: url("/media/avatars/teacher-2d.svg");
}
.avatar-square.robot {
  background-color: transparent;
  background-image: url("/media/avatars/robot-2d.svg");
}
.avatar-square.mint { background: linear-gradient(135deg, #c3e4d8, #8fb8a9); }
.avatar-square.sunset { background: linear-gradient(135deg, #f6d6b3, #e9a36f); }

.avatar-label { font-weight: 600; color: var(--ink); }
.avatar-status {
  font-size: 0.88rem;
  color: var(--muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(34, 26, 18, 0.35);
  z-index: 60;
}

.modal-overlay.is-open { display: grid; }

.modal-card {
  background: #fffaf4;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
  width: min(380px, 90vw);
}

.modal-avatar {
  width: 100%;
  margin-bottom: 14px;
  aspect-ratio: 1 / 1;
  border-radius: 20px;
}

.option-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 18px rgba(74, 56, 38, 0.08);
  cursor: pointer;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.option-title { font-weight: 700; }

.choice-row {
  display: inline-flex;
  gap: 12px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
}

.choice-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-pill {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-weight: 600;
}

.choice-radio:checked + .choice-pill,
.choice-radio:checked + .option-card {
  border-color: rgba(201, 111, 67, 0.6);
  box-shadow: 0 12px 24px rgba(201, 111, 67, 0.2);
}

.upload-row {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.file-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  font-weight: 600;
}

.file-pill input[type="file"] {
  display: none;
}

.file-pill::before {
  content: "📎";
}

.upload-row .muted {
  font-size: 0.9rem;
}

.upload-row {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.upload-row input[type="file"] {
  padding: 0.6rem 0.8rem;
  background: rgba(255, 255, 255, 0.9);
}

@media (max-width: 980px) {
  .option-grid { grid-template-columns: 1fr; }
}

.lesson-guide-stage {
  position: relative;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px dashed var(--line);
  overflow: hidden;
}
.lesson-guide-pointer {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 10px rgba(201, 111, 67, 0.18);
  animation: guidePulse 1.6s infinite;
}
.lesson-guide-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  font-weight: 600;
}
.lesson-guide-card .emoji {
  font-size: 1.4rem;
}

.learning-stage {
  position: relative;
  min-height: 440px;
  padding: 28px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  align-items: start;
}

.teacher-lane {
  position: relative;
  min-height: 360px;
}

.teacher-card {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 16px 14px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 250, 244, 0.98), rgba(248, 238, 227, 0.92));
  width: 180px;
  text-align: center;
}

.teacher-avatar {
  width: 132px;
  height: 180px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 22%, #f7dfc6 0 20%, transparent 21%),
    radial-gradient(circle at 50% 36%, #f1c39c 0 11%, transparent 12%),
    linear-gradient(180deg, #eaa072 0 30%, #fff0e4 30% 54%, #d58c5d 54% 100%);
  box-shadow: inset 0 0 0 1px rgba(84, 68, 49, 0.08);
}

.teacher-card.ban-gau .teacher-avatar {
  background: linear-gradient(180deg, #d6c0a0, #9d7656);
}

.teacher-card.ban-meo .teacher-avatar {
  background: linear-gradient(180deg, #f4d4b3, #df9b6a);
}

.teacher-name { font-weight: 700; }

.teacher-hand {
  position: absolute;
  width: 88px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0c7a5, #d88d60);
  top: 150px;
  left: 124px;
  transform-origin: left center;
  transition: transform 280ms ease;
  box-shadow: 0 6px 12px rgba(216, 141, 96, 0.18);
}

.teacher-hand::after {
  content: "";
  position: absolute;
  right: -8px;
  top: -5px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #efc5a2;
}

.scene-lane {
  min-width: 0;
}

.scene-frame {
  display: grid;
  gap: 16px;
}

.object-card {
  padding: 20px 22px;
  border-radius: 22px;
  border: 2px dashed rgba(201, 111, 67, 0.4);
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  gap: 16px;
  justify-items: center;
  cursor: pointer;
}

.object-media {
  width: min(100%, 520px);
}

.scene-viewer {
  width: 100%;
  height: 340px;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(197, 226, 218, 0.55), rgba(255, 248, 240, 0.95));
  border: 1px solid rgba(84, 68, 49, 0.12);
}

.scene-viewer canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.scene-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.object-copy {
  display: inline-flex;
  gap: 16px;
  align-items: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.object-emoji {
  font-size: 2.2rem;
}

.object-pointer {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 12px rgba(201, 111, 67, 0.18);
  top: 180px;
  left: 180px;
}

.learning-caption {
  font-size: 1.05rem;
  font-weight: 600;
}

.learning-phrase {
  font-size: 1.2rem;
  color: var(--accent-deep);
  font-weight: 700;
}

@keyframes guidePulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

@media (max-width: 980px) {
  .hero-grid, .dashboard-grid, .assistant-layout, .stats-grid, .feature-grid, .form-grid {
    grid-template-columns: 1fr;
  }
  .site-header { position: static; }
  .learning-stage { grid-template-columns: 1fr; }
  .teacher-lane { min-height: 0; }
  .teacher-card { width: 100%; grid-template-columns: 132px 1fr; text-align: left; justify-items: start; }
  .teacher-hand { display: none; }
}

.panel-sub {
  margin-top: 20px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 12px 24px rgba(120, 92, 66, 0.08);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.summary-grid.is-hidden {
  display: none;
}

.result-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 24px rgba(120, 92, 66, 0.08);
}

.page-lesson .site-shell {
  max-width: none;
  padding: 0;
}

.page-lesson .page-wrap {
  min-height: 100vh;
  gap: 0;
}

.lesson-page {
  min-height: 100vh;
  padding: 26px;
  background:
    radial-gradient(circle at 12% 14%, rgba(164, 204, 112, 0.35), transparent 18%),
    radial-gradient(circle at 84% 18%, rgba(78, 140, 92, 0.22), transparent 20%),
    radial-gradient(circle at 52% 88%, rgba(196, 148, 84, 0.18), transparent 24%),
    linear-gradient(180deg, #dceec5 0%, #f5edd9 52%, #e7d6b6 100%);
}

.lesson-scene {
  min-height: calc(100vh - 132px);
  padding: 28px;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: linear-gradient(180deg, rgba(250, 246, 235, 0.55), rgba(255, 251, 243, 0.72));
  backdrop-filter: blur(10px);
}

.lesson-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.lesson-statuses {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lesson-picker-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.lesson-group-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.lesson-group-block {
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(84, 68, 49, 0.1);
}

.lesson-category-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.lesson-category-tab {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 18px rgba(74, 56, 38, 0.06);
}

.lesson-category-tab span {
  font-weight: 800;
}

.lesson-category-tab small {
  color: var(--muted);
}

.lesson-category-tab.is-active {
  background: linear-gradient(135deg, rgba(77, 168, 232, 0.15), rgba(127, 196, 216, 0.22));
  border-color: rgba(77, 168, 232, 0.42);
  color: var(--accent-deep);
}

.lesson-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.lesson-group-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.lesson-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0;
}

.legacy-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.4rem, 3vw, 2.4rem);
  border: 1px solid rgba(84, 68, 49, 0.12);
  border-radius: 32px;
  background:
    radial-gradient(circle at 12% 0%, rgba(143, 184, 169, 0.25), transparent 34%),
    radial-gradient(circle at 100% 10%, rgba(77, 168, 232, 0.16), transparent 34%),
    rgba(255, 251, 246, 0.9);
  box-shadow: var(--shadow);
}

.legacy-hero h1 {
  max-width: 840px;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.98;
}

.legacy-action-row,
.buddy-toolbar,
.buddy-metrics,
.screening-progress-head {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.guide-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1.1rem;
}

.guide-toc {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  box-shadow: 0 14px 36px rgba(73, 54, 35, 0.08);
}

.guide-toc a {
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  color: var(--muted);
}

.guide-toc a:hover {
  background: rgba(143, 184, 169, 0.16);
  color: var(--accent-deep);
}

.guide-content {
  display: grid;
  gap: 1.4rem;
}

.guide-section {
  scroll-margin-top: 20px;
}

.guide-section h2 {
  margin-top: 0;
}

.guide-card-grid,
.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.guide-info-card,
.support-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.support-card a {
  display: inline-flex;
  margin-top: 0.7rem;
  color: var(--accent-deep);
  font-weight: 700;
}

.buddy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 1rem;
}

.video-wrap {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, #d8f3ff 0%, #f5fbff 62%, #dbf5d5 100%);
}

.video-wrap video,
.video-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-wrap canvas {
  pointer-events: none;
}

.buddy-chat-card {
  min-height: 420px;
}

.meter-list {
  display: grid;
  gap: 0.8rem;
}

.meter-list label {
  display: grid;
  gap: 0.25rem;
  font-weight: 700;
}

.meter-list meter {
  width: 100%;
  height: 16px;
}

.risk-card,
.buddy-metrics,
.screening-result-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(143, 184, 169, 0.14);
  border: 1px solid rgba(143, 184, 169, 0.35);
}

.buddy-thread {
  min-height: 360px;
  max-height: 520px;
  overflow: auto;
  margin: 1rem 0;
}

.quick-prompt {
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  text-align: left;
}

.status-badge {
  display: inline-flex;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: #e9f6ee;
  color: #2f6b45;
  font-weight: 800;
}

.status-badge.warning {
  background: #fff2cf;
  color: #8b5b00;
}

.status-badge.crisis {
  background: #ffe1dc;
  color: #9f2c18;
}

.screening-progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(84, 68, 49, 0.1);
}

.screening-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--accent));
  transition: width 0.2s ease;
}

.screening-question-card {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
  padding: 1.1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.screening-question-label,
.screening-warning {
  margin: 0;
  color: var(--accent-deep);
  font-weight: 800;
}

.screening-answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.screening-answer-btn {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  font-weight: 800;
}

.screening-answer-btn.is-selected {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(77, 168, 232, 0.95), rgba(47, 120, 172, 0.95));
  color: #fff;
}

.safety-orb {
  width: min(280px, 70vw);
  aspect-ratio: 1;
  margin: 2rem auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(127, 196, 216, 0.38) 42%, rgba(77, 168, 232, 0.22));
  border: 1px solid rgba(143, 184, 169, 0.5);
  box-shadow: 0 28px 80px rgba(73, 54, 35, 0.16);
  transition: transform 0.12s ease;
}

.safety-orb span {
  font-size: clamp(3rem, 9vw, 5.4rem);
  font-weight: 800;
  color: var(--accent-deep);
}

.safety-orb small {
  align-self: start;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 920px) {
  .lesson-exit-menu {
    align-items: stretch;
    flex-direction: column;
  }

  .lesson-exit-brand,
  .lesson-exit-links,
  .lesson-exit-actions {
    width: 100%;
  }

  .lesson-exit-actions {
    justify-content: stretch;
  }

  .lesson-exit-primary,
  .lesson-exit-secondary {
    flex: 1 1 0;
  }

  .guide-layout,
  .buddy-layout {
    grid-template-columns: 1fr;
  }

  .guide-toc {
    position: static;
  }

  .guide-card-grid,
  .support-grid {
    grid-template-columns: 1fr;
  }
}

.lesson-start-popup {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(39, 31, 22, 0.34);
  backdrop-filter: blur(8px);
}

.lesson-start-popup.is-hidden {
  display: none;
}

.lesson-start-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 251, 244, 0.98);
  border: 1px solid rgba(84, 68, 49, 0.12);
  box-shadow: 0 28px 50px rgba(46, 34, 22, 0.18);
  text-align: center;
  pointer-events: auto;
}

.lesson-start-card h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2vw, 2.1rem);
}

.lesson-start-card .primary-button {
  justify-self: center;
  min-width: 180px;
}

.lesson-picker-page .lesson-scene {
  gap: 20px;
}

.lesson-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.lesson-module-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 252, 246, 0.9);
  border: 1px solid rgba(84, 68, 49, 0.1);
  box-shadow: 0 16px 28px rgba(73, 54, 35, 0.07);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.lesson-module-card:hover,
.lesson-module-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(77, 168, 232, 0.35);
  box-shadow: 0 20px 34px rgba(73, 54, 35, 0.1);
}

.lesson-module-card h2 {
  margin: 0;
  font-size: 1.25rem;
}

.lesson-module-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.lesson-module-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lesson-module-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lesson-module-tags span {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(77, 168, 232, 0.1);
  color: var(--accent-deep);
  font-size: 0.84rem;
}

.module-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.module-detail-card,
.module-coming-soon {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid rgba(84, 68, 49, 0.1);
  box-shadow: 0 12px 24px rgba(73, 54, 35, 0.06);
}

.module-detail-card strong,
.module-coming-soon strong {
  display: block;
  margin-bottom: 8px;
}

.module-coming-soon {
  display: grid;
  gap: 12px;
}

.lesson-card-grid {
  margin-top: 4px;
}

.lesson-complete-card {
  width: min(460px, 100%);
}

.lesson-complete-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lesson-complete-actions .primary-button,
.lesson-complete-actions .ghost-button {
  min-width: 150px;
  text-align: center;
}

.lesson-chip {
  display: grid;
  gap: 2px;
  min-width: 170px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.88);
  border: 1px solid rgba(84, 68, 49, 0.1);
  box-shadow: 0 12px 22px rgba(73, 54, 35, 0.06);
}

.lesson-chip small {
  color: var(--muted);
}

.lesson-chip.is-active {
  border-color: rgba(77, 168, 232, 0.45);
  background: linear-gradient(135deg, rgba(77, 168, 232, 0.12), rgba(127, 196, 216, 0.16));
}

.lesson-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 26px;
  min-height: 72vh;
  border-radius: 34px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.3), transparent 18%),
    linear-gradient(180deg, rgba(213, 235, 180, 0.95) 0%, rgba(243, 231, 202, 0.94) 76%, rgba(223, 201, 155, 0.96) 100%);
  border: 1px solid rgba(108, 96, 68, 0.1);
}

.lesson-stage[data-scene-theme="cow-3d"] {
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.36), transparent 18%),
    linear-gradient(180deg, #bfe7ff 0%, #dff5ff 52%, #edf8cf 100%);
}

.lesson-background-art {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 8% 28%, rgba(111, 156, 84, 0.18), transparent 18%),
    radial-gradient(circle at 92% 22%, rgba(94, 145, 98, 0.14), transparent 18%),
    radial-gradient(circle at 24% 84%, rgba(122, 94, 54, 0.12), transparent 15%);
  pointer-events: none;
}

.lesson-stage[data-scene-theme="cow-3d"] .lesson-background-art {
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.42), transparent 16%),
    radial-gradient(circle at 82% 16%, rgba(255, 255, 255, 0.28), transparent 14%),
    radial-gradient(100% 56% at 18% 100%, #59c85f 0 50%, transparent 51%),
    radial-gradient(96% 54% at 50% 100%, #34b44d 0 52%, transparent 53%),
    radial-gradient(92% 48% at 100% 100%, #269f46 0 50%, transparent 51%);
}

.lesson-animal-side,
.lesson-teacher-side {
  position: relative;
  z-index: 1;
}

.lesson-animal-side {
  display: grid;
  align-items: center;
  padding: 36px;
}

.lesson-stage[data-scene-theme="cow-3d"] .lesson-animal-side,
.lesson-stage[data-scene-theme="cow-3d"] .lesson-teacher-side {
  align-items: end;
}

.lesson-teacher-side {
  display: grid;
  gap: 18px;
  align-content: center;
  padding: 36px 36px 36px 0;
}

.lesson-stage[data-scene-theme="cow-3d"] .lesson-teacher-side {
  grid-template-columns: auto minmax(260px, 360px);
  align-items: end;
  justify-content: center;
  gap: 18px;
}

.scene-frame {
  position: relative;
  display: grid;
  gap: 18px;
  justify-items: center;
}

.lesson-stage[data-scene-theme="cow-3d"] .scene-frame {
  width: 100%;
  padding-top: 24px;
  align-self: end;
}

.scene-viewer {
  width: min(100%, 720px);
  height: 520px;
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(183, 220, 182, 0.45), rgba(246, 239, 223, 0.96));
  border: 1px solid rgba(84, 68, 49, 0.12);
  box-shadow: inset 0 -24px 40px rgba(111, 124, 52, 0.06), 0 30px 50px rgba(89, 78, 49, 0.12);
}

.lesson-stage[data-scene-theme="cow-3d"] .scene-viewer {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  width: min(100%, 640px);
  height: 420px;
}

.lesson-stage[data-scene-theme="cow-3d"] .scene-viewer::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 2%;
  height: 26%;
  z-index: 0;
  background:
    radial-gradient(80% 100% at 16% 100%, rgba(73, 188, 80, 0.96) 0 52%, transparent 53%),
    radial-gradient(92% 100% at 54% 100%, rgba(44, 170, 72, 0.95) 0 54%, transparent 55%),
    radial-gradient(82% 100% at 92% 100%, rgba(37, 157, 67, 0.96) 0 48%, transparent 49%);
  pointer-events: none;
}

.scene-viewer::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18%;
  background: linear-gradient(180deg, transparent, rgba(125, 106, 63, 0.14));
  pointer-events: none;
}

.lesson-stage[data-scene-theme="cow-3d"] .scene-viewer::after {
  left: 8%;
  right: 10%;
  bottom: 10%;
  height: 9%;
  z-index: 1;
  filter: blur(8px);
  background:
    radial-gradient(circle at 50% 50%, rgba(67, 83, 47, 0.24) 0 45%, transparent 70%);
}

.lesson-stage[data-scene-theme="cow-3d"] .scene-frame::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 18%;
  bottom: 54px;
  height: 24px;
  border-radius: 50%;
  background: rgba(61, 81, 45, 0.16);
  filter: blur(10px);
  pointer-events: none;
}

.scene-viewer canvas,
.scene-fallback {
  width: 100%;
  height: 100%;
  display: block;
}

.scene-viewer canvas,
.scene-fallback {
  position: relative;
  z-index: 2;
}

.scene-fallback {
  object-fit: contain;
}

.lesson-stage[data-scene-theme="cow-3d"] .scene-fallback {
  object-fit: contain;
  transform: scale(0.82);
  transform-origin: center bottom;
}

.animal-label-chip {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  padding: 14px 20px;
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.96);
  border: 1px solid rgba(84, 68, 49, 0.1);
  box-shadow: 0 16px 26px rgba(73, 54, 35, 0.08);
}

.lesson-topic-icons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.module-topic-grid {
  align-items: center;
}

.lesson-topic-chip {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid rgba(84, 68, 49, 0.1);
  box-shadow: 0 12px 22px rgba(73, 54, 35, 0.08);
  cursor: pointer;
}

.lesson-topic-chip.is-active {
  border-color: rgba(201, 111, 67, 0.35);
  background: linear-gradient(135deg, rgba(201, 111, 67, 0.14), rgba(255, 252, 246, 0.96));
}

.lesson-topic-chip.is-static {
  cursor: default;
  pointer-events: none;
}

.lesson-topic-emoji {
  font-size: 1.2rem;
  line-height: 1;
}

.lesson-topic-text {
  font-weight: 700;
  color: var(--ink);
}

.teacher-card {
  position: relative;
  display: grid;
  grid-template-columns: 184px;
  justify-items: center;
  align-items: center;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.teacher-avatar {
  width: 176px;
  height: 280px;
  border-radius: 30px;
  background-color: transparent;
  background-image: url("/media/avatars/teacher-2d.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
}

.teacher-card.co-giao .teacher-avatar {
  background-image: none;
  display: grid;
  place-items: center;
}

.teacher-card.ban-gau .teacher-avatar {
  background: linear-gradient(180deg, #d0b08c, #936949);
}

.teacher-card.robot-ban .teacher-avatar {
  background-color: transparent;
  background-image: none;
  display: grid;
  place-items: center;
}

.teacher-card.ban-meo .teacher-avatar {
  background: linear-gradient(180deg, #f2cfaa, #d59361);
}

.teacher-copy {
  display: grid;
  gap: 10px;
  padding-right: 20px;
  align-content: center;
}

.lesson-stage .teacher-copy {
  display: none;
}

.lesson-teacher-side {
  justify-items: center;
}

.lesson-teacher-side .teacher-card {
  margin-top: 28px;
}

.lesson-analysis-card {
  display: grid;
  gap: 10px;
  width: min(360px, 100%);
  padding: 18px 20px;
  border-radius: 24px;
  background: rgba(255, 251, 244, 0.9);
  border: 1px solid rgba(84, 68, 49, 0.12);
  box-shadow: 0 20px 34px rgba(73, 54, 35, 0.08);
}

.lesson-analysis-card strong {
  font-size: 1rem;
}

.lesson-analysis-card .status-pill {
  justify-self: start;
}

.attention-camera-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(69, 55, 44, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.attention-camera-card video {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
  background: #dcebf1;
  transform: scaleX(-1);
}

.attention-camera-copy {
  display: grid;
  gap: 4px;
}

.attention-camera-copy strong {
  font-size: 0.92rem;
}

.attention-camera-copy span {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(154, 137, 108, 0.14);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.attention-camera-copy span[data-state="ok"] {
  background: rgba(107, 159, 126, 0.18);
  color: #3d7251;
}

.attention-camera-copy span[data-state="away"] {
  background: rgba(177, 91, 54, 0.16);
  color: var(--accent-deep);
}

.mini-audio-test {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(84, 68, 49, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.mini-audio-test:hover {
  border-color: rgba(77, 168, 232, 0.42);
}

.speech-counter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(84, 68, 49, 0.1);
}

.speech-counter span,
.speech-counter small {
  color: var(--muted);
}

.speech-counter strong {
  grid-row: span 2;
  font-size: 1.8rem;
  color: var(--accent-deep);
}

.speech-counter.is-counting {
  border-color: rgba(107, 159, 126, 0.36);
  background: rgba(107, 159, 126, 0.12);
}

.teacher-card {
  cursor: pointer;
}

.lesson-stage[data-scene-theme="cow-3d"] .teacher-card {
  align-self: end;
  margin-top: 0;
  margin-bottom: 72px;
  transform: none;
  justify-self: end;
}

.lesson-stage[data-scene-theme="cow-3d"] .teacher-card::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 120px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(61, 81, 45, 0.14);
  filter: blur(8px);
}

.teacher-copy .muted {
  font-size: 1rem;
  line-height: 1.55;
}

.teacher-mascot {
  position: relative;
  width: 170px;
  height: 248px;
  display: grid;
  place-items: center;
}

.teacher-float {
  position: relative;
  width: 136px;
  height: 212px;
  animation: floatTeacher 3.2s ease-in-out infinite;
}

.teacher-head {
  position: relative;
  width: 94px;
  height: 98px;
  margin: 0 auto;
}

.teacher-hair {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #7a4d35, #5f3724);
  border-radius: 44px 44px 34px 34px;
}

.teacher-hair::before,
.teacher-hair::after {
  content: "";
  position: absolute;
  top: 34px;
  width: 20px;
  height: 36px;
  border-radius: 16px;
  background: #70462f;
}

.teacher-hair::before {
  left: -6px;
  transform: rotate(8deg);
}

.teacher-hair::after {
  right: -6px;
  transform: rotate(-8deg);
}

.teacher-face {
  position: absolute;
  inset: 12px 12px 6px;
  background: linear-gradient(180deg, #ffe9d6, #ffd9bf);
  border-radius: 34px 34px 28px 28px;
}

.teacher-face::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  width: 46px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 231, 212, 0.8);
}

.teacher-eye {
  position: absolute;
  top: 38px;
  width: 16px;
  height: 16px;
  overflow: hidden;
  border-radius: 50%;
  background: #ffffff;
}

.teacher-eye.left {
  left: 20px;
}

.teacher-eye.right {
  right: 20px;
}

.teacher-face-pupil {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5a3425;
  transition: transform 0.08s linear;
  will-change: transform;
}

.teacher-blush {
  position: absolute;
  top: 56px;
  width: 14px;
  height: 8px;
  border-radius: 999px;
  background: rgba(239, 144, 130, 0.55);
}

.teacher-blush.left {
  left: 12px;
}

.teacher-blush.right {
  right: 12px;
}

.teacher-mouth {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 18px;
  height: 10px;
  transform: translateX(-50%);
  border-bottom: 3px solid #d47474;
  border-radius: 0 0 18px 18px;
}

.teacher-body {
  position: relative;
  width: 90px;
  height: 112px;
  margin: -4px auto 0;
  border-radius: 28px 28px 20px 20px;
  background: linear-gradient(180deg, #f3a46a, #e2844c);
  box-shadow: inset 0 -10px 0 rgba(176, 86, 38, 0.24);
}

.teacher-body::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 40px;
  height: 44px;
  transform: translateX(-50%);
  border-radius: 16px;
  background:
    linear-gradient(#fff6ec, #fff6ec) 50% 10px / 24px 4px no-repeat,
    linear-gradient(#fff6ec, #fff6ec) 50% 20px / 24px 4px no-repeat,
    linear-gradient(#fff6ec, #fff6ec) 50% 30px / 24px 4px no-repeat,
    linear-gradient(#fff6ec, #fff6ec) 50% 40px / 14px 4px no-repeat,
    #fff0e3;
}

.teacher-body::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 40px;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 16px 16px 10px 10px;
  background:
    linear-gradient(#486791, #486791) 50% 8px / 100% 100% no-repeat,
    linear-gradient(#f7c6a8, #f7c6a8) calc(50% - 10px) 100% / 10px 26px no-repeat,
    linear-gradient(#f7c6a8, #f7c6a8) calc(50% + 10px) 100% / 10px 26px no-repeat;
}

.teacher-arm {
  position: absolute;
  border-radius: 999px;
}

.teacher-arm-left {
  top: 112px;
  left: 24px;
  width: 14px;
  height: 54px;
  background: linear-gradient(180deg, #f3a46a 0 22%, #ffdac2 22% 100%);
  transform: rotate(8deg);
  z-index: 0;
}

.teacher-arm-right {
  top: 116px;
  right: 6px;
  width: 70px;
  height: 14px;
  background: linear-gradient(90deg, #f3a46a 0 20%, #ffdac2 20% 100%);
  transform: rotate(-4deg);
  transform-origin: left center;
  z-index: 2;
}

.teacher-arm-right::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #f6c3a6;
}

.teacher-shadow {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 84px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(62, 47, 36, 0.14);
  animation: shadowScaleTeacher 3.2s ease-in-out infinite;
}

.robot-container {
  position: relative;
  width: 170px;
  margin: 0 auto;
  --robot-color: #4da8e8;
  --robot-border: #2f78ac;
  --robot-eye: #26445f;
}

.robot-body {
  position: relative;
  animation: floatRobot 3s ease-in-out infinite;
}

.robot-container .head {
  width: 86px;
  height: 66px;
  margin: 0 auto 12px;
  position: relative;
  border-radius: 18px;
  background: linear-gradient(180deg, #6dc3fb, var(--robot-color));
  border: 4px solid var(--robot-border);
  box-shadow: 0 14px 24px rgba(77, 168, 232, 0.2);
}

.robot-container .head::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -22px;
  width: 10px;
  height: 22px;
  border-radius: 999px;
  background: var(--robot-border);
  transform: translateX(-50%);
}

.robot-container .head::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -34px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #8cddff;
  border: 4px solid var(--robot-border);
  transform: translateX(-50%);
}

.robot-container .eyes {
  display: flex;
  justify-content: space-around;
  padding-top: 17px;
}

.robot-container .eye {
  width: 17px;
  height: 17px;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  background: white;
}

.robot-container .pupil {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--robot-eye);
  transition: transform 0.08s linear;
  will-change: transform;
}

.robot-container .torso {
  position: relative;
  width: 112px;
  height: 90px;
  margin: 0 auto;
  border-radius: 24px;
  background: linear-gradient(180deg, #68bef7, #419ddd);
  border: 4px solid var(--robot-border);
  box-shadow: 0 14px 24px rgba(77, 168, 232, 0.18);
}

.robot-container .torso::before,
.robot-container .torso::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.robot-container .torso::before {
  top: 22px;
  width: 46px;
  height: 10px;
  border-radius: 999px;
  background: #e9f8ff;
}

.robot-container .torso::after {
  top: 42px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e9f8ff;
}

.robot-container .arm {
  position: absolute;
  top: 88px;
  width: 30px;
  height: 88px;
  border-radius: 18px;
  background: linear-gradient(180deg, #bde7ff, #8bcdf8);
  border: 4px solid var(--robot-border);
}

.lesson-stage[data-scene-theme="cow-3d"] .lesson-analysis-card {
  align-self: end;
  margin-bottom: 54px;
  justify-self: start;
}

.robot-container .left-arm {
  left: 10px;
  transform: rotate(12deg);
  transform-origin: top center;
}

.robot-container .right-arm {
  right: 10px;
  transform: rotate(-12deg);
  transform-origin: top center;
}

.robot-container .left-arm::after,
.robot-container .right-arm::after {
  content: "";
  position: absolute;
  bottom: -6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #bde7ff;
  border: 4px solid var(--robot-border);
}

.robot-container .left-arm::after {
  left: -4px;
}

.robot-container .right-arm::after {
  right: -8px;
}

.robot-container .shadow {
  width: 84px;
  height: 12px;
  margin: 18px auto 0;
  border-radius: 50%;
  background: rgba(49, 98, 138, 0.14);
  animation: shadowScaleRobot 3s ease-in-out infinite;
}

@keyframes floatRobot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes floatTeacher {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes shadowScaleRobot {
  0%, 100% { transform: scale(1); opacity: 0.34; }
  50% { transform: scale(0.82); opacity: 0.18; }
}

@keyframes shadowScaleTeacher {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.34; }
  50% { transform: translateX(-50%) scale(0.82); opacity: 0.18; }
}

.teacher-hand {
  position: absolute;
  width: 116px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0c7a5, #d88d60);
  top: 162px;
  right: calc(100% - 214px);
  transform-origin: left center;
  transition: transform 320ms ease;
  box-shadow: 0 6px 12px rgba(216, 141, 96, 0.18);
}

.teacher-card.co-giao .teacher-hand,
.teacher-card.robot-ban .teacher-hand {
  display: none;
}

.teacher-hand::after {
  content: "";
  position: absolute;
  right: -8px;
  top: -6px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #efc5a2;
}

.teacher-bubble {
  position: relative;
  padding: 24px 24px 26px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(84, 68, 49, 0.1);
  box-shadow: 0 22px 36px rgba(73, 54, 35, 0.08);
}

.teacher-bubble::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 36px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.95);
  border-left: 1px solid rgba(84, 68, 49, 0.1);
  border-bottom: 1px solid rgba(84, 68, 49, 0.1);
  transform: rotate(45deg);
}

.bubble-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: var(--accent-deep);
}

.learning-caption {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.3;
  font-weight: 700;
}

.learning-phrase {
  margin: 14px 0 0;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--accent-deep);
  font-weight: 600;
}

.lesson-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.lesson-runtime-card,
.lesson-summary {
  padding: 18px 20px;
  border-radius: 24px;
  background: rgba(255, 252, 246, 0.9);
  border: 1px solid rgba(84, 68, 49, 0.1);
  box-shadow: 0 18px 30px rgba(73, 54, 35, 0.08);
}

.lesson-summary {
  margin-top: 18px;
}

@media (max-width: 980px) {
  .lesson-page {
    padding: 14px;
  }

  .lesson-scene {
    min-height: auto;
    padding: 18px;
  }

  .lesson-topbar,
  .lesson-statuses,
  .lesson-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    grid-template-columns: 1fr;
    grid-template-areas:
      "nav"
      "avatar";
  }

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

  .avatar-logout-form {
    justify-self: end;
  }

  .lesson-stage {
    grid-template-columns: 1fr;
  }

  .lesson-animal-side,
  .lesson-teacher-side {
    padding: 18px;
  }

  .scene-viewer {
    height: 340px;
  }

  .teacher-card {
    grid-template-columns: 132px 1fr;
  }

  .teacher-avatar {
    width: 132px;
    height: 210px;
  }

  .teacher-hand,
  .teacher-bubble::before {
    display: none;
  }
}
