/* Motion shared by the student experience and public entry pages. Content is
   visible without JavaScript and never waits for an animation to be usable. */
.student-motion .xp-icon {
  width: 42px;
  height: 42px;
}
.student-motion .xp-icon.xp-icon-small { width:22px; height:22px; }

/* The CSS grid is a fallback. Canvas paints live cells and lines with a
   gradient field whose positions and colors evolve independently. */
body.student-motion {
  isolation: isolate;
  background: linear-gradient(rgba(130,145,160,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(130,145,160,.06) 1px, transparent 1px), var(--bg);
  background-size: 56px 56px;
}
body.student-motion.student-grid-ready { background: var(--bg); }
.student-living-grid { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; filter: blur(1.68px); }

/* Tint each pane rather than lowering element opacity: type and controls stay
   solid, while nested panes naturally accumulate tint and soften the grid. */
.student-motion {
  --panel: rgba(18, 25, 39, .28);
  --glass-tint: rgba(18, 25, 39, .28);
  --glass-edge: rgba(220, 235, 255, .16);
  --glass-highlight: rgba(255, 255, 255, .055);
}
.student-motion :is(.surface, .topbar, .auth-card) {
  background: linear-gradient(135deg, var(--glass-highlight), transparent 65%), var(--glass-tint);
  border-color: var(--glass-edge);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .12), inset 0 1px 0 var(--glass-highlight);
  -webkit-backdrop-filter: blur(5px) saturate(125%);
  backdrop-filter: blur(5px) saturate(125%);
}
.student-motion .topbar { border-radius: var(--radius); }
.student-motion :is(.course-card, .social-stat, .result-player, .activity-bars > div) {
  background: linear-gradient(135deg, rgba(255,255,255,.045), transparent), var(--glass-tint);
  border-color: var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.student-motion .level-card {
  background: linear-gradient(120deg, rgba(100,64,162,.2), rgba(32,104,123,.13)), var(--glass-tint);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.student-motion .social-dashboard-link {
  background: linear-gradient(110deg, rgba(88,58,113,.13), rgba(39,138,126,.1)), var(--glass-tint);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
/* Selection cards use glass; study content keeps its opaque color gradients. */
.student-motion .practice-lessons > label {
  background-image: linear-gradient(125deg, rgba(64,94,151,.22), rgba(53,120,139,.16));
  background-color: var(--glass-tint);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.student-motion :is(.lesson-feed-block, .practice-question) {
  background-color: #152033;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.student-motion .practice-stats > span {
  background: linear-gradient(120deg, rgba(42,140,111,.2), transparent), var(--glass-tint);
}
.student-motion .practice-stats > span:nth-child(2) { background-image: linear-gradient(120deg, rgba(187,71,115,.2), transparent); }
.student-motion .practice-stats > span:nth-child(3) { background-image: linear-gradient(120deg, rgba(99,125,211,.2), transparent); }
.student-motion .duel-result.outcome-win { background-image: radial-gradient(ellipse at top, rgba(198,167,58,.2), transparent 75%); }
[data-theme="light"] .student-motion {
  --panel: rgba(250, 253, 255, .44);
  --glass-tint: rgba(250, 253, 255, .44);
  --glass-edge: rgba(45, 69, 95, .16);
  --glass-highlight: rgba(255, 255, 255, .32);
}

@media (prefers-reduced-motion: no-preference) {
  .student-motion .topbar { animation: sl-drop .55s ease-out; }
  .student-motion .sidebar { animation: sl-slide-in .6s ease-out; }
  .student-motion .main-content > *,
  .student-motion .auth-card,
  .student-motion .hero-section .container { animation: sl-arrive .6s ease-out; }

  .student-motion .sidebar .nav > a { animation: sl-slide-in .45s ease-out; }
  .student-motion .sidebar .nav > a:nth-child(3n + 2) { animation-delay: .06s; }
  .student-motion .sidebar .nav > a:nth-child(3n) { animation-delay: .12s; }

  .student-motion .course-grid > *,
  .student-motion .dashboard-actions > *,
  .student-motion .activity-bars > *,
  .student-motion .practice-lessons > *,
  .student-motion .avatar-picker > *,
  .student-motion .cover-picker > *,
  .student-motion .achievement-medal,
  .student-motion .result-player { animation: sl-card-in .55s cubic-bezier(.2,.75,.25,1); }
  .student-motion :is(.course-grid, .dashboard-actions, .activity-bars, .practice-lessons, .avatar-picker, .cover-picker) > :nth-child(4n + 2) { animation-delay: .07s; }
  .student-motion :is(.course-grid, .dashboard-actions, .activity-bars, .practice-lessons, .avatar-picker, .cover-picker) > :nth-child(4n + 3) { animation-delay: .14s; }
  .student-motion :is(.course-grid, .dashboard-actions, .activity-bars, .practice-lessons, .avatar-picker, .cover-picker) > :nth-child(4n) { animation-delay: .21s; }

  .student-motion :is(.course-card, .dashboard-actions > a, .practice-lessons > label, .avatar-picker > label, .cover-picker > label, .achievement-medal, .duel-history-row) {
    transition: transform .22s ease, border-color .22s ease, background-color .22s ease, box-shadow .22s ease;
  }
  @media (hover: hover) {
    .student-motion :is(.course-card, .dashboard-actions > a, .practice-lessons > label, .avatar-picker > label, .cover-picker > label, .duel-history-row):hover {
      transform: translateY(-4px);
      border-color: var(--teal);
      box-shadow: 0 12px 26px rgba(0,0,0,.18);
    }
    .student-motion .achievement-medal:hover { transform: translateY(-5px) rotate(-3deg); }
    .student-motion .sidebar .nav > a:hover { transform: translateX(4px); }
    .student-motion .dashboard-actions a:hover > span { transform: translateY(-4px) rotate(-8deg) scale(1.12); }
  }
  .student-motion .sidebar .nav > a,
  .student-motion .dashboard-actions a > span,
  .student-motion :is(button, a.primary, a.ghost, .btn) { transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease; }
  .student-motion :is(button, a.primary, a.ghost, .btn):active:not(:disabled) { transform: scale(.97); }
  .student-motion :is(input, textarea, select) { transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease; }
  .student-motion :is(input, textarea, select):focus-visible { box-shadow: 0 0 0 4px rgba(86,214,194,.18); }

  .student-motion :is(.answer-options, .practice-options, .duel-answer-options) label { transition: transform .2s ease, border-color .2s ease, background-color .2s ease; }
  .student-motion :is(.notice, .alert, .practice-feedback):not([hidden]) { animation: sl-feedback .4s ease-out; }
  .student-motion .practice-question > * { animation: sl-arrive .4s ease-out; }
  .student-motion .practice-options > label { animation: sl-card-in .4s ease-out; }
  .student-motion .practice-options > label:nth-child(even) { animation-delay: .07s; }

  .student-motion .brand .mark { animation: sl-owl-float 5s ease-in-out infinite; }
  .student-motion .xp-icon { animation: sl-xp-float 6s ease-in-out infinite; }
  .student-motion .dashboard-actions a > span { display: inline-block; }
  .student-motion .activity-bars > div strong { animation: sl-count-pop .7s ease-out; }
  .student-motion .auth-card :is(h2, form, .alert),
  .student-motion .hero-section :is(h1, .lead, .mt-5) { animation: sl-arrive .65s ease-out; }
}

@keyframes sl-arrive { from { opacity: .65; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sl-drop { from { opacity: .7; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sl-slide-in { from { opacity: .7; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes sl-card-in { from { opacity: .7; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes sl-feedback { from { opacity: .7; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes sl-count-pop { 0% { transform: scale(.85); } 65% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes sl-owl-float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-3deg); } }
@keyframes sl-xp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

@media (prefers-reduced-motion: reduce) {
  .student-motion *, .student-motion *::before, .student-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .student-motion :is(.course-card, .dashboard-actions > a, .student-social-card):hover { transform: none; }
}

/* Highlight an answer while it awaits checking. */
.student-motion .study-player .question-card:not(.answered-correct):not(.answered-wrong) .answer-options label:has(input:checked) { border-color:#ffd36a; box-shadow:inset 0 0 0 1px #ffd36a; background-color:rgba(255,211,106,.12); }

.student-motion .study-player .question-card .answer-options label.submitted-wrong { border-color:#ff657d; box-shadow:inset 0 0 0 1px #ff657d; background-color:rgba(255,101,125,.14); }
