/*
 * X2O2 FINAL MOBILE UI AUTHORITY
 * Purpose: one last, scoped responsive layer for the X2O2 unified UI.
 * This file deliberately avoids changing server logic, audio playback, APIs,
 * or desktop layout. It resolves mobile cascade conflicts left by legacy
 * Soundify rules and page/plugin-specific patches.
 */

/* ---------- Global mobile safety ---------- */
@media (max-width: 767.98px) {
  html,
  body {
    max-width: 100% !important;
  }

  body.x2o2-unified-ui {
    overflow-x: hidden !important;
  }

  body.x2o2-unified-ui #container_content,
  body.x2o2-unified-ui .ma_page_content,
  body.x2o2-unified-ui .page_padding,
  body.x2o2-unified-ui .content,
  body.x2o2-unified-ui .container,
  body.x2o2-unified-ui .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  body.x2o2-unified-ui img,
  body.x2o2-unified-ui video,
  body.x2o2-unified-ui canvas,
  body.x2o2-unified-ui iframe {
    max-width: 100% !important;
  }

  body.x2o2-unified-ui input,
  body.x2o2-unified-ui select,
  body.x2o2-unified-ui textarea,
  body.x2o2-unified-ui .form-control {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.x2o2-unified-ui pre,
  body.x2o2-unified-ui code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  body.x2o2-unified-ui .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.x2o2-unified-ui .modal-dialog {
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    margin: 12px auto !important;
  }

  body.x2o2-unified-ui .dropdown-menu {
    max-width: calc(100vw - 16px) !important;
  }
}

/* ---------- Account settings: one authoritative layout ---------- */
.sett_page {
  box-sizing: border-box !important;
}

.sett_page .st_sidebar,
.sett_page .st_content {
  box-sizing: border-box !important;
}

/* Keep every settings navigation item on the same X2O2 visual system. */
body.x2o2-unified-ui .sett_page .st_sidebar li a,
body.x2o2-unified-ui .sett_page .st_sidebar li.active a,
body.x2o2-unified-ui .sett_page .st_sidebar li.delete a {
  color: #b9bbc2 !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

body.x2o2-unified-ui .sett_page .st_sidebar li a {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  min-height: 44px !important;
  box-sizing: border-box !important;
}

body.x2o2-unified-ui .sett_page .st_sidebar li a span {
  color: #c9cbd1 !important;
  background: rgba(255,255,255,.055) !important;
}

body.x2o2-unified-ui .sett_page .st_sidebar li.active a {
  color: #ffffff !important;
  background: rgba(255,138,36,.11) !important;
  box-shadow: inset 2px 0 #ff8a24, 0 8px 20px rgba(0,0,0,.10) !important;
}

body.x2o2-unified-ui .sett_page .st_sidebar li.active a span {
  color: #ff9d4e !important;
  background: rgba(255,138,36,.14) !important;
}

body.x2o2-unified-ui .sett_page .st_sidebar li.delete a {
  color: #ffaaa3 !important;
}

body.x2o2-unified-ui .sett_page .st_content,
body.x2o2-unified-ui .sett_page .st_sidebar {
  color: #dfe1e5 !important;
  background-color: #121519 !important;
}

body.x2o2-unified-ui .sett_page .st_content .user_sttng_panel_hd,
body.x2o2-unified-ui .sett_page .st_content .user_sttng_panel_hd * {
  color: #f7f7f8 !important;
}

body.x2o2-unified-ui .sett_page .st_content .user_sttng_panel_hd:before {
  color: #ff8a24 !important;
}

@media (max-width: 767.98px) {
  body.x2o2-unified-ui .sett_page {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 20px !important;
  }

  body.x2o2-unified-ui .sett_page > .col-md-4,
  body.x2o2-unified-ui .sett_page > .col-md-8 {
    display: block !important;
    float: none !important;
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.x2o2-unified-ui .sett_page .st_sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 8px !important;
    border-radius: 16px !important;
    overflow: hidden !important;
  }

  body.x2o2-unified-ui .sett_page .st_sidebar ul {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.x2o2-unified-ui .sett_page .st_sidebar li {
    width: 100% !important;
    min-width: 0 !important;
    margin: 2px 0 !important;
  }

  body.x2o2-unified-ui .sett_page .st_sidebar li a {
    padding: 7px 10px !important;
    min-height: 44px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.x2o2-unified-ui .sett_page .st_sidebar li a span {
    flex: 0 0 30px !important;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    margin-right: 10px !important;
  }

  body.x2o2-unified-ui .sett_page .st_content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 12px 0 0 !important;
    padding: 20px 14px !important;
    border-radius: 16px !important;
    overflow: visible !important;
  }

  body.x2o2-unified-ui .sett_page .st_content .user_sttng_panel_hd {
    margin-bottom: 18px !important;
    padding-bottom: 14px !important;
    font-size: 22px !important;
    line-height: 1.18 !important;
    letter-spacing: -.35px !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  body.x2o2-unified-ui .sett_page .st_content .user_sttng_panel_hd:before {
    margin-bottom: 8px !important;
    font-size: 8px !important;
    line-height: 1.25 !important;
    letter-spacing: 1.5px !important;
    white-space: normal !important;
  }

  /* No global row override: only the settings content gets mobile wrapping. */
  body.x2o2-unified-ui .sett_page .st_content .row,
  body.x2o2-unified-ui .sett_page .st_content .form-row {
    display: flex !important;
    flex-wrap: wrap !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-left: -6px !important;
    margin-right: -6px !important;
  }

  body.x2o2-unified-ui .sett_page .st_content .row > [class*="col-"],
  body.x2o2-unified-ui .sett_page .st_content .form-row > [class*="col-"] {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  body.x2o2-unified-ui .sett_page .st_content .sfy_mat_input,
  body.x2o2-unified-ui .sett_page .st_content .form-group,
  body.x2o2-unified-ui .sett_page .st_content .input-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.x2o2-unified-ui .sett_page .st_content .sfy_mat_input input,
  body.x2o2-unified-ui .sett_page .st_content .sfy_mat_input textarea,
  body.x2o2-unified-ui .sett_page .st_content .sfy_mat_input select,
  body.x2o2-unified-ui .sett_page .st_content .form-control {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.x2o2-unified-ui .sett_page .st_content .sfy_sett_footer {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    width: 100% !important;
    margin-top: 18px !important;
    margin-bottom: -20px !important;
    gap: 8px !important;
  }

  body.x2o2-unified-ui .sett_page .st_content .sfy_sett_footer .btn,
  body.x2o2-unified-ui .sett_page .st_content .sfy_sett_footer a.btn,
  body.x2o2-unified-ui .sett_page .st_content .sfy_sett_footer #btn-general-submit {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
  }

  body.x2o2-unified-ui .sett_page .st_content .ma_interest_list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* ---------- X2O2 AI: non-blocking mobile launcher ---------- */
@media (max-width: 767.98px) {
  body.x2o2-unified-ui #x2o2-ai-launcher {
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0 !important;
    line-height: 1 !important;
  }

  body.x2o2-unified-ui #x2o2-ai-launcher::before {
    content: "✦";
    font-size: 20px;
    line-height: 1;
  }

  body.x2o2-unified-ui #x2o2-ai-panel {
    right: max(10px, env(safe-area-inset-right)) !important;
    left: max(10px, env(safe-area-inset-left)) !important;
    bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: none !important;
    height: min(70vh, 620px) !important;
    max-height: calc(100vh - 96px) !important;
    border-radius: 16px !important;
  }
}

/* ---------- Tiny phones ---------- */
@media (max-width: 390px) {
  body.x2o2-unified-ui .sett_page .st_content {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.x2o2-unified-ui .sett_page .st_sidebar li a {
    min-height: 42px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  body.x2o2-unified-ui .sett_page .st_sidebar li a span {
    margin-right: 8px !important;
  }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  body.x2o2-unified-ui .sett_page .st_sidebar li a,
  body.x2o2-unified-ui #x2o2-ai-launcher {
    transition: none !important;
  }
}
\n/* ---------- Common legacy shell containment ---------- */\n@media (max-width: 767.98px) {\n  body.x2o2-unified-ui .ma_page,\n  body.x2o2-unified-ui .ma_page_content,\n  body.x2o2-unified-ui .ma_page_content > .row,\n  body.x2o2-unified-ui .ma_page_content > .row > [class*="col-"] {\n    min-width: 0 !important;\n    max-width: 100% !important;\n    box-sizing: border-box !important;\n  }\n\n  body.x2o2-unified-ui .ma_page_content > .row {\n    width: 100% !important;\n  }\n\n  body.x2o2-unified-ui .sett_page .st_content [style*="width:"][style*="px"],\n  body.x2o2-unified-ui .sett_page .st_sidebar [style*="width:"][style*="px"] {\n    max-width: 100% !important;\n  }\n}\n\n/* ---------- Mobile header controls ---------- */\n@media (max-width: 767.98px) {\n  body.x2o2-unified-ui header {\n    width: 100% !important;\n    max-width: 100% !important;\n    min-width: 0 !important;\n    margin-left: 0 !important;\n    margin-right: 0 !important;\n    padding-left: 8px !important;\n    padding-right: 8px !important;\n    box-sizing: border-box !important;\n  }\n\n  body.x2o2-unified-ui header .head_menu {\n    display: flex !important;\n    align-items: center !important;\n    justify-content: center !important;\n    flex: 0 0 36px !important;\n    width: 36px !important;\n    min-width: 36px !important;\n    height: 36px !important;\n    margin: 0 5px 0 0 !important;\n    padding: 0 !important;\n    line-height: 1 !important;\n    box-sizing: border-box !important;\n  }\n\n  body.x2o2-unified-ui header .head_user {\n    display: flex !important;\n    align-items: center !important;\n    justify-content: flex-end !important;\n    gap: 5px !important;\n    flex: 1 1 auto !important;\n    min-width: 0 !important;\n    margin: 0 !important;\n  }\n\n  body.x2o2-unified-ui header .head_user .notis,\n  body.x2o2-unified-ui header .head_user .chaticon,\n  body.x2o2-unified-ui header .head_user .opts_account,\n  body.x2o2-unified-ui header .opts_head_acc {\n    display: flex !important;\n    align-items: center !important;\n    flex: 0 0 36px !important;\n    width: 36px !important;\n    min-width: 36px !important;\n    margin: 0 !important;\n  }\n\n  body.x2o2-unified-ui header .head_user .notis > .btn,\n  body.x2o2-unified-ui header .head_user .chaticon > .btn,\n  body.x2o2-unified-ui header .head_user .opts_account > .btn,\n  body.x2o2-unified-ui header .opts_head_acc > .btn {\n    display: flex !important;\n    align-items: center !important;\n    justify-content: center !important;\n    width: 36px !important;\n    min-width: 36px !important;\n    height: 36px !important;\n    padding: 0 !important;\n    margin: 0 !important;\n    box-sizing: border-box !important;\n  }\n\n  body.x2o2-unified-ui header .head_user .notis > .btn svg,\n  body.x2o2-unified-ui header .head_user .chaticon > .btn svg,\n  body.x2o2-unified-ui header .head_user .opts_account > .btn svg,\n  body.x2o2-unified-ui header .opts_head_acc > .btn svg {\n    margin: 0 !important;\n    width: 18px !important;\n    height: 18px !important;\n  }\n\n  body.x2o2-unified-ui header .head_user .notis > .dropdown-menu,\n  body.x2o2-unified-ui header .opts_head_acc .dropdown-menu {\n    left: 8px !important;\n    right: 8px !important;\n    width: auto !important;\n    max-width: calc(100vw - 16px) !important;\n    min-width: 0 !important;\n    top: 60px !important;\n    box-sizing: border-box !important;\n  }\n}\n\n@media (max-width: 350px) {\n  body.x2o2-unified-ui header {\n    padding-left: 5px !important;\n    padding-right: 5px !important;\n  }\n\n  body.x2o2-unified-ui header .head_menu,\n  body.x2o2-unified-ui header .head_user .notis,\n  body.x2o2-unified-ui header .head_user .chaticon,\n  body.x2o2-unified-ui header .head_user .opts_account,\n  body.x2o2-unified-ui header .opts_head_acc,\n  body.x2o2-unified-ui header .head_user .notis > .btn,\n  body.x2o2-unified-ui header .head_user .chaticon > .btn,\n  body.x2o2-unified-ui header .head_user .opts_account > .btn,\n  body.x2o2-unified-ui header .opts_head_acc > .btn {\n    flex-basis: 32px !important;\n    width: 32px !important;\n    min-width: 32px !important;\n    height: 32px !important;\n  }\n}\n