/*
 * Manabi Video Navi V270 — reading-shell viewport coherence.
 *
 * Presentation only. This layer repairs the legal/reading shell at desktop
 * zoom, tablet and phone widths without changing navigation ownership, form
 * submission, payment, authentication, QR, video or storage behavior.
 */

/* Keep reading pages on one intentional content axis at every viewport. */
body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content {
  width: min(calc(100% - 32px), 1280px) !important;
  max-width: 1280px !important;
  margin-inline: auto !important;
}

/* The table of contents previously fell back to a white legacy surface on
 * desktop while inheriting white type from the dark theme. Pin both halves of
 * every foreground/background pair instead of relying on inheritance. */
body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc {
  position: relative !important;
  inset: auto !important;
  z-index: 1 !important;
  width: min(100%, 1120px) !important;
  max-width: 1120px !important;
  margin: 22px auto 30px !important;
  padding: 18px !important;
  overflow: hidden !important;
  border: 1px solid rgba(103, 209, 255, .38) !important;
  border-radius: 18px !important;
  background: linear-gradient(160deg, #0b2d5d 0%, #071d42 100%) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: currentColor !important;
  box-shadow: 0 14px 34px rgba(0, 4, 24, .30) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc > strong {
  display: block !important;
  margin: 0 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  line-height: 1.4 !important;
}

body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc ol {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 12px 0 0 !important;
  padding: 0 !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  overflow: visible !important;
  list-style: none !important;
}

body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc li {
  min-width: 0 !important;
  max-width: 100% !important;
}

body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc a {
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 42px !important;
  max-width: 100% !important;
  align-items: center !important;
  padding: 9px 13px !important;
  border: 1px solid rgba(105, 218, 255, .42) !important;
  border-radius: 999px !important;
  background: #061b3c !important;
  color: #8eeaff !important;
  -webkit-text-fill-color: #8eeaff !important;
  font-size: 14px !important;
  font-weight: 850 !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  text-decoration: none !important;
}

body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc a:is(:hover, :focus-visible) {
  border-color: #77e6ff !important;
  background: #0c3568 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  outline: none !important;
}

/* Legal copy remains a dark reading surface on desktop as well as phones. */
body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .legal-page.panel {
  width: min(100%, 920px) !important;
  max-width: 920px !important;
  margin-inline: auto !important;
  padding: clamp(24px, 4vw, 42px) !important;
  overflow: hidden !important;
  border: 1px solid rgba(100, 205, 255, .34) !important;
  border-radius: 22px !important;
  background: linear-gradient(165deg, #0b2a56 0%, #071d42 100%) !important;
  color: #f7fbff !important;
  -webkit-text-fill-color: currentColor !important;
  box-shadow: 0 18px 44px rgba(0, 4, 25, .30) !important;
}

body.app-shell.future-ui.mnv-future-ui.shell-reading.page-cancel_policy
  #main-content .cancel-policy-title {
  margin: 22px 0 20px !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: clamp(42px, 5vw, 68px) !important;
  font-weight: 950 !important;
  letter-spacing: -.045em !important;
  line-height: 1.12 !important;
  text-wrap: balance !important;
}

body.app-shell.future-ui.mnv-future-ui.shell-reading.page-cancel_policy
  #main-content .cancel-policy-title > span {
  display: block !important;
  max-width: 100% !important;
  white-space: nowrap !important;
}

/* The global drawer is used up to 1800 CSS pixels. At desktop zoom levels the
 * old white MENU capsule leaked through because V269 only reset it below
 * 760px. Apply the same deterministic control throughout the drawer range. */
@media screen and (max-width: 1800px) {
  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .site-header-inner {
    min-height: 68px !important;
    align-items: center !important;
    gap: 12px !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .nav-toggle {
    position: relative !important;
    inset: auto !important;
    z-index: 5200 !important;
    display: grid !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    place-content: center !important;
    border: 1px solid rgba(105, 212, 255, .58) !important;
    border-radius: 14px !important;
    background: #0a2b59 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    writing-mode: horizontal-tb !important;
    overflow: hidden !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    filter: none !important;
    box-shadow: 0 8px 22px rgba(0, 4, 25, .28) !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .nav-toggle > span {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: 22px !important;
    height: 2px !important;
    margin: 3px auto !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #ffffff !important;
    opacity: 1 !important;
    transform: none !important;
    transform-origin: center !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header
    .nav-toggle > .mnv-v243-nav-label {
    display: none !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header
    .nav-toggle[aria-expanded="true"] > span:nth-of-type(1),
  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header
    .nav-toggle[aria-expanded="true"] > span:nth-of-type(3) {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    margin: 0 !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header
    .nav-toggle[aria-expanded="true"] > span:nth-of-type(1) {
    transform: translate(-50%, -50%) rotate(45deg) !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header
    .nav-toggle[aria-expanded="true"] > span:nth-of-type(2) {
    opacity: 0 !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header
    .nav-toggle[aria-expanded="true"] > span:nth-of-type(3) {
    transform: translate(-50%, -50%) rotate(-45deg) !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .nav-scrim {
    z-index: 4900 !important;
    background: rgba(1, 7, 20, .58) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .site-nav-area {
    position: fixed !important;
    z-index: 5100 !important;
    top: var(--site-header-bottom, calc(68px + env(safe-area-inset-top, 0px))) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    display: flex !important;
    width: min(100vw, 430px) !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: calc(100dvh - var(--site-header-bottom, 68px)) !important;
    padding: 14px max(16px, env(safe-area-inset-right, 0px))
      max(24px, calc(16px + env(safe-area-inset-bottom, 0px))) 16px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    border: 1px solid rgba(93, 205, 255, .34) !important;
    border-right: 0 !important;
    border-radius: 20px 0 0 0 !important;
    background: linear-gradient(165deg, #071b3e 0%, #061632 100%) !important;
    color: #f7fbff !important;
    -webkit-text-fill-color: currentColor !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    filter: none !important;
    transform: translate3d(104%, 0, 0) !important;
    box-shadow: -22px 0 58px rgba(0, 3, 20, .50) !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .site-nav-area.open,
  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header
    .site-nav-area[aria-hidden="false"] {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translate3d(0, 0, 0) !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .site-nav-area
    :is(.site-nav, .nav-actions, .logout-inline-form) {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 7px !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .site-nav-area
    :is(.nav-drawer-close, .site-nav a, .site-nav button, .nav-actions > a, .nav-actions > button, .logout-inline-form button) {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 11px 13px !important;
    border: 1px solid rgba(105, 194, 255, .28) !important;
    border-radius: 13px !important;
    background: #0a2852 !important;
    color: #f7fbff !important;
    -webkit-text-fill-color: #f7fbff !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    white-space: normal !important;
    text-align: left !important;
    text-decoration: none !important;
    line-height: 1.35 !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .site-nav-area
    .nav-drawer-close {
    justify-content: space-between !important;
    background: #0d315f !important;
    font-weight: 850 !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .site-nav-area
    .nav-actions {
    margin-top: 2px !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(101, 199, 255, .22) !important;
  }
}

@media screen and (max-width: 760px) {
  body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content {
    width: min(calc(100% - 24px), 920px) !important;
    padding-bottom: calc(148px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc {
    width: 100% !important;
    margin: 14px 0 18px !important;
    padding: 15px !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc ol {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc a {
    width: 100% !important;
    min-height: 44px !important;
    border-radius: 12px !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .legal-page.panel {
    width: 100% !important;
    padding: 22px 18px !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading.page-cancel_policy
    #main-content .cancel-policy-title {
    font-size: clamp(34px, 10.6vw, 48px) !important;
  }
}

@media screen and (max-width: 420px) {
  body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content .mf-reading-toc ol {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.app-shell.future-ui.mnv-future-ui.shell-reading.page-cancel_policy
    #main-content .cancel-policy-title > span {
    white-space: normal !important;
  }
}

@media (forced-colors: active) {
  body.app-shell.future-ui.mnv-future-ui.shell-reading #main-content
    :is(.mf-reading-toc, .legal-page.panel),
  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .nav-toggle,
  body.app-shell.future-ui.mnv-future-ui.shell-reading .site-header .site-nav-area {
    border: 2px solid CanvasText !important;
  }
}
