/**
 * Site-wide mobile polish — load after udemy-premium.css
 */

@media (max-width: 1023px) {
  .ud-nav-search {
    display: none !important;
  }

  /* Mobile / tablet header layout (desktop unchanged at 1024px+) */
  nav .ud-nav-bar {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 1rem !important;
  }

  nav .brand-logo {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 7.5rem);
  }

  nav .ud-nav-bar__cluster {
    display: flex;
    flex: 0 0 auto;
    margin-left: auto !important;
    gap: 0.5rem !important;
    padding-left: 0 !important;
    grid-column: auto !important;
    justify-self: auto !important;
  }

  nav .ud-nav-bar__actions {
    gap: 0.75rem !important;
    align-items: center;
  }
}

/* Desktop header — loaded last so Chrome/Edge match */
@media (min-width: 1024px) {
  nav .ud-nav-bar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) max-content !important;
    justify-content: start !important;
    column-gap: 0.875rem;
  }

  nav .ud-nav-search {
    grid-column: 2;
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
  }

  nav .ud-nav-bar__cluster {
    grid-column: 3;
    justify-self: end;
    width: max-content;
  }

  nav .ud-nav-links {
    justify-content: flex-start !important;
    gap: 0.625rem;
  }
}

@media (min-width: 1280px) {
  nav .ud-nav-bar {
    column-gap: 1rem;
  }

  nav .ud-nav-links {
    gap: 0.75rem;
  }

  nav .ud-nav-bar__cluster {
    gap: 0.875rem;
  }
}

@media (max-width: 767px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  html,
  body.site-shell {
    overflow-x: clip;
    max-width: 100%;
  }

  body.site-shell {
    font-size: 14px;
    line-height: 1.5;
  }

  #main-content {
    padding-bottom: 4.5rem;
  }

  /* —— Compact typography —— */
  h1 {
    font-size: clamp(1.45rem, 6vw, 1.85rem) !important;
    line-height: 1.18 !important;
  }

  h2 {
    font-size: clamp(1.2rem, 4.8vw, 1.45rem) !important;
  }

  h3 {
    font-size: clamp(1rem, 4vw, 1.2rem) !important;
  }

  /* —— Hero: text-first, no giant image block —— */
  .ud-hero,
  .ud-hero--premium {
    padding: 1.15rem 0.875rem 1.35rem !important;
  }

  .ud-hero--premium .ud-hero__title {
    max-width: none !important;
    font-size: clamp(1.45rem, 6.2vw, 1.9rem) !important;
    line-height: 1.15 !important;
  }

  .ud-hero--premium .ud-hero__lead,
  .ud-hero__lead {
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
    margin-top: 0.625rem;
    margin-bottom: 0.125rem;
  }

  .ud-hero--premium .ud-hero__eyebrow,
  .ud-hero__eyebrow {
    font-size: 0.6875rem !important;
    letter-spacing: 0.12em;
  }

  .ud-hero__media {
    display: none;
  }

  .ud-hero-actions {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.625rem;
    width: 100%;
    margin-top: 1rem;
  }

  .ud-hero-actions .ud-btn-primary,
  .ud-hero-actions .ud-btn-outline-light,
  .ud-hero-actions .ud-btn-secondary {
    width: 100%;
    flex: 0 0 auto;
    min-width: 0;
    justify-content: center;
    min-height: 44px;
    padding: 0.625rem 1rem !important;
    font-size: 0.875rem !important;
  }

  .ud-hero-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.35rem !important;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgb(255 255 255 / 0.12);
  }

  .ud-hero-stats__item strong {
    font-size: 0.9375rem !important;
    line-height: 1.2;
  }

  .ud-hero-stats__item span {
    font-size: 0.625rem !important;
    line-height: 1.25;
  }

  /* —— Sections —— */
  .ud-section {
    padding: 1.35rem 0.875rem !important;
  }

  .ud-section__head {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
  }

  .ud-section__link {
    white-space: normal;
    font-size: 0.8125rem !important;
  }

  .ud-section__title {
    font-size: 1.125rem !important;
    line-height: 1.25;
  }

  .ud-section__sub {
    font-size: 0.8125rem !important;
    margin-top: 0.15rem;
  }

  .ud-card-grid,
  .ud-card-grid--compact {
    grid-template-columns: 1fr !important;
    gap: 0.55rem;
  }

  /* —— Learning cards: compact horizontal rows —— */
  .ud-learning-card {
    flex-direction: row;
    align-items: stretch;
    border-radius: 0.75rem;
  }

  .ud-learning-card__thumb {
    width: 5.25rem;
    min-width: 5.25rem;
    max-width: 5.25rem;
    aspect-ratio: unset;
    align-self: stretch;
    min-height: 4.75rem;
  }

  .ud-learning-card__thumb-icon {
    font-size: 1.125rem !important;
    opacity: 0.85;
  }

  .ud-learning-card__badge {
    top: 0.25rem;
    left: 0.25rem;
    font-size: 0.5625rem;
    padding: 0.1rem 0.3rem;
    letter-spacing: 0.02em;
  }

  .ud-learning-card__body {
    padding: 0.55rem 0.65rem 0.55rem 0;
    gap: 0.15rem;
    min-width: 0;
    justify-content: center;
  }

  .ud-learning-card__title {
    font-size: 0.8125rem;
    line-height: 1.35;
    -webkit-line-clamp: 2;
  }

  .ud-learning-card__instructor {
    font-size: 0.6875rem;
  }

  .ud-learning-card__meta,
  .ud-learning-card__tags {
    margin-top: 0.1rem;
  }

  .ud-learning-card__meta {
    font-size: 0.6875rem;
    padding-top: 0.1rem;
  }

  .ud-tag {
    font-size: 0.625rem;
    padding: 0.1rem 0.35rem;
  }

  .ud-learning-card__price-row {
    font-size: 0.8125rem;
    margin-top: 0.1rem;
  }

  .ud-learning-card__join {
    font-size: 0.75rem;
    margin-top: 0.15rem;
  }

  .glass-card,
  .ud-tool-card,
  .ud-instructor-card {
    border-radius: 0.75rem;
  }

  /* —— Value props: inline icon + text —— */
  .ud-value-props {
    padding: 1.125rem 0.875rem !important;
  }

  .ud-value-props__grid {
    gap: 0.75rem;
  }

  .ud-value-prop {
    display: grid;
    grid-template-columns: 1.75rem 1fr;
    grid-template-rows: auto auto auto;
    gap: 0.15rem 0.65rem;
    padding: 0.875rem 0.95rem;
    border-radius: 0.75rem;
  }

  .ud-value-prop__icon {
    grid-row: 1 / span 3;
    font-size: 1rem;
    line-height: 1.2;
    margin-top: 0.05rem;
  }

  .ud-value-prop__title {
    margin-top: 0;
    font-size: 0.875rem;
    line-height: 1.25;
  }

  .ud-value-prop__text {
    font-size: 0.75rem;
    line-height: 1.45;
  }

  .ud-value-prop__link {
    margin-top: 0.15rem;
    font-size: 0.6875rem;
  }

  /* —— Instructor rows —— */
  .ud-instructor-card {
    display: grid;
    grid-template-columns: 2.75rem 1fr;
    grid-template-rows: auto auto auto;
    gap: 0.05rem 0.65rem;
    text-align: left;
    padding: 0.75rem 0.85rem;
    align-items: start;
  }

  .ud-instructor-card__avatar {
    grid-row: 1 / span 3;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    font-size: 0.9375rem;
  }

  .ud-instructor-card__name {
    margin-top: 0;
    font-size: 0.875rem;
    line-height: 1.25;
  }

  .ud-instructor-card__role {
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .ud-instructor-card .ud-rating {
    grid-column: 2;
    justify-content: flex-start !important;
    margin-top: 0.15rem !important;
    font-size: 0.6875rem;
  }

  /* —— Tool grid —— */
  .ud-tools-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .ud-tool-card {
    padding: 0.75rem;
    gap: 0.2rem;
    border-radius: 0.75rem;
  }

  .ud-tool-card__icon {
    font-size: 1.125rem;
  }

  .ud-tool-card__title {
    font-size: 0.8125rem;
  }

  .ud-tool-card__desc {
    font-size: 0.6875rem;
    line-height: 1.35;
  }

  /* —— Quick nav & filters —— */
  .ud-quick-nav {
    padding: 0.5rem 0.875rem;
  }

  .ud-quick-nav__inner {
    padding-right: 0.35rem;
    gap: 0.35rem;
  }

  .ud-quick-nav__pill {
    padding: 0.3rem 0.65rem !important;
    font-size: 0.6875rem !important;
    gap: 0.25rem !important;
  }

  .ud-quick-nav__pill span[aria-hidden="true"] {
    font-size: 0.8125rem;
  }

  .ud-mock-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    overflow: visible;
    margin-bottom: 0.75rem;
  }

  .ud-mock-filters__label {
    flex: none;
    position: static;
    margin: 0;
    padding: 0;
    background: transparent;
    font-size: 0.6875rem;
  }

  .ud-mock-filters__track {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    margin-left: -0.875rem;
    margin-right: -0.875rem;
    padding: 0 0.875rem 0.2rem;
  }

  .ud-mock-filters__track::-webkit-scrollbar {
    display: none;
  }

  .ud-mock-filters__chip {
    flex-shrink: 0;
    scroll-snap-align: start;
    min-height: 30px;
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
  }

  .ud-filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -0.875rem;
    margin-right: -0.875rem;
    padding: 0.5rem 0.875rem 0.35rem;
    gap: 0.35rem;
  }

  .ud-filter-bar::-webkit-scrollbar {
    display: none;
  }

  .ud-filter-chip {
    flex-shrink: 0;
    min-height: 30px;
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
  }

  .ud-section__cta-row {
    margin-top: 1rem;
  }

  .ud-section__cta-row .ud-btn-primary,
  .ud-section__cta-row .ud-btn-outline {
    display: flex;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
  }

  .ud-section__ai-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .ud-section__ai-form {
    padding: 1rem;
    border-radius: 0.85rem;
  }

  .ud-carousel {
    margin-left: -0.875rem;
    margin-right: -0.875rem;
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  .ph-hero,
  .ph-hero__inner {
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
  }

  .ph-hero {
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
  }

  .site-shell img,
  .site-shell video,
  .site-shell iframe {
    max-width: 100%;
  }

  .site-shell table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .prose {
    overflow-wrap: anywhere;
  }

  /* —— Featured strips —— */
  .ud-strip {
    max-width: 100vw;
    overflow: hidden;
    padding: 0.75rem 0 0.65rem;
  }

  .ud-strip__head {
    padding: 0 0.875rem;
    margin-bottom: 0.45rem;
  }

  .ud-strip__label {
    font-size: 0.625rem;
  }

  .ud-strip__link {
    font-size: 0.75rem;
  }

  .ud-strip__scroll {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
    gap: 0.65rem;
  }

  .ud-strip__school-badge {
    width: 2.5rem;
    height: 2.5rem;
  }

  .ud-strip__item--partner {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
  }

  /* —— Navbar —— */
  .ud-nav-bar {
    flex-wrap: nowrap;
    gap: 0.625rem !important;
    padding: 0.625rem 1rem !important;
  }

  .brand-logo {
    gap: 0.625rem !important;
    min-width: 0;
  }

  .brand-logo__mark {
    font-size: 1rem;
    flex-shrink: 0;
  }

  .ud-nav-bar .font-extrabold {
    font-size: 0.875rem !important;
    line-height: 1.2;
  }

  .ud-nav-bar__cluster {
    margin-left: auto !important;
    gap: 0.5rem !important;
  }

  .ud-nav-bar__actions {
    gap: 0.75rem !important;
  }

  .ud-nav-menu-toggle {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    padding: 0.35rem !important;
    flex-shrink: 0;
  }

  .ud-nav-menu-toggle svg {
    width: 1.35rem;
    height: 1.35rem;
  }

  #userMenu > button {
    padding: 0.3rem 0.45rem !important;
    gap: 0.25rem !important;
    min-height: 38px;
    flex-shrink: 0;
  }

  #userMenu > button .h-9.w-9 {
    height: 1.875rem;
    width: 1.875rem;
  }

  #userMenu > button > svg.w-4.h-4 {
    display: none;
  }

  .btn-gradient {
    padding: 0.45rem 0.7rem !important;
    font-size: 0.75rem !important;
    white-space: nowrap;
  }

  /* —— Mobile menu (link sizing) —— */
  .ud-mobile-menu__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 0.65rem;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none !important;
  }

  .ud-mobile-menu__cta--outline {
    border: 1px solid #cbd5e1;
    color: #0f172a !important;
    background: #fff;
  }

  .ud-mobile-menu__cta--primary {
    background: #0d9488 !important;
    color: #fff !important;
  }

  .ud-mobile-menu__links a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0.45rem 0.75rem !important;
    font-size: 0.8125rem !important;
    border-radius: 0.65rem !important;
  }

  .ud-mobile-search {
    margin-bottom: 0.55rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #e2e8f0;
  }

  .ud-mobile-search .ud-nav-search {
    display: flex !important;
    max-width: none;
    width: 100%;
  }

  .ud-mobile-search .ud-nav-search__input {
    font-size: 0.8125rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  /* —— Mentor cards —— */
  .mentor-card {
    padding: 0.75rem !important;
    border-radius: 0.75rem !important;
  }

  .mentor-card .h-16.w-16,
  .mentor-card .flex.h-16 {
    height: 2.75rem !important;
    width: 2.75rem !important;
    font-size: 0.875rem !important;
    border-radius: 0.65rem !important;
  }

  .mentor-card h2 {
    font-size: 0.9375rem !important;
  }

  .mentor-card .text-sm {
    font-size: 0.75rem !important;
  }

  .mentor-card__btn {
    min-height: 38px;
    justify-content: center;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    font-size: 0.8125rem !important;
  }

  /* —— Platform hub —— */
  .ph-hero {
    padding: 1.35rem 0.875rem 1.65rem !important;
  }

  .ph-hero__title {
    font-size: clamp(1.35rem, 5.5vw, 1.65rem) !important;
  }

  .ph-hero__lead {
    font-size: 0.8125rem !important;
    margin-top: 0.5rem;
  }

  .ph-hero__eyebrow {
    font-size: 0.625rem !important;
  }

  .ph-stat-pill {
    font-size: 0.6875rem !important;
    padding: 0.25rem 0.55rem !important;
  }

  .ph-body {
    padding: 1.15rem 0.875rem 2rem !important;
  }

  .ph-split > * {
    align-self: start;
    min-height: 0;
  }

  .ph-split .ph-card {
    height: auto !important;
  }

  .ph-body.ph-split {
    padding-bottom: 2.5rem !important;
  }

  .ph-body .text-2xl {
    font-size: 1.125rem !important;
  }

  .ph-body > .flex.flex-wrap.gap-2,
  .ph-body .mt-6.flex.flex-wrap.gap-2 {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.2rem;
    gap: 0.35rem !important;
  }

  .ph-body > .flex.flex-wrap.gap-2::-webkit-scrollbar,
  .ph-body .mt-6.flex.flex-wrap.gap-2::-webkit-scrollbar {
    display: none;
  }

  .ph-body > .flex.flex-wrap.gap-2 > a,
  .ph-body .mt-6.flex.flex-wrap.gap-2 > a {
    flex-shrink: 0;
    font-size: 0.75rem !important;
    padding: 0.35rem 0.75rem !important;
  }

  .ph-section__title {
    font-size: 1rem !important;
  }

  /* —— Footer (shared mobile/tablet tweaks) —— */
  .site-footer__wrap {
    padding: 1rem 0.875rem 0.75rem !important;
  }

  .site-footer__grid {
    gap: 0.65rem;
  }

  .site-footer__bar-inner {
    padding: 0.55rem 0.875rem 0.65rem !important;
    align-items: flex-start;
    text-align: left;
    gap: 0.35rem;
  }

  @media (min-width: 640px) {
    .site-footer__bar-inner {
      align-items: center;
      text-align: center;
    }

    .site-footer__legal {
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
    }
  }

  .site-footer__copy {
    font-size: 0.625rem;
    line-height: 1.35;
    margin: 0;
  }

  .site-footer__legal {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem 0.65rem;
  }

  .site-footer__legal a {
    font-size: 0.6875rem;
    font-weight: 600;
  }

  /* —— Auth —— */
  .auth-shell {
    min-height: 100dvh;
  }

  .auth-shell__main {
    padding: 1rem 0.875rem 1.75rem !important;
  }

  .auth-shell__card {
    padding: 1.25rem 1rem !important;
  }

  .auth-head__title {
    font-size: 1.35rem !important;
  }

  .auth-pill,
  .auth-submit {
    min-height: 44px;
    font-size: 0.875rem !important;
  }

  /* —— CAT portal —— */
  .cat-hero {
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
  }

  .cat-hero h1 {
    font-size: clamp(1.35rem, 6vw, 1.75rem) !important;
  }

  .cat-hero .flex.flex-wrap.gap-3 {
    flex-direction: column;
    align-items: stretch;
  }

  .cat-hero .flex.flex-wrap.gap-3 a {
    width: 100%;
    justify-content: center;
    text-align: center;
    min-height: 40px;
    font-size: 0.8125rem;
  }

  /* —— Tables —— */
  .prose,
  .ud-table-wrap,
  table {
    overflow-x: auto;
    display: block;
    max-width: 100%;
  }

  /* —— AI assistant —— */
  #aiAssistantRoot {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0.75rem;
  }

  #aiAssistantToggle {
    width: 3rem;
    height: 3rem;
    margin-right: 0.65rem;
    margin-bottom: 0.15rem;
  }

  .ai-assistant-panel {
    max-width: none !important;
    height: auto !important;
  }

  .ai-assistant-panel > .relative {
    height: 100%;
  }

  #aiAssistantStatus {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ai-assistant-chip {
    padding: 0.55rem 0.85rem !important;
    font-size: 0.75rem !important;
    text-align: left;
  }

  .ai-assistant-input-row {
    flex-wrap: nowrap;
  }

  .ai-assistant-input-row input {
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
    background: #fff !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
  }

  .ai-assistant-input-row input::placeholder {
    color: #64748b !important;
    opacity: 1 !important;
  }

  .ai-assistant-input-row #aiAssistantSend {
    order: 1;
    min-width: 4.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .ai-assistant-extra-btn {
    display: none !important;
  }

  .ai-assistant-bubble {
    max-width: 92% !important;
    padding: 0.85rem 1rem !important;
  }

  .ai-assistant-bubble p,
  .ai-assistant-bubble li {
    font-size: 0.875rem;
    line-height: 1.55;
  }

  .ud-quick-nav__inner,
  .ud-strip__scroll {
    padding-bottom: 0.15rem;
  }

  /* Carousel cards on home */
  .ud-carousel .ud-learning-card {
    flex-direction: column;
    min-width: 11.5rem;
    max-width: 11.5rem;
  }

  .ud-carousel .ud-learning-card__thumb {
    width: 100%;
    min-width: 0;
    max-width: none;
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .ud-carousel .ud-learning-card__body {
    padding: 0.55rem 0.65rem 0.65rem;
  }
}

@media (max-width: 767px) {
  .site-footer__brand {
    display: none;
  }

  .site-footer__wrap {
    padding: 0.85rem 1rem 0.65rem !important;
  }

  .site-footer__grid {
    gap: 0;
  }

  .site-footer__nav-row--desktop {
    display: none !important;
  }

  .site-footer__nav-row--mobile {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    width: 100%;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .site-footer__accordion {
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  }

  .site-footer__accordion:last-child {
    border-bottom: none;
  }

  .site-footer__accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0;
    padding: 0.72rem 0.875rem;
    cursor: pointer;
    list-style: none;
    pointer-events: auto;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease;
  }

  .site-footer__accordion summary::-webkit-details-marker {
    display: none;
  }

  .site-footer__accordion summary::after {
    content: "";
    flex-shrink: 0;
    width: 0.45rem;
    height: 0.45rem;
    margin-top: -0.1rem;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: rotate(45deg);
    transition: transform 0.2s ease, margin-top 0.2s ease;
  }

  .site-footer__accordion[open] summary {
    background: rgba(248, 250, 252, 0.95);
    padding-bottom: 0.55rem;
  }

  .site-footer__accordion[open] summary::after {
    margin-top: 0.15rem;
    transform: rotate(-135deg);
  }

  .site-footer__accordion:not([open]) .site-footer__links {
    display: none !important;
  }

  .site-footer__accordion[open] .site-footer__links {
    display: flex !important;
  }

  .site-footer__heading {
    margin: 0;
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    color: #0f172a;
  }

  .site-footer__links {
    gap: 0.2rem;
    padding: 0 0.875rem 0.65rem;
  }

  .site-footer__links a {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
    line-height: 1.4;
    padding: 0.22rem 0;
  }

  .site-footer__links a:hover,
  .site-footer__links a:focus-visible {
    color: #0f766e !important;
    -webkit-text-fill-color: #0f766e !important;
  }

  .site-footer__link-cta {
    color: #0d9488 !important;
    -webkit-text-fill-color: #0d9488 !important;
    font-weight: 600 !important;
  }

  .site-footer__bar {
    padding-bottom: 4.5rem;
  }

  .site-footer__bar-inner {
    padding: 0.65rem 1rem 0.85rem !important;
    align-items: flex-start;
    text-align: left;
    gap: 0.45rem;
  }

  .site-footer__copy {
    font-size: 0.625rem;
    line-height: 1.4;
    color: #94a3b8;
  }

  .site-footer__legal {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.85rem;
  }

  .site-footer__legal a {
    font-size: 0.75rem;
    font-weight: 600;
    color: #0d9488 !important;
    -webkit-text-fill-color: #0d9488 !important;
  }
}

@media (max-width: 380px) {
  .brand-logo__mark {
    font-size: 0.9375rem;
  }

  .ud-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ud-hero-actions .ud-btn-primary,
  .ud-hero-actions .ud-btn-outline-light,
  .ud-hero-actions .ud-btn-secondary {
    flex: 1 1 100%;
  }

  .btn-gradient {
    padding: 0.4rem 0.55rem !important;
    font-size: 0.6875rem !important;
  }
}

@media (max-width: 1023px) {
  .ud-mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    border: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  #mobileMenu,
  .ud-mobile-menu {
    position: fixed;
    left: 0.65rem;
    right: 0.65rem;
    top: calc(var(--ud-mobile-nav-height, 3.75rem) + 0.35rem);
    z-index: 45;
    max-height: calc(100dvh - var(--ud-mobile-nav-height, 3.75rem) - 1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0.75rem;
    border-radius: 1rem !important;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  }
}

html.mobile-menu-open,
html.mobile-menu-open body {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

/* AI mentor stays inside the viewport on every screen size. */
#aiAssistantRoot {
  position: fixed !important;
  left: auto !important;
  right: 1rem !important;
  bottom: 1rem !important;
  top: auto !important;
  width: min(26.25rem, calc(100vw - 2rem)) !important;
  max-width: calc(100vw - 2rem) !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  justify-content: flex-end !important;
  z-index: 70;
}

#aiAssistantRoot > div {
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
  max-height: calc(100dvh - 2rem);
}

#aiAssistantToggle {
  align-self: flex-end;
  margin: 0 !important;
}

#aiAssistantPanel.ai-assistant-panel {
  width: 100% !important;
  max-width: 100% !important;
  height: min(40rem, calc(100dvh - 6.5rem)) !important;
  max-height: calc(100dvh - 6.5rem) !important;
  overflow: hidden;
}

#aiAssistantQuickActions {
  max-height: 7.5rem !important;
  overflow-y: auto;
}

.ai-assistant-chip {
  white-space: normal;
  overflow-wrap: anywhere;
}

.ai-assistant-bubble {
  overflow-wrap: anywhere;
}

.ai-assistant-copy {
  margin-top: 0.65rem;
  border: 0;
  background: transparent;
  padding: 0;
  color: #0f766e;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

#aiAssistantAttachment,
.ai-assistant-input-row input[type="file"],
.ai-assistant-input-row button[aria-label="Add attachment"] {
  display: none !important;
}

#aiAssistantVoice.is-listening {
  border-color: #0f766e;
  color: #0f766e;
}

.mistake-notebook__title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #0f172a;
}

.mistake-notebook__lead {
  margin-top: 0.4rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #475569;
}

.mistake-notebook__question {
  margin-top: 0.45rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.5;
  color: #0f172a;
}
