:root {
  /* Minimum space reserved under main content so it isn’t hidden behind the fixed footer */
  --site-footer-safe-area: 4.25rem;

  /* Brand theme */
  --rc-brand: #004d24;
  --rc-brand-hover: #006b33;
}

body {
  padding-bottom: calc(var(--site-footer-safe-area) + env(safe-area-inset-bottom, 0px));
}

.u-hacker { color: #4aa3ff; }
.u-robber { color: #ff4a4a; }
.u-drug { color: #4aff7c; }

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--rc-brand);
  color: rgba(255,255,255,.92);
  border-top: 1px solid rgba(255,255,255,.12);
  z-index: 9998;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  min-height: 2.75rem;
  box-sizing: border-box;
  /* Let height grow when link buttons wrap (e.g. mobile); do not clip */
  overflow: visible;
}

.site-footer .footer-links {
  flex: 1 1 auto;
  max-width: 100%;
}

.site-footer a,
.site-footer a:hover,
.site-footer a:focus {
  color: #fff;
}

/* Mobile polish */
@media (max-width: 576px) {
  :root {
    /* Two rows of footer buttons + copyright — extra scroll padding under main */
    --site-footer-safe-area: 7.5rem;
  }

  main.container { padding-left: .75rem; padding-right: .75rem; }
  .card-body { padding: 1rem; }
  .list-group-item { padding-left: .75rem; padding-right: .75rem; }
  .btn { border-radius: .6rem; }
  .btn-sm { padding: .4rem .6rem; }
  .navbar .navbar-text { display: none; }

  .site-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .site-footer .footer-links {
    justify-content: flex-start !important;
  }
}

.navbar-rc {
  background: var(--rc-brand) !important;
}

.navbar-rc .navbar-brand,
.navbar-rc .nav-link {
  color: rgba(255,255,255,.92);
}

.navbar-rc .nav-link:hover,
.navbar-rc .nav-link:focus {
  color: #fff;
}

/* Bootstrap primary theme overrides (keep it lightweight) */
.btn-primary {
  background-color: var(--rc-brand) !important;
  border-color: var(--rc-brand) !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--rc-brand-hover) !important;
  border-color: var(--rc-brand-hover) !important;
}

.btn-outline-primary {
  color: var(--rc-brand) !important;
  border-color: var(--rc-brand) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background-color: var(--rc-brand) !important;
  border-color: var(--rc-brand) !important;
  color: #fff !important;
}

a {
  color: var(--rc-brand);
}

a:hover {
  color: var(--rc-brand-hover);
}

.text-bg-primary {
  background-color: var(--rc-brand) !important;
}

/* Global chat — CSP-friendly (no inline styles) */
.global-chat-messages {
  height: min(65vh, 520px);
  overflow-y: auto;
  background: #03060d;
  color: #e8eef8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 0.95rem;
}

/* Faction dashboard chat (CSP: no inline styles) */
.faction-chat-messages {
  height: min(45vh, 320px);
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 0.95rem;
}

/* Dashboard — CSP-friendly (no inline styles) */
.dashboard-avatar,
.dashboard-avatar-placeholder {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.dashboard-avatar {
  border-radius: 50%;
  object-fit: cover;
}

.dashboard-avatar-placeholder {
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rc-break-all {
  word-break: break-all;
}

/* Inventory — list-on-market inputs (CSP: no inline max-width) */
.inv-market-price-input {
  max-width: 120px;
}

.inv-market-qty-input {
  max-width: 90px;
}

/* Market — CSP-friendly */
.market-search-form {
  max-width: 420px;
  width: 100%;
}

.rc-item-icon-emoji {
  font-size: 1.1rem;
}

/* Trades inbox — start trade username field (CSP) */
.trade-start-username-input {
  min-width: 220px;
}

/* Progress bars — SVG fill width (CSP allows presentation attrs; not inline style attrs) */
.progress.rc-progress {
  background-color: transparent;
  padding: 0;
}

.rc-progress-svg {
  display: block;
  width: 100%;
  height: 1rem;
  border-radius: var(--bs-border-radius, 0.375rem);
}

.rc-progress-track {
  fill: var(--bs-secondary-bg, #e9ecef);
}

.rc-progress-bar-fill--primary {
  fill: var(--bs-primary);
}

.rc-progress-bar-fill--warning {
  fill: var(--bs-warning);
}

.rc-progress-bar-fill--danger {
  fill: var(--bs-danger);
}

.rc-progress-bar-fill--success {
  fill: var(--bs-success);
}

/* Factions — list + dashboard (CSP: no inline styles) */
.faction-avatar-lg {
  width: 64px;
  height: 64px;
  object-fit: cover;
}

.faction-avatar-placeholder-lg {
  width: 64px;
  height: 64px;
}

.faction-avatar-upload-col {
  min-width: 260px;
  max-width: 520px;
}

.faction-donate-source {
  max-width: 120px;
}

.faction-invite-username {
  min-width: 200px;
}

.faction-rank-select {
  width: auto;
  min-width: 7.5rem;
}

.faction-rank-select-sm {
  max-width: 11rem;
}

.faction-news-scroll {
  max-height: 260px;
  overflow-y: auto;
}

.faction-table-rank-col {
  width: 56px;
}

.faction-avatar-thumb-18 {
  width: 18px;
  height: 18px;
  object-fit: cover;
}

.faction-avatar-thumb-20 {
  width: 20px;
  height: 20px;
  object-fit: cover;
}

.faction-avatar-thumb-22 {
  width: 22px;
  height: 22px;
  object-fit: cover;
}

/* Contact page (CSP) */
.contact-us-form {
  max-width: 720px;
}
