:root {
    --bg: #0e0e10;
    --header: #070709;
    --block: #19191c;
    --block-alt: #1e1e22;
    --block-label: #202024;
    --block-line: #2a2a2f;
    --field: #232327;
    --field-line: #33333a;
    --text: #e6e6ea;
    --text-soft: #c4c4cc;
    --muted: #85858f;
    --accent: #3b5bff;
    --accent-bright: #6d86ff;
    --accent-glow: rgba(59, 91, 255, .35);
    --error-text: #ff6b6b;
    --error-bg: #351617;
    --error-line: #6e2a2c;
    --error-edge: #e5484d;
    --ok-text: #6fe3a5;
    --ok-bg: #12291d;
    --ok-line: #24533a;
    --ok-edge: #2fbf71;
    --button: #2c2c32;
    --button-hover: #393941;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
}

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 10px 12px; }
.hide-sm { display: inline; }

/* ---------- Header / banner ---------- */
.site-header { background: var(--header); }
.banner {
    display: block;
    height: 150px;
    overflow: hidden;
    background: #000;
    position: relative;
}
.banner img {
    display: block;
    height: 100%;
    width: auto;
    margin: 0 auto;
    object-fit: cover;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18%, #000 82%, transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 18%, #000 82%, transparent 100%);
}
.banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, var(--header) 100%);
    pointer-events: none;
}

.nav-bar {
    border-bottom: 1px solid #d9d9e0;
    box-shadow: 0 8px 14px -6px rgba(255, 255, 255, .16);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 2px; }
.nav-tab, .nav-right > a, .nav-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 13px 10px;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.nav-tab::-webkit-details-marker, .nav-user::-webkit-details-marker { display: none; }
.nav-tab:hover, .nav-right > a:hover, .nav-user:hover { color: #fff; text-decoration: none; }
.nav-tab.active { color: #fff; background: linear-gradient(to top, rgba(92, 107, 255, .16), transparent 75%); box-shadow: inset 0 -3px 0 var(--accent), 0 6px 14px -8px var(--accent); }
.nav-tab .icon { color: var(--muted); }
.nav-user { font-weight: 400; }

.nav-menu { position: relative; }
.nav-menu .menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    min-width: 190px;
    padding: 6px 0;
    background: var(--block-alt);
    border: 1px solid var(--block-line);
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.nav-menu.align-right .menu { left: auto; right: 0; }
.menu a, .menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: 0;
    color: var(--text-soft);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--button); color: #fff; text-decoration: none; }
.menu form { margin: 0; }

/* ---------- Avatars ---------- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3a4a8c;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
}
.avatar.xs { width: 20px; height: 20px; font-size: 10px; vertical-align: middle; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.avatar.lg { width: 84px; height: 84px; font-size: 38px; }
.username.staff { color: var(--accent-bright); font-weight: 700; }

/* ---------- Page layout ---------- */
.page {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 14px 40px;
}
.narrow { max-width: 980px; margin: 0 auto; }
.page-title { margin: 0 0 12px; font-size: 20px; font-weight: 400; color: #f2f2f5; }
.section-title { margin: 28px 0 10px; font-size: 16px; font-weight: 400; color: #f2f2f5; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.title-row .page-title { margin: 0; }
.title-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs { margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.crumbs a { color: var(--text-soft); }
.forum-desc { margin: -4px 0 12px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; align-items: start; }

/* ---------- Blocks ---------- */
.block {
    background: var(--block);
    border: 1px solid var(--block-line);
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: hidden;
}
.block-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 8px 10px;
    border-bottom: 2px solid var(--text-soft);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.block-foot { padding: 6px 10px; background: var(--block-label); color: var(--muted); font-size: 12px; border-top: 1px solid var(--block-line); }

/* Categories & nodes */
.cat-head { display: block; }
.cat-title { font-size: 13px; font-weight: 700; }
.cat-desc { color: var(--text-soft); font-size: 11px; font-weight: 400; }

.node {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 70px 70px 230px;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border-top: 1px solid var(--block-line);
}
.node:first-of-type { border-top: 0; }
.node-icon { color: var(--muted); display: flex; justify-content: center; }
.node.has-posts .node-icon { color: var(--accent-bright); }
.node-title { font-size: 15px; color: #f0f0f3; }
.node.has-posts .node-title { font-weight: 700; }
.node-desc { color: var(--muted); font-size: 12px; }
.node-stat { margin: 0; text-align: center; }
.node-stat dt { color: var(--muted); font-size: 11px; }
.node-stat dd { margin: 0; font-size: 13px; }
.node-last {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 6px 8px;
    background: var(--block-alt);
    border-radius: 3px;
}
.node-last-text { min-width: 0; }
.node-last-text a { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }

/* Thread lists */
.thread-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 70px 150px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--block-line);
}
.thread-row:first-of-type, .block-head + .thread-row { border-top: 0; }
.thread-title { font-size: 14px; font-weight: 600; }
.thread-last { text-align: right; }
.label {
    display: inline-block;
    margin-right: 4px;
    padding: 0 6px;
    background: var(--button);
    border-radius: 3px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

/* Posts */
.post {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    background: var(--block);
    border: 1px solid var(--block-line);
    border-radius: 3px;
    margin-bottom: 10px;
    overflow: hidden;
}
.post-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    background: var(--block-label);
    border-right: 1px solid var(--block-line);
    text-align: center;
}
.post-username { font-weight: 700; }
.role-badge { padding: 1px 8px; background: var(--accent); border-radius: 3px; color: #fff; font-size: 11px; font-weight: 700; }
.post-meta { display: grid; grid-template-columns: auto auto; gap: 0 8px; margin: 4px 0 0; font-size: 11px; }
.post-meta dt { color: var(--muted); text-align: left; }
.post-meta dd { margin: 0; text-align: right; }
.post-content { display: flex; flex-direction: column; min-width: 0; padding: 10px 14px 14px; }
.post-head { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--block-line); color: var(--muted); font-size: 12px; }
.post-head time { margin-right: auto; }
.post-body { overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; }
.post-body a, .shout-body a, .shout-notice a { color: var(--accent-bright); }
.reply-box .post-user { justify-content: flex-start; }
.reply-actions { margin-top: 8px; display: flex; justify-content: flex-end; }

/* Shoutbox */
.shout-notice { padding: 8px 12px; border-bottom: 1px solid var(--block-line); color: var(--text-soft); font-size: 13px; overflow-wrap: anywhere; }
.shout-form { display: flex; gap: 6px; padding: 8px 10px; }
.shout-form input { flex: 1; }
.shout-list {
    list-style: none;
    margin: 0;
    padding: 4px 10px 8px;
    height: 230px;
    overflow-y: auto;
    scrollbar-color: #444 transparent;
}
.shout { padding: 3px 0; font-size: 13px; overflow-wrap: anywhere; }
.shout .username { font-weight: 700; }
.shout-time { color: var(--muted); font-size: 11px; margin-left: 4px; }
.shout-error { color: var(--error-text); }
.shout-del { margin-left: 4px; font-size: 11px; }

/* Sidebar */
.sidebar .block-head { font-size: 12px; }
.side-thread { display: flex; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--block-line); font-size: 13px; }
.side-thread:first-child { border-top: 0; }
.side-thread a { overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 0; font-size: 13px; }
.stats dt { color: var(--text-soft); }
.stats dd { margin: 0; text-align: right; }
.share { display: flex; align-items: center; gap: 8px; }

/* ---------- Notices ---------- */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 14px;
    min-height: 60px;
    border-radius: 3px;
    border: 1px solid;
    border-left-width: 3px;
}
.notice svg { flex-shrink: 0; }
.notice > div { padding-top: 5px; }
.notice-error { color: var(--error-text); background: var(--error-bg); border-color: var(--error-line); border-left-color: var(--error-edge); }
.notice-success { color: var(--ok-text); background: var(--ok-bg); border-color: var(--ok-line); border-left-color: var(--ok-edge); }

/* ---------- Two-column block form ---------- */
.block-form {
    background: var(--block);
    border: 1px solid var(--block-line);
    border-radius: 3px;
    overflow: hidden;
}
.form-row, .form-submit { display: grid; grid-template-columns: minmax(180px, 33%) 1fr; }
.form-label {
    padding: 22px 10px 10px;
    background: var(--block-label);
    text-align: right;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 400;
}
.form-field { padding: 14px 10px 10px; min-width: 0; }
.form-field.static { padding-top: 22px; }
.form-row:last-of-type .form-field { padding-bottom: 20px; }
.form-submit { border-top: 1px solid var(--block-line); background: var(--block-label); }
.form-submit .form-label { padding: 0; }
.form-submit .form-field { padding: 6px 10px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input:not([type]), textarea, select {
    display: block;
    width: 100%;
    padding: 8px 10px;
    background: var(--field);
    border: 1px solid var(--field-line);
    border-radius: 3px;
    color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
select { cursor: pointer; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
textarea { resize: vertical; }

.input-group { display: flex; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-addon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    background: var(--block-label);
    border: 1px solid var(--field-line);
    border-left: 0;
    border-radius: 0 3px 3px 0;
    color: var(--text-soft);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.input-addon:hover { color: #fff; background: #2b2b30; }

.field-link { display: inline-block; margin-top: 8px; color: #fff; }
.hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 26px; cursor: pointer; color: var(--text-soft); }
.check input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
.inline-check { margin-top: 0; white-space: nowrap; }

.strength { margin-top: 8px; }
.strength-bar { height: 4px; border-radius: 2px; background: var(--field-line); overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; transition: width .2s, background-color .2s; }
.strength-bar .s1 { background: var(--error-edge); }
.strength-bar .s2 { background: #f5a524; }
.strength-bar .s3 { background: #6d86ff; }
.strength-bar .s4 { background: var(--ok-edge); }
.strength-label { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

/* ---------- Buttons ---------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 12px;
    min-height: 28px;
    background: var(--button);
    border: 1px solid #45454d;
    border-radius: 3px;
    color: #f0f0f3;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none !important;
    transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.button:hover { background: var(--button-hover); }
.button-primary { background: var(--accent); border-color: var(--accent); color: #fff; min-width: 110px; padding: 6px 24px; font-size: 13px; }
.button-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); box-shadow: 0 0 12px var(--accent-glow); }
.button-danger:hover { background: #5a1f22; border-color: var(--error-edge); }
.button-small { padding: 3px 10px; min-height: 24px; min-width: 0; font-size: 12px; }
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--field);
    border: 1px solid var(--field-line);
    border-radius: 3px;
    color: var(--text-soft);
    cursor: pointer;
}
.icon-btn:hover { color: #fff; border-color: var(--accent); }
.link-btn { padding: 0; background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }
.link-btn:hover { color: var(--error-text); }
form.inline { display: inline-flex; margin: 0; }

.spinner {
    display: none;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
button.loading { pointer-events: none; opacity: .8; }
button.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.below-form { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0; color: var(--text-soft); }

/* Pager */
.pager { display: flex; gap: 4px; margin: 10px 0; flex-wrap: wrap; }
.pager-item { min-width: 28px; padding: 3px 8px; text-align: center; background: var(--button); border: 1px solid var(--block-line); border-radius: 3px; font-size: 12px; }
.pager-item.current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Search */
.search-form { display: flex; gap: 6px; margin-bottom: 12px; }
.search-form input { flex: 1; }

/* Admin */
.admin-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--block-line); margin: 0; }
.admin-line.block-head { border-top: 0; }
.admin-line input, .admin-line select { width: auto; flex: 1 1 150px; padding: 5px 8px; }
.admin-line input.num { flex: 0 0 64px; }
.admin-add { display: grid; gap: 0; }
.admin-add .block { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--block-line); text-align: left; white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.data select { width: auto; padding: 3px 6px; }

.site-footer { padding: 20px; text-align: center; color: var(--muted); font-size: 12px; border-top: 1px solid var(--block-line); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .layout { grid-template-columns: 1fr; }
    .node { grid-template-columns: 40px minmax(0, 1fr) 60px 60px; }
    .node-last { grid-column: 2 / -1; }
}
@media (max-width: 650px) {
    .banner { height: 110px; }
    .hide-sm { display: none; }
    .nav-tab, .nav-right > a, .nav-user { padding: 12px 7px; }
    .node { grid-template-columns: 34px minmax(0, 1fr); gap: 6px 10px; }
    .node-stat { display: none; }
    .node-last { grid-column: 1 / -1; }
    .thread-row { grid-template-columns: 36px minmax(0, 1fr); }
    .thread-row .node-stat { display: none; }
    .thread-last { grid-column: 2; text-align: left; }
    .post { grid-template-columns: 1fr; }
    .post-user { flex-direction: row; justify-content: flex-start; border-right: 0; border-bottom: 1px solid var(--block-line); padding: 8px 10px; }
    .post-user .avatar.lg { width: 36px; height: 36px; font-size: 15px; }
    .post-meta { display: none; }
    .reply-box .post-user { display: none; }
    .form-row, .form-submit { grid-template-columns: 1fr; }
    .form-label { text-align: left; padding: 12px 10px 0; background: none; }
    .form-field { padding-top: 6px; }
    .form-field.static { padding-top: 4px; }
    .form-submit .form-label { display: none; }
    .form-submit .form-field { padding: 8px 10px; }
    .form-submit .button-primary { width: 100%; }
    .check { margin-top: 16px; }
    .below-form { flex-wrap: wrap; }
}

/* Avatar colours (classes instead of inline styles, so CSP can block inline styles) */
.avatar.hue-0 { background: hsl(0 55% 42%); }
.avatar.hue-1 { background: hsl(30 55% 42%); }
.avatar.hue-2 { background: hsl(60 55% 42%); }
.avatar.hue-3 { background: hsl(90 55% 42%); }
.avatar.hue-4 { background: hsl(120 55% 42%); }
.avatar.hue-5 { background: hsl(150 55% 42%); }
.avatar.hue-6 { background: hsl(180 55% 42%); }
.avatar.hue-7 { background: hsl(210 55% 42%); }
.avatar.hue-8 { background: hsl(240 55% 42%); }
.avatar.hue-9 { background: hsl(270 55% 42%); }
.avatar.hue-10 { background: hsl(300 55% 42%); }
.avatar.hue-11 { background: hsl(330 55% 42%); }

/* Status labels + warning notice */
.label-ok { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-line); margin-left: 6px; }
.label-warn { background: #3a2d10; color: #f5c451; border: 1px solid #6b5418; margin-left: 6px; }
.notice-warn { color: #f5c451; background: #2b2410; border-color: #5a4a1a; border-left-color: #f5a524; }
.notice-warn form { margin-left: 8px; vertical-align: middle; }
.notice-warn strong { color: #fff; }
/* =====================================================================
   v6: roles, profiles, wallet, roulette, tickets, workshop, mobile nav
   ===================================================================== */

/* Role colours */
.username { font-weight: 600; color: var(--text); }
.username.role-owner     { color: #ff4d5e; }
.username.role-co_owner  { color: #ff8a3d; }
.username.role-developer { color: #b67cff; }
.username.role-premium   { color: #f5c451; }
.username.role-customer  { color: #4ade80; }
.username.role-verified  { color: #60a5fa; }
.role-badge { display: inline-block; padding: 1px 8px; border-radius: 3px; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .3px; vertical-align: middle; background: var(--button); }
.role-badge.role-owner     { background: linear-gradient(90deg, #d7263d, #ff4d5e); }
.role-badge.role-co_owner  { background: linear-gradient(90deg, #e0621b, #ff8a3d); }
.role-badge.role-developer { background: linear-gradient(90deg, #7c3aed, #b67cff); }
.role-badge.role-premium   { background: linear-gradient(90deg, #c98a0b, #f5c451); color: #221600; }
.role-badge.role-customer  { background: #1f7a45; }
.role-badge.role-verified  { background: #1d5fbf; }
.role-badge.role-member    { background: var(--button); color: var(--text-soft); }

.label-bad { background: var(--error-bg); color: var(--error-text); border: 1px solid var(--error-line); }
.label .icon { vertical-align: -1px; }

/* Nav extras */
.nav-mobile { display: none; }
.nav-coins, .nav-icon { display: inline-flex; align-items: center; gap: 5px; padding: 13px 8px; color: var(--text-soft); font-size: 13px; font-weight: 600; position: relative; }
.nav-coins { color: #f5c451; }
.nav-coins:hover, .nav-icon:hover { color: #fff; text-decoration: none; }
.count { display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 3px; border-radius: 8px; background: var(--error-edge); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.menu-head { padding: 8px 14px 10px; border-bottom: 1px solid var(--block-line); margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
.menu-head .avatar { flex-shrink: 0; }
.menu-head-info { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.menu .menu-head-info a.username { padding: 0; display: inline; }

/* Avatars */
.avatar.xl { width: 110px; height: 110px; font-size: 48px; border: 4px solid var(--block); }

/* Profile */
.profile-card { position: relative; }
.profile-banner { height: 110px; background: linear-gradient(120deg, #0b1233, #1c2a6e 55%, #0b0b10); position: relative; overflow: hidden; }
.profile-banner.has-image { height: 190px; }
.profile-banner-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-banner.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(7, 7, 9, .75)); pointer-events: none; }
.banner-preview { width: 100%; max-width: 480px; height: auto; aspect-ratio: 4 / 1; border-radius: 4px; border: 1px solid var(--block-line); }
.profile-banner.role-bg-owner { background: linear-gradient(120deg, #2a0a10, #7a1522 55%, #0b0b10); }
.profile-banner.role-bg-co_owner { background: linear-gradient(120deg, #2a1407, #7a3a12 55%, #0b0b10); }
.profile-banner.role-bg-developer { background: linear-gradient(120deg, #170b2e, #45207a 55%, #0b0b10); }
.profile-banner.role-bg-premium { background: linear-gradient(120deg, #2a1f05, #7a5a0e 55%, #0b0b10); }
.profile-main { display: flex; align-items: flex-end; gap: 16px; padding: 0 18px; margin-top: -55px; flex-wrap: wrap; position: relative; z-index: 1; }
.profile-id { flex: 1; min-width: 200px; padding-bottom: 6px; }
.profile-name { margin: 0 0 4px; font-size: 24px; font-weight: 600; }
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.profile-edit, .profile-actions { margin-bottom: 10px; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 0; margin: 16px 0 0; border-top: 1px solid var(--block-line); }
.profile-stats > div { padding: 10px 12px; border-right: 1px solid var(--block-line); text-align: center; }
.profile-stats > div:last-child { border-right: 0; }
.profile-stats dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.profile-stats dt a { color: inherit; }
.profile-stats dt a:hover { color: var(--text, #fff); }
.profile-stats dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; }
.profile-layout { margin-top: 12px; }
.thread-row.compact { grid-template-columns: minmax(0, 1fr); }

/* Wallet */
.wallet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wallet-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-bottom: 0; }
.wallet-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.wallet-balance { display: flex; align-items: center; gap: 8px; font-size: 32px; font-weight: 700; color: #f5c451; }
.wallet-balance.small-bal { font-size: 24px; }
.num-col { text-align: right !important; }
.pos { color: var(--ok-text); }
.neg { color: var(--error-text); }

/* Roulette */
.roulette { padding: 16px; }
.rl-window { position: relative; overflow: hidden; height: 132px; border-radius: 4px; background: #0a0a0d; border: 1px solid var(--block-line);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.rl-marker { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1px; background: #fff; box-shadow: 0 0 12px var(--accent), 0 0 4px #fff; z-index: 2; }
.rl-marker::before, .rl-marker::after { content: ""; position: absolute; left: -7px; border: 8px solid transparent; }
.rl-marker::before { top: 0; border-top-color: #fff; }
.rl-marker::after { bottom: 0; border-bottom-color: #fff; }
.rl-strip { display: flex; height: 100%; will-change: transform; }
.rl-card { flex: 0 0 124px; margin: 8px 4px; border-radius: 4px; background: linear-gradient(180deg, #202027, #16161b); border: 1px solid #2c2c35; border-bottom: 4px solid var(--accent);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 6px; text-align: center; }
.rl-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px rgba(255,255,255,.12); }
.rl-label { font-size: 12px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.rl-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.rl-spin { padding: 10px 26px; font-size: 14px; }
.rl-spin:disabled { opacity: .6; cursor: wait; }
.rl-result { font-weight: 600; }
.rl-result.good { color: var(--ok-text); }
.rl-result.bad { color: var(--error-text); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; background: var(--accent); }

/* Tickets */
.tabs { flex-wrap: wrap; }
.ticket-status { text-align: center; }
.thread-row:has(.ticket-status) { grid-template-columns: 36px minmax(0, 1fr) 120px 130px; }
.post-staff { border-color: #2c3f8a; }
.post-staff .post-user { background: #161c33; }

/* Workshop */
.workshop-filter select { width: auto; }
.workshop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.workshop-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; margin: 0; color: var(--text); transition: border-color .15s, transform .15s; }
.workshop-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.wc-type { align-self: flex-start; display: inline-flex; gap: 5px; align-items: center; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 700; background: #1d2750; color: #9fb2ff; }
.wc-type.type-lua { background: #2a1d50; color: #c9a8ff; }
.wc-title { font-size: 15px; font-weight: 700; }
.wc-desc { font-size: 12px; flex: 1; }
.wc-meta { display: flex; justify-content: space-between; align-items: center; }
.code-preview { margin: 0; padding: 12px; max-height: 480px; overflow: auto; background: #0a0a0d; font: 12px/1.5 Consolas, "Cascadia Mono", Menlo, monospace; color: #d6d6e0; white-space: pre; }
.button-block { width: 100%; }
.sha code { font-size: 10px; overflow-wrap: anywhere; }

/* 2FA */
.secret-key { margin: 10px 0; }
.secret-key code, .recovery-codes code { display: inline-block; padding: 6px 10px; background: #0a0a0d; border: 1px solid var(--field-line); border-radius: 3px; font: 600 15px/1.3 Consolas, Menlo, monospace; letter-spacing: 1px; color: #fff; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; list-style: none; padding: 0; margin: 10px 0 0; }
.codes-box { align-items: flex-start; }
.code-input { font: 600 20px/1.2 Consolas, Menlo, monospace; letter-spacing: 4px; max-width: 220px; }
.mt { margin-top: 8px; }
.ua-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* Admin */
/* ---------- Admin panel v2: overview tiles + real tabs ---------- */
.admin-whoami { margin: 2px 0 0; }
.page-title .icon { vertical-align: -3px; color: var(--accent-bright); margin-right: 2px; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 4px 0 16px; }
.stat-tile { padding: 14px 16px; background: var(--block); border: 1px solid var(--block-line); border-left: 3px solid var(--accent); border-radius: 4px; }
.stat-tile.stat-warn { border-left-color: #f5a524; }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1.1; color: #fff; }
.stat-tile.stat-warn .stat-num { color: #f5c451; }
.stat-label { margin-top: 3px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

.admin-tabs {
    display: flex; gap: 2px; flex-wrap: wrap; margin: 0 0 16px; padding-bottom: 0;
    border-bottom: 1px solid var(--block-line); position: sticky; top: 0; z-index: 30;
    background: var(--bg); padding-top: 4px;
}
.admin-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px; background: none; border: 0; border-bottom: 2px solid transparent;
    color: var(--text-soft); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    border-radius: 4px 4px 0 0; white-space: nowrap;
}
.admin-tab .icon { color: var(--muted); }
.admin-tab:hover { color: #fff; background: var(--block-alt); text-decoration: none; }
.admin-tab.active { color: #fff; background: var(--block-alt); border-bottom-color: var(--accent); }
.admin-tab.active .icon { color: var(--accent-bright); }
.admin-tab-link { margin-left: auto; }
.admin-tab .count { margin-left: 2px; }

.admin-panel { display: none; }
.admin-panel.active { display: block; animation: adminFade .15s ease; }
@keyframes adminFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-title.small-title { margin: 20px 0 10px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.section-title.small-title:first-child { margin-top: 0; }

table.data tbody tr:hover { background: var(--block-alt); }
table.data { border-radius: 4px; overflow: hidden; }
.admin-line:hover { background: var(--block-alt); }
.admin-line .spacer { flex: 1; }
.admin-line .w-label { flex: 2 1 180px; }
.admin-head { background: var(--block-label); }
.admin-head span { flex: 1 1 100px; }
.admin-new { background: var(--block-label); }
.coin-form { gap: 4px; margin-left: 8px; }
.coin-form input { width: 80px; padding: 3px 6px; }
.coin-form input[name=reason] { width: 110px; }
input[type=color] { width: 40px; height: 30px; padding: 2px; flex: 0 0 40px !important; }

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
    .nav-left { display: none; }
    .nav-mobile { display: block; }
    .nav-mobile .menu a { padding: 11px 16px; font-size: 15px; }
    .profile-stats { grid-template-columns: repeat(3, 1fr); }
    .profile-stats > div:nth-child(3n) { border-right: 0; }
    .profile-stats > div { border-bottom: 1px solid var(--block-line); }
    .wallet-grid { grid-template-columns: 1fr; }
    .thread-row:has(.ticket-status) { grid-template-columns: 36px minmax(0, 1fr); }
    .thread-row:has(.ticket-status) .ticket-status { grid-column: 2; text-align: left; }
}
@media (max-width: 650px) {
    .page { padding: 14px 10px 30px; }
    .page-title { font-size: 18px; }
    .title-row { align-items: flex-start; }
    .profile-main { margin-top: -40px; padding: 0 12px; }
    .profile-banner.has-image { height: 120px; }
    .avatar.xl { width: 80px; height: 80px; font-size: 34px; }
    .profile-name { font-size: 20px; }
    .rl-window { height: 116px; }
    .rl-card { flex-basis: 110px; }
    .rl-spin { width: 100%; }
    .admin-line { align-items: stretch; }
    .admin-line input, .admin-line select { flex: 1 1 100%; }
    .admin-line input.num, input[type=color] { flex: 1 1 30% !important; }
    .coin-form { display: flex; flex-wrap: wrap; margin: 6px 0 0; }
    .search-form { flex-wrap: wrap; }
    .search-form .button { flex: 1; }
    .nav-coins, .nav-icon { padding: 12px 6px; }
    table.data th, table.data td { padding: 7px 8px; }
    .code-input { max-width: none; }
    input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
}
/* =====================================================================
   v7: roles rename, QR 2FA, moderation, invites, downloads, inbox
   ===================================================================== */

/* Role badge colours for the new hierarchy */
.username.role-admin { color: #ff8a3d; }
.username.role-staff { color: #34c9a3; }
.role-badge.role-admin { background: linear-gradient(90deg, #e0621b, #ff8a3d); }
.role-badge.role-staff { background: #14705c; }

/* QR code (2FA setup) */
.qr-box { display: inline-block; padding: 10px; margin: 10px 0; background: #fff; border-radius: 4px; line-height: 0; }
.qr-img { display: block; width: 176px; height: 176px; image-rendering: pixelated; }

/* Moderation panel on the admin members table */
.mod-details { position: relative; }
.mod-details summary { list-style: none; }
.mod-details summary::-webkit-details-marker { display: none; }

.mod-trigger {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; background: var(--button); border: 1px solid #45454d; border-radius: 3px;
    color: #f0f0f3; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.mod-trigger .icon:first-child { color: var(--accent-bright); }
.mod-trigger .icon:last-child { color: var(--muted); transition: transform .15s; margin-left: 1px; }
.mod-trigger:hover { background: var(--button-hover); border-color: var(--accent); }
.mod-details[open] .mod-trigger { background: var(--accent); border-color: var(--accent); color: #fff; }
.mod-details[open] .mod-trigger .icon { color: #fff; }
.mod-details[open] .mod-trigger .icon:last-child { transform: rotate(180deg); }

.mod-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
    width: 290px; max-width: calc(100vw - 32px);
    background: var(--block-alt); border: 1px solid var(--block-line); border-radius: 6px;
    box-shadow: 0 16px 40px rgba(0,0,0,.55); overflow: hidden;
    animation: modIn .12s ease;
}
@keyframes modIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.mod-panel-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; background: var(--block-label); border-bottom: 1px solid var(--block-line);
    font-weight: 700; font-size: 13px;
}
.mod-panel-head-role { margin-left: auto; }

.mod-section { padding: 10px 12px; border-top: 1px solid var(--block-line); }
.mod-section:first-of-type { border-top: 0; }
.mod-section-danger { background: rgba(255, 77, 106, .04); }
.mod-section-title {
    display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
    color: var(--muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.mod-section-danger .mod-section-title { color: var(--error-text); }
.mod-note { margin: 0 0 8px; font-size: 12px; color: var(--text-soft); overflow-wrap: anywhere; }

.mod-form { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.mod-form input, .mod-form select { width: 100%; padding: 7px 9px; font-size: 12.5px; }
.mod-form-btn { width: 100%; justify-content: center; }

/* Invites / downloads */
.qr-box + .hint, .secret-key { margin-top: 6px; }

/* Inbox */
.inbox-msg { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-top: 1px solid var(--block-line); }
.inbox-msg:first-child { border-top: 0; }
.inbox-icon { flex: 0 0 auto; color: var(--accent-bright); margin-top: 2px; }
.inbox-body { flex: 1; min-width: 0; }
.inbox-subject { font-weight: 700; margin-bottom: 2px; }
.inbox-text { overflow-wrap: anywhere; color: var(--text-soft); font-size: 13px; margin-bottom: 4px; white-space: pre-line; }

/* Downloads page */
.download-row { grid-template-columns: 30px minmax(0, 1fr) auto; }
.download-desc { margin: 2px 0; }

/* Timeout / lock notices */
.notice-error .button { margin-left: 8px; }

@media (max-width: 650px) {
    /* .mod-panel position/size is computed in JS (placeModPanel) so it can never be clipped
       by the members table's horizontal scroll container, on any screen size. */
    .qr-img, .qr-box { width: 140px; height: 140px; }
}
/* Admin → Permissions grid */
.perm-table td, .perm-table th { vertical-align: middle; }
.perm-table .perm-col { text-align: center; width: 1%; white-space: nowrap; }
.perm-table .perm-col input { width: 16px; height: 16px; accent-color: var(--accent, #3b5bff); cursor: pointer; }
.perm-table .perm-col input:disabled { cursor: not-allowed; opacity: .6; }
.perm-table tr.perm-group td { background: rgba(255, 255, 255, .03); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted, #85858f); }
.perm-table tbody tr:not(.perm-group):hover td { background: rgba(255, 255, 255, .02); }
.perm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Emoji reactions under forum posts */
.reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.reactions .rx-form { display: inline; margin: 0; }
.rx { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--block-line); background: rgba(255, 255, 255, .03); color: var(--text, #e6e6ea); font-size: 13px; line-height: 1.4; cursor: pointer; transition: background .12s, border-color .12s, transform .08s; }
.rx:hover { background: rgba(255, 255, 255, .08); }
.rx:active { transform: scale(.94); }
.rx.mine { border-color: #3b5bff; background: rgba(59, 91, 255, .18); }
.rx.zero { opacity: .45; }
.rx.zero:hover { opacity: 1; }
.rx.static { cursor: default; }
.rx .rx-emoji { font-size: 15px; }
.rx .rx-count { min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.rx .rx-count:empty { display: none; }
.referral-link { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.referral-link input { flex: 1; min-width: 220px; font-family: ui-monospace, Consolas, monospace; }
/* Discord invite */
.nav-tab.nav-discord { display: inline-flex; align-items: center; gap: 6px; color: #8c96ff; }
.nav-tab.nav-discord:hover { color: #fff; background: rgba(88, 101, 242, .22); }
.site-footer a { color: #8c96ff; display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.site-footer a:hover { color: #fff; }

/* Profile comments */
.comment-form { display: flex; gap: 10px; align-items: flex-start; border-bottom: 1px solid var(--block-line); }
.comment-form textarea { flex: 1; min-height: 44px; resize: vertical; }
.comment { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--block-line); }
.comment:last-child { border-bottom: 0; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.comment-head .comment-del { margin-left: auto; }
.comment .post-body { word-wrap: break-word; }

/* Shoutbox replies */
.shout-reply-ctx { font-size: 12px; color: var(--muted, #85858f); margin: 0 0 2px 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shout-reply-user { color: #8c96ff; font-weight: 600; }
.shout .shout-reply { font-size: 12px; opacity: 0; transition: opacity .12s; }
.shout:hover .shout-reply, .shout .shout-reply:focus { opacity: 1; }
@media (hover: none) { .shout .shout-reply { opacity: .7; } }
.shout.shout-to-me { background: rgba(88, 101, 242, .10); box-shadow: inset 3px 0 0 #5865f2; }
.shout-replying { display: flex; align-items: center; gap: 4px; padding: 6px 12px; font-size: 13px; background: rgba(88, 101, 242, .12); border-bottom: 1px solid var(--block-line); }
.shout-replying[hidden] { display: none; }

/* Our socials */
.socials { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.social { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; border: 1px solid var(--block-line); color: var(--text, #e6e6ea); background: rgba(255, 255, 255, .02); transition: background .12s, border-color .12s; }
.social:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.social-discord:hover { border-color: #5865f2; }
.social-youtube:hover { border-color: #ff0033; }
.social-tiktok:hover { border-color: #25f4ee; }
.social-x:hover { border-color: #e7e9ea; }
.social-instagram:hover { border-color: #e1306c; }
.social-twitch:hover { border-color: #9146ff; }
.share { display: flex; align-items: center; gap: 8px; }

/* Staff activity log */
.log-filter { flex-wrap: wrap; }
.staff-log td { vertical-align: top; }
.staff-log .nowrap { white-space: nowrap; }
.staff-log .log-detail { color: var(--muted, #85858f); word-break: break-word; min-width: 220px; }
.label.log-members { background: rgba(239, 68, 68, .16); color: #fca5a5; }
.label.log-content { background: rgba(245, 158, 11, .16); color: #fcd34d; }
.label.log-site { background: rgba(59, 91, 255, .18); color: #a5b4fc; }

/* ---------- Legal pages (privacy, terms) ---------- */
.legal { max-width: 760px; padding: 0 2px 10px; color: var(--text-soft); }
.legal p, .legal ul { margin: 0 0 12px; line-height: 1.6; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal h2.section-title { margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--block-line); }
.legal h3.section-title { margin: 16px 0 6px; }
.legal strong { color: var(--text); }
.legal code {
    background: var(--field);
    border: 1px solid var(--field-line);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 12px;
}
.legal a { color: var(--accent-bright); }
.legal .below-form { margin-top: 26px; }
