/* Keep mobile overlays inside the viewport without disabling visitor zoom. */
html { scrollbar-gutter: stable; }
@media (max-width: 740px), (max-height: 500px) and (pointer: coarse) {
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  html body textarea, html body select {
    font-size: 16px !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  html.mobile-popup-locked { overflow: hidden !important; }
  html body dialog:not(.cs-intro):is(#search-dialog, #studio-journey, dialog), html body .human-support section {
    box-sizing: border-box;
    position: fixed;
    inset: auto 24px auto;
    top: calc(var(--popup-view-top, 0px) + var(--popup-view-height, 100dvh) / 2);
    transform: translateY(-50%);
    width: calc(100% - 48px);
    min-width: 0;
    max-width: 560px;
    height: auto;
    max-height: min(80svh, calc(var(--popup-view-height, 100dvh) - 48px));
    margin: 0 auto;
    padding: 22px 18px;
    border: 1px solid #7996a580;
    border-radius: 22px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scroll-padding: 16px;
    box-shadow: 0 24px 80px #0007;
  }
  html body dialog:not(.cs-intro):is(#search-dialog, #studio-journey, dialog)::backdrop,
  .mobile-popup-backdrop {
    background: #030a106b;
    -webkit-backdrop-filter: blur(9px);
    backdrop-filter: blur(9px);
  }
  html body dialog:not(.cs-intro):is(#search-dialog, #studio-journey, dialog) *,
  html body .human-support section * { box-sizing: border-box; }
  html body dialog:not(.cs-intro):is(#search-dialog, #studio-journey, dialog) :is(h2, p, a, label),
  html body .human-support section :is(h2, p, a) { overflow-wrap: anywhere; }
  html body dialog:not(.cs-intro):is(#search-dialog, #studio-journey, dialog) :is(.currency-heading, .dialog-top) {
    gap: 12px; margin-bottom: 18px;
  }
  html body dialog.choice-panel[open] { display: flex; flex-direction: column; overflow: hidden; }
  html body .choice-panel .currency-heading { flex: none; align-items: flex-start; }
  html body .choice-panel .currency-heading > div { min-width: 0; }
  html body .choice-panel .currency-heading h2 { font-size: 24px !important; line-height: 1.2; margin-top: 8px; }
  html body .choice-panel .currency-heading > div > span { font-size: 9px; letter-spacing: .15em; }
  html body .choice-panel .choice-grid {
    flex: 1 1 auto; min-height: 0; max-height: none;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px; margin: 0; padding: 3px;
    overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  }
  html body .choice-panel .choice-grid button {
    min-width: 0; min-height: 66px; padding: 10px 8px; gap: 7px; position: relative;
  }
  html body .choice-panel .choice-grid button > span:nth-child(2) { min-width: 0; }
  html body .choice-panel .choice-grid strong { font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
  html body .choice-panel .choice-grid small { font-size: 10px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
  html body .choice-panel .currency-symbol { width: 28px; height: 28px; font-size: 18px; }
  html body .choice-panel .currency-abbreviation { font-size: 10px; }
  html body .choice-panel .choice-grid i { position: absolute; top: 3px; right: 4px; font-size: 10px; }
  html body :is(.currency-close, .search-close, .consent-close, .support-close) {
    flex: 0 0 40px; width: 40px; height: 40px; min-width: 40px; min-height: 40px;
  }
  html body #search-dialog label[for="site-search"] { font-size: 25px; line-height: 1.2; margin: 18px 0; }
  html body #search-dialog #site-search { height: 54px; padding: 12px; min-width: 0; }
  html body #search-dialog .explorer-grid { grid-template-columns: minmax(0, 1fr); }
  html body #search-dialog .explorer-grid a { min-width: 0; padding: 12px; }
  html body #search-dialog .explorer-grid a > span { min-width: 0; }
  html body #search-dialog .explorer-foot { flex-wrap: wrap; gap: 10px; }
  html body .consent-dialog h2 { font-size: 25px; }
  html body .consent-dialog .consent-category { padding: 13px; }
  html body .consent-dialog .consent-category h3 { flex-wrap: wrap; }
  html body .consent-dialog .consent-actions { grid-template-columns: minmax(0, 1fr); }
  html body #studio-journey:not(.cs-intro) { padding: 0; background: #09131ff5; }
  html body #studio-journey .sj-topbar { height: auto; min-height: 62px; padding: 12px 16px; gap: 8px; }
  html body #studio-journey .sj-brand { font-size: 13px; gap: 7px; letter-spacing: .12em; }
  html body #studio-journey .sj-skip { gap: 8px; padding-left: 5px; }
  html body #studio-journey .sj-scene { min-height: 0; padding: 0 16px 20px; }
  html body #studio-journey .sj-halo { max-width: 100%; }
  html body #studio-journey .sj-wing-art { width: 180px; max-width: 80%; margin: 0 auto; }
  html body #studio-journey .sj-progress { gap: 8px; margin-bottom: 16px; }
  html body #studio-journey .sj-progress i { width: 14px; }
  html body #studio-journey .sj-setup h2 { font-size: 26px; }
  html body #studio-journey .sj-intro { margin: 12px 0 18px; }
  html body #studio-journey .sj-role { padding: 12px 9px; }
  html body #studio-journey .sj-scene-caption { margin-top: 18px; }
  html body #studio-journey .sj-phone {
    min-height: 340px; height: min(600px, calc(var(--popup-view-height, 100dvh) - 154px));
    max-height: none; border-radius: 22px;
  }
  html body #studio-journey[data-stage="chat"] .sj-scene { padding: 4px 14px 16px; }
  html body #studio-journey[data-stage="chat"] .sj-scene-caption { display: none; }
  .mobile-popup-backdrop { position: fixed; inset: 0; z-index: 9997; }
  .mobile-popup-backdrop[hidden] { display: none; }
  html body .human-support.mobile-support-open { z-index: 9998; }
  html body .human-support.mobile-support-open .support-launcher { visibility: hidden; }
  html body .human-support section { z-index: 1; }
}
@media (max-width: 359px) {
  html body .choice-panel .choice-grid { grid-template-columns: minmax(0, 1fr); }
  html body .choice-panel .choice-grid button { min-height: 56px; }
  html body #studio-journey .sj-roles { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 741px) and (min-height: 501px) {
  .mobile-popup-backdrop { display: none; }
}
