/*
  Professional MyBB visual layer, aware of the existing custom plugins.
  Load after the current theme CSS and plugin inline styles.

  Preserved plugin surfaces:
  - forumdisplay_grid_*: .fdgrid-*
  - index_forum_grid: .ifgrid-*
  - portal_most_popular: .pmp-*
  - hashtags/forum14_hashtags: .hashtag-chip, .ht-*, .f14ht-*
  - content/filehost/scat/zoo alerts: #cam-*, #fhmn-*, #scat-alert-*, #zoo-alert-*
  - image guard/premium/upvotes: .ig-card-*, .premium-*, .thread-vote, .post-upvote
*/

:root {
  --pro-page: var(--page-bg, #fff6f8);
  --pro-surface: var(--surface, #ffffff);
  --pro-surface-muted: var(--surface-muted, #f8eef2);
  --pro-border: var(--border-subtle, #e6cfd7);
  --pro-border-strong: var(--border-strong, #d3b1bf);
  --pro-brand: var(--spruce, #8d4a5d);
  --pro-brand-soft: var(--spruce-soft, #f2dbe3);
  --pro-ink: var(--green, #3b1822);
  --pro-ink-soft: var(--green-soft, #f7e2e8);
  --pro-text: var(--text-main, #2b1b22);
  --pro-muted: var(--text-soft, #3f2f37);
  --pro-on-dark: var(--text-on-dark, #fff6f8);
  --pro-radius: 10px;
  --pro-radius-sm: 6px;
  --pro-shadow: 0 12px 34px rgba(61, 24, 34, 0.10);
  --pro-shadow-soft: 0 7px 20px rgba(61, 24, 34, 0.08);
  --pro-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

html {
  background: var(--pro-page);
}

body {
  min-width: 0 !important;
  background:
    radial-gradient(circle at 50% -120px, rgba(141, 74, 93, .16), transparent 380px),
    linear-gradient(180deg, #ffffff 0%, var(--pro-page) 58%, #fff0f4 100%) !important;
  color: var(--pro-text) !important;
  font-family: var(--pro-font) !important;
  font-size: 14px;
  line-height: 1.58;
  text-rendering: optimizeLegibility;
}

img,
video,
iframe {
  max-width: 100%;
}

#container {
  min-width: 0 !important;
  color: var(--pro-text) !important;
  font-family: var(--pro-font) !important;
}

.wrapper {
  width: min(100% - 32px, 1320px) !important;
  min-width: 0 !important;
  max-width: none !important;
  margin-inline: auto !important;
}

#content {
  background: transparent !important;
  overflow: visible !important;
  padding: 18px 0 34px !important;
}

/* Header and logo */
#logo {
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,246,248,.96)) !important;
  border-bottom: 1px solid var(--pro-border) !important;
  padding: 18px 0 !important;
}

#logo .wrapper,
.header-inner {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  min-height: 236px;
}

#logo .wrapper > a,
.header-inner .logo {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

#logo img,
.logo img,
.header-inner .logo img {
  display: block;
  width: auto !important;
  max-width: min(100%, 760px) !important;
  max-height: 236px !important;
  min-height: 132px;
  object-fit: contain;
}

#logo ul.top_links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 !important;
}

#logo ul.top_links li:has(br) {
  display: none;
}

#panel .upper,
#panel .lower {
  background-image: none !important;
}

#panel .upper {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

#panel .upper .wrapper,
#panel .lower .wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#panel .lower ul.panel_links,
#panel .lower ul.user_links,
#search {
  float: none !important;
}

#search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#search input {
  margin: 0 !important;
}

#search input.textbox {
  min-width: 220px;
}

.navigation {
  margin: 0 0 14px;
  color: color-mix(in srgb, var(--pro-muted) 82%, #000 18%) !important;
  font-size: 13px;
}

.navigation .active {
  color: var(--pro-text) !important;
  font-size: 13px;
  font-weight: 800;
}

/* Base MyBB surfaces */
table {
  color: var(--pro-text);
}

.tborder {
  border: 1px solid var(--pro-border) !important;
  border-radius: var(--pro-radius) !important;
  border-collapse: separate;
  background: rgba(255,255,255,.86) !important;
  box-shadow: var(--pro-shadow-soft);
  overflow: visible !important;
}

.thead,
.tcat,
.tfoot,
.trow_sep,
.trow1,
.trow2 {
  background-image: none !important;
}

.thead,
.tcat {
  font-weight: 800;
}

.thead {
  padding: 12px 14px !important;
}

.tcat {
  padding: 10px 12px !important;
  text-transform: none;
}

.trow1,
.trow2,
.trow_sep,
.tfoot {
  border-left: 0 !important;
  border-right: 0 !important;
}

.smalltext {
  line-height: 1.45;
}

fieldset,
blockquote,
.codeblock,
.popup_menu,
.modal,
.bottommenu {
  border-radius: var(--pro-radius) !important;
}

blockquote,
.codeblock {
  box-shadow: 0 4px 14px rgba(61, 24, 34, .05);
}

input.textbox,
textarea,
select {
  box-sizing: border-box;
  min-height: 38px;
  border-radius: var(--pro-radius-sm) !important;
  font-family: var(--pro-font) !important;
  font-size: 14px;
}

textarea {
  min-height: 128px;
}

input.textbox:focus,
textarea:focus,
select:focus {
  border-color: var(--pro-brand) !important;
  box-shadow: 0 0 0 3px rgba(141, 74, 93, .16);
  outline: 0;
}

button,
input.button,
a.button,
.postbit_buttons > a {
  min-height: 36px;
  box-sizing: border-box;
  border-radius: var(--pro-radius-sm) !important;
  font-family: var(--pro-font) !important;
  font-weight: 800 !important;
  line-height: 1.2;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}

button:hover,
input.button:hover,
a.button:hover,
.postbit_buttons > a:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(61, 24, 34, .16);
  filter: saturate(1.03);
}

.post {
  border-radius: var(--pro-radius) !important;
  box-shadow: var(--pro-shadow-soft);
  overflow: visible !important;
}

.post.classic {
  padding-top: 0 !important;
}

.post .post_author div.author_avatar img {
  border-radius: var(--pro-radius-sm) !important;
}

.post_body {
  line-height: 1.68;
}

.post_controls {
  clear: both !important;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  width: 100%;
  min-height: 52px;
  box-sizing: border-box;
  overflow: visible;
}

.post_controls .float_left,
.post_controls .float_right,
.post_controls .author_buttons,
.post_controls .post_management_buttons {
  float: none !important;
}

.post_controls .postbit_buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.post_controls .author_buttons {
  justify-content: flex-start;
}

.post_controls .post_management_buttons {
  justify-content: flex-end;
  margin-left: auto;
}

.post-upvote {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(141, 74, 93, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .56);
  color: var(--pro-text);
  white-space: nowrap;
}

.post-upvote-button {
  display: inline-flex;
  align-items: center;
  color: var(--pro-ink) !important;
  font-weight: 800;
  text-decoration: none !important;
}

.post-upvote-button:hover {
  color: var(--pro-brand) !important;
}

.post-upvote-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--pro-brand-soft);
  color: var(--pro-text);
  font-weight: 800;
}

/* Existing homepage featured blocks */
.featured-wrapper {
  gap: 16px !important;
  align-items: stretch;
}

.featured-thread {
  min-width: 0;
}

.ft-flex {
  height: auto !important;
  aspect-ratio: 16 / 7;
}

.ft-thumb {
  height: 100% !important;
  border-radius: var(--pro-radius-sm);
}

.thumbbox,
.thumb,
.thumb.placeholder,
.thumb-preview {
  border-radius: var(--pro-radius-sm);
}

/* Forumdisplay grid plugins */
body.fdgrid-enabled .fdgrid-wrap {
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)) !important;
  gap: 18px !important;
  margin: 18px 0 !important;
}

.fdgrid-toolbar {
  margin: 14px 0 !important;
}

.fdgrid-left,
.fdgrid-right {
  flex-wrap: wrap;
}

.fdgrid-card {
  border: 1px solid rgba(141, 74, 93, .18) !important;
  border-radius: 16px !important;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,247,251,.88)) !important;
  box-shadow: var(--pro-shadow-soft);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.fdgrid-card:hover {
  transform: translateY(-2px);
  border-color: rgba(141, 74, 93, .34) !important;
  box-shadow: var(--pro-shadow);
}

body.fdgrid-enabled .fdgrid-thumb {
  border-bottom: 1px solid rgba(141, 74, 93, .14);
}

.fdgrid-body {
  padding: 14px !important;
}

.fdgrid-title {
  font-size: 16px !important;
  line-height: 1.28 !important;
  overflow-wrap: anywhere;
}

.fdgrid-meta,
.fdgrid-stats,
.fdgrid-last {
  color: color-mix(in srgb, var(--pro-muted) 86%, #000 14%);
}

.fdgrid-section {
  color: var(--pro-text);
  font-size: 13px;
}

/* Index forum cards */
.ifgrid-wrap {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
  gap: 18px !important;
  justify-content: stretch !important;
  margin: 16px 0 !important;
}

.ifgrid-card {
  border: 1px solid rgba(141, 74, 93, .18) !important;
  border-radius: 16px !important;
  background: linear-gradient(180deg, rgba(255,255,255,.93), rgba(255,247,251,.88)) !important;
  box-shadow: var(--pro-shadow-soft);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.ifgrid-card:hover {
  transform: translateY(-2px);
  border-color: rgba(141, 74, 93, .34) !important;
  box-shadow: var(--pro-shadow);
  text-decoration: none;
}

.ifgrid-thumb {
  border-bottom: 1px solid rgba(141, 74, 93, .14);
}

.ifgrid-body {
  padding: 14px !important;
}

.ifgrid-title {
  font-size: 16px !important;
  overflow-wrap: anywhere;
}

/* Portal most popular */
.pmp-shell {
  border-radius: 18px !important;
  border-color: rgba(141, 74, 93, .18) !important;
  box-shadow: var(--pro-shadow-soft) !important;
}

.pmp-scroller {
  gap: 14px !important;
  padding-bottom: 12px !important;
}

.pmp-card {
  min-width: 250px !important;
  max-width: 250px !important;
  border-radius: 16px !important;
  border-color: rgba(141, 74, 93, .18) !important;
  box-shadow: var(--pro-shadow-soft) !important;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.pmp-card:hover {
  transform: translateY(-2px);
  border-color: rgba(141, 74, 93, .34) !important;
  box-shadow: var(--pro-shadow) !important;
  text-decoration: none;
}

.pmp-title {
  min-height: 0 !important;
  overflow-wrap: anywhere;
}

.pmp-badge,
a.hashtag-chip,
.f14ht-chip,
.cam-pill {
  border-radius: 999px !important;
}

/* Hashtags and posting option rows */
.hashtags-input,
.forum14ht-box {
  max-width: 100%;
}

#hashtags_suggest_list {
  box-sizing: border-box;
  max-width: min(100%, 420px);
  border-radius: var(--pro-radius-sm);
  box-shadow: var(--pro-shadow-soft);
  z-index: 10000;
}

.ht-item {
  box-shadow: var(--pro-shadow-soft);
}

.ht-excerpt-images img {
  border-radius: var(--pro-radius-sm);
}

.content-alerts-row td,
.forum14ht-row td,
.scat-alert-row td,
.zoo-alert-row td {
  vertical-align: top;
}

/* Premium and image guard */
.premium-wrap,
.premium-blur,
.ig-card {
  border-radius: var(--pro-radius) !important;
}

.premium-overlay {
  border-radius: var(--pro-radius) !important;
}

.ig-card {
  box-shadow: var(--pro-shadow) !important;
}

.ig-card__title,
.ig-card__copy {
  overflow-wrap: anywhere;
}

/* Alerts and captcha: keep their art direction, make mobile fit reliable. */
#cam-modal,
#fhmn-card,
#scat-alert-modal,
#zoo-alert-modal,
.hc-wrap {
  box-sizing: border-box;
  max-width: calc(100vw - 28px) !important;
}

#cam-title,
#fhmn-title,
#scat-alert-title,
#zoo-alert-title {
  overflow-wrap: anywhere;
}

.hc-wrap {
  box-shadow: var(--pro-shadow) !important;
}

.hc-img {
  height: clamp(180px, 30vw, 280px) !important;
}

/* Footer */
#footer .upper,
#footer .lower {
  overflow: visible;
}

#footer .upper .language,
#footer .upper .theme {
  margin-top: 0 !important;
}

.forum_legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.forum_legend dt,
.forum_legend dd {
  margin: 0;
}

@media (max-width: 980px) {
  .wrapper {
    width: min(100% - 22px, 1320px) !important;
  }

  #logo .wrapper,
  .header-inner {
    min-height: 192px;
  }

  #logo img,
  .logo img,
  .header-inner .logo img {
    max-height: 192px !important;
    min-height: 108px;
  }

  #panel .upper .wrapper,
  #panel .lower .wrapper {
    align-items: flex-start;
    flex-direction: column;
  }

  #search {
    width: 100%;
  }

  #search input.textbox {
    flex: 1 1 220px;
  }

  .featured-wrapper {
    display: grid !important;
    grid-template-columns: 1fr;
  }

  .fdgrid-toolbar {
    align-items: stretch !important;
    flex-direction: column;
  }

  .fdgrid-left,
  .fdgrid-right {
    justify-content: space-between;
  }
}

@media (max-width: 720px) {
  body,
  #container,
  table {
    font-size: 13px;
  }

  .wrapper {
    width: min(100% - 16px, 1320px) !important;
  }

  #content {
    padding-top: 12px !important;
    padding-bottom: 22px !important;
  }

  #logo {
    padding: 12px 0 !important;
  }

  #logo .wrapper,
  .header-inner {
    align-items: center !important;
    justify-content: center !important;
    min-height: 0;
    text-align: center;
  }

  #logo img,
  .logo img,
  .header-inner .logo img {
    max-width: min(100%, 560px) !important;
    max-height: 150px !important;
    min-height: 86px;
  }

  #logo ul.top_links {
    justify-content: center;
  }

  #panel .upper,
  #panel .lower {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #search input.textbox {
    min-width: 0;
    flex-basis: 170px;
  }

  /* Standard MyBB tables remain usable on phones instead of forcing 990px layout. */
  #content table.tborder {
    display: block;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #content table.tborder > tbody,
  #content table.tborder > thead,
  #content table.tborder > tfoot {
    min-width: 560px;
  }

  body.fdgrid-enabled table.tborder.clear {
    display: none !important;
  }

  .thead,
  .tcat,
  .trow1,
  .trow2,
  .tfoot,
  .trow_sep {
    padding: 9px !important;
  }

  body.fdgrid-enabled .fdgrid-wrap,
  .ifgrid-wrap {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  .fdgrid-card,
  .ifgrid-card {
    border-radius: 14px !important;
  }

  .fdgrid-body,
  .ifgrid-body {
    padding: 12px !important;
  }

  .pmp-card {
    min-width: min(78vw, 245px) !important;
    max-width: min(78vw, 245px) !important;
  }

  .pmp-shell {
    padding: 13px 10px 14px !important;
  }

  .ft-flex {
    aspect-ratio: 4 / 3;
  }

  .post_content,
  .post.classic .post_content,
  .post .post_author,
  .post.classic .post_author {
    padding: 12px !important;
  }

  .post_body {
    font-size: 14px;
  }

  button,
  input.button,
  a.button,
  .postbit_buttons > a {
    max-width: 100%;
    white-space: normal;
  }

  .post_controls {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
  }

  .post_controls .author_buttons,
  .post_controls .post_management_buttons {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .post_controls .post_management_buttons {
    justify-content: flex-end;
  }

  #cam-modal,
  #fhmn-card,
  #scat-alert-modal,
  #zoo-alert-modal {
    border-radius: 20px !important;
    padding: 22px 18px 18px !important;
  }

  #cam-title,
  #fhmn-title,
  #scat-alert-title,
  #zoo-alert-title {
    font-size: 24px !important;
  }

  #cam-emoji,
  #scat-alert-poop {
    font-size: 54px !important;
  }

  #fhmn-icon {
    width: 58px !important;
    height: 58px !important;
    border-radius: 18px !important;
    font-size: 30px !important;
  }

  .hc-wrap {
    margin: 18px auto !important;
    padding: 14px !important;
  }

  .hc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .hc-img {
    height: clamp(145px, 42vw, 220px) !important;
  }
}

@media (max-width: 460px) {
  .wrapper {
    width: min(100% - 12px, 1320px) !important;
  }

  #logo img,
  .logo img,
  .header-inner .logo img {
    max-height: 118px !important;
    min-height: 72px;
  }

  #search {
    display: grid;
    grid-template-columns: 1fr;
  }

  #search input.textbox,
  #search input.button {
    width: 100%;
  }

  .hc-grid {
    grid-template-columns: 1fr !important;
  }

  .hc-img {
    height: min(58vw, 240px) !important;
  }
}
