:root {
  --green: #2f7d62;
  --green-dark: #1f5e48;
  --green-light: #e5f2ec;
  --bg: #e4e4e4;
  --card: #ffffff;
  --head: #f1f1f1;
  --line: #d5d8d6;
  --text: #1e2120;
  --muted: #545a57;
  --link: #1e2120;
  --danger: #c0392b;
  --radius: 3px;
  --font: 'Titillium Web', system-ui, sans-serif;
}
/* Light by default to match the original theme; dark is opt-in from Settings. */
:root[data-theme="dark"] {
  --bg: #17191a; --card: #212425; --head: #2a2e2f; --line: #3a4142; --text: #eef0ef; --muted: #b3bbb8; --link: #e6e6e6; --green-light: #1d3a30;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--green); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-weight: 600; margin: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { margin-left: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hidden-item { opacity: .55; background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(192,57,43,.06) 10px 20px); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- header */
.banner { position: relative; color: #fff; background: #1b2420; overflow: hidden; }
.carousel { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.carousel-track { display: flex; height: 100%; width: max-content; animation: slide var(--speed, 60s) linear infinite; margin-left: -60px; }
.carousel-track span { position: relative; flex: none; width: 380px; height: 100%; margin-right: 6px; transform: skewX(-18deg); overflow: hidden; background: #2c3a33; border-left: 4px solid rgba(0,0,0,.45); }
.carousel-track span i { display: block; position: absolute; inset: 0 -60px; transform: skewX(18deg); background: center / cover no-repeat; filter: brightness(1.28) contrast(.92); }
.carousel-track span.ph:nth-child(3n) { background: linear-gradient(160deg, #3c4c44, #222c27); }
.carousel-track span.ph:nth-child(3n+1) { background: linear-gradient(160deg, #4b524e, #2b302d); }
.carousel-track span.ph:nth-child(3n+2) { background: linear-gradient(160deg, #2f4a3e, #1a2721); }
.carousel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,14,12,.4) 0, rgba(10,14,12,.04) 45%, rgba(10,14,12,.23) 100%), linear-gradient(0deg, rgba(10,14,12,.45), transparent 45%); }
@keyframes slide { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .carousel-track { animation: none; } }
.banner-inner, .banner .tabs { position: relative; z-index: 1; }
.banner-inner { display: flex; align-items: center; min-height: 128px; padding-top: 4px; }
.logo img { height: 124px; width: auto; display: block; }
.userbar { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.userbar a, .userbar button { color: #fff; }
.userbar .btn-ghost { border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.25); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; text-align: center; line-height: 18px; }
.tabs { display: flex; gap: 2px; }
.tabs a { color: #fff; padding: 6px 16px; font-weight: 600; font-size: 13px; border-radius: var(--radius) var(--radius) 0 0; }
.tabs a.active { background: var(--green); }
.tabs a:hover { background: rgba(47,125,98,.7); color: #fff; }
.subnav { background: var(--green); }
.subnav .wrap { display: flex; gap: 4px; overflow-x: auto; }
.subnav a { color: #e8f4ef; padding: 9px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.subnav a.active, .subnav a:hover { color: #fff; background: rgba(0,0,0,.12); }

main { padding: 12px 16px 30px; min-height: 60vh; }
main:focus { outline: none; }
.crumbs { color: var(--muted); font-size: 12px; margin: 4px 0 14px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--green); }
.page-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 400; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; padding-bottom: 30px; }

/* ---------- buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: var(--radius); padding: 8px 16px; font: 600 13px var(--font);
  background: var(--green); color: #fff; cursor: pointer; }
.btn:hover { background: var(--green-dark); color: #fff; }
.btn-light { background: var(--head); color: var(--text); border: 1px solid var(--line); }
.btn-light:hover { background: var(--line); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; color: inherit; border: 1px solid var(--line); }
.btn-big { padding: 10px 28px; font-size: 14px; }
button:disabled { opacity: .6; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; margin: 10px 0 4px; font-weight: 600; }
label.inline { display: flex; gap: 6px; align-items: center; font-weight: 400; }
.form { max-width: 560px; }
.form .actions { margin-top: 16px; display: flex; gap: 8px; }
.error { color: var(--danger); margin: 8px 0; }
.notice { background: var(--green-light); border-left: 3px solid var(--green); padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius); }

/* ---------- boxes */
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.box-head { background: var(--head); padding: 9px 14px; text-transform: uppercase; font-size: 12px; letter-spacing: .3px; color: var(--muted); display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.box-head a { color: var(--muted); }
.box-head .toggle { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.box-body { padding: 14px; }
.box.collapsed > :not(.box-head) { display: none; }

.frow { display: grid; grid-template-columns: 44px 1fr 90px 250px; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.frow:first-of-type { border-top: 0; }
.ficon { width: 34px; height: 34px; border-radius: 50%; background: #3a3f3d; color: #fff; display: grid; place-items: center; }
.ficon.unread { background: var(--green); }
.ficon svg { width: 16px; height: 16px; fill: currentColor; }
.ftitle { font-size: 15px; font-weight: 600; }
.fdesc { color: var(--muted); font-size: 12px; }
.fdesc p { margin: 0; }
.subs { font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.subs a::before { content: '▪ '; color: var(--muted); }
.fstat { text-align: center; font-size: 18px; line-height: 1.1; }
.fstat small { display: block; font-size: 11px; color: var(--muted); }
.flast { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: 12px; }
.flast .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; display: block; font-size: 13px; }

.trow { display: grid; grid-template-columns: 1fr 110px 220px; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; }
.trow .ttitle { font-weight: 600; font-size: 15px; }
.tag { display: inline-block; font-size: 10px; text-transform: uppercase; padding: 1px 6px; border-radius: 2px; background: var(--green); color: #fff; margin-right: 4px; vertical-align: middle; }
.tag.lock { background: #777; }
.tag.hidden { background: var(--danger); }
.tag.feat { background: #c8952c; }

/* ---------- avatars */
.av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; background: #888; overflow: hidden; }
.av.lg { width: 96px; height: 96px; font-size: 40px; }
.av.md { width: 64px; height: 64px; font-size: 26px; }
.av.sm { width: 24px; height: 24px; font-size: 11px; }

/* ---------- posts */
.post { display: grid; grid-template-columns: 170px 1fr; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.post-author { padding: 14px; text-align: center; border-right: 1px solid var(--line); background: var(--head); }
.post-author .name { font-weight: 700; font-size: 15px; display: block; margin-bottom: 6px; }
.post-author .grp { font-size: 12px; margin-top: 6px; }
.post-author .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.post-main { min-width: 0; display: flex; flex-direction: column; }
.post-head { padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.post-body { padding: 14px; overflow-wrap: anywhere; flex: 1; }
.post-sig { padding: 8px 14px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); max-height: 160px; overflow: hidden; }
.post-foot { padding: 6px 14px 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.content blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--green); background: var(--head); }
.content blockquote[data-author]::before { content: attr(data-author) ' said:'; display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.content pre { background: #1e1e1e; color: #ddd; padding: 10px; overflow: auto; border-radius: var(--radius); }
.content .box_border { border: 1px solid var(--line); padding: 8px 12px; border-radius: var(--radius); margin: 8px 0; }
.content .spoiler { filter: blur(5px); transition: filter .2s; cursor: pointer; }
.content .spoiler:hover, .content .spoiler:focus { filter: none; }
.content iframe { max-width: 100%; aspect-ratio: 16/9; height: auto; border: 0; }
.content table { border-collapse: collapse; }
.content td, .content th { border: 1px solid var(--line); padding: 4px 8px; }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; font-size: 12px; }
.react-pill { background: var(--head); border: 1px solid var(--line); border-radius: 12px; padding: 0 8px; }
.react-pick { position: relative; }
.react-menu { position: absolute; bottom: 100%; left: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 4px; display: none; gap: 2px; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 5; }
.react-pick:hover .react-menu, .react-pick:focus-within .react-menu { display: flex; }
.react-menu button { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 2px 4px; }
.react-menu button:hover { transform: scale(1.25); }

/* ---------- editor */
.editor { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.editor .tb { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); background: var(--head); }
.editor .tb button { background: none; border: 1px solid transparent; border-radius: 2px; min-width: 28px; height: 28px; cursor: pointer; color: var(--text); font: 600 13px var(--font); }
.editor .tb button:hover { border-color: var(--line); background: var(--card); }
.editor .area { min-height: 160px; max-height: 60vh; overflow: auto; padding: 10px 12px; outline: none; }
.editor .area:empty::before { content: attr(data-placeholder); color: var(--muted); }

/* ---------- poll */
.poll .bar { height: 8px; background: var(--head); border-radius: 4px; overflow: hidden; margin: 3px 0 10px; }
.poll .bar span { display: block; height: 100%; background: var(--green); }

/* ---------- profile */
.cover { position: relative; aspect-ratio: 5 / 1; background: linear-gradient(120deg, #2f7d62, #1d2622) center / cover; border-radius: var(--radius) var(--radius) 0 0; }
.cover-edit { position: absolute; top: 14px; right: 14px; box-shadow: 0 2px 10px #0004; }
.profile-name { text-shadow: 0 0 5px color-mix(in srgb, currentColor 90%, transparent), 0 0 12px color-mix(in srgb, currentColor 65%, transparent), 0 0 22px color-mix(in srgb, currentColor 40%, transparent); }
.cover-preview { display: block; width: 100%; aspect-ratio: 5 / 1; object-fit: cover; border-radius: 6px; margin: 8px 0; }
dialog.modal.cover-cropper { width: min(900px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
.cover-cropper canvas { display: block; width: 100%; aspect-ratio: 5 / 1; margin: 14px 0; border-radius: 6px; cursor: grab; touch-action: none; }
.cover-cropper canvas:active { cursor: grabbing; }
.cover-cropper input[type=range] { padding: 0; width: 100%; accent-color: var(--green); min-height: 30px; }
.editor .upload-placeholder { display: inline-block; background: var(--head); color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 8px; }
.editor .upload-status { padding: 4px 12px; font-size: 12px; color: var(--muted); }
.editor .upload-status:empty { display: none; }
.profile-head { position: relative; z-index: 1; display: flex; gap: 16px; align-items: flex-end; padding: 0 20px 16px; margin-top: -50px; flex-wrap: wrap; }
.profile-head .av.lg { border: 4px solid var(--card); }
.profile-head h1 { font-size: 26px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.stats > div { min-width: 0; padding: 12px 14px; border-radius: 8px; background: var(--head); font-size: 12px; color: var(--muted); }
.stats b { display: block; margin-bottom: 3px; font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--text); overflow-wrap: anywhere; }
.stats > div:nth-child(-n+4) b { color: var(--green); font-size: 23px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; } .stats > div { padding: 10px 12px; } }
.cols { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }

/* ---------- grids (downloads, gallery) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card .thumb { aspect-ratio: 16/10; background: var(--head) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 32px; }
.card .body { padding: 10px 12px; }
.card .t { font-weight: 600; display: block; }
.side-nav a { display: flex; justify-content: space-between; padding: 7px 14px; border-top: 1px solid var(--line); }
.side-nav a.active { background: var(--green-light); font-weight: 600; }
.side-nav a:first-child { border-top: 0; }

/* ---------- tables, lists */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
table.list th { background: var(--head); font-size: 12px; text-transform: uppercase; color: var(--muted); border-top: 0; }
.pager { display: flex; gap: 4px; margin: 10px 0; flex-wrap: wrap; }
.pager a, .pager span { padding: 3px 10px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); font-size: 12px; }
.pager .cur { background: var(--green); color: #fff; border-color: var(--green); }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 100%; margin-top: 6px; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.2); width: 320px; max-height: 420px; overflow: auto; z-index: 20; }
.menu-pop a { display: block; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--text); }
.menu-pop a.unread { background: var(--green-light); }
.online-list a { margin-right: 6px; }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 80px; }
.chart span { flex: 1; background: var(--green); min-height: 1px; border-radius: 1px 1px 0 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kpi b { display: block; font-size: 22px; }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-nav a { padding: 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-nav a.active { background: var(--green); color: #fff; border-color: var(--green); }
mark { background: #fff3a3; color: #222; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 18px; border-radius: var(--radius); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
#toast.err { background: var(--danger); }

/* ---------- small screens */
@media (max-width: 860px) {
  .frow { grid-template-columns: 32px minmax(0, 1fr) 54px; gap: 8px; padding: 12px; }
  .frow .flast { display: none; }
  .frow .fstat { display: block; font-size: 16px; }
  .frow .ficon { width: 32px; height: 32px; }
  .frow > div { min-width: 0; }
  .trow { grid-template-columns: 1fr; }
  .trow > :not(:first-child) { display: none; }
  .post { grid-template-columns: 1fr; }
  .post-author { display: flex; gap: 10px; align-items: center; text-align: left; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 14px; }
  .post-author .av.md { width: 36px; height: 36px; font-size: 16px; }
  .post-author .name { margin: 0; }
  .post-author .meta, .post-author .grp { margin: 0; }
  .cols { grid-template-columns: minmax(0, 1fr) !important; }
  .logo img { height: 84px; }
  .banner-inner { min-height: 90px; }
  .home { grid-template-columns: 1fr !important; }
  .menu-pop { position: fixed; left: 16px; right: 16px; width: auto; top: 90px; }
}

/* ---------- readability */
.fdesc, .small { font-size: 13px; }
.trow .small, .flast { font-size: 13px; line-height: 1.5; }
.trow .small b { font-size: 15px; color: var(--text); }
.box-head { color: #3d4340; font-weight: 600; }
.footer { color: var(--muted); font-size: 13px; }
.footer a { color: var(--text); }
.crumbs, .crumbs a { color: #4d5350; }
:root[data-theme="dark"] .box-head, :root[data-theme="dark"] .crumbs, :root[data-theme="dark"] .crumbs a { color: var(--muted); }

/* ---------- home layout + sidebar */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); min-width: 0; }
.side-list li:first-child { border-top: 0; }
.side-list li > div { min-width: 0; }
.side-list .t { font-weight: 600; display: block; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-list .score { margin-left: auto; font-weight: 700; }
.side-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 10px; }
.side-stats b { display: block; font-size: 18px; }
.side-stats span { font-size: 12px; color: var(--muted); }
.online-avatars { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- unread, tags, ranks, presence */
.ficon.unread { box-shadow: 0 0 0 3px rgba(47,125,98,.25); }
.dot-unread { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-right: 6px; vertical-align: middle; }
.trow.unread .ttitle { font-weight: 700; }
.chip { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 10px; background: var(--head); border: 1px solid var(--line); color: var(--text); margin: 2px 4px 2px 0; }
.chip.prefix { background: var(--green); border-color: var(--green); color: #fff; text-transform: uppercase; font-weight: 600; }
.tag.solved { background: #2e8b57; }
.post.solution { border: 2px solid #2e8b57; }
.post.solution .post-head::before { content: '✔ Best answer'; color: #2e8b57; font-weight: 700; margin-right: 8px; }
.rank { display: block; font-size: 12px; color: var(--muted); }
.pips { color: #c8952c; letter-spacing: 1px; }
.av-wrap { position: relative; display: inline-block; }
.av-wrap.online::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 12px; height: 12px; border-radius: 50%; background: #3cb371; border: 2px solid var(--head); }
.ignored-post { padding: 10px 14px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.bulkbar { position: sticky; bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; background: #1f2a25; color: #fff; padding: 8px 12px; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 10; margin-bottom: 12px; }
.bulkbar select { width: auto; }
.trow .pick { margin-right: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar select { width: auto; }

/* ---------- editor extras */
.editor { position: relative; }
.editor .tb .sep { width: 1px; background: var(--line); margin: 4px 3px; }
.editor .tb .tb-hint { margin-left: auto; font-size: 12px; color: var(--muted); align-self: center; padding-right: 6px; }
.emoji-pop { position: absolute; z-index: 5; top: 40px; right: 8px; width: 290px; display: grid; grid-template-columns: repeat(8, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.15); padding: 6px; }
.emoji-pop[hidden] { display: none; }
.emoji-pop button { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 3px; border-radius: 3px; }
.emoji-pop button:hover { background: var(--head); }

/* ---------- autocomplete */
.suggest { position: absolute; z-index: 100; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.2); padding: 4px; }
.suggest button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; background: none; color: var(--text); font: 600 14px var(--font); cursor: pointer; border-radius: 3px; text-align: left; }
.suggest button.on, .suggest button:hover { background: var(--green-light); }

/* ---------- dialogs */
dialog.modal { border: 0; padding: 0; border-radius: 6px; width: min(460px, calc(100% - 32px)); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(10,14,12,.55); backdrop-filter: blur(2px); }
.modal-head { background: var(--green); color: #fff; padding: 12px 18px; font-weight: 700; font-size: 16px; }
.modal-body { padding: 8px 18px 16px; }
.modal-body p { margin: 10px 0 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; background: var(--head); border-top: 1px solid var(--line); }

/* ---------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal > div { background: var(--card); min-height: 96px; padding: 4px 6px; font-size: 12px; min-width: 0; }
.cal .dow { min-height: 0; background: var(--head); font-weight: 600; text-align: center; padding: 6px; }
.cal .other { background: var(--head); color: var(--muted); }
.cal .today { box-shadow: inset 0 0 0 2px var(--green); }
.cal a.ev { display: block; background: var(--green); color: #fff; border-radius: 2px; padding: 1px 5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) { .cal > div { min-height: 60px; padding: 2px; } .cal a.ev { font-size: 10px; } }

/* ---------- profile feed, banner admin */
.status-item { display: flex; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.status-item:first-of-type { border-top: 0; }
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.slides figure { margin: 0; position: relative; }
.slides img { aspect-ratio: 16/9; object-fit: cover; width: 100%; border-radius: 3px; }
.slides button { position: absolute; top: 4px; right: 4px; }

/* ======================================================================
   Modern layer: same layout and colours as the original theme, with softer
   cards, rounded corners, depth, hover feedback and a sticky nav bar.
   ====================================================================== */
:root {
  --radius: 10px;
  --bg: #eceeed;
  --line: #e1e4e2;
  --head: #f6f7f6;
  --shadow: 0 1px 2px rgba(16, 28, 22, .05), 0 6px 20px -8px rgba(16, 28, 22, .12);
  --shadow-lg: 0 2px 4px rgba(16, 28, 22, .06), 0 16px 40px -12px rgba(16, 28, 22, .25);
  --green-grad: linear-gradient(135deg, #36906f, #24684f);
}
:root[data-theme="dark"] { --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px -8px rgba(0,0,0,.5); --head: #262a2b; --line: #33393a; }

/* nav: sticky, with a soft glass edge */
.subnav { position: sticky; top: 0; z-index: 30; background: rgba(39, 110, 84, .94); backdrop-filter: saturate(1.4) blur(8px); box-shadow: 0 4px 16px -8px rgba(0,0,0,.35); }
.subnav .wrap { gap: 2px; padding-top: 4px; padding-bottom: 4px; }
.subnav a { border-radius: 8px; padding: 7px 12px; transition: background .15s; }
.subnav a.active { background: rgba(255,255,255,.16); }
.tabs a { border-radius: 10px 10px 0 0; transition: background .15s; }
.userbar .btn-ghost { border-color: rgba(255,255,255,.25); background: rgba(10,16,13,.35); backdrop-filter: blur(6px); border-radius: 999px; }
.userbar .btn { border-radius: 999px; }

/* cards */
.box, .post, .card, .kpi, .cal { border: 1px solid rgba(16, 28, 22, .06); border-radius: var(--radius); box-shadow: var(--shadow); }
.card, .kpi, .cal { overflow: hidden; }
.post-author { border-radius: var(--radius) 0 0 var(--radius); }
.box > :first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.box > :last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.box { margin-bottom: 16px; }
.box-head { background: transparent; padding: 12px 16px; font-size: 11.5px; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.box-head a { color: inherit; }
.box-head a:hover { color: var(--green); }
.frow, .trow, .side-list li, .side-nav a { transition: background .12s; }
.frow:hover, .trow:hover, .side-list li:hover, .side-nav a:hover { background: rgba(47, 125, 98, .045); }
.frow { padding: 14px 16px; }
.ficon { width: 40px; height: 40px; border-radius: 12px; background: #3d4441; }
.ficon.unread { background: var(--green-grad); box-shadow: 0 4px 12px -4px rgba(47,125,98,.6); }
.ftitle { font-size: 16px; }
.fstat { font-size: 20px; font-weight: 600; }
.card { transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* buttons & fields */
.btn { border-radius: 8px; background: var(--green-grad); box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.12); transition: transform .12s, box-shadow .12s, filter .12s; }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 6px 14px -6px rgba(36,104,79,.6); }
.btn:active { transform: none; }
.btn-light, .btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn-light:hover { background: var(--head); color: var(--text); box-shadow: 0 4px 10px -6px rgba(0,0,0,.25); }
.btn-danger { background: linear-gradient(135deg, #d24a3b, #a93226); }
.btn-sm { border-radius: 7px; }
input, select, textarea { border-radius: 8px; padding: 9px 12px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,125,98,.18); }
:focus-visible { outline: 3px solid rgba(47,125,98,.45); outline-offset: 2px; border-radius: 6px; }

/* posts */
.post { margin-bottom: 16px; grid-template-columns: 180px 1fr; }
.post-author { background: linear-gradient(180deg, var(--head), var(--card)); border-right: 1px solid var(--line); }
.post-author .av.md { width: 72px; height: 72px; box-shadow: 0 4px 12px -4px rgba(0,0,0,.35); }
.post-head { border-bottom-color: var(--line); padding: 10px 16px; }
.post-body { padding: 16px; font-size: 15.5px; line-height: 1.7; }
.post-foot { padding: 8px 16px 12px; }
.post-foot .btn-sm { padding: 4px 10px; }
.content blockquote { border-radius: 0 8px 8px 0; }
.content img { border-radius: 6px; }
.react-pill { border-radius: 999px; padding: 1px 10px; }

/* misc */
.page-head h1 { font-weight: 700; letter-spacing: -.01em; }
.tag { border-radius: 999px; padding: 1px 8px; }
.chip { border-radius: 999px; }
.notice { border-radius: var(--radius); border-left-width: 4px; box-shadow: var(--shadow); }
.pager a, .pager span { border-radius: 7px; padding: 4px 11px; }
.pager a:hover { border-color: var(--green); color: var(--green); }
.menu-pop, .suggest, .emoji-pop { border-radius: 12px; box-shadow: var(--shadow-lg); }
.editor { border-radius: var(--radius); overflow: visible; }
.editor .tb { border-radius: var(--radius) var(--radius) 0 0; }
.editor .tb button { border-radius: 6px; }
.editor.dropping { outline: 3px dashed var(--green); outline-offset: 3px; background: var(--green-light); }
.editor.dropping .area::before { content: 'Drop images to upload'; color: var(--green); font-weight: 600; }
.bulkbar { border-radius: 12px; }
dialog.modal { border-radius: 14px; overflow: hidden; }
.modal-head { background: var(--green-grad); }
.av { box-shadow: 0 0 0 2px var(--card); }
.cover { border-radius: var(--radius) var(--radius) 0 0; }
.footer { padding-top: 10px; }
.side-stats b { color: var(--green); }
@media (max-width: 860px) { .post { grid-template-columns: 1fr; } .subnav { position: static; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Compact account navigation and live game server */
.banner { overflow: visible; z-index: 40; }
.banner-inner { z-index: 3; }
.account-menu { position: relative; }
.account-trigger { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; padding: 5px 10px 5px 5px; border: 1px solid #ffffff40; border-radius: 999px; background: #0a100d80; }
.account-trigger::-webkit-details-marker { display: none; }
.account-pop { width: 240px; padding: 6px; }
.account-pop a, .userbar .account-pop button { display: block; width: 100%; padding: 10px 12px; color: var(--text); background: transparent; border: 0; border-radius: 6px; text-align: left; font: inherit; cursor: pointer; }
.account-pop a:hover, .account-pop button:hover { background: var(--green-light); color: var(--text); }
.userbar .account-pop #logout { border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; color: var(--danger); }
.game-server { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 5px; color: var(--text); background: var(--card); }
.server-platforms { position: relative; width: 36px; height: 36px; }
.server-platforms > img:first-child { display: block; border-radius: 3px; }
.server-platforms > img:last-child { position: absolute; bottom: -4px; right: -5px; padding: 1px; background: var(--card); border-radius: 50%; }
.game-server-main { min-width: 0; }
.server-title { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.game-server h2 { font-size: 16px; font-weight: 600; line-height: 1.4; margin: 0; }
.server-status { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; }
.server-status::before { content: ''; width: 5px; height: 5px; background: var(--muted); border-radius: 50%; }
.server-status.online::before { background: #36a568; }
.game-server-detail { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.server-address { color: var(--muted); font: 11px ui-monospace, monospace; }
.game-server-players { min-width: 56px; text-align: right; line-height: 1.3; }
.game-server-players b { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.game-server-players small { display: block; font-size: 10px; color: var(--muted); }
.game-server-actions { display: flex; align-items: center; gap: 5px; }
.game-server .btn { padding: 5px 13px; border-radius: 4px; font-size: 12px; box-shadow: none; background: var(--green); }
.server-copy { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 30px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.server-copy:hover { background: var(--head); color: var(--text); }
@media (max-width: 640px) { .account-trigger b { max-width: 100px; overflow: hidden; text-overflow: ellipsis; } .game-server { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 10px; } .server-platforms { width: 28px; height: 28px; } .server-platforms > img:first-child { width: 28px; height: 28px; } .server-platforms > img:last-child { width: 15px; height: 15px; } .game-server h2 { font-size: 14px; } .server-title { gap: 5px; } .server-mode { display: none; } .game-server-players { min-width: 45px; } .game-server-actions { grid-column: 2 / -1; justify-content: flex-start; margin-top: -3px; } .game-server .btn { padding: 3px 13px; } }

.server-lock { display: inline-flex; color: var(--muted); }

.editor .tb select { width: auto; height: 28px; margin: 0 2px; padding: 2px 5px; font-size: 12px; border-radius: 4px; background: var(--card); color: var(--text); }
.editor .tb .text-colour { position: relative; display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; border-bottom: 3px solid var(--green); }
.text-colour input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; cursor: pointer; }
.content h2, .content h3, .content h4 { margin: .7em 0 .35em; line-height: 1.35; }
.content h2 { font-size: 24px; } .content h3 { font-size: 20px; } .content h4 { font-size: 17px; }
.discord-banner { display: flex; align-items: center; gap: 12px; padding: 15px 16px; margin-bottom: 14px; border-radius: 6px; background: #5865f2; color: #fff; }
.discord-banner:hover { background: #4752c4; color: #fff; }
.discord-banner span:nth-child(2) { flex: 1; } .discord-banner b { display: block; font-size: 15px; } .discord-banner small { display: block; font-size: 11px; color: #e0e3ff; }

.guide-nav { display:flex; flex-wrap:wrap; gap:8px 18px; margin:0 0 14px; font-size:13px; } .guide-nav a { color:var(--green); } .guide-content { max-width:900px; } .guide-content h1 { font-size:28px; margin-bottom:14px; line-height:1.3; } .guide-content li { margin-bottom:10px; } .guide-links { padding-left:20px; } .guide-links p { margin:2px 0 12px; } .game-server-players .server-lock { justify-content:center; vertical-align:middle; }

.leaderboard-columns { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; align-items:start; }
.leaderboard-row { display:grid; grid-template-columns:28px minmax(0,1fr) 60px; gap:10px; align-items:center; padding:12px 14px; border-top:1px solid var(--line); }
.leaderboard-member { display:flex; align-items:center; gap:10px; min-width:0; }
.leaderboard-member > div { min-width:0; }
.leaderboard-member a { overflow-wrap:anywhere; }
.leaderboard-member .small { display:block; }
.leaderboard-score { text-align:right; font-variant-numeric:tabular-nums; }
.cols > *, .home > *, .content { min-width:0; }
.content a { overflow-wrap:anywhere; }
@media(max-width:860px) { .leaderboard-columns { grid-template-columns:minmax(0,1fr); } }
@media(max-width:640px) { .page-head { flex-wrap:wrap; gap:10px; } .leaderboard-row { grid-template-columns:24px minmax(0,1fr) 48px; gap:8px; padding:12px; } .leaderboard-member .av { width:32px; height:32px; font-size:15px; flex-shrink:0; } .frow .fstat { font-size:16px; } }

/* Member previews */
.profile-card[hidden] { display:none; }
.profile-card { position:fixed; z-index:10000; width:min(320px,calc(100vw - 20px)); background:var(--card); color:var(--text); border:1px solid var(--line); border-radius:8px; box-shadow:0 8px 30px #0003; overflow:hidden; font-size:13px; }
.profile-card-cover { height:54px; background:var(--green) center/cover no-repeat; }
.profile-card-body { padding:0 14px 12px; }
.profile-card-person { display:flex; gap:12px; align-items:flex-end; margin-top:-24px; position:relative; }
.profile-card-person .av { width:62px; height:62px; border:3px solid var(--card); font-size:25px; flex:none; }
.profile-card-identity { display:flex; flex-direction:column; min-width:0; padding-top:27px; }
.profile-card-name { font-weight:700; font-size:16px; overflow-wrap:anywhere; }
.profile-card-identity span,.profile-card-identity small { color:var(--muted); }
.profile-card-stats { display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; padding:12px 0; color:var(--muted); }
.profile-card-stats b { color:var(--text); }
.profile-card-actions { display:flex; gap:14px; padding-top:10px; border-top:1px solid var(--line); font-weight:600; }

/* Factions and gangs */
.gang-search { display:flex; gap:8px; margin:0 0 16px; max-width:480px; }
.gang-search input { flex:1; min-width:0; }
.gang-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(235px,1fr)); gap:14px; }
.gang-card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.gang-cover, .gang-profile-cover { display:block; background:#36584a center/cover no-repeat; }
.gang-cover { height:92px; }
.gang-card-body { display:flex; align-items:flex-end; gap:10px; padding:0 12px 13px; margin-top:-22px; position:relative; }
.gang-icon, .gang-profile-icon { flex:none; border:3px solid var(--card); border-radius:8px; object-fit:cover; background:#58776a; color:#fff; }
.gang-icon { width:58px; height:58px; }
.gang-initial { display:grid; place-items:center; font-weight:700; font-size:24px; }
.gang-info { padding-top:24px; min-width:0; }
.gang-name { font-size:16px; font-weight:700; overflow-wrap:anywhere; }
.gang-profile { overflow:hidden; }
.gang-profile-cover { height:155px; }
.gang-profile-head { display:flex; align-items:flex-end; flex-wrap:wrap; gap:14px; padding:0 18px 16px; margin-top:-30px; position:relative; }
.gang-profile-head h1 { font-size:25px; line-height:1.2; overflow-wrap:anywhere; }
.gang-profile-icon { width:86px; height:86px; }
.gang-update { border-bottom:1px solid var(--line); }
.gang-request { padding:6px 0; }
@media(max-width:640px) { .gang-grid { grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; } .gang-profile-cover { height:110px; } .gang-profile-icon { width:68px; height:68px; } .gang-profile-head h1 { font-size:21px; } .gang-profile-head .right { width:100%; } }
.gang-gallery { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:8px; }
.gang-gallery img { width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:4px; display:block; }
