:root {
  --motion-blue: #1f5fbf;
  --motion-teal: #0f766e;
  --motion-green: #16834a;
  --motion-amber: #d18b11;
  --motion-violet: #6841bf;
}

body.advanced-motion {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 95, 191, .08), transparent 32%),
    linear-gradient(225deg, rgba(15, 118, 110, .07), transparent 36%),
    linear-gradient(180deg, #eaf3fb 0, #f8fafc 245px, #f2f6fb 100%);
  background-attachment: fixed;
}

body.advanced-motion::before,
body.advanced-motion .app-header::before {
  background: linear-gradient(90deg, #1f5fbf, #0f766e, #16834a, #d18b11, #6841bf, #1f5fbf);
  background-size: 300% 100%;
  animation: motionSpectrum 8s ease-in-out infinite;
}

body.advanced-motion::before {
  height: 6px;
  box-shadow: 0 0 24px rgba(31, 95, 191, .22);
}

body.advanced-motion :is(.gate-card, .panel, .app-header, .modal-panel) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(248,252,255,.94));
  backdrop-filter: blur(14px) saturate(1.08);
  box-shadow: 0 26px 78px rgba(15, 23, 42, .11), 0 1px 0 rgba(255,255,255,.82) inset, 0 0 0 1px rgba(255,255,255,.55) inset;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .28s ease, border-color .28s ease;
}

body.advanced-motion :is(.gate-card, .panel, .app-header, .modal-panel):hover {
  transform: translateY(-2px);
  border-color: rgba(31, 95, 191, .38);
  box-shadow: 0 32px 92px rgba(15, 23, 42, .14), 0 0 38px rgba(31,95,191,.10), 0 1px 0 rgba(255,255,255,.88) inset;
}

body.advanced-motion :is(.gate-card, .panel, .app-header, .modal-panel, .metric, .group-credit-card, .issue-box, .semester-card, .semester-credit, .plan-block)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(118deg, transparent 0%, transparent 38%, rgba(255,255,255,.48) 49%, transparent 60%, transparent 100%);
  opacity: 0;
  translate: -130% 0;
  z-index: 2;
}

body.advanced-motion :is(.gate-card, .panel, .app-header, .modal-panel, .metric, .group-credit-card, .issue-box, .semester-card, .semester-credit, .plan-block):hover::after {
  opacity: 1;
  animation: motionSurfaceSweep 1.05s ease both;
}

body.advanced-motion .logo-box {
  box-shadow: 0 18px 40px rgba(31, 95, 191, .14), 0 0 0 1px rgba(255,255,255,.82) inset;
}

body.advanced-motion .app-title,
body.advanced-motion .gate-title {
  text-shadow: 0 1px 0 rgba(255,255,255,.78), 0 14px 34px rgba(31,95,191,.12);
}

body.advanced-motion .btn:not(.secondary):not(.ghost) {
  background: linear-gradient(135deg, #1f5fbf, #0f766e, #16834a, #1f5fbf);
  background-size: 260% 260%;
  border-color: rgba(31, 95, 191, .76);
  box-shadow: 0 12px 28px rgba(31, 95, 191, .18);
  animation: motionButtonCurrent 8s ease-in-out infinite;
}

body.advanced-motion .btn.secondary,
body.advanced-motion .mode-btn {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

body.advanced-motion :is(.btn, .mode-btn):hover,
body.advanced-motion .mode-btn.active {
  box-shadow: 0 14px 30px rgba(31,95,191,.16), 0 0 0 3px rgba(31,95,191,.08);
}

body.advanced-motion :is(.metric, .group-credit-card, .issue-box, .semester-card, .semester-credit, .plan-block) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: translate .22s ease, box-shadow .22s ease, border-color .22s ease;
}

body.advanced-motion :is(.metric, .group-credit-card, .issue-box, .semester-card, .semester-credit, .plan-block):hover {
  translate: 0 -2px;
  border-color: rgba(31,95,191,.28);
  box-shadow: 0 16px 38px rgba(15,23,42,.09);
}

body.advanced-motion .metric::before,
body.advanced-motion .status.loading::before {
  animation: motionStatusRail 2.4s ease-in-out infinite;
}

body.advanced-motion :is(.group-credit-fill, .progress-bar) {
  background-size: 220% 100%;
  animation: motionProgressFlow 2.4s linear infinite;
}

body.advanced-motion .course-kind-legend span,
body.advanced-motion .badge {
  box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
}

body.advanced-motion .badge.good {
  animation: motionBadgePulse 4.2s ease-in-out infinite;
}

body.advanced-motion .table-wrap,
body.advanced-motion .plan-matrix-wrap {
  box-shadow: 0 18px 48px rgba(15,23,42,.07), 0 1px 0 rgba(255,255,255,.8) inset;
}

body.advanced-motion th {
  background: linear-gradient(180deg, #f8fbff, #eef4fb);
}

body.advanced-motion .motion-item {
  opacity: 0;
  animation: motionRiseIn .58s cubic-bezier(.2,.8,.2,1) both;
}

body.advanced-motion .motion-row > td,
body.advanced-motion .motion-row > th {
  opacity: 0;
  animation: motionRowIn .46s cubic-bezier(.2,.8,.2,1) both;
}

body.advanced-motion .status.loading {
  border-left-color: var(--motion-blue);
  box-shadow: 0 12px 32px rgba(31,95,191,.10);
}

body.advanced-motion .status.loading::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #1f5fbf, #0f766e, #16834a, #d18b11);
  background-size: 100% 240%;
}

body.advanced-motion .site-footer {
  padding: 10px 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.68), transparent);
}

@keyframes motionSpectrum {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes motionSurfaceSweep {
  0% { translate: -135% 0; opacity: 0; }
  22% { opacity: .78; }
  100% { translate: 135% 0; opacity: 0; }
}

@keyframes motionButtonCurrent {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes motionProgressFlow {
  to { background-position: 220% 0; }
}

@keyframes motionBadgePulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(22,131,74,.08); }
  50% { box-shadow: 0 6px 24px rgba(22,131,74,.24); }
}

@keyframes motionStatusRail {
  0%, 100% { background-position: 0% 0%; filter: saturate(1); }
  50% { background-position: 0% 100%; filter: saturate(1.35); }
}

@keyframes motionRiseIn {
  from { opacity: 0; translate: 0 14px; filter: saturate(.9); }
  to { opacity: 1; translate: 0 0; filter: saturate(1); }
}

@keyframes motionRowIn {
  from { opacity: 0; translate: 0 8px; }
  to { opacity: 1; translate: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  body.advanced-motion *,
  body.advanced-motion *::before,
  body.advanced-motion *::after {
    animation: none !important;
    transition-duration: .001ms !important;
  }

  body.advanced-motion .motion-item,
  body.advanced-motion .motion-row > td,
  body.advanced-motion .motion-row > th {
    opacity: 1 !important;
    translate: 0 0 !important;
  }
}
