/* ==========================================================================
   app-mode.css — the app chrome for phones and tablets (< 1200px)
   docs/RESPONSIVE_APP_UI_PLAN.md §12

   Enqueued with media="(max-width: 1199.98px)" by inc/app-mode.php, so a
   desktop browser never applies any of it. Every rule is also scoped under
   body.em-app, which is only set where app mode is on (not on the sign-in
   pages, the lesson player or inside the Flutter WebView).

   This file owns the chrome: top bar, menu sheet, tablet sidebar, tab bar
   polish, compact screen headers and touch feel. Per-screen layouts are in
   app-screens.css.

     Phone          < 768px            top bar + bottom tab bar
     Landscape phone  max-height 500px top bar + short bottom bar (surfaces.css)
     Tablet portrait  768-1023px       top bar + 88px labelled rail
     Tablet landscape 1024-1199px      top bar + 240px sidebar
   ========================================================================== */

.em-app {
  --app-bg: #f6f8f6;
  --app-surface: #fff;
  --app-ink: #111827;
  --app-muted: #6b7280;
  --app-line: rgba(17, 24, 39, .08);
  --app-accent: var(--accent, #388E3C);
  --app-accent-ink: #1f6b24;
  --app-tint: rgba(56, 142, 60, .10);
  --app-radius: 16px;
  --topbar-h: 56px;
  --topbar-total: calc(var(--topbar-h) + var(--safe-top));
  --app-side: 0px;            /* width the tablet rail/sidebar takes */
}

/* --------------------------------------------------------------------------
   The website header is replaced, not restyled
   -------------------------------------------------------------------------- */
.em-app .header-float-wrap {
  display: none !important;
}

/* style.css puts overflow-x:hidden on body. With html also non-visible that
   makes body its own (never-scrolling) scroll container, which silently
   disables position:sticky for everything inside it - the pinned chips,
   sub-toolbars and quiz bar here all depend on sticky. clip still stops
   sideways overflow without creating a scroll container. */
body.em-app {
  overflow-x: clip !important;
  overflow-y: visible !important;
}

body.em-app {
  padding-top: 0 !important;
  background: var(--app-bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.em-app .site {
  padding-top: var(--topbar-total) !important;
}

/* Taps should feel like an app, not a web page: no grey flash, no text
   selection on controls, and no 300ms double-tap-zoom wait. */
.em-app a,
.em-app button,
.em-app [role="button"],
.em-app label {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.em-app button,
.em-app .em-topbar,
.em-app .em-shell-nav,
.em-app .em-sheet {
  -webkit-user-select: none;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.em-topbar {
  position: fixed;
  top: 0;
  left: var(--app-side);
  right: 0;
  z-index: var(--z-header);
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition:
    transform var(--dur-base) var(--ease-standard),
    border-color var(--dur-base) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-standard);
  will-change: transform;
}

.em-topbar.is-scrolled {
  border-bottom-color: var(--app-line);
  box-shadow: 0 1px 12px rgba(0, 0, 0, .04);
}

/* WordPress's admin bar is 46px on phones, 32px from 783px. */
.em-app.admin-bar .em-topbar {
  top: 46px;
}

@media (min-width: 783px) {
  .em-app.admin-bar .em-topbar {
    top: 32px;
  }
}

.em-topbar__inner {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--topbar-h);
  padding: 0 8px 0 12px;
  max-width: 1100px;
  margin: 0 auto;
}

.em-topbar--inner .em-topbar__inner {
  padding-left: 4px;
}

.em-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  color: var(--app-ink);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -.01em;
  text-decoration: none;
}

.em-topbar__brand:hover {
  color: var(--app-ink);
  text-decoration: none;
}

.em-topbar__mark,
.em-shell-nav__mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(145deg, #43a047, #2e7d32);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(56, 142, 60, .3);
  flex: 0 0 auto;
}

.em-topbar__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0 4px;
  color: var(--app-ink);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-standard);
}

.em-topbar--root .em-topbar__title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Large-title behaviour: while the page's own heading is on screen the bar
   title would just repeat it, so it waits until that heading scrolls away.
   app-mode.js adds .has-large-title only when such a heading exists, so a
   screen without one always shows its title. */
.em-topbar.has-large-title .em-topbar__title {
  opacity: 0;
  transform: translateY(6px);
}

.em-topbar.has-large-title.is-titled .em-topbar__title {
  opacity: 1;
  transform: none;
}

.em-topbar__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex: 0 0 auto;
}

.em-topbar__btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--app-ink);
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}

.em-topbar__btn[hidden] {
  display: none;
}

.em-topbar__btn:hover,
.em-topbar__btn:focus {
  color: var(--app-ink);
  text-decoration: none;
}

.em-topbar__btn:active {
  background: rgba(0, 0, 0, .06);
  transform: scale(.92);
}

.em-topbar__btn:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 1px;
}

.em-topbar__back {
  font-size: 22px;
  color: var(--app-accent-ink);
}

.em-topbar__menu img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--app-tint);
}

.em-topbar__badge {
  position: absolute;
  top: 6px;
  right: 5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

/* Hide on scroll-down, return on scroll-up (phone only - app-shell.js only
   sets the class below 768px). */
.em-appbar-hidden .em-topbar {
  transform: translateY(calc(-100% - 46px));
}

.em-sheet-open .em-topbar {
  transform: none;
}

/* --------------------------------------------------------------------------
   Menu sheet (replaces the hamburger slide-out)
   -------------------------------------------------------------------------- */
.em-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  display: block;
}

.em-sheet[hidden] {
  display: none;
}

.em-sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 12, .42);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-standard);
}

.em-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(88dvh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(20px + var(--safe-bottom));
  background: var(--app-surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-decelerate);
  outline: none;
}

.em-sheet.is-open .em-sheet__scrim {
  opacity: 1;
}

.em-sheet.is-open .em-sheet__panel {
  transform: none;
}

.em-sheet__grab {
  width: 40px;
  height: 5px;
  margin: 2px auto 12px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .14);
}

.em-sheet__account {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 4px 48px 16px 4px;
  border-bottom: 1px solid var(--app-line);
}

.em-sheet__account img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.em-sheet__who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 160px;
}

.em-sheet__who strong {
  color: var(--app-ink);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.em-sheet__who span,
.em-sheet__who a {
  color: var(--app-muted);
  font-size: .8125rem;
  text-decoration: none;
}

.em-sheet__who a {
  color: var(--app-accent-ink);
  font-weight: 600;
}

.em-sheet__auth {
  display: flex;
  gap: 8px;
  width: 100%;
}

.em-sheet__btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 12px;
  background: var(--app-accent);
  color: #fff;
  font-weight: 600;
  font-size: .9375rem;
  text-decoration: none;
}

.em-sheet__btn:hover,
.em-sheet__btn:focus {
  color: #fff;
  text-decoration: none;
}

.em-sheet__btn--ghost {
  background: var(--app-tint);
  color: var(--app-accent-ink);
}

.em-sheet__btn--ghost:hover,
.em-sheet__btn--ghost:focus {
  color: var(--app-accent-ink);
}

.em-sheet__close {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .05);
  color: var(--app-ink);
  font-size: 15px;
  display: grid;
  place-items: center;
}

.em-sheet__quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 8px;
  padding: 0;
  list-style: none;
}

.em-sheet__quick a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 4px 12px;
  border-radius: 14px;
  background: #f4f7f4;
  color: var(--app-ink);
  font-size: .75rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-standard), background-color var(--dur-fast);
}

.em-sheet__quick a:hover,
.em-sheet__quick a:focus {
  color: var(--app-ink);
  text-decoration: none;
}

.em-sheet__quick a:active {
  transform: scale(.95);
  background: #e9f1e9;
}

.em-sheet__qicon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  color: var(--app-accent);
  font-size: 19px;
  box-shadow: var(--sh-sm);
}

.em-sheet__menu {
  margin-top: 8px;
}

.em-sheet__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.em-sheet__list li {
  margin: 0;
  list-style: none;
}

.em-sheet__list a {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 0 8px;
  border-radius: 12px;
  color: var(--app-ink);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
}

.em-sheet__list a:hover,
.em-sheet__list a:focus {
  color: var(--app-ink);
  text-decoration: none;
}

.em-sheet__list a:active {
  background: #f1f5f1;
}

.em-sheet__list a i {
  width: 22px;
  color: var(--app-muted);
  font-size: 18px;
  text-align: center;
}

.em-sheet__list a.is-danger,
.em-sheet__list a.is-danger i {
  color: #c62828;
}

/* The primary menu's submenus render expanded and indented - a sheet is the
   place to see everything at once, and hover menus do not exist on touch. */
.em-sheet__list .sub-menu {
  margin: 0 0 6px 8px;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--app-line);
  list-style: none;
}

.em-sheet__list .sub-menu a {
  min-height: 42px;
  font-size: .875rem;
  color: #374151;
}

.em-sheet__list > .menu-item-has-children > a {
  color: var(--app-muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  min-height: 36px;
  pointer-events: none;
}

.em-sheet__list--plain {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--app-line);
}

.em-sheet__count {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 11px;
  background: var(--app-accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
}

.em-sheet__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 14px 8px 0;
  font-size: .75rem;
}

.em-sheet__legal a {
  color: var(--app-muted);
  text-decoration: none;
}

/* While the sheet is open the page behind must not scroll or show floating
   widgets over the scrim. */
/* The page scrolls on the root element, so that is what gets locked. */
html:has(body.em-sheet-open) {
  overflow: hidden !important;
}

.em-sheet-open .emhb-root,
.em-sheet-open #em-app-banner {
  visibility: hidden;
}

/* --------------------------------------------------------------------------
   Phone tab bar polish (< 768px, and landscape phones)
   -------------------------------------------------------------------------- */
@media (max-width: 767px), (orientation: landscape) and (max-height: 500px) {
  .em-app .em-shell-nav {
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    box-shadow: none;
    border-top: 1px solid var(--app-line);
  }

  /* Material-style indicator pill behind the active icon. */
  .em-app .em-shell-nav__icon {
    width: 56px;
    height: 28px;
    border-radius: 14px;
    transition: background-color var(--dur-base) var(--ease-standard);
  }

  .em-app .em-shell-nav__link.is-active .em-shell-nav__icon {
    background: var(--app-tint);
    transform: none;
  }

  .em-app .em-shell-nav__link.is-active .em-shell-nav__label {
    font-weight: 700;
  }

  .em-app .em-shell-nav__link:active .em-shell-nav__icon {
    background: rgba(0, 0, 0, .06);
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .em-app .em-shell-nav__link.is-active {
    box-shadow: none;
  }

  .em-app .em-shell-nav__icon {
    width: 44px;
    height: 26px;
  }
}

/* --------------------------------------------------------------------------
   Tablet: labelled rail (portrait) and sidebar (landscape)
   min-height keeps landscape phones on the bottom bar (see surfaces.css).
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (min-height: 501px) {
  .em-app {
    --rail-w: 88px;
    --app-side: calc(var(--rail-w) + var(--safe-left));
  }

  .em-app .em-shell-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: calc(var(--safe-top) + 10px);
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    border-right: 1px solid var(--app-line);
    z-index: calc(var(--z-header) + 1);
    overflow-y: auto;
    scrollbar-width: none;
  }

  .em-app.admin-bar .em-shell-nav {
    top: 32px;
  }

  .em-app .em-shell-nav__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 46px;
    margin: 0 0 14px;
    color: var(--app-ink);
    font-weight: 700;
    text-decoration: none;
  }

  .em-app .em-shell-nav__mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 20px;
  }

  .em-app .em-shell-nav__brandname {
    display: none;
  }

  .em-app .em-shell-nav__list {
    padding-top: 0;
    gap: 6px;
  }

  .em-app .em-shell-nav__item--extra {
    display: flex;
  }

  /* The account / log-in item sits at the bottom of the rail, apart from the
     content destinations - the convention in tablet apps. */
  .em-app .em-shell-nav__item:last-child {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--app-line);
  }

  .em-app .em-shell-nav__link {
    gap: 4px;
    min-height: 58px;
    margin: 0 8px;
    width: calc(100% - 16px);
    padding: 6px 2px;
    border-radius: 14px;
    font-size: 11px;
    color: #4b5563;
  }

  .em-app .em-shell-nav__link.is-active {
    background: none;
    color: var(--app-accent-ink);
  }

  .em-app .em-shell-nav__icon {
    width: 52px;
    height: 30px;
    border-radius: 15px;
    transition: background-color var(--dur-base) var(--ease-standard);
  }

  .em-app .em-shell-nav__link.is-active .em-shell-nav__icon {
    background: var(--app-tint);
    transform: none;
  }

  .em-app .em-shell-nav__link:hover .em-shell-nav__icon {
    background: rgba(0, 0, 0, .04);
  }

  .em-app .em-shell-nav__link.is-active .em-shell-nav__label {
    font-weight: 700;
  }

  .em-app .em-shell-nav__icon i {
    font-size: 20px;
  }

  .em-app .site {
    margin-left: var(--app-side);
  }

  /* No bottom bar on tablets, so the helper bot returns to the corner. */
  .em-app .emhb-root {
    bottom: calc(20px + var(--safe-bottom));
  }
}

@media (min-width: 1024px) and (min-height: 501px) {
  .em-app {
    --rail-w: 232px;
  }

  .em-app .em-shell-nav {
    padding-left: calc(var(--safe-left) + 12px);
    padding-right: 12px;
  }

  .em-app .em-shell-nav__brand {
    justify-content: flex-start;
    padding: 0 8px;
    margin-bottom: 18px;
    font-size: 1.125rem;
  }

  .em-app .em-shell-nav__brandname {
    display: inline;
  }

  .em-app .em-shell-nav__link {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 46px;
    margin: 0;
    width: 100%;
    padding: 0 14px;
    border-radius: 12px;
    font-size: .9375rem;
    font-weight: 500;
  }

  .em-app .em-shell-nav__link.is-active {
    background: var(--app-tint);
  }

  .em-app .em-shell-nav__link:hover {
    background: rgba(0, 0, 0, .035);
  }

  .em-app .em-shell-nav__link.is-active:hover {
    background: var(--app-tint);
  }

  .em-app .em-shell-nav__icon,
  .em-app .em-shell-nav__link.is-active .em-shell-nav__icon,
  .em-app .em-shell-nav__link:hover .em-shell-nav__icon {
    width: auto;
    height: auto;
    background: none;
  }

  .em-app .em-shell-nav__label {
    overflow: visible;
  }
}

/* --------------------------------------------------------------------------
   Compact screen headers
   The marketing hero bands (255-410px tall on a phone, centred, decorated)
   become an app's large title: left aligned, flat, a fraction of the height.
   -------------------------------------------------------------------------- */
.em-app .about-hero,
.em-app .page-hero,
.em-app .learn-hero,
.em-app .shortcuts-hero,
.em-app .em-tyk-hero {
  min-height: 0 !important;
  margin: 0 !important;
  /* Some heroes break out of their container with left:50% plus a -50vw
     margin (the cart). The margin is zeroed above, so the offset must go
     too or the hero slides half off screen. */
  left: auto !important;
  right: auto !important;
  width: auto !important;
  padding: 18px var(--gutter) 18px !important;
  text-align: left !important;
  background: var(--app-bg) !important;
  border: 0 !important;
  box-shadow: none !important;
}

.em-app .about-hero::before,
.em-app .about-hero::after,
.em-app .shortcuts-hero::before,
.em-app .shortcuts-hero::after,
.em-app .em-tyk-hero::before,
.em-app .em-tyk-hero::after,
.em-app .about-hero-dots {
  display: none !important;
}

.em-app .about-hero-inner,
.em-app .shortcuts-hero-inner {
  max-width: 1100px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  text-align: left !important;
  align-items: flex-start !important;
}

.em-app .about-hero-badge {
  display: none !important;
}

.em-app .about-hero-title,
.em-app .shortcuts-hero h1,
.em-app .em-tyk-hero h1 {
  margin: 0 0 4px !important;
  font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.125rem) !important;
  line-height: 1.15 !important;
  letter-spacing: -.02em !important;
  text-align: left !important;
}

.em-app .about-hero-sub,
.em-app .shortcuts-hero p,
.em-app .em-tyk-hero p {
  margin: 0 !important;
  max-width: 60ch;
  font-size: .9375rem !important;
  line-height: 1.45 !important;
  color: var(--app-muted) !important;
  text-align: left !important;
}

/* Accent underlines and highlight swashes are display-type decoration. */
.em-app .about-hero-title *,
.em-app .about-hero-accent {
  background-image: none !important;
  text-decoration: none !important;
}

.em-app .about-hero-title::after,
.em-app .about-hero-accent::after {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Floating widgets
   -------------------------------------------------------------------------- */
/* The helper-bot launcher at 64px covered list content on every screen. A
   48px FAB is the app norm; it also steps aside while scrolling down. */
.em-app .emhb-launcher {
  width: 52px;
  height: 52px;
}

.em-app .emhb-root {
  right: 14px;
  transition: transform var(--dur-base) var(--ease-standard), opacity var(--dur-base);
}

@media (max-width: 767px) {
  .em-app .emhb-root {
    bottom: calc(12px + var(--tabbar-total));
  }

  .em-app.em-appbar-hidden .emhb-root:not(.is-open) {
    transform: translateY(12px) scale(.9);
    opacity: 0;
    pointer-events: none;
  }

  .em-app.em-appbar-hidden .emhb-root:not(.is-open) > * {
    pointer-events: none;
  }

  /* The "Read in the app" banner is fixed to bottom:0 inline, which put it
     over the tab bar. It sits on top of the bar instead. */
  .em-app #em-app-banner {
    bottom: var(--tabbar-total) !important;
    padding-bottom: 10px !important;
    border-radius: 16px 16px 0 0;
  }
}

/* --------------------------------------------------------------------------
   Screen transitions (cross-document view transitions, see inc/app-mode.php)
   The bars stay still while the content cross-fades with a short slide.
   -------------------------------------------------------------------------- */
.em-app .em-topbar {
  view-transition-name: em-topbar;
}

.em-app .em-shell-nav {
  view-transition-name: em-tabbar;
}

::view-transition-old(root) {
  animation: em-vt-out 160ms var(--ease-accelerate) both;
}

::view-transition-new(root) {
  animation: em-vt-in 240ms var(--ease-decelerate) both;
}

@keyframes em-vt-out {
  to { opacity: 0; transform: translateX(-12px); }
}

@keyframes em-vt-in {
  from { opacity: 0; transform: translateX(16px); }
}

/* Going back slides the other way. app-mode.js marks back navigations. */
html.em-vt-back::view-transition-old(root) {
  animation-name: em-vt-out-back;
}

html.em-vt-back::view-transition-new(root) {
  animation-name: em-vt-in-back;
}

@keyframes em-vt-out-back {
  to { opacity: 0; transform: translateX(12px); }
}

@keyframes em-vt-in-back {
  from { opacity: 0; transform: translateX(-16px); }
}

@media (prefers-reduced-motion: reduce) {
  .em-topbar,
  .em-sheet__panel,
  .em-sheet__scrim {
    transition: none;
  }
}

@media print {
  .em-topbar,
  .em-sheet {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Course buy bar (built by app-mode.js on single course pages)
   -------------------------------------------------------------------------- */
.em-cta-bar {
  position: fixed;
  left: var(--app-side);
  right: 0;
  bottom: 0;
  z-index: calc(var(--z-tabbar) - 1);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--gutter) calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--app-line);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
  transform: translateY(110%);
  transition: transform var(--dur-base) var(--ease-standard);
}

.em-cta-bar.is-shown {
  transform: none;
}

.em-cta-bar__info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.em-cta-bar__info strong {
  color: var(--app-ink);
  font-size: 1.125rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.em-cta-bar__info s {
  color: var(--app-muted);
  font-size: .8125rem;
}

.em-cta-bar__btn {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  background: var(--app-accent);
  color: #fff;
  font-weight: 700;
  font-size: .9375rem;
  box-shadow: 0 6px 16px rgba(56, 142, 60, .3);
}

.em-cta-bar__btn:active {
  transform: scale(.97);
}

/* Phones: the bar sits on top of the tab bar, not behind it. */
@media (max-width: 767px), (orientation: landscape) and (max-height: 500px) {
  .em-cta-bar {
    bottom: var(--tabbar-total);
    padding-bottom: 10px;
  }

  .em-has-cta .emhb-root {
    bottom: calc(80px + var(--tabbar-total));
  }
}

/* The landscape sidebar already shows the logo and name. */
@media (min-width: 1024px) and (min-height: 501px) {
  .em-topbar__brand {
    visibility: hidden;
  }
}

/* Tablets: the sheet must clear the rail (which sits above the header), and
   on a wide screen it reads better as a side panel than a full-width sheet. */
.em-sheet {
  z-index: calc(var(--z-sheet) + 10);
}

@media (min-width: 768px) and (min-height: 501px) {
  .em-sheet__panel {
    left: auto;
    top: 0;
    width: min(420px, 100%);
    max-height: none;
    padding-top: calc(16px + var(--safe-top));
    border-radius: 24px 0 0 24px;
    transform: translateX(100%);
  }

  .em-sheet__grab {
    display: none;
  }
}
