:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  color: #cbd0d6;
  background: #0b1017;
  --gold: #b2a17b;
  --line: #303642;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: linear-gradient(120deg, #111823, #0b1017 60%);
  min-height: 100vh;
}
a {
  color: var(--gold);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  color: #e0cc9e;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
textarea,
select {
  touch-action: manipulation;
}
button {
  border: 1px solid #605741;
  border-radius: 5px;
  background: #1b2028;
  padding: 9px 13px;
  cursor: pointer;
}
button:hover {
  background: #292d35;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
:focus-visible {
  outline: 2px solid #c3ac78;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.forum-header {
  padding: 18px max(20px, calc((100vw - 1140px) / 2));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 25px;
  background: #10161f;
}
.brand {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.brand span {
  font-size: 16px;
  font-weight: 500;
}
.forum-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}
main {
  max-width: 1140px;
  margin: auto;
  padding: 24px 20px 70px;
}
h1 {
  font-family: Georgia, serif;
  font-size: clamp(24px, 4vw, 36px);
  color: #d8c7a2;
  overflow-wrap: anywhere;
  margin: 24px 0;
}
h2 {
  font-size: 20px;
  color: #d8c7a2;
}
small,
time {
  color: #919ba9;
  font-size: 12px;
}
#forum-session {
  font-size: 13px;
  min-height: 20px;
}
#forum-error {
  border-left: 3px solid #b66760;
  background: #442625;
  padding: 12px;
  white-space: pre-wrap;
}
.forum-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.forum-categories a {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #a6adb9;
}
.forum-categories .active {
  border-color: #716343;
  background: #24231f;
  color: #d4be8c;
}
.list-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
}
.list-tools form {
  display: flex;
  gap: 8px;
}
input,
textarea,
select {
  background: #0c121b;
  border: 1px solid #3a4350;
  border-radius: 5px;
  padding: 10px;
  max-width: 100%;
}
textarea {
  resize: vertical;
  width: 100%;
  line-height: 1.6;
}
.forum-topic {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: #151d27;
}
.forum-topic:nth-of-type(even) {
  background: #121923;
}
.forum-topic a {
  font-size: 17px;
  overflow-wrap: anywhere;
}
.forum-topic small {
  display: block;
  margin-top: 8px;
}
.forum-topic > div:last-child {
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}
.forum-topic b {
  font-size: 16px;
  color: #d0d5dc;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 25px 0;
  font-size: 13px;
}
.empty {
  padding: 36px;
  text-align: center;
  background: #131b25;
}
.forum-post {
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #141c27;
  margin: 16px 0;
  scroll-margin-top: 12px;
  overflow: hidden;
}
.forum-author {
  padding: 18px 14px;
  background: #101720;
  border-right: 1px solid var(--line);
  font-size: 12px;
}
.forum-author a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  overflow-wrap: anywhere;
}
.forum-author img {
  object-fit: cover;
  border-radius: 7px;
  background: #19212b;
}
.forum-author b {
  font-size: 14px;
}
.forum-author dl {
  margin: 16px 0 0;
}
.forum-author dl div {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 5px;
}
.forum-author dt {
  color: #929daa;
}
.forum-author dd {
  margin: 0;
}
.admin-label {
  display: block;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  color: #c5ad7d;
  margin-top: 9px;
}
.forum-post > section {
  padding: 18px 22px;
  min-width: 0;
}
.forum-post header {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}
.post-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.75;
  font-size: 15px;
  min-height: 38px;
}
.forum-post blockquote {
  margin: 15px 0;
  padding: 12px 16px;
  background: #0d141e;
  border-left: 2px solid #776643;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 13px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.actions button {
  font-size: 12px;
  padding: 7px 10px;
}
.actions [aria-pressed="true"] {
  color: #ddc88e;
  background: #383326;
}
.battle-link {
  display: inline-block;
  padding: 10px 14px;
  background: #202735;
  border: 1px solid #4e5663;
  border-radius: 5px;
  font-size: 13px;
}
.forum-editor {
  padding: 24px;
  background: #151d27;
  border: 1px solid var(--line);
  border-radius: 7px;
  margin-top: 26px;
}
.forum-editor label {
  display: block;
  font-size: 13px;
  margin-bottom: 16px;
}
.forum-editor label > input,
.forum-editor label > select,
.forum-editor label > textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
}
.forum-editor small {
  line-height: 1.5;
}
#topic-admin {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-row {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-row p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  width: 100%;
  margin: 5px 0;
  font-size: 13px;
}
.admin-row small {
  word-break: break-all;
}
.admin-section {
  padding: 20px;
  background: #151d27;
  margin-top: 20px;
}
.admin-section form {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.admin-section label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}
.forum-header code,
main code {
  overflow-wrap: anywhere;
}
.embedded .forum-header {
  padding: 14px 18px;
}
.embedded main {
  padding-top: 16px;
}
.embedded #game-link {
  display: none;
}
.forum-dialog {
  padding: 0;
  width: min(1180px, 96vw);
  height: 92dvh;
  max-height: 94dvh;
  border: 1px solid #605741;
  border-radius: 8px;
  background: #0b1017;
}
.forum-dialog::backdrop {
  background: #02050bd9;
}
.forum-dialog iframe {
  border: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.forum-dialog-close {
  position: absolute;
  right: 8px;
  top: 7px;
  z-index: 2;
}
a.forum-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #9ca6b5;
  padding: 10px;
  text-decoration: none;
  white-space: nowrap;
}
.forum-nav-link.has-replies {
  color: #ddc18b;
}
.forum-nav-link .forum-count {
  background: #343127;
  color: #d8c396;
  padding: 2px 5px;
  border-radius: 8px;
  font-size: 10px;
}
.forum-nav-link .reply-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ccaf6d;
}
.forum-dialog-link {
  font-size: 12px;
}
@media (max-width: 650px) {
  .forum-header {
    padding: 13px;
    gap: 10px;
  }
  .brand {
    font-size: 20px;
  }
  .brand span {
    font-size: 13px;
  }
  .forum-header nav {
    gap: 9px;
    font-size: 12px;
  }
  main {
    padding: 15px 10px 35px;
  }
  .list-tools {
    align-items: stretch;
    flex-direction: column;
  }
  .list-tools form input {
    flex: 1;
    min-width: 0;
  }
  .forum-topic {
    padding: 15px 12px;
    gap: 10px;
  }
  .forum-topic a {
    font-size: 15px;
  }
  .forum-topic > div:last-child small {
    font-size: 10px;
  }
  .forum-post {
    display: block;
  }
  .forum-author {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px;
    display: grid;
    grid-template-columns: 115px 1fr;
    gap: 8px;
  }
  .forum-author > a {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 7px;
    font-size: 12px;
  }
  .forum-author img {
    width: 40px;
    height: 50px;
  }
  .forum-author b {
    font-size: 12px;
  }
  .forum-author dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 10px;
    margin: 0;
    font-size: 10px;
  }
  .admin-label {
    grid-column: 1;
    font-size: 9px;
  }
  .forum-post > section {
    padding: 13px;
  }
  .post-body {
    font-size: 14px;
  }
  .forum-editor {
    padding: 15px;
  }
  .forum-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  #forum-admin .admin-section {
    padding: 12px;
  }
  .forum-header #game-link {
    font-size: 11px;
  }
}

.forum-credits {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px 30px;
  font-size: 12px;
}
/* Transactional market announcements use the same readable forum palette. */
.forum-market-item { padding: 16px; border: 1px solid #665331; background: #b9954810; border-radius: 5px; }
.forum-market-item h3 { margin: 8px 0; color: #e1c386; }
.forum-market-item dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px; }
.forum-market-item dt { color: #8594a6; font-size: 12px; }
.forum-market-item dd { margin: 3px 0 0; color: #e1d5ba; }
.forum-market-item ul { padding-left: 20px; line-height: 1.65; }
.forum-topic .market-summary { color: #d6ba7c; }

/* p247: shared arena palette, readable sale cards and direct page navigation. */
.forum-header { background: linear-gradient(180deg, #17212d, #0c131b); border-color: #665331; }
.forum-categories a { border-radius: 2px; text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.forum-categories .active { border-color: #b99548; box-shadow: inset 0 -2px #b99548; }
.forum-topic { margin: 8px 0; border: 1px solid #303c4a; border-left: 3px solid #665331; border-radius: 3px; align-items: center; background: linear-gradient(115deg, #182331, #111923); }
.forum-topic:nth-of-type(even) { background: linear-gradient(115deg, #14202c, #0f1720); }
.forum-topic:hover { border-color: #8d7548; }
.forum-topic > div:first-child { min-width: 0; }
.forum-topic a { color: #e1d1ad; font-weight: 600; }
.forum-topic b { color: #e3bf78; }
.forum-post { border-color: #384453; box-shadow: 0 8px 25px #0002; }
.pagination { flex-wrap: wrap; gap: 6px; margin: 22px 0; }
.pagination a, .pagination .current-page { display: inline-flex; justify-content: center; align-items: center; min-width: 38px; min-height: 38px; padding: 6px 10px; border: 1px solid #46505e; border-radius: 3px; background: #141f2a; }
.pagination a:hover { border-color: #ba944e; text-decoration: none; background: #29281f; }
.pagination .current-page { color: #171109; background: #cfac66; border-color: #edc879; font-weight: 700; }
.pagination small { flex-basis: 100%; text-align: center; margin-top: 4px; }
.pagination .page-gap { color: #8393a4; padding: 3px; }
.forum-market-item { --item-accent: #bdc5cd; padding: clamp(14px, 3vw, 24px); border-color: #596372; border-top: 3px solid var(--item-accent); background: linear-gradient(125deg, #1b2937, #101821); }
.forum-market-item[data-rarity="uncommon"] { --item-accent: #7eca9d; }
.forum-market-item[data-rarity="rare"] { --item-accent: #a8a0ef; }
.forum-market-item[data-rarity="mythical"] { --item-accent: #d88bed; }
.forum-market-item[data-rarity="unique"] { --item-accent: #efbb59; }
.forum-market-heading { display: flex; align-items: center; gap: 18px; }
.forum-market-heading > div:last-child { min-width: 0; }
.forum-market-heading h3 { font: 700 clamp(21px, 3vw, 28px) Georgia, serif; overflow-wrap: anywhere; }
.forum-market-artwork { flex: 0 0 112px; width: 112px; height: 112px; }
.forum-market-artwork .item-artwork { position: relative; height: 100%; width: 100%; overflow: hidden; border: 1px solid var(--item-accent); border-radius: 5px; background: radial-gradient(ellipse at center, #344353, #080f17); }
.forum-market-artwork img, .forum-market-artwork svg { display: block; height: 100%; width: 100%; object-fit: contain; }
.forum-market-artwork .item-artwork-grade { display: none; }
.market-rarity { color: var(--item-accent); font-size: 13px; }
.market-status { display: inline-block; margin: 4px 0 4px 12px; padding: 4px 8px; border: 1px solid #50685c; border-radius: 3px; font-size: 12px; color: #9ed0b0; background: #23453244; }
.market-status[data-status="sold"] { color: #c0c7d0; background: #44506444; border-color: #566172; }
.forum-market-item dl { padding: 16px 0; margin: 14px 0; border-block: 1px solid #384756; }
.forum-market-item dd { font-size: 18px; font-weight: 600; }
.forum-market-item h4 { margin: 16px 0 8px; font-size: 14px; color: #b0a0d8; }
.forum-market-item ul { margin: 0; padding-left: 18px; font-size: 14px; }
.market-open-button { display: inline-flex; margin-top: 20px; min-height: 42px; align-items: center; padding: 10px 16px; border: 1px solid #bc9855; border-radius: 3px; color: #f3dfb6; background: linear-gradient(180deg, #675029, #392d1b); font-weight: 600; }
.market-open-button:hover { text-decoration: none; background: #756039; }
@media (max-width: 600px) {
  .forum-topic { padding: 14px 12px; gap: 12px; align-items: flex-start; }
  .forum-topic > div:last-child { white-space: normal; flex: 0 0 90px; }
  .forum-topic a { font-size: 16px; }
  .forum-market-heading { gap: 12px; }
  .forum-market-artwork { flex-basis: 80px; width: 80px; height: 80px; }
  .forum-market-item dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-status { margin-left: 0; display: table; }
  .market-open-button { width: 100%; justify-content: center; text-align: center; }
  .pagination { gap: 4px; }
  .pagination a, .pagination .current-page { min-height: 40px; min-width: 34px; padding: 6px 8px; }
}

.forum-topic .forum-pin {
  display: inline-block;
  margin-inline-end: .5em;
  color: #ebc985;
  font-size: .78em;
}
.forum-topic [data-pin-topic] {
  margin-top: .3rem;
  padding: .2rem .5rem;
  font-size: .78rem;
}
