/* Responsive overrides and mobile-only behaviors */

/* nav drawer elements hidden by default */
.rc-nav-mount,
.rc-nav-toggle,
.rc-nav-drawer,
.rc-nav-overlay {
  display: none;
}
.rc-nav-drawer-top,
.rc-nav-drawer-bottom {
  z-index:9000
}

@media (max-width: 1284px) {
  #popup_server_mapper {
    width: 120vh!important;
  }
  #popup_server_mapper_gentemp_container {
    height: 56vh!important;
  }
}
@media (max-width: 1024px) {
  /* ---------- General downscale helpers ---------- */
  body {
    font-size: 13px;
  }
  .popup_detail_image_container{
    display: block;
  }
  /* local courses popup sizing on small screens */
  .courses_list_wrapper {
    width: 100%;
    height: 60vh;
    max-height: 60vh;
  }

  /* detail image popup stacks panels and limits image height */
  #popup_change_chapter {
    max-height: 90vh;
  }
  #popup_detail_image {
    height: 80vh;
    max-height: 80vh;
  }
  #popup_detail_image .popup_detail_image_right_panel,
  #popup_detail_image .popup_detail_image_left_panel {
    width: 100% !important;
  }
  #popup_detail_image .popup_detail_image_right_panel {
    order: 2;
  }
  #popup_detail_image .popup_detail_image_left_panel {
    order: 1;
  }
  #popup_detail_image img {
    max-height: 40vh;
    height: auto;
  }
  #container,
  .container {
    min-width: 0;
    width: 100%;
    gap: 8px;
  }
  textarea,
  input[type="text"],
  select {
    max-width: 100%;
  }
  select{
    width:100%!important;
  }
  .resize_disappear{
    display: none;
  }
  .monkey-info-bar {
    padding: 6px 8px;
    gap: 12px;
  }
  .bar-server-msg {
    padding: 6px 8px;
    gap: 12px;
    height: var(--server-bar-height);
    box-sizing: border-box;
  }

  #animations_menu th:nth-child(6),
  #animations_menu td:nth-child(6) {
    display: none;
  }
  #lastsignin_menu th:nth-child(5),
  #lastsignin_menu td:nth-child(5),
  #lastsignin_menu th:nth-child(6),
  #lastsignin_menu td:nth-child(6),
  #lastsignin_menu th:nth-child(7),
  #lastsignin_menu td:nth-child(7) {
    display: none;
  }
  #popup_detail th:nth-child(5),
  #popup_detail td:nth-child(5),
  #popup_detail th:nth-child(6),
  #popup_detail td:nth-child(6),
  #popup_detail th:nth-child(7),
  #popup_detail td:nth-child(7),
  #popup_detail th:nth-child(8),
  #popup_detail td:nth-child(8) {
    display: none;
  }
}

@media (max-width: 1000px) {
  .analytics_panel .panel_controls .btn:nth-child(n+5) {
    display: none;
  }
}

@media (max-width: 880px) {

    .login_container{
      margin: 24px auto;
      width: 85%;
      padding: 24px;
      box-sizing: border-box;
      position: static;
    }
  #popup_change_talkscript_raw{
    background-color: rgba(19, 25, 33,1);
    padding:14px;
    line-height: 1.5;
    letter-spacing:0.25;
    font-family: "Cascadia Mono";
    overflow: auto;
    font-weight: 380!important;
    font-size: 14px;
  }
  .rc-graph-mobile {
    width: 100%;
    display: block;
  }
  /* nav drawer styles */
  .rc-nav-mount {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 301;
    padding-bottom: 4px;
  }
  .rc-nav-mount{
    background-color:rgba(20, 25, 21,0.75) ;
    border:1px solid rgba(165, 165, 165,0.3) ;
    padding: 6px;
    border-radius: 12px;
  }
  .rc-nav-toggle {
    display: block;
    position: sticky;
    top: 0;
    z-index: 302;
    width: 100%;
    text-align: center;
    background: #1d3e4a; /* subtle blue lift for Actions */
    border: 1px solid rgba(60, 170, 190, 0.9);
  }
  /* greener tint for Navigation toggle only */
  .rc-nav-toggle-bottom {
    background: #1c4a47; /* Navigation: greener */
    border-color: rgba(43, 220, 180, 0.9);
    margin-bottom:6px ;
  }
  .rc-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 298;
    display: none;
  }
  .rc-nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 6299;
    background: #0c1314;
    padding: 14px;
    display: none;
    overflow-y: auto;
   background: linear-gradient(130deg, rgba(3, 24, 20, 1) 15%, rgba(16, 22, 22, 1) 70%);
  }
  .rc-nav-drawer .btn {
    width: 100%;
    text-align: center;
    padding: 20px 60px;
    margin: 10px 0;
  }
  .rc-nav-close {
    margin-bottom: 10px;
  }
  .rc-nav-drawer .nagivation_bottom,
  .rc-nav-drawer .nagivation_top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    height: auto;
  }

  /* stack main container */
  #container,
  .container {
    flex-direction: column;
    height: auto;
  }
  #right-panel,
  #right-panel-vuln,
  #main-left-screen {
    width: 100%;
    max-height: 88vh;
    height: 88vh;
    position: relative;
    overflow-y: auto;
  }
  #dashboard_menu,
  .lastsignin_menu,
  .gamesplayed_menu{
    padding: 8px;
    box-sizing: border-box;
  }
  .lastsignin_menu table,
  .gamesplayed_menu table{
    display: block;
    width: 100%;
    overflow-x: auto;
  }
  .lastsignin_menu th,
  .lastsignin_menu td,
  .gamesplayed_menu th,
  .gamesplayed_menu td{
    white-space: normal;
  }
  #steps_menu th:nth-child(6),
  #steps_menu td:nth-child(6),
  #steps_menu th:nth-child(7),
  #steps_menu td:nth-child(7),
  #gamesplayed_menu th:nth-child(2),
  #gamesplayed_menu td:nth-child(2),
  #gamesplayed_menu th:nth-child(5),
  #gamesplayed_menu td:nth-child(5),
  #gamesplayed_menu th:nth-child(8),
  #gamesplayed_menu td:nth-child(8),
  #gamesplayed_menu th:nth-child(7),
  #gamesplayed_menu td:nth-child(7) {
    display: none;
  }
  .analytics_summary_strip{
    flex-wrap: wrap;
  }
  .connection_hash_input {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    margin-top:6px;
    padding:6px;
  }
  .auth_btn{
    margin-top: 6px;
    font-size: 14px;
    margin-left: 0px;
  }
  /* large editors/panels shrink */
  .node_content {
    height: auto;
    max-height: 55vh;
  }
  /* give editors predictable space */
  .editor-container {
    height: 45vh;
    max-height: 45vh;
  }
  #editor-container{
      min-height: 65vh;
      max-height: 65vh;
  }
  #node-ids-container{
    display:none;
  }
  /* fixed height for content textareas/viewer */
  #raw_content,
  #formatted_content,
  #view_content,
  #view_markdown {
    height: 55vh;
    min-height: 55vh;
    max-height: 55vh;
    overflow: auto;
  }

  /* branch view more room for navigation */
  .branch_viewE {
    height: 60vh;
    max-height: 60vh;
  }
  #network_panel,
  #node_detail_panel {
    width: 100%;
  }

  .thumbnail_scroll_wrapper {
    height: 55vh;
    max-height: 55vh;
  }

  /* theory/enigma/games selects with fixed widths */
  .popup_game_steps_rightPanel,
  .theory_select_published_course,
  .problem_set_title_input,
  .popup_modify_qcm_textarea,
  .popup_modify_qcm_choice,
  .popup_modify_qcm_textarea_thin {
    width: 100% !important;
  }

  /* tighten button rows and allow wrapping */
  .monkey-info-bar.monkey_udpate_anim {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(44px, auto);
    gap: 12px;
    height: auto;
    min-height: 64px;
    align-items: stretch;
  }
  .monkey-info-bar.monkey_udpate_anim2 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(44px, auto);
    gap:6px 8px;
    height: auto;
    min-height: 64px;
    align-items: stretch;
      position: inherit;
  }
   .monkey_udpate_anim_c {
     display: grid;
     grid-template-columns: repeat(3, minmax(0, 1fr));
     grid-auto-rows: minmax(44px, auto);
     gap: 12px;
     align-items: stretch;
     font-size: 14px;
  }
  .monkey_udpate_anim2 .btn,
  .monkey_udpate_anim2 #markdown_color {
    padding: 6px 8px;
    margin: 0;
    font-size: 14px;
    text-align: center;
  }
  #popup_change_enigma .popup_change_anim_container{
    margin-top:0;
  }
  /* node action buttons grid */
  .buttons_node_panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(44px, auto);
    gap: 8px 6px;
    width: 100%;
  }
  .buttons_node_panel_c4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(44px, auto);
    gap:8px;
    font-size: 14px;
  }
  .buttons_node_panel_c4 .btn {
    padding: 6px 8px;
    margin: 0;
    font-size: 14px;
    text-align: center;
  }
  .course_title_annc {
    font-size: 14px;
  }
  .talk_script_elem_conf  {
    font-size: 12px;
  }
  .buttons_node_panel .button_node_panel {
    width: 100%;
    padding: 8px 10px;
    margin: 0;
    font-size: 14px;
    text-align: center;
  }
  .popup_av_qcm_codes_buttons{
      gap: 24px;
        position: sticky;
      background-color:rgba(20, 25, 21,0.85) ;
      border:1px solid rgba(155, 165, 161,0.4) ;
      border-radius:8px;
      bottom: 0;
      left: 0;
      width: 100%;
      padding: 8px 6px;
      z-index: 15;
      box-sizing: border-box;
      display: block;
  }
  .buttons_grid_show{
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
      grid-auto-rows: minmax(44px, 44px);
      gap: 8px;
      position: sticky;
      background-color:rgba(20, 25, 21,0.85) ;
      border:1px solid rgba(155, 165, 161,0.4) ;
      border-radius:8px;
      bottom: 0;
      left: 0;
      width: 100%;
      box-sizing: border-box;
      z-index: 5;
      padding: 8px 6px;
      align-self:flex-end;
  }
  .buttons_grid_show > * {
    width: 100%;
  }
  .buttons_grid_show button{
    width: 100%;
  }
  .buttons_grid_show > :nth-last-child(1):nth-child(3n + 1) {
    grid-column: 3;
  }

  /* If the last row has 2 items (total items = 3n+2), put the first of those in column 2 */
  .buttons_grid_show > :nth-last-child(2):nth-child(3n + 1) {
    grid-column: 2;
  }

    #popup_change_resource .pResource_leftScreen ,
    #popup_change_resource .pResource_rightScreen {
      width: 100% !important;
    }
  /* general popup scaling */
  .popup-new-course,
  .popup-upload-pdf,
  .popup_courses_listE,
  .popup_modify_qcm,
  .popup_detail_image,
  .popup_modif_vuln,
  .popup_modif_game,
  .popup_add_gamestep_item,
  .popup_character_selector,
  .popup_add_lesson_selector,
  #vuln_add_popup,
  #theory_add_popup,
  #popup_change_resource,
  #popup_modif_vulnerability_detail,
  #popup_change_game_config,
  #popup_change_enigma,
  #popup_change_theory_step,
  #popup_change_theory_step_detail,
  #popup_add_lesson_selector,
  #popup_av_add_animation,
  #popup_av_add_animation_theory,
  #popup_av_add_enigma,
  #popup_av_add_resource,
  #popup_av_qcm_codes,
  #popup_change_anim,
  #popup_change_anim0,
  #popup_change_anim0_user_action,
  #popup_change_talkscript{
    padding:10px!important;
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 88vh;
    overflow: auto;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    top: 6vh !important;
    box-sizing: border-box;
    filter: brightness(0.95); /* slight darken on small screens */
  }
  #popup_change_anim,
  #popup_change_anim0,
  #popup_change_anim0_user_action{
    height: 90vh !important;
    max-height: 90vh !important;
  }

  #popup_change_devcode_detail .popup_change_anim_conti_left ,
  #popup_change_devcode .popup_change_anim_conti_left {
    height:auto !important;
    min-height:5vh !important;
    max-height:40vh !important;
  }
  #popup_change_devcode_detail .popup_devcode_leftScreen ,
  #popup_change_devcode_detail .popup_devcode_rightScreen ,
  #popup_change_devcode .popup_devcode_leftScreen ,
  #popup_change_devcode .popup_devcode_rightScreen {
  width: 100%!important;
  max-width: 100%!important;

  }
  /* table overflow helpers: keep wrappers in control, let cells wrap (leave #popup_av_qcm_codes unchanged) */
  #popup_av_add_animation table,
  #popup_av_add_animation_theory table,
  #popup_av_add_enigma table,
  #popup_av_add_resource table,
  .popup_add_gamestep_item table {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
  }
  #popup_av_add_animation th, #popup_av_add_animation td,
  #popup_av_add_animation_theory th, #popup_av_add_animation_theory td,
  #popup_av_add_enigma th, #popup_av_add_enigma td,
  #popup_av_add_resource th, #popup_av_add_resource td,
  .popup_add_gamestep_item th, .popup_add_gamestep_item td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .popup_table_scroll_anim,
  .popup_add_gamestep_item {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  /* Sticky action bar for popups on mobile */
  /* Lesson selector: larger, left-aligned checkboxes and flex alignment */
  .tree-item,
  #lesson_selector_branch_viewE_wrapper input[type="checkbox"],
  #lesson_selector_branch_viewE_wrapper label,
  #lesson_selector_branch_viewE_wrapper span {
    box-sizing: border-box;
  }
  .tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 13px;
  }
  .btn_add_codes{
    font-size: 16px;]
    font-weight: bold;
  }
  input[type="checkbox"]{
    transform: scale(1.5);
      box-sizing: border-box;
  }
  .tree-item input[type="checkbox"] {
    margin-right: 10px;
  }
  /* Mode column width cap */
  #popup_av_add_animation th:nth-child(3),
  #popup_av_add_animation td:nth-child(3),
  #popup_av_add_animation_theory th:nth-child(3),
  #popup_av_add_animation_theory td:nth-child(3),
  #popup_av_add_enigma th:nth-child(3),
  #popup_av_add_enigma td:nth-child(3),
  #popup_av_add_resource th:nth-child(3),
  #popup_av_add_resource td:nth-child(3),
  .popup_add_gamestep_item th:nth-child(3),
  .popup_add_gamestep_item td:nth-child(3) {
    width: 15%;
    max-width: 15%;
  }
  /* Shared mobile cell sizing for tables (applies to animations/games/theory popups/lists) */
  #resource_menu td, #resource_menu th,
  #animations_menu td, #animations_menu th,
  #games_menu td, #games_menu th,
  #enigma_menu td, #enigma_menu th,
  #theory_menu td, #theory_menu th,
  .popup_add_gamestep_item td, .popup_add_gamestep_item th,
  #popup_av_add_animation td, #popup_av_add_animation th,
  #popup_av_add_animation_theory td, #popup_av_add_animation_theory th,
  #popup_av_add_enigma td, #popup_av_add_enigma th,
  #popup_av_add_resource td, #popup_av_add_resource th {
    padding: 6px 8px !important;
    font-size: 13px !important;
    box-sizing: border-box;
  }
  .anim_order_info{
    font-size: 14px;
    width: fit-content;
    height: fit-content;
    /* padding: 6px 12px; */
    border-radius: 12px;
  }
  .monkey_udpate_anim .anim_order_info{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
      display: inline-flex;
      flex-wrap: wrap;
      white-space: normal;
      word-break: keep-all;
      overflow-wrap: normal;
      hyphens: none;
  }
  .popup_modify_qcm span {
      margin-right: 0px;
  }
  /* Animations menu content column: 2x2 grid tokens */
  #animations_menu td:nth-child(3) .anim_order_info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
  }
  #animations_menu td:nth-child(3) .anim_order_info .anim_token{
    display: block;
  }
  #popup_av_add_animation th:nth-child(3),
  #popup_av_add_animation td:nth-child(3) {
    width: 12%;
    max-width: 12%;
  }
  /* stack multi-column popup content on mobile */
  .popup_change_anim_container,
  .popup_change_anim_container_animConf,
  .popup_update_game_container,
  .popup_userAction_central {
    flex-direction: column;
    max-height: none;
    height: auto;
    width: 100%;
  }
  .popup_change_anim_container_leftScreen,
  .popup_change_anim_container_rightScreen,
  .popup_change_anim_container_users,
  .popup_change_anim_container_animConf,
  .popup_update_game_container_leftScreen,
  .popup_update_game_conti_left,
  .popup_userAction_leftPanel,
  .popup_userAction_rightPanel {
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
  }
  .popup_change_anim_container_users,
  .popup_change_anim_container_anims {
    max-height: 40vh;
    height: auto;
    overflow: auto;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* stretch selects consistently in popups */
  .popup_modify_qcm select,
  .popup_modif_vuln select,
  .popup-upload-pdf select,
  .popup_courses_listE select,
  .popup_add_lesson_selector select,
  .popup_change_anim_container select,
  .popup_userAction_leftPanel select,
  .popup_change_talkscript_rightPanel select {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* normalize button grids across popups */
  .popup_modify_qcm .buttons_grid_show,
  .popup_modif_vuln .buttons_grid_show,
  .popup-upload-pdf .buttons_grid_show,
  .popup_add_lesson_selector .buttons_grid_show,
  .popup_change_talkscript .buttons_grid_show {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  }
  .buttons_grid_show > div {
    width: 100%;
    display: contents;
  }

  /* lesson selector two-phase buttons */
  .popup_add_lesson_selector .popup_av_qcm_codes_buttons {
    display: grid;
    gap: 8px;
  }

  /* talkscript and user action layouts */
  .popup_userAction_central {
    flex-direction: column;
    align-items: stretch;
  }
  .popup_userAction_leftPanel,
  .popup_userAction_rightPanel,
  .popup_change_talkscript_rightPanel {
    width: 100% !important;
    height: auto;
    max-height: 70vh;
    box-sizing: border-box;
    overflow: auto;
  }
  .popup_change_talkscript_button,
  .popup_change_talkscript_rightPanel .vuln_modif_line_teal,
  .popup_change_talkscript_rightPanel .vuln_modif_line {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
  }
  .popup_change_talkscript_rightPanel button,
  .popup_change_talkscript_rightPanel select,
  .popup_change_talkscript_rightPanel textarea,
  .popup_change_talkscript_rightPanel .talk_script_elem_audio_file_value {
    width: 100%;
    box-sizing: border-box;
  }
  .talk_script_elem_cont{
    gap:12px;
  }
  .camera_info_bubble{
    padding:6px;
  }
  .padding_buttons{
    padding:6px;
    border-radius: 6px;
  }
  .popup_userAction_rightPanel .popup_change_anim_container_users,
  .popup_userAction_rightPanel .bubles_actions_talk {
    width: 100%;
    box-sizing: border-box;
    overflow: auto;
  }

  /* keep label + control on one line while letting controls stretch (mobile) */
  .popup_modify_qcm .vuln_modif_line,
  .popup_modify_qcm .vuln_modif_line_teal,
  .popup_modif_vuln .vuln_modif_line,
  .popup_modif_vuln .vuln_modif_line_teal,
  .popup-upload-pdf .vuln_modif_line,
  .popup-upload-pdf .vuln_modif_line_teal,
  .popup_add_lesson_selector .vuln_modif_line,
  .popup_add_lesson_selector .vuln_modif_line_teal,
  .popup_change_anim_container .vuln_modif_line,
  .popup_change_anim_container .vuln_modif_line_teal,
  .popup_userAction_central .vuln_modif_line,
  .popup_userAction_central .vuln_modif_line_teal,
  .popup_change_talkscript_rightPanel .vuln_modif_line,
  .popup_change_talkscript_rightPanel .vuln_modif_line_teal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }
  .popup_modify_qcm .vuln_modif_line > span,
  .popup_modify_qcm .vuln_modif_line_teal > span,
  .popup_modif_vuln .vuln_modif_line > span,
  .popup_modif_vuln .vuln_modif_line_teal > span,
  .popup-upload-pdf .vuln_modif_line > span,
  .popup-upload-pdf .vuln_modif_line_teal > span,
  .popup_add_lesson_selector .vuln_modif_line > span,
  .popup_add_lesson_selector .vuln_modif_line_teal > span,
  .popup_change_anim_container .vuln_modif_line > span,
  .popup_change_anim_container .vuln_modif_line_teal > span,
  .popup_userAction_central .vuln_modif_line > span,
  .popup_userAction_central .vuln_modif_line_teal > span,
  .popup_change_talkscript_rightPanel .vuln_modif_line > span,
  .popup_change_talkscript_rightPanel .vuln_modif_line_teal > span {
    flex: 0 0 auto;
    max-width: 100%;
  }
  .popup_modify_qcm .vuln_modif_line > :not(span),
  .popup_modify_qcm .vuln_modif_line_teal > :not(span),
  .popup_modif_vuln .vuln_modif_line > :not(span),
  .popup_modif_vuln .vuln_modif_line_teal > :not(span),
  .popup-upload-pdf .vuln_modif_line > :not(span),
  .popup-upload-pdf .vuln_modif_line_teal > :not(span),
  .popup_add_lesson_selector .vuln_modif_line > :not(span),
  .popup_add_lesson_selector .vuln_modif_line_teal > :not(span),
  .popup_change_anim_container .vuln_modif_line > :not(span),
  .popup_change_anim_container .vuln_modif_line_teal > :not(span),
  .popup_userAction_central .vuln_modif_line > :not(span),
  .popup_userAction_central .vuln_modif_line_teal > :not(span),
  .popup_change_talkscript_rightPanel .vuln_modif_line > :not(span),
  .popup_change_talkscript_rightPanel .vuln_modif_line_teal > :not(span) {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* Mobile: prevent checkbox rows from forcing horizontal overflow */
  .vuln_modif_line {
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
  }
  .vuln_modif_line > :not(span) {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .vuln_modif_line_grid{
    display: flex;
  }
  .vuln_modif_line input[type="checkbox"] {
    flex: 0 0 auto;
    height:16px;
    width:16px;
    border-radius:6px;
    opacity:0.9;
    margin-left: 5%;
  }
  .vuln_modif_line button,
  .vuln_modif_line input[type="button"],
  .vuln_modif_line input[type="submit"] {
    flex: 0 0 auto;
    width: auto !important;
    max-width: none !important;
  }
  .popup_change_anim_container_anims {
    min-height: 50vh;
    max-height: 50vh;
  }

  .popup_userAction_leftPanel,
  .popup_gamesteps_long_container,
  #popup_change_anim_container_anims,
  #popup_change_anim0_talkscripts,
  #popup_change_theory_step_covered_steps_container{
    height: auto;
    min-height: 10vh;
    overflow: auto;
  }
  /* published courses popup sizing on small screens */
  .popup_courses_listE {
    width: 90vw;
  }
  .published_courses_list_wrapper {
    width: 100%;
    height: 60vh;
    max-height: 60vh;
  }
  /* keep sticky stack identical to desktop */
  .bar-server-msg {
    top: 0;
  }
  #main-left-screen .search-bar-zone {
    top: var(--server-bar-height);
    height: var(--search-bar-height);
    box-sizing: border-box;
    z-index: 950;
  }
  #main-left-screen thead {
    top: calc(var(--server-bar-height) + var(--search-bar-height));
  }

  /* qcm select popups: larger tap targets on mobile */
  #popup_av_qcm_codes {
    height: fit-content !important;
  }
  #popup_av_qcm_codes th,
  #popup_av_qcm_codes td {
    font-size: 14px;
    padding: 10px 12px;
  }

  /* local courses popup sizing on small screens */
  .courses_list_wrapper {
    width: 100%;
    height: 60vh;
    max-height: 60vh;
  }

  #popup_change_chapter_node_branch .chapter_node_game_order{
    display: none;
  }
  .chapter_nodes_tree li{
    overflow: hidden;
  }
  #popup_change_chapter_node_branch .chapter_node_i_card{

    /*   max-height: 60px; */
  }
  #popup_change_chapter_node_branch .chapter_nodes_tree > li{
    margin: 0;
  }
  /* vulnerabilities table: tighten layout and widths */
  #vulnerabilities_menu table {
    table-layout: fixed;
    width: 100%;
  }
  #vuln_add_popup th,
  #vuln_add_popup td,
  #theory_add_popup th,
  #theory_add_popup td,
  #devcode_add_popup th,
  #devcode_add_popup td,
  #popup_av_add_animation_gamevuln th,
  #popup_av_add_animation_gamevuln td,
  #popup_change_chapter_node_add_game th,
  #popup_change_chapter_node_add_game td,
  #vulnerabilities_menu th,
  #vulnerabilities_menu td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: none;
  }

  #vuln_add_popup th:nth-child(1),
  #vuln_add_popup td:nth-child(1),
  #theory_add_popup th:nth-child(1),
  #theory_add_popup td:nth-child(1),
  #devcode_add_popup th:nth-child(1),
  #devcode_add_popup td:nth-child(1),
  #popup_av_add_animation_gamevuln th:nth-child(1),
  #popup_av_add_animation_gamevuln td:nth-child(1),
  #vulnerabilities_menu th:nth-child(1),
  #vulnerabilities_menu td:nth-child(1),
  #popup_change_chapter_node_add_game th:nth-child(1),
  #popup_change_chapter_node_add_game td:nth-child(1),
  #vulnerabilities_menu th:nth-child(2),
  #vulnerabilities_menu td:nth-child(2) {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  #enigma_menu th:nth-child(1),
  #enigma_menu td:nth-child(1) {
    width: 45%;
  }
  #vuln_add_popup th:nth-child(1),
  #vuln_add_popup td:nth-child(1),
  #theory_add_popup th:nth-child(1),
  #theory_add_popup td:nth-child(1),
  #devcode_add_popup th:nth-child(1),
  #devcode_add_popup td:nth-child(1),
  #popup_av_add_animation_gamevuln th:nth-child(1),
  #popup_av_add_animation_gamevuln td:nth-child(1),
  #popup_change_chapter_node_add_game th:nth-child(1),
  #popup_change_chapter_node_add_game td:nth-child(1),
  #vulnerabilities_menu th:nth-child(1),
  #vulnerabilities_menu td:nth-child(1) {
    width: 45%;
  }
  #games_menu th:nth-child(1),
  #games_menu td:nth-child(1) {
    width: 1%;
  }

  #vuln_add_popup th:nth-child(2),
  #vuln_add_popup td:nth-child(2),
  #theory_add_popup th:nth-child(2),
  #theory_add_popup td:nth-child(2),
  #devcode_add_popup th:nth-child(2),
  #devcode_add_popup td:nth-child(2),
  #popup_av_add_animation_gamevuln th:nth-child(2),
  #popup_av_add_animation_gamevuln td:nth-child(2),
  #vulnerabilities_menu th:nth-child(2),
  #vulnerabilities_menu td:nth-child(2),
  #enigma_menu th:nth-child(2),
  #enigma_menu td:nth-child(2) ,
  #devcode_menu th:nth-child(2),
  #devcode_menu td:nth-child(2) {
    width: 22%;
    display:none;
  }
  #games_menu th:nth-child(2),
  #games_menu td:nth-child(2) {
    width: 55%;
  }
  #vuln_add_popup table,
  #devcode_add_popup table,
  #popup_av_add_animation table,
  #popup_av_add_animation_theory table,
  #popup_av_add_animation_gamevuln table,
  #theory_add_popup table{
    font-size: 13px;
  }
  #vuln_add_popup th:nth-child(3),
  #vuln_add_popup th:nth-child(3),
  #vulnerabilities_menu th:nth-child(3),
  #vulnerabilities_menu td:nth-child(3),
  #vulnerabilities_menu th:nth-child(4),
  #vulnerabilities_menu td:nth-child(4) {
    width: 22%;
  }
  #popup_change_chapter_node_add_game th:nth-child(2),
  #popup_change_chapter_node_add_game td:nth-child(2) {
    width: 5%;
  }
  #enigma_menu th:nth-child(3),
  #enigma_menu td:nth-child(3) {
    width: 5%;
  }
  #games_menu th:nth-child(3),
  #games_menu td:nth-child(3) {
    width: 8%;
  }
  #enigma_menu th:nth-child(4),
  #enigma_menu td:nth-child(4) {
    width: 8%;
  }
  #popup_change_chapter_node_add_game th:nth-child(3),
  #popup_change_chapter_node_add_game td:nth-child(3) {
    width: 18%;
  }
  #popup_change_chapter_node_add_game th:nth-child(4),
  #popup_change_chapter_node_add_game td:nth-child(4) {
    width: 8%;
  }
  #devcode_menu th:nth-child(3),
  #devcode_menu td:nth-child(3) {
    width: 18%;
  }
  #devcode_add_popup th:nth-child(4),
  #devcode_add_popup td:nth-child(4),
  #devcode_menu th:nth-child(4),
  #devcode_menu td:nth-child(4) {
    width: 13%;
  }
  #devcode_menu th:nth-child(5),
  #devcode_menu td:nth-child(5) {
    width: 10%;
  }
  #vulnerabilities_menu th:nth-child(5),
  #vulnerabilities_menu td:nth-child(5) {
    display: none;
  }
  #enigma_menu th:nth-child(5),
  #enigma_menu td:nth-child(5) {
    width: 12%;
  }
  #devcode_add_popup th:nth-child(5),
  #devcode_add_popup td:nth-child(5) ,
  #games_menu th:nth-child(5),
  #games_menu td:nth-child(5) {
    width: 12%;
  }
  #vulnerabilities_menu th:nth-child(6),
  #vulnerabilities_menu td:nth-child(6) {
    width: 18%;
  }
  #enigma_menu th:nth-child(6),
  #enigma_menu td:nth-child(6) {
    width: 8%;
  }

  #games_menu th:nth-child(6),
  #games_menu td:nth-child(6),
  #devcode_menu th:nth-child(6),
  #devcode_menu td:nth-child(6) {
    display: none;
  }
  #vulnerabilities_menu th:nth-child(7),
  #vulnerabilities_menu td:nth-child(7) {
    display: none;
    width: 14%;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: normal;
    text-overflow: unset;
    line-height: 1.25;
    max-height: 2.6em;
  }
  #enigma_menu th:nth-child(7),
  #enigma_menu td:nth-child(7) {
    display: none;
  }
   .cia_bar {
    gap: 4px;
    font-size: 11px;
  }
  #vulnerabilities_menu .cia_track {
    flex: 1 1 100%;
    max-width: 100%;
    height: 12px;
  }

  /* animations table: allow only content column to wrap at spaces; cap team */
  #animations_menu table {
    table-layout: fixed;
    width: 100%;
  }
  #animations_menu th,
  #animations_menu td {
    min-width: 0;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: none;
  }
  #animations_menu th:nth-child(1),
  #animations_menu td:nth-child(1),
  #animations_menu th:nth-child(2),
  #animations_menu td:nth-child(2) {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  #animations_menu th:nth-child(2),
  #animations_menu td:nth-child(2) {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  #animations_menu th:nth-child(1),
  #animations_menu td:nth-child(1) {
    max-width: 45%;
  }
  #animations_menu th:nth-child(2),
  #animations_menu td:nth-child(2) {
    width: 5%;
    display: none;
  }
  #animations_menu td:nth-child(3) .anim_order_info {
    display: inline-flex;
    flex-wrap: wrap;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
  }
  #animations_menu td:nth-child(3) .anim_order_info .anim_token {
    display: inline-block;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
  }
  #animations_menu th:nth-child(3),
  #animations_menu td:nth-child(3) {
    width: 22%;
    max-width: 22%;
    padding:6px!important;
  }
  #animations_menu th:nth-child(4),
  #animations_menu td:nth-child(4) {
    width: 18%;
    max-width: 18%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  #animations_menu th:nth-child(5),
  #animations_menu td:nth-child(5) {
    width: 20%;
    max-width: 20%;
  }
  #animations_menu td:nth-child(6), #animations_menu th:nth-child(6) {
    display: none;
  }
  /* theory table: cap team/entry to leave room for titles */
  #theory_menu table {
    table-layout: fixed;
    width: 100%;
  }
  #theory_menu th,
  #theory_menu td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: none;
  }
  #theory_menu th:nth-child(1),
  #theory_menu td:nth-child(1),
  #theory_menu th:nth-child(2),
  #theory_menu td:nth-child(2) {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  #theory_menu th:nth-child(1),
  #theory_menu td:nth-child(1) {
    width: 40%;
    max-width: 40%;
  }
  #resource_menu th:nth-child(2),
  #resource_menu td:nth-child(2) {
    display: none;
  }
  #resource_menu th:nth-child(6),
  #resource_menu td:nth-child(6) {
    display: none;
  }
  #theory_menu th:nth-child(2),
  #theory_menu td:nth-child(2) {
    width: 26%;
    max-width: 26%;
    display: none;
  }
  #resource_menu th:nth-child(3),
  #resource_menu td:nth-child(3),
  #resource_menu th:nth-child(4),
  #resource_menu td:nth-child(4){
      width: 16%;
      max-width: 16%;
  }
  #resource_menu th:nth-child(5),
  #resource_menu td:nth-child(5) {
    width: 8%;
    max-width: 8%;
  }
  #theory_menu th:nth-child(3),
  #theory_menu td:nth-child(3) {
    width: 18%;
    max-width: 18%;
  }
  #theory_menu th:nth-child(4),
  #theory_menu td:nth-child(4),
  #theory_menu th:nth-child(5),
  #theory_menu td:nth-child(5) {
    width: 10%;
    max-width: 10%;
  }
  #theory_menu th:nth-child(6),
  #theory_menu td:nth-child(6) {
      display: none;
  }
  #popup_change_anim0_talkscripts,
  #popup_change_anim0_user_action {
    max-height: 75vh;
  }

  /* wide inputs/selects in popups */
  .popup_modify_qcm textarea,
  .popup_upload-pdf textarea,
  .popup_detail_image input[type="text"],
  .enigma_config_block input[type="text"],
  .popup_detail_image textarea,
  .popup_modif_game textarea,
  .popup_add_gamestep_item textarea,
  #popup_generate_qcm textarea,
  #popup_change_enigma textarea,
  #popup_change_theory_step textarea,
  #popup_change_theory_step_detail textarea,
  #popup_generate_qcm_data,
  #popup_modify_qcm_textarea,
  #popup_modify_qcm_question,
  #popup_modify_qcm_choiceA,
  #popup_modify_qcm_choiceB,
  #popup_modify_qcm_choiceC,
  #popup_modify_qcm_choiceD,
  #popup_modify_qcm_explanation,
  #popup_modify_qcm_code {
    width: 100% !important;
    box-sizing: border-box;
    margin:auto;
  }
  input[type="text"]{
      width: 100% !important;
      box-sizing: border-box;
  }
  /* ensure popup form fields never overflow container */
  [class*="popup"] textarea,
  [id^="popup_"] textarea {
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* ensure key QCM textareas have comfortable height on mobile */
  #popup_generate_qcm_data,
  #popup_modify_qcm_textarea,
  #popup_modify_qcm_question,
  #popup_modify_qcm_choiceA,
  #popup_modify_qcm_choiceB,
  #popup_modify_qcm_choiceC,
  #popup_modify_qcm_choiceD,
  #popup_modify_qcm_explanation,
  #popup_modify_qcm_code {
    min-height: 80px;
    height: auto;
  }

  /* stack footer/header nav buttons when shown */
  .nagivation .btn,
  .monkey-info-bar.nagivation_bottom .btn {
    width: 100%;
    text-align: center;
  }

  /* thumbnail/QCM grids become single column */
  /* removed thumbnail_grid*/
  .thumbnail_table{
    width: 100%;
  }
  .thumbnail_cell {
    width: 100%;
    display: block;
  }
  .vuln_search_bar{
    height:30px;
  }

  td{
    padding: 6px 8px !important;
    font-size:13px !important;
  }
  #popup_av_add_enigma table td{
     padding: 6px 8px !important;
     font-size:13px !important;
  }
  .enigma_config_block label{
    font-size:14px;
    font-weight:500;
  }
  .problem_set_card textarea{
    font-size:14px;
      min-height: 50vh;
      max-height: 50vh;
  }
  .vuln_modif_line_blue,
  .vuln_modif_line_red,
  .vuln_modif_line_all,
  .vuln_modif_line_teal{
      padding: 8px;
  }
  .vuln_modif_line_blue span,
  .vuln_modif_line_red span,
  .vuln_modif_line_all span,
  .vuln_modif_line_teal span{
    padding: 6px;
      padding-left: 12px;
  }
  #popup_change_theory_step .popup_change_anim_container_rightScreen{
    width:100%!important;
    max-width:100%!important;
    min-width:100%!important;
  }
  .popup_av_qcm_codes_buttons .btn{
    padding:0;
  }

  /* SSE terminal popup */
  .popup-sse-terminal {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 88vh;
    top: 6vh !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    box-sizing: border-box;
  }
  .sse-terminal-body {
    height: 55vh;
    max-height: 55vh;
  }
}

@media (max-width: 500px) {
  /* reorder is handled in JS; here we keep burger shell visible */
   td{
    padding: 6px 8px !important;
    font-size:13px !important;
  }
  #popup_av_add_enigma table td{
     padding: 6px 8px !important;
     font-size:13px !important;
  }
  /* vis.js area sizing */
  #mynetwork {
    width: 100%;
  }

  .problem_set_textarea,
  .problem_eval_textarea{
    min-height: 60vh;
    max-height: 60vh;
  }

  .node_content,
  .editor-container,
  .thumbnail_grid{
    max-height: 50vh;
  }
  #network_panel .branch_viewE{
    max-height: 74vh;
  }
  /* tighter tab row */
  .monkey_udpate_anim2 {
    gap: 4px;
  }
  .monkey_udpate_anim2 .btn {
    padding: 5px 8px;
    font-size: 12px;
  }

  /* popups: more compact */
  .popup-new-course,
  .popup-upload-pdf,
  .popup_courses_listE,
  .popup_modify_qcm,
  .popup_detail_image,
  .popup_modif_vuln,
  .popup_modif_game,
  .popup_add_gamestep_item,
  .popup_character_selector,
  .popup_add_lesson_selector,
  #popup_change_enigma,
  #popup_change_theory_step,
  #popup_change_theory_step_detail {
    padding: 12px !important;
    top: 6vh !important;
  }


  .vuln_modif_line_pop_add_anim, .vuln_modif_line_pop_qcm{
    height:70vh;
  }
}
