/* =========================================================
   Global right-edge conversion tabs / 2026-08-24
   - Always follows the viewport's right edge.
   - The three form entry pages omit the component in HTML/PHP.
   - The phone card is secondary and disappears on small/short screens.
   ========================================================= */

:root {
  --global-ear-navy: #1a2b5c;
  --global-ear-blue: #b6cae9;
  --global-ear-sky: #1e8fc9;
  --global-ear-width: 50px;
  --global-ear-gap: 8px;
  --global-ear-max-height: 412px;
}

/* The ear rail starts as soon as the horizontal conversion actions leave. */
@media (max-width: 1550px) {
html body .global-ear-tabs,
html body .header:not(.header-min) .header-actions.global-ear-tabs,
html.nav-drawer-ready body .header:not(.header-min) .header-actions.global-ear-tabs {
  position: fixed !important;
  top: 50% !important;
  right: 0 !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 450 !important;
  display: flex !important;
  width: var(--global-ear-width) !important;
  height: min(var(--global-ear-max-height), calc(100vh - 24px)) !important;
  height: min(var(--global-ear-max-height), calc(100dvh - 24px)) !important;
  padding: 0 !important;
  flex: none !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: var(--global-ear-gap) !important;
  box-sizing: border-box !important;
  transform: translateY(-50%) !important;
  pointer-events: none !important;
}

html body .global-ear-tabs > .header-action-item {
  position: relative !important;
  display: inline-flex !important;
  width: var(--global-ear-width) !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 34px 3px 8px !important;
  flex: 1 1 0 !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  writing-mode: vertical-rl !important;
  color: var(--global-ear-navy) !important;
  background: #fff !important;
  border: 1px solid var(--global-ear-blue) !important;
  border-right: 0 !important;
  border-radius: 8px 0 0 8px !important;
  box-shadow: -3px 3px 10px rgba(9, 40, 79, .18) !important;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  letter-spacing: .1em !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  transform: none !important;
  transform-origin: right center !important;
  transition: color .2s ease, background-color .2s ease, transform .2s ease, box-shadow .2s ease !important;
  pointer-events: auto !important;
}

html body .global-ear-tabs > .header-action-item::before,
html body .global-ear-tabs > .header-action-item > i {
  display: none !important;
}

html body .global-ear-tabs > .header-action-item::after {
  content: "" !important;
  position: absolute !important;
  top: 9px !important;
  left: 50% !important;
  display: block !important;
  width: 21px !important;
  height: 21px !important;
  background-color: currentColor !important;
  transform: translateX(-50%) !important;
  -webkit-mask-position: center !important;
  mask-position: center !important;
  -webkit-mask-repeat: no-repeat !important;
  mask-repeat: no-repeat !important;
  -webkit-mask-size: contain !important;
  mask-size: contain !important;
  pointer-events: none !important;
}

html body .global-ear-tabs > .header-demo-btn::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3h12l5 5v21H8z'/%3E%3Cpath d='M20 3v6h5M12 15h9M12 20h9M12 25h6'/%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3h12l5 5v21H8z'/%3E%3Cpath d='M20 3v6h5M12 15h9M12 20h9M12 25h6'/%3E%3C/svg%3E") !important;
}

html body .global-ear-tabs > .header-demo-apply-btn::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='25' height='17' rx='2'/%3E%3Cpath d='M11 28h10M16 22v6M12.5 10l8 4-8 4z'/%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='25' height='17' rx='2'/%3E%3Cpath d='M11 28h10M16 22v6M12.5 10l8 4-8 4z'/%3E%3C/svg%3E") !important;
}

html body .global-ear-tabs > .header-contact-btn::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='6' width='25' height='20' rx='2'/%3E%3Cpath d='m5.5 9 10.5 8L26.5 9'/%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='6' width='25' height='20' rx='2'/%3E%3Cpath d='m5.5 9 10.5 8L26.5 9'/%3E%3C/svg%3E") !important;
}

html body .global-ear-tabs > .header-action-item:hover {
  color: var(--global-ear-navy) !important;
  background: #fbfdff !important;
  border-color: var(--global-ear-navy) !important;
  transform: translateX(-4px) !important;
  box-shadow: -5px 5px 15px rgba(9, 40, 79, .16) !important;
}

html body .global-ear-tabs > .header-action-item:focus-visible {
  outline: 3px solid var(--global-ear-sky) !important;
  outline-offset: 3px !important;
}

/* The phone card is preserved on roomy screens, but it is not part of the ear rail. */
html body .global-ear-tabs > .tel-widget {
  display: none !important;
}
}

/* The former desktop floating phone card is intentionally disabled. */
@media not all {
  html body .global-ear-tabs > .tel-widget {
    position: fixed !important;
    right: 10px !important;
    bottom: 10px !important;
    left: auto !important;
    z-index: 470 !important;
    display: block !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  html body .global-ear-tabs .telx {
    position: absolute !important;
    top: -10px !important;
    left: -10px !important;
    z-index: 2 !important;
    display: flex !important;
    width: 24px !important;
    height: 24px !important;
    align-items: center !important;
    justify-content: center !important;
    color: #fff !important;
    background: #1a1a1a !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3) !important;
    cursor: pointer !important;
  }

  html body .global-ear-tabs .header-tel-btn {
    display: flex !important;
    width: auto !important;
    padding: 13px 20px !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    color: #1a1a1a !important;
    background: #fff !important;
    border: 1px solid var(--global-ear-navy) !important;
    border-radius: 6px !important;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .22) !important;
    transform: none !important;
  }

  html body .global-ear-tabs .telx-cb:checked ~ .header-tel-btn,
  html body .global-ear-tabs .telx-cb:checked ~ .telx {
    display: none !important;
  }
}

@media (max-width: 768px) {
  :root {
    --global-ear-width: 44px;
    --global-ear-gap: 6px;
    --global-ear-max-height: 396px;
  }

  html body .global-ear-tabs,
  html.nav-drawer-ready body .header:not(.header-min) .header-actions.global-ear-tabs {
    height: min(var(--global-ear-max-height), calc(100vh - 16px)) !important;
    height: min(var(--global-ear-max-height), calc(100dvh - 16px)) !important;
  }

  html body .global-ear-tabs > .header-action-item {
    padding: 29px 2px 6px !important;
    border-radius: 7px 0 0 7px !important;
    font-size: 12px !important;
    line-height: 1.1 !important;
    letter-spacing: .04em !important;
  }

  html body .global-ear-tabs > .header-action-item::after {
    top: 8px !important;
    width: 18px !important;
    height: 18px !important;
  }
}

@media (max-width: 480px) {
  :root {
    --global-ear-width: 42px;
  }
}

@media (max-width: 768px) and (max-height: 420px) {
  :root {
    --global-ear-gap: 4px;
    --global-ear-max-height: calc(100dvh - 12px);
  }

  html body .global-ear-tabs,
  html.nav-drawer-ready body .header:not(.header-min) .header-actions.global-ear-tabs {
    height: calc(100vh - 12px) !important;
    height: calc(100dvh - 12px) !important;
  }

  html body .global-ear-tabs > .header-action-item {
    padding: 4px 2px !important;
    font-size: 10.5px !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
  }

  html body .global-ear-tabs > .header-action-item::after {
    display: none !important;
  }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  html body .global-ear-tabs > .header-action-item {
    transition: none !important;
  }

  html body .global-ear-tabs > .header-action-item:hover {
    transform: none !important;
  }
}

/* Smartphone conversion bar: replace the right-edge ears with three fixed actions. */
@media (max-width: 768px) {
  :root {
    --mobile-bottom-cta-height: 64px;
  }

  html body {
    padding-bottom: calc(var(--mobile-bottom-cta-height) + env(safe-area-inset-bottom, 0px)) !important;
  }

  html body .global-ear-tabs,
  html body .header:not(.header-min) .header-actions.global-ear-tabs,
  html.nav-drawer-ready body .header:not(.header-min) .header-actions.global-ear-tabs {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 450 !important;
    display: flex !important;
    width: 100% !important;
    height: calc(var(--mobile-bottom-cta-height) + env(safe-area-inset-bottom, 0px)) !important;
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px) !important;
    flex: none !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    gap: 0 !important;
    box-sizing: border-box !important;
    transform: none !important;
    pointer-events: auto !important;
    background: #112e56 !important;
    border-top: 1px solid #c9d8e7 !important;
    box-shadow: 0 -6px 20px rgba(7, 30, 73, .16) !important;
  }

  html body .global-ear-tabs > .header-action-item,
  html body .global-ear-tabs > .tel-widget {
    position: static !important;
    width: auto !important;
    height: var(--mobile-bottom-cta-height) !important;
    min-width: 0 !important;
    min-height: 44px !important;
    flex: 1 1 33.333% !important;
    margin: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  html body .global-ear-tabs > .header-contact-btn {
    order: 1 !important;
  }

  html body .global-ear-tabs > .header-demo-btn {
    order: 2 !important;
  }

  html body .global-ear-tabs > .tel-widget {
    order: 3 !important;
    display: flex !important;
  }

  html body .global-ear-tabs > .header-demo-apply-btn {
    display: none !important;
  }

  html body .global-ear-tabs .telx,
  html body .global-ear-tabs .telx-cb {
    display: none !important;
  }

  html body .global-ear-tabs > .header-action-item,
  html body .global-ear-tabs .header-tel-btn {
    position: static !important;
    display: inline-flex !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 44px !important;
    padding: 8px 4px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    writing-mode: horizontal-tb !important;
    color: #fff !important;
    background: #112e56 !important;
    border: 0 !important;
    border-right: 1px solid rgba(255, 255, 255, .32) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: clamp(12px, 3.5vw, 14px) !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    transform: none !important;
  }

  html body .global-ear-tabs .header-tel-btn {
    border-right: 0 !important;
  }

  html body .global-ear-tabs > .header-action-item::before,
  html body .global-ear-tabs > .header-action-item::after {
    display: none !important;
  }

  html body .global-ear-tabs > .header-action-item > i,
  html body .global-ear-tabs .header-tel-icon {
    display: inline-block !important;
    margin: 0 !important;
    color: currentColor !important;
    font-size: 16px !important;
  }

  html body .global-ear-tabs .header-tel-textcol {
    display: none !important;
  }

  html body .global-ear-tabs .header-tel-btn::after {
    content: "電話相談";
    display: inline !important;
  }

  html body .global-ear-tabs > .header-action-item:hover,
  html body .global-ear-tabs .header-tel-btn:hover {
    color: #fff !important;
    background: #1658a0 !important;
    transform: none !important;
  }

  html body .global-ear-tabs > .header-action-item:focus-visible,
  html body .global-ear-tabs .header-tel-btn:focus-visible {
    position: relative !important;
    z-index: 1 !important;
    outline: 3px solid #fff !important;
    outline-offset: -4px !important;
    box-shadow: inset 0 0 0 6px #1e8fc9 !important;
  }

  html body.thanks-platform .global-ear-tabs {
    display: none !important;
  }

  html body.thanks-platform {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }
}

/* Stage01 mobile fixed conversion rail / 2026-09-02
 * The shared drawer script keeps the rail DOM near the site footer on mobile,
 * while this layer pins it to the viewport without changing the desktop rail. */
@media (max-width: 768px) {
  html body {
    padding-bottom: calc(var(--mobile-bottom-cta-height) + env(safe-area-inset-bottom, 0px)) !important;
  }

  html body .global-ear-tabs,
  html body .header:not(.header-min) .header-actions.global-ear-tabs,
  html.nav-drawer-ready body .header:not(.header-min) .header-actions.global-ear-tabs {
    display: none !important;
  }

  html body .global-ear-tabs.is-mobile-footer-actions {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 1500 !important;
    display: flex !important;
    width: 100% !important;
    height: calc(var(--mobile-bottom-cta-height) + env(safe-area-inset-bottom, 0px)) !important;
    min-height: calc(var(--mobile-bottom-cta-height) + env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px) !important;
    flex: none !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    gap: 0 !important;
    box-sizing: border-box !important;
    transform: none !important;
    pointer-events: auto !important;
    background: #112e56 !important;
    border-top: 1px solid #c9d8e7 !important;
    border-bottom: 1px solid rgba(255, 255, 255, .22) !important;
    box-shadow: 0 -4px 16px rgba(7, 30, 73, .12) !important;
  }

  html body .global-ear-tabs.is-mobile-footer-actions > .tel-widget {
    display: none !important;
  }

  html body .global-ear-tabs.is-mobile-footer-actions > .header-contact-btn {
    order: 1 !important;
  }

  html body .global-ear-tabs.is-mobile-footer-actions > .header-demo-btn {
    order: 2 !important;
  }

  html body .global-ear-tabs.is-mobile-footer-actions > .header-demo-apply-btn {
    order: 3 !important;
    display: inline-flex !important;
  }

  html body .global-ear-tabs.is-mobile-footer-actions > .header-action-item {
    position: static !important;
    display: inline-flex !important;
    width: auto !important;
    height: 64px !important;
    min-width: 0 !important;
    min-height: 44px !important;
    flex: 1 1 33.333% !important;
    margin: 0 !important;
    padding: 8px 4px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    writing-mode: horizontal-tb !important;
    color: #fff !important;
    background: #112e56 !important;
    border: 0 !important;
    border-right: 1px solid rgba(255, 255, 255, .32) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: clamp(12px, 3.5vw, 14px) !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    transform: none !important;
  }

  html body .global-ear-tabs.is-mobile-footer-actions > .header-action-item:last-child {
    border-right: 0 !important;
  }
}
