@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  ::view-transition { pointer-events: none; }
  ::view-transition-group(root) { animation-duration: 350ms; }
  ::view-transition-old(root) {
    animation: app-page-leave 260ms ease-out both;
    mix-blend-mode: normal;
  }
  ::view-transition-new(root) {
    animation: app-page-enter 350ms cubic-bezier(.2, .65, .3, 1) both;
    mix-blend-mode: normal;
  }

  .app-navigation-meter::before {
    animation: app-navigation-sweep 1.1s ease-in-out infinite;
  }

  :is(.session-review-additions, .word-source-edit-dialog, .session-source-library)[open],
  [data-study-workspace] :is([data-study-note-panel], [data-study-card-panel]):not([hidden]),
  [data-lesson-reader-host] > .source-viewer,
  [data-desk-fragment] > section {
    animation: app-panel-appear 240ms cubic-bezier(.2, .65, .3, 1);
  }

  #main, .cobalt-admin #content {
    animation: app-page-enter 290ms cubic-bezier(.2, .65, .3, 1);
  }
  /* Let the initial arrival animation's clock run, while the native
     transition owns the visible motion. It then cannot replay afterward. */
  :root:active-view-transition :is(#main, .cobalt-admin #content) {
    --app-page-start-opacity: 1;
    --app-page-start-translate: none;
  }

  @keyframes app-page-leave {
    0%, 25% { opacity: 1; }
    100% { opacity: 0; }
  }

  @keyframes app-page-enter {
    from {
      opacity: var(--app-page-start-opacity, .4);
      translate: var(--app-page-start-translate, 0 12px);
    }
    to { opacity: 1; translate: none; }
  }

  @keyframes app-navigation-sweep {
    from { transform: translateX(-110%); }
    to { transform: translateX(260%); }
  }

  @keyframes app-panel-appear {
    from { opacity: .55; translate: 0 6px; }
    to { opacity: 1; translate: none; }
  }
}

.app-navigation-meter {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 10000;
  overflow: hidden;
  background: #c7dafc;
  pointer-events: none;
}

.app-navigation-meter[hidden] { display: none; }
.app-navigation-meter::before {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: #2455c7;
}

.app-navigation-announcement {
  position: fixed;
  inset: 0 auto auto 0;
  height: 1px;
  width: 1px;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

:is([data-app-loading="true"], .source-viewer[aria-busy="true"] > [data-source-message],
  .source-viewer[data-word-refresh] > [data-source-message][role="status"],
  .pdf-panel:not(.session-authoring .lesson-source-panel .pdf-panel):has([data-pdf-stage][aria-busy="true"]) [data-pdf-message],
  .word-source-edit-dialog[aria-busy="true"] [data-word-edit-status]):not([hidden]):not(:empty)::before {
  content: "";
  display: inline-block;
  box-sizing: border-box;
  width: 1em;
  height: 1em;
  margin-inline-end: .55em;
  vertical-align: -.14em;
  border: 2px solid #c7dafc;
  border-color: color-mix(in srgb, currentColor 25%, transparent);
  border-inline-start-color: currentColor;
  border-radius: 50%;
  animation: app-loading-rotate 800ms linear infinite;
}

@keyframes app-loading-rotate { to { transform: rotate(1turn); } }

@media (prefers-reduced-motion: reduce) {
  :is([data-app-loading="true"], .source-viewer[aria-busy="true"] > [data-source-message],
    .source-viewer[data-word-refresh] > [data-source-message][role="status"],
    .pdf-panel:has([data-pdf-stage][aria-busy="true"]) [data-pdf-message],
    .word-source-edit-dialog[aria-busy="true"] [data-word-edit-status])::before { animation: none; }
}

[data-desk-content] { position: relative; }
.app-activity-overlay {
  position: absolute;
  inset-block-start: var(--activity-offset, 8px);
  inset-inline-end: 12px;
  z-index: 5;
  max-inline-size: calc(100% - 24px);
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line, #c7dafc);
  border-radius: 8px;
  background: var(--paper, #fff);
  color: var(--ink, #23385a);
  font-size: 13px;
  line-height: 1.6;
  pointer-events: none;
}

.app-activity-overlay[hidden] { display: none; }
.session-source-library > .app-activity-overlay { --activity-offset: 64px; }

.app-activity-overlay[data-app-loading="true"] {
  animation: app-loading-show 0s 180ms backwards;
}

@keyframes app-loading-show { from { visibility: hidden; } }
