/* bd-mobile v1: TexAgs-style phone layout for thread list, forum list and posts.
   Desktop: only hides the phone-only meta lines. Everything else is inside the media query. */
.bd-mmeta { display: none; }

@media (max-width: 720px) {
  /* no sideways scrolling */
  html, body { max-width: 100%; overflow-x: hidden; }
  img, video, iframe, embed, object { max-width: 100%; }
  table.tborder { width: 100%; max-width: 100%; }

  /* ---- forumdisplay thread list ---- */
  .bd-tlist td.col-status, .bd-tlist td.col-icon, .bd-tlist .col-replies, .bd-tlist .col-views,
  .bd-tlist .col-lastpost, .bd-tlist td[id^="rating_table_"], .bd-tlist td.tcat:not(.col-subject) { display: none !important; }
  .bd-tlist td.forumdisplay_announcement { display: none !important; }
  .bd-tlist td.forumdisplay_announcement:nth-child(3) { display: table-cell !important; padding: 9px 10px !important; }
  .bd-tlist td.col-subject { width: auto !important; }
  .bd-tlist tr.bd-trow td.col-subject { padding: 9px 10px 8px !important; word-break: normal !important; overflow-wrap: break-word; line-height: 1.3; }
  /* v2 (Nov 23): stack the thread list as blocks, not table columns, so column sizing can never squeeze the title to one letter wide */
  table.bd-tlist, table.bd-tlist > tbody { display: block; width: 100% !important; box-sizing: border-box; }
  table.bd-tlist > tbody > tr { display: flex; width: 100%; }
  table.bd-tlist > tbody > tr > td { display: block; box-sizing: border-box; flex: 1 1 auto; min-width: 0; }
  table.bd-tlist > tbody > tr.bd-trow > td.col-subject { flex: 1 1 0; min-width: 70%; }
  table.bd-tlist > tbody > tr.bd-trow > td:not(.col-subject) { flex: 0 0 auto; width: auto !important; max-width: 30%; display: flex; align-items: center; }
  .bd-tlist tr.bd-trow td.col-subject > div > div { display: none; }
  .bd-tlist tr.bd-trow td.col-subject > div > span a { font-size: 15px; font-weight: bold; }
  .bd-tlist .bd-mmeta { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.4; color: #5f6d64; }
  .bd-tlist .bd-mmeta a { font-size: 11.5px !important; font-weight: normal !important; }
  .bd-tlist .bd-mmeta .bd-sep { color: #a8b3ab; padding: 0 2px; }

  /* ---- index forum list ---- */
  .bd-flist td.col-status, .bd-flist td.col-threads, .bd-flist td.col-posts, .bd-flist td.col-lastpost,
  .bd-flist td.tcat:not(.col-forum) { display: none !important; }
  .bd-flist td.col-forum { width: auto !important; padding: 9px 10px 8px !important; word-break: normal !important; overflow-wrap: anywhere; }
  .bd-flist td.col-forum > strong a { font-size: 15px; }
  .bd-flist td.col-forum > div.smalltext:not(.bd-mmeta) { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; color: #5f6d64; margin-top: 2px; }
  .bd-flist .bd-mmeta { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.4; color: #5f6d64; }
  .bd-flist .bd-mmeta .bd-sep { color: #a8b3ab; padding: 0 2px; }
  .bd-flist .bd-mm-last { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .3em; }
  .bd-flist .bd-mm-last > span, .bd-flist .bd-mm-last > div, .bd-flist .bd-mm-last strong { display: contents; }
  .bd-flist .bd-mm-last br { display: none; }
  .bd-flist .bd-mm-last a { font-size: 11.5px !important; font-weight: normal !important; }
  .bd-flist .bd-mm-last > span > a:first-child { font-weight: bold !important; }

  /* ---- showthread posts (horizontal and classic postbit) ---- */
  .post .post_author, .post.classic .post_author { display: flex; align-items: center; gap: 9px; float: none !important; width: auto !important; padding: 7px 8px !important; border-right: 0 !important; text-align: left !important; }
  .post .post_author div.author_avatar { float: none !important; margin: 0 !important; flex: 0 0 auto; }
  .post .post_author div.author_avatar img { width: 38px !important; height: 38px !important; max-width: 38px; max-height: 38px; }
  .post .post_author div.author_information { float: none !important; padding: 0 !important; min-width: 0; line-height: 1.25; }
  .post .post_author div.author_information .largetext { font-size: 15px; }
  .post .post_author div.author_information .smalltext { display: block; margin-top: 2px; }
  .post .post_author div.author_information .smalltext br { display: none; }
  .post .post_author div.author_information .smalltext img[src*="star"] { width: 11px; height: 11px; vertical-align: -1px; }
  .post .post_author div.author_information .smalltext img:not([src*="star"]) { height: 22px; width: auto; vertical-align: middle; margin-left: 3px; }
  .post .post_author .author_statistics { display: none !important; }
  .post.classic .post_content { float: none !important; width: auto !important; padding: 0 !important; }
  .post .post_head > .float_right { float: right !important; text-align: right !important; }
  .post .post_head { padding: 6px 8px 5px !important; margin: 0 !important; font-size: 11.5px; }
  .post .post_body { padding: 8px 10px !important; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
  .post .post_body img, .post .post_body iframe, .post .post_body video { max-width: 100% !important; height: auto; }
  .post .post_body table { display: block; max-width: 100%; overflow-x: auto; }
  .post .post_body pre, .post .post_body code, .post .post_body .codeblock { max-width: 100%; overflow-x: auto; white-space: pre-wrap; }
  .post .post_body blockquote { margin: 6px 0 !important; padding: 6px 8px !important; }
  .post_controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; padding: 5px 8px !important; }
  .post_controls .postbit_buttons { float: none !important; display: flex; flex-wrap: wrap; gap: 4px; }
  .post_controls .postbit_buttons > a { margin: 0 !important; }
  .post_controls.tyllist { display: block; font-size: 11.5px; }
}

/* BEGIN bd-mobile-compose */
/* Phone compose forms: stack each label above its field, full-width editor.
   Desktop (min-width 721px) is unchanged. */
@media (max-width: 720px) {
  form[name="input"] table.tborder,
  #quick_reply_form table.tborder {
    display: block;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  form[name="input"] table.tborder > thead,
  form[name="input"] table.tborder > tbody,
  #quick_reply_form table.tborder > thead,
  #quick_reply_form table.tborder > tbody {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  form[name="input"] table.tborder tr,
  #quick_reply_form table.tborder tr {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  form[name="input"] table.tborder th,
  form[name="input"] table.tborder td,
  #quick_reply_form table.tborder th,
  #quick_reply_form table.tborder td {
    display: block;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    float: none !important;
    height: auto !important;
  }

  /* The smilies picker lives in the left column inside a 170px wrapper and
     squeezed the editor off-screen. Hide it on phones; SCEditor has emoticons. */
  form[name="input"] #clickable_smilies,
  form[name="input"] div[style*="width: 170px"],
  form[name="input"] div[style*="width:170px"] {
    display: none !important;
  }

  form[name="input"] input.textbox,
  form[name="input"] input.textbox[name="subject"],
  form[name="input"] textarea,
  form[name="input"] select,
  form[name="input"] input.fileupload,
  #quick_reply_form textarea,
  #quick_reply_form td > div[style*="width"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  form[name="input"] .posticons_label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 2px 10px 4px 0;
    white-space: nowrap;
  }

  /* SCEditor may set an inline pixel width from the (narrow) parent at init. */
  form[name="input"] .sceditor-container,
  #quick_reply_form .sceditor-container,
  .sceditor-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  form[name="input"] .sceditor-container iframe,
  form[name="input"] .sceditor-container textarea,
  form[name="input"] .sceditor-container .sceditor-resize-cover,
  #quick_reply_form .sceditor-container iframe,
  #quick_reply_form .sceditor-container textarea,
  .sceditor-container iframe,
  .sceditor-container textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .sceditor-container .sceditor-toolbar {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    box-sizing: border-box;
  }
  .sceditor-container .sceditor-group {
    display: inline-block;
    vertical-align: middle;
    margin-bottom: 2px;
  }

  .bdpasteimg-addphoto-wrap {
    display: block;
    margin: 6px 0 0;
    max-width: 100%;
  }
  .bdpasteimg-addphoto {
    max-width: 100%;
  }

  form[name="input"] table.tborder td[style*="white-space"] {
    white-space: normal !important;
  }

  form[name="input"],
  #quick_reply_form {
    max-width: 100%;
    overflow-x: hidden;
  }
}
/* END bd-mobile-compose */
