:root {
  --eco-bg: #0a0b08;
  --eco-surface: #141611;
  --eco-raised: #1b1f16;
  --eco-stroke: #343a2d;
  --eco-text: #edf0e8;
  --eco-muted: #b4bcaa;
  --eco-lime: #b2f570;
  --eco-lime-soft: #25351d;
  --eco-gold: #d7c88d;
}

html body,
html body .ui-page {
  background: var(--eco-bg) !important;
  color: var(--eco-text);
}

html body #header,
html body .above_body {
  background: var(--eco-bg) !important;
}

html body #header.doc_header,
html body #header.mmopro-header-login {
  border-color: var(--eco-stroke) !important;
  box-shadow: none !important;
}

#header::before,
#header::after {
  background-image: none !important;
}

html body #navbar,
html body #breadcrumb,
html body .body_wrapper,
html body #mmopro-category-nav,
html body #forums .forumrow,
html body #threadlist .threadbit .threadinfo,
html body #threadlist .threadbit .threadstats {
  background: var(--eco-surface) !important;
  border-color: var(--eco-stroke) !important;
}

html body .body_wrapper { color: var(--eco-text); }
html body #forums .forumhead,
html body #pagetitle,
html body #wgo .blockhead,
html body #posts .posthead,
html body #threadlist .blockhead {
  background: var(--eco-raised) !important;
  border-color: var(--eco-stroke) !important;
  color: var(--eco-text) !important;
}

html body #pagetitle { background: transparent !important; }
html body #forums :is(.forumtitle, .forumhead) :is(a, button),
html body #threadlist .threadbit a.title,
html body #pagetitle h1,
html body #mmopro-category-title {
  color: var(--eco-text) !important;
}

html body #forums .forumbit_post .forumdescription,
html body #forums :is(.forumstats, .forumlastpost, .subforums),
html body #breadcrumb,
html body #pagetitle .description {
  color: var(--eco-muted) !important;
}

html body #forums :is(.forumstats, .forumlastpost, .subforums) a,
html body #breadcrumb a {
  color: var(--eco-lime) !important;
}

html body #navbar #navtabs > li > a.navtab,
html body #navbar :is(.mmopro-layout-subnav, #navtabs > ul) > li > a,
html body #header.mmopro-header-login #toplinks .mmopro-header-link,
html body #mmopro-category-nav :is(button, select, input) {
  background: var(--eco-surface) !important;
  color: var(--eco-text) !important;
  border-color: var(--eco-stroke) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

html body #navbar #navtabs > li.selected > a.navtab,
html body #navbar #navtabs > li > a.navtab:hover,
html body #mmopro-category-nav button[aria-pressed="true"],
html body #header.mmopro-header-login :is(.mmopro-register-link, .loginbutton, #mmopro-login-toggle),
html body #header.mmopro-header-login #toplinks .mmopro-header-link.mmopro-register-link {
  background: var(--eco-lime-soft) !important;
  color: var(--eco-lime) !important;
  border-color: #66834c !important;
  box-shadow: none !important;
}

@media (min-width: 901px) {
  html body #header.mmopro-header-login #toplinks.toplinks > ul.nouser {
    --eco-login-label-space: calc(13px * 1.4 + 5px);
    align-items: start !important;
  }

  html body #header.mmopro-header-login #toplinks > ul.nouser > li:not(.mmopro-login-item) {
    padding-block-start: var(--eco-login-label-space) !important;
  }

  html body #header.mmopro-header-login #toplinks #navbar_loginform {
    display: grid !important;
    grid-template-areas: 'fields submit' 'remember remember';
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 4px 8px;
    width: clamp(345px, 31vw, 440px) !important;
  }

  html body #header.mmopro-header-login #logindetails { grid-area: fields; }
  html body #header.mmopro-header-login #navbar_loginform #remember { display: contents !important; }
  html body #header.mmopro-header-login #remember > label { grid-area: remember; }
  html body #header.mmopro-header-login #remember > .loginbutton { grid-area: submit; }
}

#mmo-ecosystem-bar {
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  padding: 7px clamp(12px, 2vw, 25px);
  background: var(--eco-bg);
  border-block: 1px solid var(--eco-stroke);
  color: var(--eco-text);
  font: 600 14px/1.35 system-ui, sans-serif;
  text-shadow: none;
}

#mmo-ecosystem-bar:has(details[open]) { z-index: 10001; }

#mmo-ecosystem-bar .mmo-eco-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

#mmo-ecosystem-bar .mmo-eco-dot {
  flex: 0 0 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--eco-lime);
}

#mmo-ecosystem-bar .mmo-eco-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#mmo-ecosystem-bar :is(.mmo-eco-action, summary) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--eco-stroke);
  border-radius: 8px;
  background: var(--eco-surface);
  color: var(--eco-text);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 130ms ease, border-color 130ms ease;
}

#mmo-ecosystem-bar details summary {
  list-style: none;
  background: var(--eco-lime) !important;
  border-color: var(--eco-lime) !important;
  color: #111b0a !important;
  text-shadow: none !important;
}

#mmo-ecosystem-bar summary::-webkit-details-marker { display: none; }
#mmo-ecosystem-bar details summary:hover { background: #cafa9a !important; }
#mmo-ecosystem-bar .mmo-eco-action:hover { background: var(--eco-raised); border-color: #66834c; }
#mmo-ecosystem-bar .mmo-eco-chevron {
  inline-size: 7px;
  block-size: 7px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}
#mmo-ecosystem-bar details[open] .mmo-eco-chevron { transform: translateY(2px) rotate(225deg); }

#mmo-ecosystem-bar .mmo-eco-panel {
  box-sizing: border-box;
  position: absolute;
  z-index: 120;
  inset-block-start: 100%;
  inset-inline-end: clamp(10px, 2vw, 25px);
  width: min(466px, calc(100% - 20px));
  max-height: min(70vh, 410px);
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid #536344;
  border-radius: 12px;
  background: var(--eco-surface);
  box-shadow: 0 16px 42px #0009;
}

#mmo-ecosystem-bar details:not([open]) .mmo-eco-panel { display: none; }
#mmo-ecosystem-bar details[open] .mmo-eco-panel { animation: mmo-eco-enter 155ms cubic-bezier(.16,1,.3,1); }
#mmo-ecosystem-bar .mmo-eco-panel a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  gap: 2px 8px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--eco-text);
  text-decoration: none;
}
#mmo-ecosystem-bar .mmo-eco-panel a:hover,
#mmo-ecosystem-bar .mmo-eco-panel a:focus-visible {
  background: var(--eco-raised);
  border-color: var(--eco-stroke);
}
#mmo-ecosystem-bar .mmo-eco-meta { grid-column: 1; font-size: 12px; color: var(--eco-muted); }
#mmo-ecosystem-bar .mmo-eco-external { grid-area: 1 / 2 / 3 / 3; color: var(--eco-lime); }
#mmo-ecosystem-bar :is(a, summary):focus-visible {
  outline: 2px solid var(--eco-gold);
  outline-offset: 3px;
}

@keyframes mmo-eco-enter {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  #mmo-ecosystem-bar { align-items: stretch; flex-wrap: wrap; gap: 5px 8px; }
  #mmo-ecosystem-bar .mmo-eco-name { min-height: 24px; }
  #mmo-ecosystem-bar .mmo-eco-action,
  #mmo-ecosystem-bar summary { padding-inline: 9px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  #mmo-ecosystem-bar :is(.mmo-eco-action, summary) { transition: none; }
  #mmo-ecosystem-bar details[open] .mmo-eco-panel { animation: none; }
}
