/* Performance overrides for the authenticated app shell.
   Heavy backdrop filters, large blurred blobs, and blanket transitions make
   page switches and scrolling feel slow on lower-power devices. */

#portal .blobs,
#portal .blob {
  display: none !important;
}

#portal .sidebar,
#portal .topbar,
#portal .main,
#portal .shell,
#portal .widget-card,
#portal .dash-widget,
#portal .profile-hero,
#portal .settings-card,
#portal .settings-block,
#portal .sub-card,
#portal .ln-section,
#portal .editor-card,
#portal .dr-drawer,
#portal .dr-rail,
#portal .co-inner,
#portal .co-card,
#portal .sd-course-card,
#portal .sd-semester-dropdown,
#portal .st-overlay,
#portal .st-popup {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  filter: none !important;
}

#portal .dr-rail {
  background:
    linear-gradient(180deg, rgba(16, 29, 52, 0.98), rgba(8, 15, 31, 0.98)) !important;
}

#portal .dr-drawer {
  background:
    radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.10), transparent 34%),
    linear-gradient(180deg, rgba(15, 27, 48, 0.98), rgba(8, 15, 31, 0.98)) !important;
  border-color: rgba(125, 211, 252, 0.28) !important;
}

#portal .portal-section,
#portal .psec-entering,
#portal .psec-leaving,
#portal .sidebar,
#portal .sidebar *,
#portal .main,
#portal .main-scroll,
#portal .sd-course-card,
#portal .sb-item,
#portal .sb-item-icon,
#portal .sb-user,
#portal .topbar {
  animation: none !important;
  transition-duration: 0.08s !important;
}

#portal #psec-aipage.psec-entering,
#portal #psec-chat.psec-entering {
  animation: psec-in 0.22s cubic-bezier(0.22, 0.68, 0.12, 1) both !important;
}

#portal #psec-aipage.psec-leaving,
#portal #psec-chat.psec-leaving {
  animation: psec-out 0.14s ease both !important;
}

#portal #psec-aipage,
#portal #psec-chat {
  contain: layout paint;
}

#portal #psec-aipage .chat-route-skeleton,
#portal #psec-chat .chat-route-skeleton {
  width: 100%;
  height: 100%;
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0;
  background:
    radial-gradient(circle at 24% 18%, rgba(59, 130, 246, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(8, 16, 36, 0.98), rgba(12, 24, 48, 0.96));
  color: rgba(226, 232, 240, 0.88);
  overflow: hidden;
}

#portal .chat-route-skeleton__sidebar,
#portal .chat-route-skeleton__main {
  padding: 24px;
}

#portal .chat-route-skeleton__sidebar {
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.38);
}

#portal .chat-route-skeleton__main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#portal .chat-route-skeleton__brand,
#portal .chat-route-skeleton__line,
#portal .chat-route-skeleton__row,
#portal .chat-route-skeleton__top,
#portal .chat-route-skeleton__bubble,
#portal .chat-route-skeleton__composer {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.14);
}

#portal .chat-route-skeleton__brand::after,
#portal .chat-route-skeleton__line::after,
#portal .chat-route-skeleton__row::after,
#portal .chat-route-skeleton__top::after,
#portal .chat-route-skeleton__bubble::after,
#portal .chat-route-skeleton__composer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: chat-route-skeleton-sheen 1.15s ease-in-out infinite;
}

#portal .chat-route-skeleton__brand {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  margin-bottom: 24px;
  background: rgba(59, 130, 246, 0.24);
}

#portal .chat-route-skeleton__line {
  height: 14px;
  width: 62%;
  margin-bottom: 12px;
}

#portal .chat-route-skeleton__line--wide {
  width: 82%;
}

#portal .chat-route-skeleton__row {
  height: 58px;
  margin-top: 18px;
}

#portal .chat-route-skeleton__row--soft {
  opacity: 0.68;
}

#portal .chat-route-skeleton__top {
  height: 64px;
}

#portal .chat-route-skeleton__bubble {
  width: min(620px, 72%);
  height: 104px;
}

#portal .chat-route-skeleton__bubble--user {
  align-self: flex-end;
  width: min(460px, 58%);
  height: 74px;
  background: rgba(37, 99, 235, 0.22);
}

#portal .chat-route-skeleton__composer {
  height: 76px;
  margin-top: auto;
  border-radius: 22px;
}

@keyframes chat-route-skeleton-sheen {
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 820px) {
  #portal #psec-aipage .chat-route-skeleton,
  #portal #psec-chat .chat-route-skeleton {
    grid-template-columns: 1fr;
  }

  #portal .chat-route-skeleton__sidebar {
    display: none;
  }
}

#portal .main-scroll,
#portal #app,
#portal #pdfView {
  scroll-behavior: auto !important;
  will-change: auto !important;
}

/* ── Course / Quiz / Flashcards view ────────────────────────────────────────
   These render inside #courseOverview, which lives in #app (its own scroll
   container) — NOT under #portal's main-scroll, so none of the overrides above
   reached it. Every course card carries a live backdrop-filter blur (18–24px),
   and re-rasterising those on each scroll tick is what makes the quiz and
   flashcards pages stutter. Drop the live blur here too — the translucent
   backgrounds already read as glass without it. (Transitions like the
   flashcard flip are left intact.) */
#app #courseOverview,
#app #courseOverview * {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  filter: none !important;
}

#app #courseOverview {
  scroll-behavior: auto !important;
  will-change: auto !important;
}

/* ── Chat view ───────────────────────────────────────────────────────────────
   #psec-chat carries dozens of backdrop-filter blurs (message bubbles, sidebar,
   header, input bar). Re-rasterising those on every scroll/typing frame makes
   the conversation feel sluggish and switching chats janky. Drop the live blur
   (translucent backgrounds keep the glass look) and stop blanket transitions
   from firing mid-scroll. */
#psec-chat,
#psec-chat * {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
#psec-chat .chat-msg,
#psec-chat .chat-msgs,
#psec-chat .chat-friend-item {
  animation: none !important;
  transition-duration: 0.08s !important;
}
