:root {
  --bg: #f5f7ff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --primary: #e85d75;
  --secondary: #5146d8;
  --mint: #36bda2;
  --yellow: #f5c451;
  --pink: #f5b3c4;
  --blue: #7eb8f7;
  --purple: #9b8cf2;
  --text: #1c2741;
  --muted: #5b6882;
  --shadow: 0 16px 40px rgba(42, 53, 94, 0.14);
  --success: #209d78;
  --danger: #db4961;
}

body.high-contrast {
  --bg: #0d1326;
  --panel: rgba(22, 30, 47, 0.96);
  --panel-strong: #182335;
  --primary: #ffd166;
  --secondary: #7dd3fc;
  --mint: #6ee7b7;
  --yellow: #fef3c7;
  --pink: #f9a8d4;
  --blue: #93c5fd;
  --purple: #c4b5fd;
  --text: #f5f7ff;
  --muted: #c6d1ef;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(245, 196, 81, 0.32), transparent 27%),
    radial-gradient(circle at right center, rgba(126, 184, 247, 0.28), transparent 31%),
    linear-gradient(135deg, #faf8ff 0%, var(--bg) 48%, #effaf8 100%);
  color: var(--text);
}

body.high-contrast {
  background:
    radial-gradient(circle at top left, rgba(255, 180, 130, 0.2), transparent 26%),
    linear-gradient(135deg, #0d1326 0%, #131e35 100%);
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
}

.page-shell {
  min-height: 100vh;
  display: flex;
}

.page-shell.guardian-active {
  display: none;
}

.accessibility-bar {
  width: 74px;
  background: rgba(255, 255, 255, 0.46);
  border-right: 1px solid rgba(81, 70, 216, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px;
  gap: 12px;
  backdrop-filter: blur(8px);
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  font-size: 1.3rem;
}

.app {
  flex: 1;
  padding: 28px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  border-radius: 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-block {
  background: linear-gradient(135deg, #4538be 0%, #5d69d9 52%, #48b9c0 100%);
  color: white;
  padding: 52px 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.brand-block::after {
  content: "";
  position: absolute;
  inset: 20px auto auto 20px;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.brand-mark {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 2.6rem;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.8;
}

.brand-block h1,
.section-heading h3,
.topbar h2 {
  font-family: "Baloo 2", sans-serif;
}

.brand-block h1 {
  margin: 0;
  font-size: clamp(2.6rem, 4vw, 4.5rem);
  line-height: 1;
}

.brand-copy {
  margin-top: 18px;
  max-width: 420px;
  font-size: 1.05rem;
  line-height: 1.7;
  opacity: 0.95;
}

.auth-panel {
  background: var(--panel);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.role-tabs,
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: rgba(81, 70, 216, 0.08);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 16px;
}

.auth-tabs {
  margin-bottom: 26px;
}

.demo-credentials {
  display: grid;
  gap: 5px;
  margin: 0 0 18px;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(95, 213, 192, 0.14);
  border: 1px solid rgba(57, 182, 141, 0.28);
  color: var(--text);
  font-size: 0.82rem;
}

.demo-credentials strong {
  font-size: 0.92rem;
}

.demo-login-btn {
  justify-self: start;
  margin-top: 5px;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--success);
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
}

.role-tab {
  background: transparent;
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--muted);
  font-weight: 700;
}

.role-tab.active {
  background: #28365c;
  color: white;
  box-shadow: 0 8px 22px rgba(28, 39, 65, 0.18);
}

.auth-note {
  margin: 0 0 4px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
  font-weight: 600;
}

.auth-tab {
  background: transparent;
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--muted);
  font-weight: 700;
}

.auth-tab.active {
  background: white;
  box-shadow: 0 8px 22px rgba(108, 99, 255, 0.1);
  color: var(--text);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.auth-form.active {
  display: flex;
}

.auth-form label,
.learning-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

input, textarea, select {
  border: 1px solid rgba(127, 138, 167, 0.35);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text);
  outline: none;
  transition: 0.2s ease;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(81, 70, 216, 0.85);
  box-shadow: 0 0 0 4px rgba(81, 70, 216, 0.14);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), #f27b72);
  color: white;
  box-shadow: 0 12px 30px rgba(232, 93, 117, 0.25);
}

.secondary-btn {
  background: rgba(81, 70, 216, 0.09);
  color: var(--text);
}

.ghost-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(127, 138, 167, 0.4);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover,
.tab:hover {
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

.main-app {
  max-width: 1400px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px 18px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(127, 138, 167, 0.12);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(123, 136, 170, 0.08);
  backdrop-filter: blur(10px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-pill {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--yellow), var(--pink));
  font-size: 2rem;
}

.topbar-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.topbar h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2.4rem);
}

.user-pill {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.12), rgba(95, 213, 192, 0.15));
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
}

.tab-bar {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tab {
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  padding: 16px 16px;
  border-radius: 16px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(81, 67, 116, 0.06);
}

.tab.active {
  background: linear-gradient(135deg, var(--secondary), #667be2);
  color: white;
}

.panel {
  display: none;
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.38);
  border-radius: 28px;
  border: 1px solid rgba(127, 138, 167, 0.18);
  padding: 24px;
  backdrop-filter: blur(10px);
}

.panel.active {
  display: block;
}

.guardian-panel {
  min-height: 72vh;
}

.guardian-account-screen {
  min-height: 100vh;
  padding: 28px clamp(20px, 5vw, 76px) 56px;
  background: linear-gradient(145deg, #182442 0%, #2d4271 50%, #2e7180 100%);
  color: #f7f9ff;
}

.guardian-account-screen.hidden {
  display: none;
}

.guardian-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1320px;
  margin: 0 auto 24px;
}

.guardian-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.guardian-brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #f5c451;
  color: #17233e;
  font: 800 1.45rem "Baloo 2", sans-serif;
}

.guardian-header .eyebrow {
  color: #b9d5eb;
}

.guardian-header h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.guardian-header .ghost-btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.1);
}

.guardian-navigation {
  max-width: 1320px;
  margin: 0 auto 26px;
  padding: 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
}

.guardian-nav-link {
  flex: 1 0 max-content;
  padding: 11px 16px;
  border-radius: 12px;
  background: transparent;
  color: #dceafb;
  font-weight: 800;
}

.guardian-nav-link:hover,
.guardian-nav-link:focus-visible,
.guardian-nav-link.active {
  background: #f5c451;
  color: #17233e;
  outline: none;
}

.guardian-account-screen > :not(.guardian-header):not(.guardian-navigation) {
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
}

.guardian-account-screen .guardian-feature-card,
.guardian-account-screen .panel-card {
  color: var(--text);
}

.guardian-account-screen .guardian-feature-card h4,
.guardian-account-screen .panel-card h4 {
  color: var(--text);
}

.guardian-account-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.guardian-account-header h3 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.9rem);
  line-height: 1;
}

.guardian-hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 18px;
  margin-bottom: 22px;
}

.guardian-feature-card {
  background: var(--panel-strong);
  border-radius: 24px;
  border: 1px solid rgba(127, 138, 167, 0.12);
  box-shadow: var(--shadow);
  padding: 22px;
}

.focus-card {
  background: linear-gradient(135deg, rgba(81, 70, 216, 0.08), rgba(54, 189, 162, 0.13));
}

.focus-card #guardianGreeting {
  display: inline-block;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--secondary), #667be2);
  color: #ffffff;
}

.focus-card > p {
  color: var(--muted);
}

.focus-card .feature-tag {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.feature-tag {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guardian-feature-card h4 {
  margin: 18px 0 10px;
  font-size: clamp(1.6rem, 2vw, 2.4rem);
}

.guardian-feature-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.guardian-actions {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guardian-actions li {
  background: rgba(81, 70, 216, 0.05);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 600;
}

.guardian-action {
  width: 100%;
  text-align: left;
  background: rgba(81, 70, 216, 0.05);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.guardian-action:hover,
.guardian-action:focus-visible {
  border-color: rgba(81, 70, 216, 0.45);
  color: var(--text);
  outline: none;
}

.guardian-tools-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 22px;
}

.learning-plan-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.learning-plan-form label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.learning-plan-form textarea {
  resize: vertical;
}

.save-status {
  min-height: 1.4em;
  color: var(--success) !important;
  font-weight: 700;
}

.children-card {
  margin-bottom: 22px;
}

.children-card p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
}

.child-select-wrap {
  margin-bottom: 14px;
}

.child-select-wrap label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  max-width: 280px;
}

.add-child-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
  max-width: 360px;
}

.add-child-actions {
  display: flex;
  gap: 12px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.section-heading h3 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.9rem);
  line-height: 1;
}

.mini-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(57, 182, 141, 0.08);
  color: var(--success);
  font-weight: 700;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.green { background: var(--success); }

.cards-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.story-card,
.panel-card,
.video-card,
.chat-shell,
.form-shell,
.google-form-side {
  background: var(--panel-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(127, 138, 167, 0.12);
}

.story-card {
  padding: 18px 18px 16px;
}

.story-card .story-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.28), rgba(255, 181, 199, 0.28));
  font-size: 2rem;
}

.story-card h4 {
  margin: 18px 0 8px;
  font-size: 1.5rem;
}

.story-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.story-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.story-tag {
  display: inline-flex;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(81, 70, 216, 0.08);
  font-size: 0.8rem;
  font-weight: 700;
}

.story-actions {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.story-actions button {
  flex: 1;
}

.chat-shell {
  padding: 18px;
}

.chat-messages {
  min-height: 280px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 6px;
}

.bubble {
  max-width: 80%;
  padding: 14px 16px;
  border-radius: 18px 18px 18px 6px;
  line-height: 1.6;
  box-shadow: 0 12px 20px rgba(68, 82, 134, 0.08);
}

.bubble.bot {
  background: rgba(81, 70, 216, 0.08);
  align-self: flex-start;
}

.bubble.user {
  background: linear-gradient(135deg, var(--mint), #8ae5d2);
  align-self: flex-end;
  border-radius: 18px 18px 6px 18px;
}

.chat-controls {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

.chat-controls input {
  flex: 1;
}

.suggestions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.suggestion-chip {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(127, 138, 167, 0.22);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: 700;
}

.form-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr;
  gap: 18px;
  padding: 22px;
}

.learning-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.google-form-side {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  background: linear-gradient(135deg, rgba(81, 70, 216, 0.08), rgba(54, 189, 162, 0.12));
}

.form-chip {
  display: inline-flex;
  width: fit-content;
  background: white;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.google-form-side h4 {
  margin: 0;
  font-size: 2rem;
}

.google-form-side p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.mini-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  padding: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--panel-strong);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.stat-card strong {
  font-size: 2rem;
  font-family: "Baloo 2", sans-serif;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-card {
  padding: 18px;
}

.panel-card h4 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list li {
  background: rgba(81, 70, 216, 0.05);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--muted);
}

.bar-wrap {
  width: 100%;
  height: 18px;
  background: rgba(127, 138, 167, 0.16);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(135deg, var(--success), var(--mint));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.improvement-text {
  margin-top: 12px;
  font-weight: 700;
}

.video-card {
  padding: 22px;
}

#lessonVideo {
  width: 100%;
  border-radius: 18px;
  background: #000;
  max-height: 420px;
}

.custom-controls {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

#speedSelect {
  min-width: 110px;
}

/* ===== Video tab (child account): player header, layout, playlist ===== */
.section-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.video-player-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.video-category-tag {
  display: inline-block;
  background: rgba(81, 70, 216, 0.12);
  color: var(--secondary);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.video-kicker {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.video-player-header h4 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-gesture-icon {
  font-size: 1.5rem;
}

.video-count {
  background: rgba(81, 70, 216, 0.1);
  color: var(--secondary);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
}

.video-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.video-card {
  padding: 22px;
  background: var(--panel-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(127, 138, 167, 0.16);
}

.video-screen-container {
  width: 100%;
  border-radius: 18px;
  background: #090d14;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(28, 39, 65, 0.12);
  border: 2px solid rgba(81, 70, 216, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}

#lessonVideo {
  width: 100%;
  max-height: 420px;
  display: block;
  background: #000;
  outline: none;
}

.video-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  background: rgba(81, 70, 216, 0.04);
  border-radius: 16px;
  border: 1px solid rgba(127, 138, 167, 0.14);
}

.video-controls button,
.video-controls select {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.video-controls button:hover {
  transform: translateY(-1px);
}

.video-controls select {
  border: 1px solid rgba(127, 138, 167, 0.3);
  background: var(--panel-strong);
  color: var(--text);
}

/* Gesture Guide Card */
.gesture-guide-card {
  margin-top: 18px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(81, 70, 216, 0.05), rgba(54, 189, 162, 0.08));
  border-radius: 20px;
  border: 1px solid rgba(81, 70, 216, 0.18);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.guide-badge-wrap {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(81, 70, 216, 0.14), rgba(54, 189, 162, 0.22));
  border: 2px solid rgba(81, 70, 216, 0.25);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(81, 70, 216, 0.12);
}

.guide-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.guide-meta {
  flex: 1;
  min-width: 0;
}

.guide-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 2px;
}

.guide-meta h5 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  color: var(--text);
  font-family: "Baloo 2", cursive;
}

.guide-instruction {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text);
  line-height: 1.5;
}

.guide-action-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  border: 1px solid rgba(127, 138, 167, 0.16);
}

.action-effect {
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-effect strong {
  color: var(--secondary);
}

.guide-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.guide-btn {
  padding: 8px 14px;
  font-size: 0.86rem;
  font-weight: 700;
  border-radius: 12px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.guide-btn:hover {
  transform: translateY(-1px);
}

#masterGestureBtn.mastered {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.guide-steps-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.guide-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid rgba(127, 138, 167, 0.14);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--secondary);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Playlist / Video library (right column) */
.video-library {
  background: var(--panel-strong);
  border: 1px solid rgba(127, 138, 167, 0.16);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
  z-index: 2;
}

.library-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.video-library-title {
  margin: 0;
  font-size: 1.18rem;
  font-family: "Baloo 2", cursive;
}

.video-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.mastery-tracker-wrap {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: rgba(81, 70, 216, 0.05);
  border-radius: 14px;
  border: 1px solid rgba(81, 70, 216, 0.12);
}

.mastery-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.mastery-progress-track {
  height: 8px;
  background: rgba(127, 138, 167, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.mastery-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--mint));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.gesture-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(81, 70, 216, 0.06);
  border: 1px solid rgba(81, 70, 216, 0.15);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-chip:hover {
  background: rgba(81, 70, 216, 0.12);
  transform: translateY(-1px);
}

.filter-chip.active {
  background: var(--secondary);
  color: #ffffff;
  border-color: var(--secondary);
  box-shadow: 0 4px 10px rgba(81, 70, 216, 0.25);
}

.video-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-choice {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(81, 70, 216, 0.04);
  border: 1px solid rgba(127, 138, 167, 0.18);
  color: var(--text);
  text-align: start;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.video-choice:hover,
.video-choice:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(81, 70, 216, 0.45);
  box-shadow: 0 6px 18px rgba(81, 70, 216, 0.1);
  outline: none;
}

.video-choice.active {
  background: linear-gradient(135deg, rgba(81, 70, 216, 0.12), rgba(54, 189, 162, 0.14));
  border-color: var(--secondary);
  box-shadow: 0 6px 20px rgba(81, 70, 216, 0.16);
}

.video-choice-index {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 12px;
  background: rgba(81, 70, 216, 0.1);
  color: var(--secondary);
  font-weight: 800;
  font-size: 0.76rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.choice-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.video-choice.active .video-choice-index {
  background: linear-gradient(135deg, var(--secondary), #667be2);
  color: #ffffff;
}

.video-choice-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.video-choice-title {
  font-size: 0.96rem;
  color: var(--text);
}

.video-choice-summary {
  font-size: 0.78rem;
  color: var(--muted);
}

.video-choice-hint {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--secondary);
}

.video-choice.active .video-choice-hint {
  color: var(--success);
  font-weight: 700;
}

.video-choice-action {
  color: var(--secondary);
  font-size: 0.95rem;
  opacity: 0.75;
}

.video-choice.active .video-choice-action {
  opacity: 1;
}

/* Gesture Tips Box */
.gesture-tips-box {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(245, 196, 81, 0.12);
  border: 1px solid rgba(245, 196, 81, 0.3);
  border-radius: 16px;
}

.tips-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text);
}

.tips-icon {
  font-size: 1.1rem;
}

.tips-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

/* High contrast mode adjustments for video tab */
body.high-contrast .video-card,
body.high-contrast .video-library {
  border-color: rgba(255, 255, 255, 0.25);
}

body.high-contrast .gesture-guide-card {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--secondary);
}

body.high-contrast .guide-action-box,
body.high-contrast .guide-step,
body.high-contrast .mastery-tracker-wrap {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

body.high-contrast .filter-chip {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text);
}

body.high-contrast .filter-chip.active {
  background: var(--secondary);
  color: #0d1326;
  border-color: var(--secondary);
}

body.high-contrast .gesture-tips-box {
  background: rgba(255, 209, 102, 0.12);
  border-color: var(--yellow);
}

body.high-contrast .video-choice {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

body.high-contrast .video-choice.active {
  background: rgba(125, 211, 252, 0.18);
  border-color: var(--secondary);
}

/* Arabic / RTL alignments */
html[lang="ar"] .tips-list {
  padding-left: 0;
  padding-right: 20px;
}

html[lang="ar"] .video-choice {
  text-align: right;
}

html[lang="ar"] .video-choice-action {
  transform: rotate(180deg);
}

.webcam-panel {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: min(360px, calc(100vw - 32px));
  background: rgba(14, 20, 32, 0.94);
  color: white;
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  z-index: 30;
}

.webcam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.webcam-header h3 {
  margin: 0;
}

#webcamVideo {
  width: 100%;
  border-radius: 16px;
  background: #090d14;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin-bottom: 12px;
}

#webcamStatus {
  margin: 0;
  color: #c4d8ff;
  font-size: 0.94rem;
}

.main-app,
.login-card,
.panel,
.video-card,
.chat-shell,
.form-shell,
.tab-bar,
.topbar {
  position: relative;
  z-index: 2;
}

@media (max-width: 900px) {
  .login-card,
  .form-shell,
  .dashboard-grid,
  .guardian-hero-grid {
    grid-template-columns: 1fr;
  }

  .accessibility-bar {
    display: none;
  }

  .tab-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .app {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-right {
    flex-wrap: wrap;
  }

  .panel {
    padding: 16px;
  }

}

@media (max-width: 600px) {
  .guardian-account-screen {
    padding: 18px 16px 36px;
  }

  .guardian-header {
    align-items: flex-start;
  }
}

@media (max-width: 900px) {
  .video-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== ASL sign language box ===== */
.asl-toggle {
  position: fixed;
  left: 94px;
  bottom: 20px;
  border: none;
  border-radius: 35px;
  padding: 12px 22px;
  background: linear-gradient(135deg, #b23cff, #6454ff);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(80, 20, 180, 0.25);
  transition: transform 0.25s ease, background 0.25s ease;
  z-index: 45;
}

.asl-toggle:hover { transform: translateY(-2px) scale(1.03); }
.asl-toggle.off { background: #6b7280; }

.asl-box {
  position: fixed;
  left: 94px;
  bottom: 76px;
  width: min(425px, calc(100vw - 32px));
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 7px;
  border-radius: 22px;
  background: linear-gradient(135deg, #6731ed, #8100df);
  border: 4px solid #a84cff;
  box-shadow: 0 12px 35px rgba(70, 20, 140, 0.35);
  color: #fff;
  z-index: 44;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s ease, opacity 0.25s ease, visibility 0.25s;
}

.asl-box.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.asl-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
}

.asl-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
}

.asl-hand { font-size: 27px; }

.asl-close-btn {
  background: transparent;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.asl-close-btn:hover { transform: rotate(90deg); }

.asl-sign-area {
  background: #faf8ff;
  border-radius: 17px;
  padding: 14px;
  color: #6516c9;
}

.asl-choose-title {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 10px;
}

.asl-sign-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.asl-sign {
  height: 62px;
  border-radius: 13px;
  background: #f0e7ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.2s ease, background 0.2s ease;
}

.asl-sign:hover {
  transform: translateY(-3px);
  background: #e3d0ff;
  box-shadow: 0 5px 12px rgba(80, 20, 150, 0.15);
}

.asl-sign.selected {
  background: #ffd500;
  box-shadow: 0 0 0 3px #ffae00;
}

.asl-sign img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.asl-sign-letter {
  margin-top: 2px;
  color: #6415c7;
  font-weight: 900;
  font-size: 14px;
}

.asl-current-sign {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  min-height: 126px;
  border-radius: 14px;
  background: #fff;
}

.asl-current-sign img {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.asl-big-letter {
  font-family: "Baloo 2", sans-serif;
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
}

.asl-progress-container { margin: 14px 3px 8px; }

.asl-progress-bar {
  height: 9px;
  background: #a45adf;
  border-radius: 20px;
  overflow: hidden;
}

.asl-progress {
  height: 100%;
  width: 4%;
  background: #ffd400;
  border-radius: 20px;
  transition: width 0.3s ease;
}

.asl-word-counter {
  text-align: center;
  margin-top: 11px;
  font-size: 16px;
  color: #e9d3ff;
}

.asl-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.asl-control-btn {
  width: 53px;
  height: 44px;
  border-radius: 12px;
  background: #9148e8;
  color: #fff;
  font-size: 18px;
  transition: transform 0.2s ease;
}

.asl-control-btn:hover { transform: scale(1.06); }

.asl-play-btn {
  width: 125px;
  background: #df75d6;
  color: #284574;
  font-weight: 900;
}

.asl-speed {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 13px;
  padding-bottom: 8px;
}

.asl-speed-label { font-size: 15px; }

.asl-speed-btn {
  padding: 6px 11px;
  border-radius: 7px;
  background: #8b46db;
  color: #fff;
  font-weight: 700;
}

.asl-speed-btn.active {
  background: #ffd500;
  color: #4c20a8;
}

.asl-toggle:focus-visible,
.asl-box button:focus-visible {
  outline: 3px solid #ffd500;
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .asl-toggle,
  .asl-box { left: 16px; }
}

@media (max-width: 600px) {
  .asl-toggle { bottom: 14px; padding: 10px 18px; font-size: 15px; }
  .asl-box { bottom: 66px; max-height: calc(100vh - 80px); }
  .asl-sign { height: 56px; }
  .asl-sign img { width: 30px; height: 30px; }
}