/* Prompt Master mobile refinement v4. Loaded last on selected public/student pages. */
:root {
  --pm-refine-blue: #4778c8;
  --pm-refine-blue-dark: #315f9f;
  --pm-refine-ink: #071d33;
  --pm-refine-muted: #52657f;
  --pm-refine-line: #d8e5f8;
}

html,
body {
  max-width: 100%;
  overflow-x: clip !important;
}

body.pm-platform-responsive,
body.lms-dashboard,
body.lms-lesson-page {
  background: #fff !important;
  background-image: none !important;
}

/* Dashboard: keep help and logout inside the personal profile popover. */
body.lms-dashboard > .pm-student-help,
body.lms-dashboard .dash-wrap > .pm-student-help {
  display: none !important;
}

body.lms-dashboard .dash-menu__links {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 8px !important;
}

body.lms-dashboard .dash-menu__links > a:not(.pm-profile-help-v4):not(.is-danger) {
  grid-column: 1 / -1 !important;
}

body.lms-dashboard .dash-menu__links .pm-profile-help-v4 {
  grid-column: 1 !important;
  color: #315f9f !important;
  border-color: #bad0ee !important;
  background: #f3f7fd !important;
}

body.lms-dashboard .dash-menu__links .pm-profile-help-v4 svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

body.lms-dashboard .dash-menu__links .is-danger {
  grid-column: 2 !important;
}

/* Mobile contact entries are injected into the existing header menu. */
.pm-mobile-contact-item-v4,
.pm-contact-menu-toggle-v4,
.pm-contact-mobile-panel-v4 {
  display: none;
}

@media (max-width: 720px) {
  html {
    scroll-padding-top: 78px !important;
  }

  /* Standard compact header on login, registration, course and detail pages. */
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header {
    height: 64px !important;
    min-height: 64px !important;
    padding: 7px 10px !important;
    grid-template-columns: minmax(0, 1fr) 40px !important;
    gap: 8px !important;
  }

  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .brand,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-brand,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-site-brand,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-standard-brand {
    gap: 8px !important;
  }

  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .brand img,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-brand img,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-site-brand img,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-standard-brand img {
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px !important;
  }

  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .brand strong,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-brand strong,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-site-brand strong,
  body.pm-platform-responsive:not(.pm-path-home) .pm-platform-header .pm-standard-brand strong {
    font-size: 18px !important;
    line-height: 1 !important;
  }

  body.pm-platform-responsive:not(.pm-path-home) .pm-mobile-menu-toggle {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
  }

  /* Home gets its own hamburger because the older mobile script hides it there. */
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 {
    height: 114px !important;
    min-height: 114px !important;
    padding: 8px 10px 9px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 40px !important;
    grid-template-areas: "brand contact-toggle" "clock clock" !important;
    grid-template-rows: 42px 45px !important;
    align-content: center !important;
    align-items: center !important;
    gap: 6px 8px !important;
  }

  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .brand,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-brand,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-site-brand,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-standard-brand {
    grid-area: brand !important;
    gap: 8px !important;
  }

  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .brand img,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-brand img,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-site-brand img,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-standard-brand img {
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px !important;
  }

  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .brand strong,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-brand strong,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-site-brand strong,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .pm-standard-brand strong,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .logo {
    font-size: 18px !important;
    line-height: 1 !important;
  }

  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .tagline,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .brand small,
  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .brand > div > span {
    margin-top: 3px !important;
    display: block !important;
    font-size: 11px !important;
    line-height: 1 !important;
  }

  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .clock {
    grid-area: clock !important;
    max-width: 440px !important;
  }

  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .clock-labels {
    margin-bottom: 3px !important;
    font-size: 9px !important;
  }

  body.pm-path-home .pm-platform-header.pm-contact-menu-host-v4 .clock-time {
    font-size: clamp(16px, 5vw, 20px) !important;
  }

  .pm-contact-menu-toggle-v4 {
    grid-area: contact-toggle;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--pm-refine-line);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    background: #fff;
    color: var(--pm-refine-ink);
    cursor: pointer;
  }

  .pm-contact-menu-toggle-v4 span {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    display: block;
    background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
  }

  .pm-contact-menu-host-v4.is-contact-menu-open .pm-contact-menu-toggle-v4 span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .pm-contact-menu-host-v4.is-contact-menu-open .pm-contact-menu-toggle-v4 span:nth-child(2) {
    opacity: 0;
  }

  .pm-contact-menu-host-v4.is-contact-menu-open .pm-contact-menu-toggle-v4 span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .pm-contact-mobile-panel-v4 {
    position: absolute;
    top: calc(100% + 6px);
    right: 10px;
    z-index: 10020;
    width: min(292px, calc(100vw - 20px));
    max-height: calc(100vh - 132px);
    padding: 8px;
    border: 1px solid var(--pm-refine-line);
    border-radius: 14px;
    overflow-y: auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    background: #fff;
    box-shadow: 0 18px 46px rgba(7, 29, 51, .18);
  }

  .pm-contact-menu-host-v4.is-contact-menu-open .pm-contact-mobile-panel-v4 {
    display: grid;
  }

  .pm-contact-mobile-panel-v4 a,
  .pm-platform-header .nav .pm-mobile-contact-item-v4,
  .pm-platform-header .pm-nav .pm-mobile-contact-item-v4,
  .pm-platform-header .pm-site-actions .pm-mobile-contact-item-v4,
  .pm-platform-header .pm-standard-nav .pm-mobile-contact-item-v4 {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    height: auto !important;
    padding: 9px 11px !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    color: #233c59 !important;
    background: #f7faff !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    white-space: normal !important;
  }

  .pm-contact-mobile-panel-v4 a.is-primary-v4 {
    color: #fff !important;
    border-color: var(--pm-refine-blue) !important;
    background: var(--pm-refine-blue) !important;
  }

  .pm-contact-mobile-panel-v4 svg,
  .pm-platform-header .pm-mobile-contact-item-v4 svg {
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
    padding: 4px !important;
    border-radius: 50% !important;
    flex: 0 0 24px !important;
    color: var(--pm-refine-blue) !important;
    background: #eaf2ff !important;
  }

  body.pm-contact-menu-ready-v4 footer.pm-contact-footer-v3 {
    display: none !important;
  }

  /* Compact auth pages while keeping 16px inputs to prevent iPhone zoom. */
  body.pm-platform-auth .auth-wrap {
    width: calc(100% - 20px) !important;
    min-height: 0 !important;
    margin-inline: auto !important;
    padding: 18px 0 30px !important;
    gap: 15px !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.pm-platform-auth .copy h1 {
    margin: 0 0 10px !important;
    font-size: clamp(30px, 8vw, 36px) !important;
    line-height: 1.06 !important;
  }

  body.pm-platform-auth .copy p {
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1.45 !important;
  }

  body.pm-platform-auth .card,
  body.pm-platform-auth .auth-card {
    width: 100% !important;
    padding: 17px 15px !important;
    border-radius: 15px !important;
  }

  body.pm-platform-auth .card-head {
    gap: 10px !important;
    margin-bottom: 15px !important;
  }

  body.pm-platform-auth .card-head img {
    width: 44px !important;
    height: 44px !important;
  }

  body.pm-platform-auth .card-head h2 {
    font-size: 25px !important;
    line-height: 1.08 !important;
  }

  body.pm-platform-auth .card-head p,
  body.pm-platform-auth .field label,
  body.pm-platform-auth label {
    font-size: 14px !important;
  }

  body.pm-platform-auth input:not([type="checkbox"]):not([type="radio"]),
  body.pm-platform-auth select,
  body.pm-platform-auth textarea {
    min-height: 50px !important;
    padding: 11px 13px !important;
    font-size: 16px !important;
  }

  body.pm-platform-auth .submit,
  body.pm-platform-auth button[type="submit"] {
    min-height: 50px !important;
    margin-top: 16px !important;
    padding: 11px 14px !important;
    border-radius: 11px !important;
    font-size: 17px !important;
  }

  body.pm-platform-auth .links {
    gap: 9px !important;
    margin-top: 14px !important;
    font-size: 14px !important;
  }

  /* Public landing/detail pages follow the same compact mobile scale. */
  body.pm-path-home .hero,
  body.pm-path-prompting-detail .hero {
    width: calc(100% - 20px) !important;
    min-height: 0 !important;
    margin-inline: auto !important;
    padding: 26px 0 34px !important;
    gap: 18px !important;
  }

  body.pm-path-home .hero-copy h1,
  body.pm-path-prompting-detail .hero h1 {
    font-size: clamp(32px, 9vw, 38px) !important;
    line-height: 1.06 !important;
  }

  body.pm-path-home .hero-copy p,
  body.pm-path-prompting-detail .hero .lead {
    font-size: 16px !important;
    line-height: 1.45 !important;
  }

  body.pm-path-home .courses {
    gap: 14px !important;
  }

  body.pm-path-home .courses .course-card {
    min-height: 315px !important;
    padding: 20px !important;
    border-radius: 24px !important;
  }

  body.pm-path-home .courses .course-card h2 {
    font-size: 32px !important;
  }

  body.pm-path-home .courses .course-card p {
    font-size: 15px !important;
  }

  body.pm-path-home .course-shapes {
    min-height: 650px !important;
    margin-top: 18px !important;
  }

  body.pm-path-home .course-shapes .course-card {
    width: min(80vw, 330px) !important;
    height: 315px !important;
    border-radius: 36px !important;
  }

  body.pm-path-home .course-shapes .card-two {
    top: 340px !important;
  }

  /* Compact student dashboard cards. */
  body.lms-dashboard {
    padding-top: 64px !important;
  }

  body.lms-dashboard .dash-head {
    height: 64px !important;
    min-height: 64px !important;
    padding: 7px 10px !important;
  }

  body.lms-dashboard .dash-brand {
    gap: 8px !important;
  }

  body.lms-dashboard .dash-brand img {
    width: 36px !important;
    height: 36px !important;
  }

  body.lms-dashboard .dash-brand strong {
    font-size: 18px !important;
  }

  body.lms-dashboard .dash-brand small {
    display: none !important;
  }

  body.lms-dashboard .dash-menu-button {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
  }

  body.lms-dashboard .dash-wrap {
    width: calc(100% - 20px) !important;
    max-width: none !important;
    margin-inline: auto !important;
    padding: 18px 0 34px !important;
  }

  body.lms-dashboard .pm-student-profile-v2 {
    margin-bottom: 14px !important;
    padding: 15px !important;
    border-radius: 15px !important;
    grid-template-columns: 48px minmax(0, 1fr) !important;
    gap: 11px !important;
  }

  body.lms-dashboard .pm-student-profile-v2__avatar {
    width: 48px !important;
    height: 48px !important;
    font-size: 21px !important;
  }

  body.lms-dashboard .pm-student-profile-v2 h1 {
    margin: 3px 0 !important;
    font-size: 22px !important;
  }

  body.lms-dashboard .pm-student-profile-v2 p {
    font-size: 13px !important;
  }

  body.lms-dashboard .pm-student-profile-v2__status {
    grid-column: 1 / -1 !important;
    padding: 7px 10px !important;
    font-size: 11px !important;
  }

  body.lms-dashboard .dash-top {
    gap: 12px !important;
  }

  body.lms-dashboard .dash-progress,
  body.lms-dashboard .dash-course,
  body.lms-dashboard .dash-results,
  body.lms-dashboard .dash-payment {
    padding: 16px !important;
    border-radius: 14px !important;
  }

  body.lms-dashboard .dash-progress__value strong {
    font-size: 34px !important;
  }

  body.lms-dashboard .dash-course h1,
  body.lms-dashboard .dash-results h2,
  body.lms-dashboard .dash-payment h1 {
    font-size: 25px !important;
  }

  body.lms-dashboard .dash-course p,
  body.lms-dashboard .dash-progress p,
  body.lms-dashboard .dash-results p {
    font-size: 14px !important;
    line-height: 1.5 !important;
  }

  body.lms-dashboard .lms-result-card,
  body.lms-dashboard .lms-final-result {
    padding: 14px !important;
  }

  /* Course and lesson pages use a consistent 10px mobile gutter. */
  body.pm-platform-responsive .course-pm,
  body.pm-platform-responsive .lms-page,
  body.lms-lesson-page .site-main-v1 > .container {
    width: calc(100% - 20px) !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-inline: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.pm-platform-responsive .course-pm {
    padding-top: 18px !important;
    padding-bottom: 34px !important;
  }

  body.pm-platform-responsive .course-pm h1 {
    font-size: clamp(30px, 8vw, 36px) !important;
    line-height: 1.06 !important;
  }

  body.pm-platform-responsive .course-pm-panel,
  body.pm-platform-responsive .course-pm-stat,
  body.pm-platform-responsive .course-pm-module {
    padding: 15px !important;
    border-radius: 14px !important;
  }

  body.pm-platform-responsive .course-pm-stat {
    min-height: 74px !important;
  }

  body.pm-platform-responsive .course-pm-stat strong {
    font-size: 25px !important;
  }

  body.pm-platform-responsive .course-pm-module h2,
  body.pm-platform-responsive .course-pm-module h3 {
    font-size: 21px !important;
  }

  /* Lesson player: contain every grid item and pin the iframe inside 16:9. */
  body.lms-lesson-page .site-main-v1,
  body.lms-lesson-page .site-main-v1 > .container,
  body.lms-lesson-page .lesson-lms,
  body.lms-lesson-page .lesson-lms__workspace,
  body.lms-lesson-page .lesson-lms__workspace > div {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.lms-lesson-page .lesson-lms__breadcrumb {
    margin-bottom: 10px !important;
    font-size: 12px !important;
  }

  body.lms-lesson-page .lesson-lms__intro {
    margin-bottom: 12px !important;
    padding: 14px !important;
    border-radius: 12px !important;
    gap: 14px !important;
  }

  body.lms-lesson-page .lesson-lms__intro h1 {
    margin: 8px 0 6px !important;
    font-size: clamp(24px, 7vw, 30px) !important;
    line-height: 1.1 !important;
  }

  body.lms-lesson-page .lesson-lms__intro .lms-lead {
    font-size: 15px !important;
    line-height: 1.45 !important;
  }

  body.lms-lesson-page .lesson-lms__meta {
    margin-top: 10px !important;
  }

  body.lms-lesson-page .lesson-lms__meta span {
    min-height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
  }

  body.lms-lesson-page .lesson-lms__workspace {
    width: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  body.lms-lesson-page .lesson-lms__player {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    overflow: hidden !important;
    border-radius: 8px !important;
  }

  body.lms-lesson-page .lesson-lms__player > iframe {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-width: 0 !important;
    aspect-ratio: auto !important;
    display: block !important;
    border: 0 !important;
  }

  body.lms-lesson-page .lesson-lms__actions,
  body.lms-lesson-page .lesson-lms__sidebar {
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px !important;
    border-radius: 12px !important;
  }

  body.lms-lesson-page .lesson-lms__sidebar {
    padding: 0 !important;
  }

  /* Slightly smaller public page cards and final CTA. */
  body.pm-platform-responsive .pm-showcase {
    width: calc(100% - 20px) !important;
    padding-top: 30px !important;
    padding-bottom: 30px !important;
  }

  body.pm-platform-responsive .pm-showcase h2 {
    font-size: clamp(28px, 8vw, 34px) !important;
  }

  body.pm-platform-responsive .cta {
    width: calc(100% - 20px) !important;
    padding: 27px 17px !important;
    border-radius: 22px !important;
  }

  body.pm-platform-responsive .cta h2 {
    font-size: clamp(29px, 8vw, 34px) !important;
  }

  body.pm-platform-responsive .cta p {
    font-size: 16px !important;
    line-height: 1.45 !important;
  }
}

@media (max-width: 390px) {
  body.lms-dashboard .dash-menu__links {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.lms-dashboard .dash-menu__links .pm-profile-help-v4,
  body.lms-dashboard .dash-menu__links .is-danger {
    grid-column: 1 !important;
  }
}
