/* Colony website.
   Built from the game's own menus: charcoal, the pencil-sketch robot, scratched
   metal panels (textures in /assets/game/ come from the SWF), the thin cyan
   "colony" wordmark, small grey Helvetica, and the boxy light Flash buttons.
   Colour stays restrained; the game's player colours mark data. */

:root {
  --bg: #111315;
  --bg-2: #16181b;
  --sunk: #0b0c0e;
  --line: #2a2e33;
  --line-2: #3d434a;
  --text: #d8dcdf;
  --muted: #a0a8ae;
  --faint: #838b92;
  --cyan: #c4f7fb;        /* the wordmark */
  --link: #93e4ee;
  --gold: #e8c36a;        /* gold rank insignia */
  --slate: #92a7a9;       /* steel rank insignia */
  --danger: #ff9a8f;
  /* player colours (baseRim_*) */
  --p-yellow: #e8b931;
  --p-green: #43b649;
  --p-blue: #2f7fe6;
  --p-red: #d8392f;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-head: "Jost", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: 16px;
  --maxw: 1140px;
  color-scheme: dark;
}
@media (min-width: 700px) { :root { --gutter: 28px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  overflow-x: hidden;
}
main { flex: 1; outline: none; }
img { max-width: 100%; height: auto; }
svg { flex-shrink: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 400; line-height: 1.2; margin: 0 0 .5em; color: #eef1f3; }
h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); font-weight: 300; letter-spacing: .005em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
strong { color: #f2f4f5; font-weight: 600; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--sunk); border: 1px solid var(--line); padding: .05em .35em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--cyan); color: #000; padding: 8px 12px; }
.skip-link:focus { top: 8px; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 820px; }
.section { padding-top: 32px; padding-bottom: 32px; }
.section-tight { padding-top: 20px; padding-bottom: 20px; }
.empty { color: var(--muted); font-size: 14px; }
.count { font: 400 13px var(--font); color: var(--faint); }

/* --- textures -------------------------------------------------------------- */
.metal {
  background: #121417 url(game/panel-metal.webp) center / cover;
  border: 1px solid #050506;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), inset 2px 0 0 rgba(255, 255, 255, .04);
}
.plate {
  background: linear-gradient(rgba(14, 15, 17, .62), rgba(14, 15, 17, .62)), #2b2d2f url(game/plate.webp) center / cover;
  border: 1px solid #070708;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 1px rgba(255, 255, 255, .05);
}
.metal-edge { border: 1px solid #060607; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); background: var(--bg-2); }

/* --- buttons: the game's Flash buttons ------------------------------------- */
.gbtn, .mbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 18px;
  font: 400 15px/1 var(--font-head); letter-spacing: .02em;
  border-radius: 1px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
.gbtn {
  color: #0d0d0d;
  font-family: var(--font); letter-spacing: 0;
  background: linear-gradient(#bdbdbd, #7b7b7b 20%, #737373 26%, #b4b4b4);
  border: 1px solid #1e1e1e; border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 0 0 1px rgba(255, 255, 255, .07);
}
.gbtn:hover { color: #000; text-decoration: none; background: linear-gradient(#d4d4d4, #8e8e8e 20%, #888 26%, #c9c9c9); }
.gbtn:active { background: linear-gradient(#8a8a8a, #a8a8a8); }
.mbtn {
  color: var(--text); font-family: var(--font); letter-spacing: 0; border-radius: 3px;
  background: linear-gradient(#2b2f34, #1b1e21);
  border: 1px solid #484e55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
.mbtn:hover { color: #fff; text-decoration: none; border-color: #79828b; }
.mbtn-danger { color: var(--danger); border-color: #6b302a; }
.mbtn-danger:hover { color: #ffc3bc; border-color: #a2463d; }
.gbtn-sm, .mbtn-sm { min-height: 30px; padding: 0 12px; font-size: 14px; }
.gbtn-block, .mbtn-block { display: flex; width: 100%; }
button:disabled { opacity: .55; cursor: progress; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--faint); font-size: 18px; line-height: 1; width: 28px; height: 28px; cursor: pointer; }
.icon-btn:hover { color: var(--danger); border-color: var(--line-2); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* --- forms: the game's light text inputs ----------------------------------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select {
  width: 100%;
  font: 400 15px/1.4 var(--font);
  color: #121314;
  background: linear-gradient(#c9cbcd, #eceeef 35%, #fafafa);
  border: 1px solid #6f757a;
  border-radius: 0;
  padding: 7px 9px;
  min-height: 36px;
}
textarea { resize: vertical; background: #f3f4f5; }
textarea.mono { font-family: var(--font-mono); font-size: 13px; }
input::placeholder, textarea::placeholder { color: #6a7075; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.field { margin-bottom: 14px; }
.field label, .inline-form > label, .form-title { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field-row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.hint { font-size: 12px; color: var(--faint); margin: 4px 0 0; }
.form-error { color: var(--danger); font-size: 13px; margin: 0; min-height: 0; flex: 1; }
.form-error:empty { display: none; }
.form-row-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.form-row-end .form-error { text-align: left; }
.char-count { display: block; text-align: right; font-size: 12px; color: var(--faint); margin-top: 3px; }
.char-count.near { color: var(--p-yellow); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text); margin: 4px 0 12px; }
.check input { width: 16px; height: 16px; accent-color: #d8dcdf; }

/* --- header ---------------------------------------------------------------- */
.site-header {
  background: #15171a url(game/hud-dark.webp) center / cover;
  border-bottom: 1px solid #050506;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05);
}
.hdr { display: flex; align-items: center; gap: 28px; min-height: 58px; }
.brand { display: flex; align-items: center; line-height: 0; }
.brand:hover { text-decoration: none; }
.wordmark { display: block; height: auto; }
.wm-hdr { width: 82px; margin-top: 4px; }
.main-nav ul { display: flex; gap: 22px; margin: 0; padding: 0; list-style: none; }
.main-nav a { font: 400 16px/1 var(--font-head); color: var(--muted); padding: 6px 0; display: inline-block; border-bottom: 1px solid transparent; }
.main-nav a:hover { color: var(--text); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--cyan); border-bottom-color: var(--cyan); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.hdr-link { font: 400 15px/1 var(--font-head); color: var(--muted); }
.hdr-link:hover { color: var(--text); }

.account-menu { position: relative; }
.account-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px; font-size: 14px; color: var(--text); }
.account-menu summary::-webkit-details-marker { display: none; }
.caret { width: 0; height: 0; border: 4px solid transparent; border-top-color: var(--muted); margin-top: 4px; }
.account-menu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 180px;
  background: #1a1d20; border: 1px solid #050506; box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), 0 10px 24px rgba(0,0,0,.5);
  display: flex; flex-direction: column; padding: 4px 0;
}
.account-menu .menu a, .account-menu .menu button {
  display: block; width: 100%; text-align: left; padding: 8px 14px; font: 400 14px var(--font); color: var(--text); background: none; border: 0; cursor: pointer;
}
.account-menu .menu a:hover, .account-menu .menu button:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }

@media (max-width: 760px) {
  .hdr { flex-wrap: wrap; gap: 0 14px; min-height: 0; padding-top: 8px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .main-nav ul { gap: 18px; padding: 4px 0 8px; }
  .main-nav a { font-size: 15px; }
  .account-name { display: none; }
  .hide-xs { display: none; }
}

/* --- footer ---------------------------------------------------------------- */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--sunk); }
.foot { display: grid; grid-template-columns: 1fr auto; gap: 18px 32px; padding-top: 26px; padding-bottom: 30px; align-items: start; }
.foot-credits p { font-size: 12px; line-height: 1.6; color: var(--faint); margin: 0 0 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; justify-content: flex-end; max-width: 380px; }
.foot-links a { color: var(--muted); }
.foot-mark { width: 92px; opacity: .55; grid-column: 1; }
@media (max-width: 700px) {
  .foot { grid-template-columns: 1fr; }
  .foot-links { justify-content: flex-start; }
}

/* --- shared pieces --------------------------------------------------------- */
.kicker { font: 400 14px/1.2 var(--font-head); color: var(--faint); margin: 0 0 4px; letter-spacing: .03em; }
.kicker a { color: var(--faint); }
.lead { color: var(--muted); font-size: 15px; max-width: 62ch; margin: 0; }
.page-head { border-bottom: 1px solid var(--line); background: linear-gradient(var(--bg-2), var(--bg)); }
.page-head-in { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; padding-top: 28px; padding-bottom: 20px; }
.page-head h1 { margin: 0 0 6px; }
.page-head-extra { display: flex; gap: 10px; align-items: center; }

/* Section label: small heading with a hairline running to the right edge, like the game's option labels. */
.label-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font: 400 15px/1.3 var(--font-head); letter-spacing: .04em; color: var(--text);
  margin: 0 0 14px;
}
.label-head::after { content: ""; flex: 1 1 40px; height: 1px; background: var(--line-2); order: 1; }
.label-head > a, .label-head > .mbtn, .label-head > button, .label-head > .head-note { order: 2; font: 400 13px var(--font); letter-spacing: 0; }
.label-head > a:not(.mbtn) { color: var(--muted); }
.head-note { color: var(--faint); }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1; padding: 4px 7px; border: 1px solid var(--line-2); color: var(--muted); background: rgba(0,0,0,.25); vertical-align: middle; }
.tag-role { color: var(--gold); border-color: #6a5a32; }
.tag-online { color: #9be39f; border-color: #2f5a32; }
.online-dot { display: inline-block; width: 7px; height: 7px; background: var(--p-green); margin-left: 6px; vertical-align: 1px; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.tag .online-dot { margin-left: 0; }

.avatar {
  --size: 34px;
  width: var(--size); height: var(--size); flex: 0 0 var(--size);
  display: inline-flex; align-items: center; justify-content: center;
  font: 500 calc(var(--size) * .46)/1 var(--font-head); color: #e6e9eb;
  background: linear-gradient(#2c3035, #1c1f22); border: 1px solid #060607; border-left: 3px solid var(--pc, #888);
}
.avatar-sm { --size: 26px; }

.rank-ico { width: 22px; height: 24px; vertical-align: middle; }
.ri-xs { width: 13px; height: 14px; }
.ri-sm { width: 17px; height: 18px; }
.ri-md { width: 22px; height: 24px; }
.ri-xl { width: 64px; height: 69px; }

.ver { font: 400 1em var(--font-head); color: var(--cyan); }
.crumbs { font: 400 14px var(--font-head); color: var(--faint); margin: 0 0 14px; }
.crumbs a { color: var(--muted); }
.mod-tools { display: flex; gap: 8px; margin-top: 10px; }

.segs { display: inline-flex; border: 1px solid #060607; box-shadow: 0 1px 0 rgba(255,255,255,.05); flex-wrap: wrap; }
.seg { font: 400 14px/1 var(--font-head); padding: 9px 13px; color: var(--muted); background: linear-gradient(#25292d, #1a1c1f); border-right: 1px solid #060607; }
.seg:last-child { border-right: 0; }
.seg:hover { color: #fff; text-decoration: none; }
.seg[aria-current="page"] { color: #0d0d0d; background: linear-gradient(#bdbdbd, #7b7b7b 20%, #737373 26%, #b4b4b4); }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; gap: 10px; }
.pager-info { font-size: 13px; color: var(--faint); }

.search { display: flex; gap: 8px; align-items: stretch; width: 100%; max-width: 420px; }
.search input { flex: 1; min-width: 0; }

.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 50; transform: translate(-50%, 140%);
  background: #1b1e21; color: var(--text); border: 1px solid #050506; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 8px 24px rgba(0,0,0,.5);
  padding: 10px 16px; font-size: 14px; max-width: calc(100vw - 32px); transition: transform .2s;
}
.toast.show { transform: translate(-50%, 0); }

/* --- the title screen (home) ----------------------------------------------- */
.title-screen, .auth-screen {
  display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, 1fr);
  margin-top: 28px; border: 1px solid #050506; box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 18px 40px rgba(0,0,0,.45);
  padding: 0; max-width: calc(var(--maxw) - 2 * var(--gutter));
  width: calc(100% - 2 * var(--gutter));
}
.ts-art { position: relative; margin: 0; background: #1d2122; overflow: hidden; min-height: 100%; }
.ts-art img { display: block; width: 100%; height: 100%; max-height: 640px; object-fit: cover; object-position: 50% 20%; }
.ts-art figcaption {
  position: absolute; left: 14px; bottom: 12px; font-size: 11px; line-height: 1.45; color: #aab0b5;
  text-shadow: 0 1px 2px #000, 0 0 6px #000;
}
.ts-panel { padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 14px; border-width: 0 0 0 2px; border-left-color: #000; }
.wm-xl { width: min(280px, 90%); margin: 6px auto 8px 0; filter: drop-shadow(0 0 10px rgba(160, 240, 250, .18)); }
.ts-blurb { font-size: 14px; color: #c7ccd0; margin: 0 0 6px; }
.ts-panel .gbtn-block { min-height: 44px; font-size: 18px; }
.menu-who { font-size: 13px; color: var(--muted); margin: 0; }
.ts-status { margin: auto 0 0; padding-top: 10px; display: grid; gap: 0; font-size: 13px; }
.ts-status div { display: flex; justify-content: space-between; border-top: 1px solid rgba(255,255,255,.08); padding: 6px 0; }
.ts-status dt { color: var(--muted); }
.ts-status dd { margin: 0; font: 400 15px/1.2 var(--font-head); color: var(--text); }

@media (max-width: 760px) {
  .title-screen { grid-template-columns: 1fr; margin-top: 0; width: 100%; border-left: 0; border-right: 0; }
  .ts-art img { height: 300px; max-height: none; object-position: 50% 26%; }
  .ts-art figcaption { display: none; }
  .ts-panel { border-width: 2px 0 0; border-top-color: #000; padding: 22px var(--gutter); }
  .wm-xl { width: 210px; }
}

.home-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; }
.home-side { display: flex; flex-direction: column; gap: 24px; }
.side-block { padding: 14px 16px 12px; }
.side-block:not(.plate) { padding: 0; }
@media (max-width: 900px) { .home-cols { grid-template-columns: 1fr; gap: 32px; } }

.board-mini { list-style: none; margin: 0; padding: 0; }
.board-mini li { display: grid; grid-template-columns: 22px 20px 1fr auto; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 14px; }
.board-mini li:first-child { border-top: 0; }
.board-mini .pos { font: 400 15px var(--font-head); color: var(--faint); text-align: right; }
.board-mini li:first-child .pos { color: var(--gold); }
.board-mini a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-mini .pts { font: 400 14px var(--font-head); color: var(--muted); }
.update-line { font-size: 14px; margin: 0 0 8px; }

/* news lists: date column, then title and excerpt */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.news-row:first-child { border-top: 0; padding-top: 4px; }
.date-stack { display: flex; flex-direction: column; font: 400 15px/1.25 var(--font-head); color: var(--text); padding-top: 2px; }
.date-stack span + span { color: var(--faint); font-size: 13px; }
@media (max-width: 520px) {
  .news-row { grid-template-columns: 1fr; gap: 4px; }
  .date-stack { flex-direction: row; gap: 6px; font-size: 13px; color: var(--muted); }
}
.news-body h3 { font-size: 1.2rem; margin: 0 0 6px; }
.news-row:first-child .news-body h3 { font-size: 1.5rem; font-weight: 300; }
.news-body h3 a { color: #eef1f3; }
.news-body h3 a:hover { color: var(--cyan); }
.news-body p { font-size: 14px; color: #c3c8cc; margin: 0 0 6px; }
.news-body .meta { font-size: 12px; color: var(--faint); margin: 0; }
.news-body .meta a { color: var(--muted); }
.meta { font-size: 13px; color: var(--faint); }

/* unit filmstrip */
.unit-strip { list-style: none; margin: 0; padding: 0 0 6px; display: flex; gap: 2px; overflow-x: auto; scroll-snap-type: x proximity; background: var(--sunk); border: 1px solid #050506; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.unit-strip li { flex: 0 0 128px; scroll-snap-align: start; }
.unit-strip a { display: block; padding: 10px 10px 8px; color: var(--text); }
.unit-strip a:hover { text-decoration: none; background: rgba(255,255,255,.04); }
.unit-strip a:hover .unit-name { color: var(--cyan); }
.unit-pic { display: flex; align-items: flex-end; justify-content: center; height: 84px; margin-bottom: 8px; }
.unit-pic img { height: 84px; width: 100%; object-fit: contain; object-position: 50% 100%; }
.unit-name { display: block; font: 400 14px/1.2 var(--font-head); }
.unit-type { display: block; font-size: 11px; color: var(--faint); }

/* --- changelog ------------------------------------------------------------- */
.release { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 20px; padding: 20px 0; border-top: 1px solid var(--line); }
.release:first-child { border-top: 0; padding-top: 0; }
.release-head h2 { font-size: 1.6rem; font-weight: 300; margin: 0 0 2px; }
.release-head .meta { margin: 0; }
.release-body h3 { font-weight: 400; margin: 2px 0 10px; }
.changes { list-style: none; margin: 0; padding: 0; }
.changes li { display: grid; align-items: start; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 5px 0; font-size: 14px; border-top: 1px solid rgba(255,255,255,.05); }
.changes li:first-child { border-top: 0; }
.changes.compact li { grid-template-columns: 70px minmax(0, 1fr); font-size: 13px; padding: 3px 0; border: 0; }
.ctype { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ctype::before { content: ""; width: 8px; height: 8px; background: var(--c, #888); flex: 0 0 8px; }
.ctype-added { --c: var(--p-green); }
.ctype-changed { --c: var(--p-yellow); }
.ctype-fixed { --c: var(--p-blue); }
.ctype-removed { --c: var(--p-red); }
@media (max-width: 600px) { .release { grid-template-columns: 1fr; gap: 6px; } .release-head { display: flex; gap: 12px; align-items: baseline; } }

/* --- leaderboard ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 400 12px var(--font); color: var(--faint); padding: 9px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th a { color: var(--faint); }
th[aria-sort] a { color: var(--text); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.board tbody tr:hover { background: rgba(255,255,255,.025); }
.board td.sorted { color: #fff; }
.board td.num { color: #b9bfc4; }
.board td.sorted.num { color: #f2f4f5; }
.pos-cell { width: 44px; text-align: right; font: 400 15px var(--font-head); color: var(--faint); }
.pos-cell.top1 { color: var(--gold); }
.pos-cell.top2, .pos-cell.top3 { color: var(--slate); }
.rank-cell { white-space: nowrap; width: 76px; }
.rank-num { font-size: 12px; color: var(--faint); margin-left: 6px; }
.player-cell a { color: var(--text); font-weight: 500; }
.player-cell a:hover { color: var(--cyan); }
.is-me td { background: rgba(196, 247, 251, .05); }
.is-me td:first-child { box-shadow: inset 2px 0 0 var(--cyan); }
@media (max-width: 600px) {
  .hide-sm { display: none; }
  td, th { padding: 8px 6px; }
  .rank-cell { width: auto; }
  .rank-num { display: none; }
  .pos-cell { width: 30px; }
}

/* --- profile --------------------------------------------------------------- */
.profile-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 22px 24px; }
.profile-rank { display: flex; flex-direction: column; align-items: center; gap: 6px; font: 400 14px var(--font-head); color: var(--text); min-width: 84px; }
.profile-id h1 { margin: 0 0 8px; word-break: break-word; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.profile-actions { display: flex; gap: 8px; align-self: start; flex-wrap: wrap; justify-content: flex-end; }
.loadbar { height: 8px; max-width: 360px; background: #08090a; border: 1px solid #4a5056; padding: 1px; }
.loadbar span { display: block; height: 100%; background: linear-gradient(#ffffff, #cfd3d6); }
.loadbar-label { font-size: 12px; color: var(--muted); margin: 6px 0 0; display: flex; align-items: center; gap: 6px; }
.profile-stats { display: grid; grid-template-columns: repeat(6, 1fr); margin: 0; border: 1px solid var(--line); border-top: 0; background: var(--bg-2); }
.profile-stats div { padding: 10px 14px; border-left: 1px solid var(--line); }
.profile-stats div:first-child { border-left: 0; }
.profile-stats dt { font-size: 12px; color: var(--faint); }
.profile-stats dd { margin: 0; font: 400 20px/1.3 var(--font-head); color: #eef1f3; font-variant-numeric: tabular-nums; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.profile-main { display: flex; flex-direction: column; gap: 28px; }
.block { margin-bottom: 0; }
.profile-side .block { padding: 14px 16px; }
.bio { white-space: normal; font-size: 15px; }
.bio-form { margin-top: 10px; }
.friend-list { list-style: none; margin: 0; padding: 0; }
.friend-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 14px; }
.friend-list li:first-child { border-top: 0; }
.friend-list a { color: var(--text); }
@media (max-width: 800px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(3, 1fr); }
  .profile-stats div:nth-child(4) { border-left: 0; }
  .profile-stats div:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .profile-card { grid-template-columns: auto minmax(0, 1fr); padding: 18px 16px; gap: 14px 16px; }
  .profile-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .profile-rank { min-width: 0; }
  .ri-xl { width: 46px; height: 50px; }
}

/* comments */
.comment-list { list-style: none; margin: 0 0 16px; padding: 0; }
.comment { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.comment-meta { font-size: 13px; margin: 0 0 3px; }
.comment-meta .muted { font-size: 12px; margin-left: 6px; }
.comment-body p:last-child { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.user-link { color: var(--text); font-weight: 500; }
.login-prompt { font-size: 14px; color: var(--muted); border: 1px dashed var(--line-2); padding: 10px 14px; }

/* --- articles and prose ---------------------------------------------------- */
.article-head { margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.article-head h1 { margin-bottom: 8px; }
.prose { font-size: 16px; line-height: 1.7; color: #d2d6d9; overflow-wrap: break-word; }
.prose h2 { font-size: 1.4rem; margin: 1.6em 0 .5em; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 1.15rem; margin: 1.4em 0 .4em; }
.prose img { display: block; margin: 1em 0; border: 1px solid var(--line); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .2em 0; }
.prose blockquote { margin: 1em 0; padding: 6px 14px; border-left: 2px solid var(--line-2); color: var(--muted); }
.prose table { margin: 1em 0; font-size: 14px; display: block; overflow-x: auto; max-width: 100%; }
.prose th { color: var(--muted); }
.prose td:first-child { color: var(--muted); }
.prose pre { background: var(--sunk); border: 1px solid var(--line); padding: 12px; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; }

/* --- wiki ------------------------------------------------------------------ */
.cat-jump { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 24px; font: 400 15px var(--font-head); }
.cat-jump a { color: var(--muted); }
.cat-jump span { color: var(--faint); font-size: 12px; }
.wiki-cat { margin-bottom: 34px; }
.cat-head { font-size: 1.7rem; font-weight: 300; margin: 0 0 14px; }
.wiki-type-group { margin-bottom: 18px; }
.wiki-rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 28px; }
.wiki-row a { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.wiki-row a:hover { text-decoration: none; }
.wiki-row a:hover .wiki-row-title { color: var(--cyan); }
.wiki-row a:hover .wiki-pic { border-color: var(--line-2); }
.wiki-pic { width: 64px; height: 64px; padding: 4px; display: flex; align-items: center; justify-content: center; background: var(--sunk); border: 1px solid #060607; overflow: hidden; }
.wiki-pic img { width: 100%; height: 100%; object-fit: contain; }
.wiki-row-title { display: block; font: 400 16px/1.25 var(--font-head); }
.wiki-row-sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--muted); line-height: 1.4; }
@media (max-width: 420px) { .wiki-rows { grid-template-columns: 1fr; } }
.wiki-credits { margin-top: 30px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.wiki-credits p { margin: 0 0 6px; }
.wiki-credits summary { cursor: pointer; color: var(--muted); }

.wiki-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; align-items: start; }
.wiki-head { display: flex; gap: 22px; align-items: center; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.wiki-head h1 { margin: 0 0 6px; }
.wiki-figure { margin: 0; flex: 0 0 180px; height: 160px; display: flex; align-items: center; justify-content: center; padding: 10px; }
.wiki-figure { background: #121417 url(game/panel-metal.webp) center / cover; border: 1px solid #050506; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.wiki-figure img { width: 100%; height: 100%; object-fit: contain; }
.wiki-aside { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 16px; }
.wiki-side ul { list-style: none; margin: 0; padding: 0; font-size: 14px; max-height: 70vh; overflow-y: auto; }
.wiki-side li a { display: block; padding: 4px 0 4px 10px; color: var(--muted); border-left: 1px solid var(--line); }
.wiki-side li a:hover { color: var(--text); text-decoration: none; border-left-color: var(--line-2); }
.wiki-side li a[aria-current="page"] { color: var(--cyan); border-left: 2px solid var(--cyan); padding-left: 9px; }
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 30px 0 14px; }
.pn { display: block; padding: 10px 14px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); }
.pn:hover { border-color: var(--line-2); text-decoration: none; }
.pn-next { text-align: right; }
.pn-label { display: block; font-size: 12px; color: var(--faint); }
.pn-title { font: 400 16px var(--font-head); }
@media (max-width: 860px) {
  .wiki-layout { grid-template-columns: 1fr; gap: 24px; }
  .wiki-aside { position: static; }
  .wiki-side { display: none; }
}
@media (max-width: 560px) {
  .wiki-head.has-image { flex-direction: column; align-items: flex-start; }
  .wiki-figure { flex-basis: auto; width: 100%; height: 150px; }
}

/* --- login / register: the game's login screen ----------------------------- */
.auth-screen { grid-template-columns: minmax(0, 536fr) minmax(300px, 340fr); max-width: 900px; margin: 28px auto 0; }
.auth-art img { max-height: none; }
.auth-panel { padding: 26px 30px 24px; gap: 10px; }
.auth-panel .wm-lg { width: 210px; margin: 0 0 6px; filter: drop-shadow(0 0 10px rgba(160, 240, 250, .18)); }
.auth-tabs { display: flex; gap: 0; margin: 4px 0 10px; border-bottom: 1px solid rgba(255,255,255,.1); }
.auth-tabs a { font: 400 16px/1 var(--font-head); color: var(--muted); padding: 8px 14px 9px 0; margin-right: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth-tabs a:hover { color: var(--text); text-decoration: none; }
.auth-tabs a[aria-current="page"] { color: var(--cyan); border-bottom-color: var(--cyan); }
.game-form .field label { color: #c9ced2; font-size: 13px; }
.game-form .gbtn-block { min-height: 40px; font-size: 17px; margin-top: 8px; }
.ts-widget { margin: 4px 0 8px; min-height: 65px; }
.auth-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
@media (max-width: 760px) {
  .auth-screen { grid-template-columns: 1fr; margin-top: 0; width: 100%; border: 0; box-shadow: none; }
  .auth-art { display: none; }
  .auth-panel { border-width: 1px; padding: 22px var(--gutter); }
}

/* --- account / admin ------------------------------------------------------- */
.settings { display: flex; flex-direction: column; gap: 34px; }
.admin { display: flex; flex-direction: column; gap: 38px; }
.admin-table td { font-size: 14px; }
.admin-table .actions, .admin-table td.actions { white-space: nowrap; text-align: right; }
.admin-table .actions .mbtn + .mbtn { margin-left: 6px; }
.admin-table .sub { display: block; font-size: 12px; color: var(--faint); }
.admin-table .ip { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.inline-form { margin-top: 16px; max-width: 560px; }
.inline-row { display: flex; gap: 8px; }
.inline-row input { flex: 1; min-width: 0; }
.roles-list { list-style: none; margin: 0 0 6px; padding: 0; }
.roles-list li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.roles-list li:first-child { border-top: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; }
.setting-name { margin: 0 0 2px; font-size: 15px; }
.setting-row .small { margin: 0; }
.switch {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; cursor: pointer;
  min-height: 32px; padding: 3px 12px 3px 3px; border: 1px solid #1e1e1e; border-radius: 3px;
  background: linear-gradient(#2b2f34, #1b1e21); color: var(--muted); font: 400 14px var(--font);
}
.switch-knob { width: 26px; height: 24px; border-radius: 2px; border: 1px solid #1e1e1e; background: linear-gradient(#5a5f64, #3b4045); }
.switch[aria-checked="true"] { color: #0d0d0d; background: linear-gradient(#bdbdbd, #7b7b7b 20%, #737373 26%, #b4b4b4); }
.switch[aria-checked="true"] .switch-knob { background: var(--p-green); border-color: #1f4f22; }
.switch:disabled { cursor: not-allowed; opacity: .6; }
.dlg { color: var(--text); padding: 20px 22px; width: min(440px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(0, 0, 0, .65); }
.preview-panel { margin-top: 24px; }
.editor { display: block; }

/* --- message pages --------------------------------------------------------- */
.message-page { padding-top: 60px; padding-bottom: 60px; }
.message-page .lead { margin-bottom: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* --- Log in with Discord / Google ------------------------------------------ */
.auth-title { font: 400 20px/1.2 var(--font-head); color: var(--text); margin: 6px 0 2px; }
.oauth-list { display: grid; gap: 10px; margin: 14px 0 6px; }
.oauth-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 42px; padding: 0 18px;
  font: 600 15px/1 "Helvetica Neue", Helvetica, Arial, sans-serif; color: #fff; text-decoration: none;
  border-radius: 3px; border: 1px solid rgba(0, 0, 0, .6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.oauth-btn:hover { text-decoration: none; color: #fff; }
.oauth-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.oauth-discord { background: #5865f2; }
.oauth-discord:hover { background: #4752c4; }
.oauth-google { background: #f2f2f2; color: #1f1f1f; }
.oauth-google:hover { background: #fff; color: #1f1f1f; }
.login-list { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 8px; }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(0, 0, 0, .25); }
.login-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.login-name svg { flex: none; color: var(--muted); }

/* --- Social: pictures, bell, feed, notifications ------------------------------ */
.avatar-img { padding: 0; object-fit: cover; background: #1c1f22; border-left-width: 1px; }
.avatar-xs { --size: 20px; }
.avatar-lg { --size: 56px; }
.player-wrap { display: inline-flex; align-items: center; gap: 8px; }
.profile-name { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; }
.profile-name h1 { margin: 0; }
.friend-list .friend-rank { margin-left: auto; line-height: 0; }
.mention { color: var(--cyan); }

.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; color: var(--muted); }
.bell:hover { color: var(--text); text-decoration: none; }
.bell.has-unread { color: var(--cyan); }
.bell-count {
  position: absolute; top: 1px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px; box-sizing: border-box;
  font: 600 11px/17px "Helvetica Neue", Helvetica, Arial, sans-serif; text-align: center; color: #0d0d0d;
  background: var(--gold); border: 1px solid #050506;
}

.feed-head { margin-top: 32px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 14px; }
.feed-item:first-child { border-top: 0; }
.feed-item p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.feed-item .rank-ico { vertical-align: -2px; }
.feed-mark { flex: none; width: 7px; height: 7px; margin: 0 4px; background: var(--line-2); }
.feed-rank .feed-mark, .feed-streak .feed-mark { background: var(--gold); }
.feed-first_win .feed-mark, .feed-awards .feed-mark { background: var(--cyan); }
.feed-streak strong { color: var(--gold); font-weight: 500; }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 12px; border-top: 1px solid var(--line); }
.notif:first-child { border-top: 0; }
.notif.unread { background: rgba(196, 247, 251, .05); box-shadow: inset 3px 0 0 var(--cyan); }
.notif-text { color: var(--text); overflow-wrap: anywhere; }
.notif-text:hover { color: #fff; }
.notif-text strong { font-weight: 600; }
.notif-ico { width: 26px; display: inline-flex; justify-content: center; }
.picture-row { display: flex; align-items: center; gap: 14px; }
.picture-row p { margin: 0; }
@media (max-width: 520px) {
  .notif { grid-template-columns: auto minmax(0, 1fr); }
  .notif > .small { grid-column: 2; }
  .avatar-lg { --size: 44px; }
}
