/*
 * ================================================================
 *  NamelessMC Custom Theme — Premium Dark Edition
 *  Inspired by SpigotMC / BuiltByBit / Modrinth
 *  GateWayMC — Minecraft Plugin Marketplace
 * ================================================================
 */

/* ----------------------------------------------------------------
 *  GOOGLE FONTS
 * ---------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ----------------------------------------------------------------
 *  DESIGN TOKENS
 * ---------------------------------------------------------------- */
:root {
    /* Core backgrounds */
    --bg-base:       #0a0c10;
    --bg-surface:    #10131a;
    --bg-elevated:   #161b26;
    --bg-card:       #12151f;
    --bg-card-hover: #1a1f2e;
    --bg-input:      #0e1118;

    /* Borders */
    --border:        #1e2536;
    --border-soft:   #161c2a;
    --border-focus:  #f7941d;

    /* Accent — orange */
    --accent:        #f7941d;
    --accent-dim:    #c97610;
    --accent-bright: #ffac45;
    --accent-glow:   rgba(247, 148, 29, 0.18);
    --accent-glow-sm:rgba(247, 148, 29, 0.08);

    /* Brand blue */
    --blue:          #3b82f6;
    --blue-dim:      #1d4ed8;
    --blue-glow:     rgba(59, 130, 246, 0.15);

    /* Semantic */
    --green:         #22c55e;
    --green-dim:     #15803d;
    --red:           #ef4444;
    --red-dim:       #b91c1c;
    --yellow:        #eab308;
    --purple:        #a855f7;

    /* Text */
    --text-bright:   #f1f5f9;
    --text-primary:  #cbd5e1;
    --text-secondary:#64748b;
    --text-muted:    #374151;
    --text-link:     #60a5fa;
    --text-link-hover:#93c5fd;

    /* Shadows */
    --shadow-sm:     0 1px 4px rgba(0,0,0,0.6), 0 0 0 1px rgba(30,37,54,0.9);
    --shadow-md:     0 4px 16px rgba(0,0,0,0.7), 0 0 0 1px rgba(30,37,54,0.9);
    --shadow-lg:     0 8px 32px rgba(0,0,0,0.8), 0 0 0 1px rgba(30,37,54,0.9);
    --shadow-accent: 0 4px 20px rgba(247,148,29,0.25);

    /* Radii */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
}

/* ----------------------------------------------------------------
 *  BASE
 * ---------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    background: var(--bg-base) !important;
    font-family: 'Inter', Lato, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

body.pushable > .pusher {
    background: var(--bg-base) !important;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

#wrapper {
    margin-bottom: 1.5rem;
}

a {
    color: var(--text-link);
    transition: color 0.15s ease;
    text-decoration: none;
}

a:hover {
    color: var(--text-link-hover);
}

/* ----------------------------------------------------------------
 *  NAVIGATION BAR
 * ---------------------------------------------------------------- */
.ui.secondary.menu {
    background: var(--bg-surface) !important;
    padding: 0 16px;
    margin: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

/* Nav text links — use padding for height, never a fixed height */
.ui.secondary.menu .item {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 14px 14px !important;
    border-radius: 0 !important;
    border-bottom: 2px solid transparent;
    border-top: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    letter-spacing: 0.01em;
}

.ui.secondary.menu .item:hover {
    color: var(--text-bright) !important;
    background: transparent !important;
    border-bottom-color: var(--border);
}

.ui.secondary.menu .item.active {
    color: var(--accent) !important;
    background: transparent !important;
    border-bottom: 2px solid var(--accent) !important;
    font-weight: 600;
}

/* Icons next to text in nav items */
#navbar .item i {
    margin-right: 6px;
    color: var(--text-secondary);
}

/* ── Icon-only action buttons (mail, flag, gear) ──
   Target only items where the ONLY thing inside is a <i> tag
   Using a safe approach: target by NamelessMC's own classes/IDs
   ------------------------------------------------------------ */
#navbar .icon.item {
    padding: 10px 12px !important;
    margin: 4px 2px;
    border-radius: var(--r-sm) !important;
    border-bottom: none !important;
    border-top: none !important;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    line-height: 1;
}

#navbar .icon.item:hover {
    background: var(--bg-card-hover) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

#navbar .icon.item i {
    margin: 0 !important;
    color: inherit !important;
}

/* ── User profile label (MO MossZyter) ──
   Override ALL color sources including inline style= attributes
   ------------------------------------------------------------ */
.ui.secondary.menu .ui.label,
.ui.secondary.menu .ui.medium.label,
.ui.secondary.menu .ui.image.label,
#navbar .ui.label,
#navbar .ui.medium.label,
#navbar .ui.image.label,
#navbar a.item > .ui.label {
    background: var(--bg-elevated) !important;
    color: var(--text-bright) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-md) !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    box-shadow: none !important;
    transition: border-color 0.15s ease, background 0.15s ease;
    padding: 6px 12px 6px 6px !important;
}

.ui.secondary.menu .ui.label:hover,
.ui.secondary.menu .ui.medium.label:hover,
.ui.secondary.menu .ui.image.label:hover,
#navbar .ui.label:hover,
#navbar a.item > .ui.label:hover {
    background: var(--bg-card-hover) !important;
    border-color: var(--accent) !important;
    color: var(--text-bright) !important;
}

/* Avatar image — desaturate the random group color & give rounded corners */
.ui.secondary.menu .ui.label img,
.ui.secondary.menu .ui.medium.label img,
.ui.secondary.menu .ui.image.label img,
#navbar .ui.label img,
#navbar .ui.medium.label img {
    border-radius: 6px !important;
    filter: grayscale(0.35) brightness(0.95);
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-right: 8px !important;
    margin-left: 0 !important;
    width: 28px !important;
    height: 28px !important;
}

.ui.secondary.menu .toc.item { display: none; }
.ui.secondary.menu .toc.item i { margin: 0; }

.ui.secondary.inverted.menu .popup .list a.item {
    color: var(--text-primary) !important;
}

.ui.secondary.menu .ui.popup { min-width: 220px; }
.ui.secondary.menu .ui.popup a:not([href]) { cursor: default !important; }

@media only screen and (max-width: 768px) {
    .ui.secondary.menu .menu,
    .ui.secondary.menu .item { display: none; }
    .ui.secondary.menu .toc.item { display: block; }
}

/* ── Mobile sidebar panel ──
   Do NOT change position/transform/display — Semantic UI JS manages those.
   Only style colours, z-index, and scrolling.
   ----------------------------------------------------------------- */
.ui.vertical.inverted.sidebar.menu.left {
    background: var(--bg-surface) !important;
    border-right: 1px solid var(--border) !important;
}

.ui.vertical.inverted.sidebar.menu.left .item {
    color: var(--text-secondary) !important;
}

.ui.vertical.inverted.sidebar.menu.left .item:hover {
    color: var(--text-bright) !important;
    background: var(--bg-elevated) !important;
}

.ui.vertical.inverted.sidebar.menu.left .item.active {
    color: var(--accent) !important;
    background: var(--bg-elevated) !important;
}

.ui.vertical.inverted.sidebar.menu.left .item .header span.icon { float: right; }

/* Dim overlay when sidebar is open */
body.pushable > .pusher.dimmed::after {
    background: rgba(0,0,0,0.7) !important;
}

/* ----------------------------------------------------------------
 *  MASTHEAD / HEADER
 *  — Hide the site name text (GateWayMC-Core) shown by NamelessMC
 * ---------------------------------------------------------------- */

/* Hide the site-name heading inside the masthead (GateWayMC-Core) */
.ui.masthead .ui.header,
.ui.masthead h1,
.ui.masthead h2,
.ui.masthead .ui.huge.header,
.ui.masthead .ui.container > .ui.header,
.ui.masthead .ui.container > h1,
.ui.masthead .ui.container > h2,
.ui.masthead .ui.grid .ui.header,
.ui.masthead .site-name,
.ui.masthead .site_name,
.ui.masthead [class*="site"] {
    display: none !important;
}

/* But keep server connect widget headers visible */
.ui.masthead .connect-server .ui.header {
    display: block !important;
}

.ui.masthead {
    background:
        linear-gradient(180deg,
            rgba(247,148,29,0.06) 0%,
            transparent 40%
        ),
        linear-gradient(135deg,
            #08090e 0%,
            #0d1220 40%,
            #0a0f1e 100%
        );
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin-bottom: 28px;
    padding: 3.5rem 0;
    border-radius: 0;
    color: #fff;
    border-bottom: 2px solid var(--accent);
    position: relative;
    overflow: hidden;
}

.ui.masthead::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 80% at 10% 50%, rgba(59,130,246,0.08) 0%, transparent 70%),
        radial-gradient(ellipse 40% 60% at 90% 30%, rgba(247,148,29,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.ui.masthead::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--blue), var(--accent), transparent);
    opacity: 0.8;
}

.ui.masthead .ui.header {
    color: var(--text-bright) !important;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

.ui.masthead .connect-server {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    width: fit-content;
    padding: 1rem 1.5rem;
    margin-left: auto;
    border-radius: var(--r-md);
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

@media (max-width: 768px) {
    .ui.masthead .ui.grid .ui.row .column > * {
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }
}

.ui.masthead .connect-server .ui.header {
    margin: 0;
    color: #fff;
}

/* ----------------------------------------------------------------
 *  SEGMENTS
 * ---------------------------------------------------------------- */
.ui.segment {
    background: var(--bg-card) !important;
    border-radius: var(--r-md) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    color: var(--text-primary);
    -webkit-box-shadow: var(--shadow-sm) !important;
}

.ui.segment .ui.list .list > .item .header,
.ui.segment .ui.list > .item .header {
    display: inline-block;
    color: var(--text-bright);
}

.ui.secondary.segment.segment.segment.segment.segment:not(.inverted) {
    border-top: none !important;
    background: var(--bg-elevated) !important;
}

.ui.inverted.segment {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}

/* ----------------------------------------------------------------
 *  CARDS
 * ---------------------------------------------------------------- */
.ui.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    border-radius: var(--r-md) !important;
    color: var(--text-primary) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ui.card:hover {
    border-color: rgba(247,148,29,0.4) !important;
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(247,148,29,0.2), var(--shadow-accent) !important;
    transform: translateY(-3px);
}

.ui.cards > .card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    border-radius: var(--r-md) !important;
    transition: all 0.2s ease;
}

.ui.cards > .card:hover {
    border-color: rgba(247,148,29,0.4) !important;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), var(--shadow-accent) !important;
}

.ui.card .content,
.ui.cards > .card .content {
    border-color: var(--border) !important;
    color: var(--text-primary);
    background: transparent !important;
}

.ui.card .content.header,
.ui.cards > .card .content.header {
    background: var(--bg-elevated) !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: var(--r-md) var(--r-md) 0 0 !important;
}

.ui.card .meta,
.ui.cards > .card .meta {
    color: var(--text-secondary) !important;
    font-size: 0.82rem;
}

.ui.card > .content > .header,
.ui.cards > .card > .content > .header {
    color: var(--text-bright) !important;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.ui.card > .content > .description,
.ui.cards > .card > .content > .description {
    color: var(--text-secondary) !important;
}

.ui.card > .extra,
.ui.cards > .card > .extra {
    border-color: var(--border) !important;
    color: var(--text-secondary) !important;
    background: var(--bg-elevated) !important;
    border-radius: 0 0 var(--r-md) var(--r-md) !important;
}

.ui.card > .extra a:not(.ui),
.ui.cards > .card > .extra a:not(.ui) {
    color: var(--text-link) !important;
}

.ui.card > .extra a:not(.ui):hover,
.ui.cards > .card > .extra a:not(.ui):hover {
    color: var(--text-link-hover) !important;
}

/* ----------------------------------------------------------------
 *  BUTTONS
 * ---------------------------------------------------------------- */
.ui.button {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: var(--r-sm) !important;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.ui.primary.button,
.ui.blue.button {
    background: var(--blue) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(59,130,246,0.35) !important;
}

.ui.primary.button:hover,
.ui.blue.button:hover {
    background: var(--blue-dim) !important;
    box-shadow: 0 4px 16px rgba(59,130,246,0.5) !important;
    transform: translateY(-1px);
}

.ui.green.button {
    background: var(--green) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(34,197,94,0.3) !important;
}

.ui.green.button:hover {
    background: var(--green-dim) !important;
    box-shadow: 0 4px 16px rgba(34,197,94,0.45) !important;
    transform: translateY(-1px);
}

.ui.red.button {
    background: var(--red) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(239,68,68,0.3) !important;
}

.ui.red.button:hover {
    background: var(--red-dim) !important;
    box-shadow: 0 4px 16px rgba(239,68,68,0.45) !important;
    transform: translateY(-1px);
}

.ui.orange.button {
    background: linear-gradient(135deg, var(--accent), var(--accent-dim)) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(247,148,29,0.35) !important;
}

.ui.orange.button:hover {
    background: linear-gradient(135deg, var(--accent-bright), var(--accent)) !important;
    box-shadow: 0 4px 16px rgba(247,148,29,0.5) !important;
    transform: translateY(-1px);
}

.ui.default.button,
.ui.basic.button {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
}

.ui.default.button:hover,
.ui.basic.button:hover {
    background: var(--bg-card-hover) !important;
    border-color: var(--text-secondary) !important;
    color: var(--text-bright) !important;
}

.ui.mini.icon.button,
.ui.top.right.attached.label {
    background: var(--bg-elevated) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
}

/* ----------------------------------------------------------------
 *  MENUS (vertical / tab)
 * ---------------------------------------------------------------- */
.ui.vertical.menu {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-md) !important;
    box-shadow: var(--shadow-sm) !important;
    overflow: hidden;
}

.ui.vertical.menu .item {
    color: var(--text-secondary) !important;
    border-color: var(--border-soft) !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    border-radius: 0 !important;
}

.ui.vertical.menu .item:hover {
    color: var(--text-bright) !important;
    background: var(--bg-card-hover) !important;
}

.ui.vertical.menu .active.item {
    background: rgba(247,148,29,0.08) !important;
    color: var(--accent) !important;
    border-left: 3px solid var(--accent) !important;
    font-weight: 600;
}

.ui.vertical.pointing.menu .active.item:after {
    background: var(--bg-card-hover);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

/* Tab menus */
.ui.tabular.menu {
    border-color: var(--border) !important;
    background: transparent !important;
}

.ui.tabular.menu .item {
    color: var(--text-secondary) !important;
    font-weight: 500;
    border-color: var(--border) !important;
    background: var(--bg-elevated) !important;
    transition: all 0.15s ease;
}

.ui.tabular.menu .item:hover {
    color: var(--text-bright) !important;
    background: var(--bg-card-hover) !important;
}

.ui.tabular.menu .active.item {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
    border-bottom-color: var(--bg-card) !important;
    color: var(--accent) !important;
    font-weight: 700;
}

.ui.attached.tabular.menu { border-bottom: none !important; }
.ui.attached.tabular.menu .item { color: var(--text-secondary) !important; }
.ui.attached.tabular.menu .item.active {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
    color: var(--accent) !important;
}

.ui.top.attached.menu:not(.inverted) {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
}

.ui.top.attached.menu:not(.inverted) .item { color: var(--text-secondary) !important; }
.ui.top.attached.menu:not(.inverted) .item.active { color: var(--accent) !important; }

/* ----------------------------------------------------------------
 *  DROPDOWNS & POPUPS
 * ---------------------------------------------------------------- */
.ui.popup,
.ui.secondary.menu .ui.popup,
.ui.menu .dropdown.item .menu,
.ui.dropdown .menu {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: var(--r-md) !important;
}

.ui.popup { z-index: 99999; text-align: left; }
.ui.popup .ui.header { margin: 0; color: var(--text-bright); }

.ui.pointing.dropdown > .menu:after {
    background: var(--bg-elevated) !important;
    border-color: var(--border) !important;
}

.ui.dropdown .menu > .item {
    color: var(--text-secondary) !important;
    font-size: 0.88rem;
    transition: all 0.12s ease;
    border-radius: 0 !important;
}

.ui.dropdown .menu > .item:hover {
    background: rgba(247,148,29,0.08) !important;
    color: var(--text-bright) !important;
}

.ui.dropdown .menu > .item.active {
    background: var(--accent-glow-sm) !important;
    color: var(--accent) !important;
}

.ui.dropdown .menu > .header:not(.ui) {
    color: var(--text-muted) !important;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 800;
}

.ui.selection.dropdown {
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--r-sm) !important;
    transition: border-color 0.15s ease;
}

.ui.selection.dropdown:hover,
.ui.selection.active.dropdown {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-glow-sm) !important;
}

.ui.selection.visible.dropdown > .text:not(.default) { color: var(--text-primary) !important; }

.ui.selection.dropdown .ui.label {
    background: var(--bg-card-hover) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
}

.ui.image.label {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
}

/* Popup arrows */
.ui.top.left.popup:before,
.ui.top.right.popup:before {
    background: var(--bg-elevated);
    box-shadow: 1px 1px 0 0 var(--border);
}
.ui.right.center.popup:before {
    background: var(--bg-elevated);
    box-shadow: -1px 1px 0 0 var(--border);
}
.ui.left.center.popup:before {
    background: var(--bg-elevated);
    box-shadow: 1px -1px 0 0 var(--border);
}
.ui.bottom.left.popup:before {
    background: var(--bg-elevated);
    box-shadow: 1px 1px 0 0 var(--bg-elevated);
}

/* ----------------------------------------------------------------
 *  FORMS & INPUTS
 * ---------------------------------------------------------------- */
.ui.form .field > label {
    color: var(--text-secondary) !important;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.45em;
}

.ui.form input:not(.button),
.ui.form input[type=text],
.ui.form input[type=email],
.ui.form input[type=password],
.ui.form input[type=number],
.ui.form input[type=url],
.ui.form input[type=search],
.ui.form input[type=tel],
.ui.form input[type=date],
.ui.form input[type=datetime-local],
.ui.form input[type=time],
.ui.form input[type=file] {
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-bright) !important;
    border-radius: var(--r-sm) !important;
    font-family: 'Inter', sans-serif !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ui.form input:not(.button):focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
    outline: none;
}

.ui.form textarea {
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-bright) !important;
    border-radius: var(--r-sm) !important;
    font-family: 'Inter', sans-serif !important;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ui.form textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
    outline: none;
}

.ui.form .field input { background: var(--bg-input) !important; color: var(--text-bright) !important; }
.ui.form .ui.selection.dropdown input:not(.button) { background: var(--bg-input) !important; }
.ui.form .field .ui.selection.active.dropdown .menu { border: 1px solid var(--accent) !important; }

.ui.form .field .ui.dropdown .menu .item {
    background: var(--bg-elevated) !important;
    border-top: 1px solid var(--border-soft) !important;
    color: var(--text-secondary) !important;
}

.ui.form .field .ui.dropdown .menu .item:hover {
    background: var(--bg-card-hover) !important;
    color: var(--text-bright) !important;
}

.ui.form .ui.text input:not(.button) { background: var(--bg-input) !important; }
.inline.fields.labels { flex-wrap: wrap; }
.ui.form .inline.fields.labels .field { padding-bottom: 1em; }

.ui.checkbox label,
.ui.checkbox + label { color: var(--text-secondary) !important; }

.ui.checkbox .box:before,
.ui.checkbox label:before {
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
}

.ui.checkbox input:checked ~ .box:before,
.ui.checkbox input:checked ~ label:before {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
}

.ui.checkbox input:checked ~ .box:after,
.ui.checkbox input:checked ~ label:after {
    color: #fff !important;
}

.ui.checkbox .box:before { margin-top: 4px; }
.ui.checkbox input:checked ~ .box:after { margin-top: 4px; }

select {
    font-family: 'Inter', Lato, sans-serif;
    font-size: 0.9rem;
    padding: 10px !important;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    transition: border-color 0.15s ease;
}

select:focus {
    border-color: var(--accent);
    outline: none;
}

/* ----------------------------------------------------------------
 *  TABLES
 * ---------------------------------------------------------------- */
.ui.table {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-md) !important;
    font-size: 0.9rem;
    overflow: hidden;
}

.ui.table thead th {
    background: var(--bg-elevated) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border) !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    padding: 12px 14px;
}

.ui.table tbody tr td {
    border-color: var(--border-soft) !important;
    color: var(--text-primary) !important;
    padding: 11px 14px;
}

.ui.table tbody tr:last-child td { border-bottom: none !important; }

.ui.table a { color: var(--text-link) !important; }
.ui.table a:hover { color: var(--text-link-hover) !important; }

.ui.selectable.table tbody tr:hover,
.ui.table tbody tr td.selectable:hover {
    background: var(--bg-card-hover) !important;
    color: var(--text-bright) !important;
}

.ui.top.attached.header {
    background: var(--bg-elevated) !important;
    border-color: var(--border) !important;
    color: var(--text-bright) !important;
    font-weight: 700;
}

@media (max-width: 576px) {
    .ui.table.res thead tr th:first-child { width: 100%; }
    .ui.table.res thead tr th:not(:first-child),
    .ui.table.res tbody tr td:not(:first-child) { display: none; }
}

@media (max-width: 992px) {
    .ui.table.res thead tr th:first-child,
    .ui.table.res thead tr th:last-child { width: 50%; }
    .ui.table.res thead tr th:not(:first-child):not(:last-child),
    .ui.table.res tbody tr td:not(:first-child):not(:last-child) { display: none; }
}

/* ----------------------------------------------------------------
 *  HEADERS / TYPOGRAPHY
 * ---------------------------------------------------------------- */
.ui.header {
    color: var(--text-bright) !important;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
}

.ui.header .sub.header { color: var(--text-secondary) !important; }

.ui.header .topic.title .label,
.ui.header .topic.title .badge {
    margin-top: -4px;
    vertical-align: middle;
}

.ui.breadcrumb a { color: var(--text-link) !important; }
.ui.breadcrumb .icon.divider { color: var(--text-muted) !important; }
.ui.breadcrumb .active.section {
    color: var(--text-primary) !important;
    font-weight: 600;
}

.ui.horizontal.divider { color: var(--text-muted) !important; }

/* ----------------------------------------------------------------
 *  MESSAGES / ALERTS
 * ---------------------------------------------------------------- */
.ui.message {
    margin: 0.5em 0;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
    border-radius: var(--r-md) !important;
}

.ui.message > .close.icon { right: .8em; color: var(--text-secondary); }

.ui.info.message,
.ui.mini.info.message,
.ui.mini.message {
    background: rgba(59,130,246,0.08) !important;
    border: 1px solid rgba(59,130,246,0.25) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}

.ui.info.message .header { color: var(--blue) !important; }

.ui.success.message,
.ui.positive.message {
    background: rgba(34,197,94,0.08) !important;
    border: 1px solid rgba(34,197,94,0.25) !important;
    color: var(--text-primary) !important;
}

.ui.warning.message,
.ui.yellow.message {
    background: rgba(234,179,8,0.08) !important;
    border: 1px solid rgba(234,179,8,0.25) !important;
    color: var(--text-primary) !important;
}

.ui.error.message,
.ui.red.message,
.ui.negative.message {
    background: rgba(239,68,68,0.08) !important;
    border: 1px solid rgba(239,68,68,0.25) !important;
    color: var(--text-primary) !important;
}

/* ----------------------------------------------------------------
 *  PAGINATION
 * ---------------------------------------------------------------- */
.ui.pagination,
.ui.mini.pagination.menu {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-md) !important;
    box-shadow: none !important;
    overflow: hidden;
}

.ui.pagination.menu .item {
    color: var(--text-secondary) !important;
    border-color: var(--border-soft) !important;
    font-weight: 600;
    min-width: 38px;
    transition: all 0.12s ease;
    font-size: 0.875rem;
}

.ui.pagination.menu .item:hover {
    background: var(--bg-card-hover) !important;
    color: var(--text-bright) !important;
}

.ui.pagination.menu .item.active {
    background: var(--accent) !important;
    color: #fff !important;
    font-weight: 700;
}

.ui.pagination .disabled.item {
    background: transparent !important;
    color: var(--text-muted) !important;
}

.ui.mini.pagination.menu .item:first-child,
.ui.mini.pagination.menu .item:last-child { padding-top: .5rem; }

/* ----------------------------------------------------------------
 *  LABELS / BADGES
 * ---------------------------------------------------------------- */
.ui.label {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-sm) !important;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.badge {
    display: inline-block;
    line-height: 1;
    vertical-align: baseline;
    margin: 0 .14285714em;
    background: var(--bg-elevated);
    padding: 0.3em .55em;
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    transition: all 0.15s ease;
    letter-spacing: 0.03em;
}

a.badge:hover, a.badge:focus { text-decoration: none; }
.badge:empty { display: none; }

.badge-primary   { color: #fff; background: rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.4); }
.badge-secondary { color: var(--text-secondary); background: var(--bg-elevated); border-color: var(--border); }
.badge-success   { color: #fff; background: rgba(34,197,94,0.2); border-color: rgba(34,197,94,0.4); }
.badge-info      { color: #fff; background: rgba(6,182,212,0.2); border-color: rgba(6,182,212,0.4); }
.badge-warning   { color: var(--yellow); background: rgba(234,179,8,0.1); border-color: rgba(234,179,8,0.35); }
.badge-danger    { color: #fff; background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); }
.badge-light     { color: var(--text-primary); background: var(--bg-elevated); border-color: var(--border); }
.badge-dark      { color: var(--text-secondary); background: var(--bg-base); border-color: var(--border); }

a.badge-primary:hover   { background: rgba(59,130,246,0.3); }
a.badge-success:hover   { background: rgba(34,197,94,0.3); }
a.badge-danger:hover    { background: rgba(239,68,68,0.3); }

/* ----------------------------------------------------------------
 *  MODALS
 * ---------------------------------------------------------------- */
.ui.modal {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-xl) !important;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(247,148,29,0.1) !important;
}

.ui.modal > .header {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text-bright) !important;
    font-weight: 700;
    border-radius: var(--r-xl) var(--r-xl) 0 0 !important;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.ui.modal > .content {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: none !important;
    box-shadow: none !important;
}

.ui.modal > .actions {
    background: var(--bg-card) !important;
    border-top: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    border-radius: 0 0 var(--r-xl) var(--r-xl) !important;
}

/* ----------------------------------------------------------------
 *  NEWS POST
 * ---------------------------------------------------------------- */
#news-post .badge,
#news-post .ui.label {
    position: absolute;
    margin: 0;
    padding: .55em 1em;
    width: auto;
    top: 0;
    right: 0;
    text-transform: uppercase;
    border-radius: 0 var(--r-md) 0 var(--r-md);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: var(--accent) !important;
    color: #fff !important;
    border: none !important;
}

/* ----------------------------------------------------------------
 *  FORUM NODE
 * ---------------------------------------------------------------- */
#forum-node #last-post { width: 250px; }
#forum-node #last-post .avatar { margin: 2px 10px 0 0; }

#forum-node .ui.table tbody tr:hover {
    background: var(--bg-card-hover) !important;
}

/* ----------------------------------------------------------------
 *  FORUM PAGE
 * ---------------------------------------------------------------- */
#sticky-threads tbody tr td:last-child:not(:first-child),
#normal-threads tbody tr td:last-child:not(:first-child) { text-align: right; }

#sticky-threads tbody tr td:last-child .ui.image.header .image,
#normal-threads tbody tr td:last-child .ui.image.header .image {
    float: right;
    margin-left: 1rem;
    margin-top: .24rem;
}

#sticky-threads .badge,
#sticky-threads .ui.label,
#normal-threads .badge,
#normal-threads .ui.label {
    position: relative;
    top: -1.2px;
    padding: .25rem .55rem;
    font-size: .7rem;
    margin: 0 .2rem .1rem 0;
}

/* Accent left border for sticky threads */
#sticky-threads tbody tr {
    border-left: 3px solid var(--accent) !important;
}

#sticky-threads tbody tr:hover,
#normal-threads tbody tr:hover {
    background: var(--bg-card-hover) !important;
}

/* ----------------------------------------------------------------
 *  TOPIC / POST PAGE
 * ---------------------------------------------------------------- */
#topic-post #post-sidebar .ui.small.image,
#topic-reply #reply-sidebar .ui.small.image { width: 120px; }

#topic-post #post-sidebar h3,
#topic-reply #reply-sidebar h3 { margin: 1rem 0; color: var(--text-bright); }

@media (max-width: 768px) {
    #topic-post #post-sidebar .ui.list,
    #topic-reply #reply-sidebar .ui.list { display: none; }
}

#topic-post #post-meta [class*="res right floated"] { margin-top: -5px; }

@media (max-width: 576px) {
    #topic-post #post-meta { text-align: center; }
    #topic-post #post-meta [class*="res right floated"] { margin-top: 0; }
}

@media only screen and (min-width: 768px) {
    #topic-post #post-sidebar,
    #topic-reply #reply-sidebar {
        border-right: 1px solid var(--border);
        margin-top: -1.5rem;
        margin-bottom: -1.5rem;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    #topic-post #post-sidebar:before,
    #topic-reply #reply-sidebar:before {
        content: "";
        height: 0;
        border: 8px solid transparent;
        border-right: 8px solid var(--border);
        position: absolute;
        top: 75px;
        right: 0;
    }
    #topic-post #post-sidebar:after,
    #topic-reply #reply-sidebar:after {
        content: "";
        height: 0;
        border: 8px solid transparent;
        border-right: 8px solid var(--bg-card);
        position: absolute;
        top: 75px;
        right: -1px;
    }
}

@media only screen and (max-width: 768px) {
    #topic-post #post-sidebar,
    #topic-reply #reply-sidebar { border-bottom: 1px solid var(--border); }
}

#topic-post #post-content {
    display: flex;
    flex-direction: column;
    padding: .85em 1.3em;
    min-height: 32.5px;
}

#post-content #reactions { margin-top: auto; }
#topic-post #post-meta { margin-right: 1.3em; }
#topic-post #post-sidebar .groups { text-align: center; }

/* AFTER */
.forum_post {
    word-wrap: break-word;
    overflow-wrap: break-word;  /* ← added */
    word-break: break-word;     /* ← added */
    overflow-x: hidden;         /* ← added */
    color: var(--text-primary);
    line-height: 1.75;
    font-size: 0.95rem;
}

.forum_post img {
    overflow: auto;
    max-width: 100%;
    height: auto;
    border-radius: var(--r-sm);
}

#post-content .forum_post { margin-bottom: 1rem; }
.forum_post a { color: var(--text-link) !important; }
.forum_post a:hover { color: var(--text-link-hover) !important; }

/* ----------------------------------------------------------------
 *  REACTIONS
 * ---------------------------------------------------------------- */
#reactions {
    margin-top: 0;
    padding: .65em 1.3em;
    min-height: 32.5px;
    font-size: 12px;
    background: var(--bg-elevated) !important;
    border-top: 1px solid var(--border-soft) !important;
    border-radius: 0 0 var(--r-md) var(--r-md) !important;
    box-shadow: none !important;
}

#reactions span { color: var(--text-primary); }

.reaction-button,
.reaction-button-selected {
    margin: 0 4px;
    border-radius: var(--r-sm);
    padding: 2px 6px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.reaction-button { opacity: 0.5; }
.reaction-button:hover, .reaction-button-selected {
    opacity: 1;
    cursor: pointer;
}

#modal-reactions .ui.menu {
    overflow-x: auto;
    background: var(--bg-elevated) !important;
    border-bottom: 1px solid var(--border) !important;
}

.ui.menu .item > img:not(.ui) { width: 1em; }
#modal-reactions .ui.menu .item { color: var(--text-secondary) !important; }
#modal-reactions .ui.menu .item.active { background: var(--bg-card-hover) !important; color: var(--accent) !important; }
#modal-reactions .ui.large.selection.divided.list.middle.aligned .item .content { color: var(--text-primary) !important; }

/* ----------------------------------------------------------------
 *  QUOTES / BLOCKQUOTE / SPOILER
 * ---------------------------------------------------------------- */
.blockquote {
    border-left: 3px solid var(--accent);
    background: rgba(247,148,29,0.05);
    margin: 1.5em 0;
    padding: 0.85em 1.2em;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}

#tinymce .spoiler,
.spoiler {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    box-shadow: none;
}

#tinymce .spoiler-toggle,
.spoiler-toggle { color: var(--accent); font-weight: 700; cursor: pointer; }

#tinymce .spoiler-text,
.spoiler-text { color: var(--text-primary); }

.user-mention {
    background: rgba(247,148,29,0.12);
    border: 1px solid rgba(247,148,29,0.28);
    color: var(--accent-bright);
    border-radius: var(--r-sm);
    padding: 1px 6px;
    font-weight: 700;
    font-size: 0.88em;
}

/* ----------------------------------------------------------------
 *  COMMENTS
 * ---------------------------------------------------------------- */
.ui.comments { max-width: none; }
.ui.comments .comment .author { color: var(--text-bright) !important; font-weight: 700; }
.ui.comments .comment .metadata { color: var(--text-muted) !important; font-size: 0.8rem; }
.ui.comments .comment .actions a { color: var(--text-secondary) !important; font-size: 0.82rem; transition: color 0.12s ease; }
.ui.comments .comment .actions a:hover { color: var(--accent) !important; }
.ui.threaded.comments .comment .text { color: var(--text-primary) !important; }
.ui.comments .forum_post.text { color: var(--text-primary) !important; }
.ui.comments .comment .forum_post a { color: var(--text-link) !important; }
.ui.comments .comment .forum_post a:hover { color: var(--text-link-hover) !important; }

/* ----------------------------------------------------------------
 *  PROFILE PAGE
 * ---------------------------------------------------------------- */
#profile-header {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 2px solid var(--accent);
    padding: 2.5rem 2rem;
    position: relative;
    overflow: hidden;
}

#profile-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 0% 50%, rgba(59,130,246,0.07) 0%, transparent 60%);
    pointer-events: none;
}

#profile-header .ui.header { margin: 8px 0; color: var(--text-bright) !important; }
#profile-header .ui.label { margin: 0; }
#profile-header .actions { position: absolute; right: 1rem; }
#profile a.ui.circular.image.avatar img { max-height: 35px; border: 2px solid var(--border); }
.ui.image.label img { vertical-align: top !important; }
.ui.segment#profile-header { border: none !important; }

/* ----------------------------------------------------------------
 *  LEADERBOARD
 * ---------------------------------------------------------------- */
.ui.grid.segment.leaderboard_table { margin-top: 0; }
.leaderboard_table .ui.list { margin-left: -10px; }
.leaderboard_table .ui.list li a { display: block; height: 100%; width: 100%; color: var(--text-primary) !important; transition: color 0.12s ease; }
.leaderboard_table .ui.list li a:hover { color: var(--accent) !important; }
.leaderboard_table .middle.aligned.content { display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.leaderboard_table ol li:before { display: none; }

/* ----------------------------------------------------------------
 *  WIDGETS
 * ---------------------------------------------------------------- */
[id*="widget"] .item .content { width: calc(100% - 40px) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[id*="widget"] .item .content * { overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
[id*="widget"] .item .description { width: calc(100% - 120px) !important; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary) !important; }
[id*="widget"] .item .description * { overflow: hidden; }

#widget-online-users .content { padding-bottom: .5rem; }
#widget-online-users .ui.image.label { margin-bottom: .5rem; }

#widget-online-staff .ui.list .item { display: flex; align-items: center; }
#widget-online-staff .ui.list .item .content { display: flex; align-items: center; }
#widget-online-staff .ui.list .item .content .badge { margin-left: .35rem; }

.fb-page { padding-bottom: 14px; }

/* ----------------------------------------------------------------
 *  FOOTER
 * ---------------------------------------------------------------- */
.ui.footer.segment {
    position: relative;
    margin: auto 0 -.5rem 0;
    padding: 3em 0;
    background: var(--bg-surface) !important;
    border-top: 1px solid var(--border) !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

@media only screen and (max-width: 768px) { .ui.footer.segment { text-align: center; } }

.ui.link.list.list .active.item { color: var(--text-muted); }
.ui.link.list.list .active.item a:not(.ui) { color: var(--text-secondary) !important; transition: color 0.12s ease; }
.ui.link.list.list .active.item a:not(.ui):hover { color: var(--text-bright) !important; background: none !important; }
.ui.link.list.list .item a:not(.ui):hover, .ui.link.list.list a.item:hover { background: none; color: var(--text-bright) !important; }
.ui.link.list.list .ui.divider { margin: 0.5rem 0; border-color: var(--border) !important; }

/* ----------------------------------------------------------------
 *  ACCOUNT MESSAGES
 * ---------------------------------------------------------------- */
#view-message #message .header { font-size: 1.15rem; margin-top: 0.01rem; color: var(--text-bright); }
#view-message #message .meta { line-height: 0.95rem; color: var(--text-secondary); }

@media (max-width: 768px) {
    #messages table thead tr th:first-child { width: 100%; }
    #messages table thead tr th:not(:first-child),
    #messages table tbody tr td:not(:first-child) { display: none; }
}

/* ----------------------------------------------------------------
 *  ERROR / MAINTENANCE
 * ---------------------------------------------------------------- */
#error-403 .ui.container,
#error-404 .ui.container,
#maintenance .ui.container { position: relative; min-height: 100vh; }

#error-403 .ui.segment,
#error-404 .ui.segment,
#maintenance .ui.segment {
    position: absolute;
    transform: translate(-50%, -70%);
    top: 50%;
    left: 50%;
    width: 500px;
    text-align: center;
    border: 1px solid var(--border) !important;
    border-top: 3px solid var(--accent) !important;
}

/* ----------------------------------------------------------------
 *  FORUM SEARCH
 * ---------------------------------------------------------------- */
#forum-search-result h3.ui.header { margin-top: 0; margin-bottom: 1rem; color: var(--text-bright) !important; }

/* ----------------------------------------------------------------
 *  SERVER PAGE
 * ---------------------------------------------------------------- */
[id*="server"] #server-players a:not(:last-child) { margin-right: .3rem; }

/* ----------------------------------------------------------------
 *  USER POPUP
 * ---------------------------------------------------------------- */
#user-popup .header { text-align: center; }
#user-popup .header .ui.header { padding: .5rem 0; color: var(--text-bright) !important; }
#user-popup .header .ui.image { margin: auto; }
#user-popup .description { color: var(--text-secondary) !important; }

/* ----------------------------------------------------------------
 *  UPDATE MESSAGE
 * ---------------------------------------------------------------- */
#update-message { margin-bottom: 1rem; }
#update-message > a { color: inherit; transition: all .2s ease; }
#update-message > a:hover { filter: contrast(2); }
#update-message > a > .icon { margin-right: .5em; }
#update-message > a > .icon:not(.close) { display: block; flex: 0 0 auto; width: auto; line-height: 1; font-size: 3em; opacity: .8; }

/* ----------------------------------------------------------------
 *  COOKIE NOTICE
 * ---------------------------------------------------------------- */
.cc-window.cc-floating {
    padding: 1.2rem 1.5rem;
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-lg) !important;
    font-family: 'Inter', Lato, sans-serif;
    font-size: 14px;
    line-height: 18px;
    opacity: 1;
    transition: .5s all ease;
}

.cc-window.cc-floating .cc-highlight .cc-btn:first-child { color: var(--text-secondary); }
.cc-window.cc-floating .cc-highlight .cc-btn.cc-allow {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    border-radius: var(--r-sm);
    color: #fff;
    font-weight: 700;
}

.cc-window.cc-floating .cc-link { color: var(--text-link); }
.cc-revoke.cc-bottom.cc-right { color: #fff; }

/* ----------------------------------------------------------------
 *  SEARCH RESULTS
 * ---------------------------------------------------------------- */
.ui.search > .results .result .image { border-radius: 0; }

.ui.search > .results {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-md) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

.ui.search > .results .result {
    border-color: var(--border-soft) !important;
    color: var(--text-primary) !important;
    transition: background 0.12s ease;
}

.ui.search > .results .result:hover { background: var(--bg-card-hover) !important; }
.ui.search > .results .result .title { color: var(--text-bright) !important; }

/* ----------------------------------------------------------------
 *  NEW MEMBERS GRID
 * ---------------------------------------------------------------- */
#new-members-grid { padding: 0.5em; }
#new-members-grid .column { padding: 0.5em; }

/* ----------------------------------------------------------------
 *  TINYMCE EDITOR
 * ---------------------------------------------------------------- */
.tox-tinymce {
    min-height: 300px;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-md) !important;
    overflow: hidden;
}

.tox .tox-toolbar,
.tox .tox-menubar,
.tox .tox-toolbar__primary,
.tox .tox-toolbar__overflow,
.tox .tox-statusbar,
.tox .tox-menu,
.tox .tox-dialog,
.tox .tox-dialog__header,
.tox .tox-dialog__footer,
.tox .tox-listboxfield .tox-listbox--select,
.tox .tox-textarea,
.tox .tox-textfield,
.tox .tox-toolbar-textfield,
.tox .tox-selectfield select {
    background: var(--bg-elevated) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

.tox .tox-tbtn { color: var(--text-secondary) !important; }
.tox .tox-tbtn:hover, .tox .tox-tbtn--enabled { color: var(--text-bright) !important; background: var(--bg-card-hover) !important; }
.tox .tox-tbtn svg { fill: var(--text-secondary) !important; }
.tox .tox-tbtn:hover svg { fill: var(--text-bright) !important; }
.tox .tox-dialog-wrap__backdrop { background: rgba(0,0,0,0.85) !important; }
.tox .tox-collection--list .tox-collection__item--enabled { background: var(--bg-card-hover) !important; }
.tox .tox-collection--list .tox-collection__item--active { background: var(--accent-glow) !important; }

/* ----------------------------------------------------------------
 *  GRID
 * ---------------------------------------------------------------- */
.ui.grid + .grid { margin-top: 0.3rem; }
.ui.row + .row   { padding-top: 0.3rem; }
.ui.padded.grid:not(.vertically):not(.horizontally) { margin: 0 -1rem !important; }

@media only screen and (max-width: 768px) {
    .ui.padded.grid:not(.vertically):not(.horizontally) { margin: 0 !important; }
}

/* ----------------------------------------------------------------
 *  ALIGNMENTS & FLOATS
 * ---------------------------------------------------------------- */
[class*="left aligned"]   { text-align: left; }
[class*="center aligned"] { text-align: center; }
[class*="right aligned"]  { text-align: right; }
[class*="left floated"], [class*="res left floated"]   { float: left; }
[class*="right floated"], [class*="res right floated"] { float: right; }
[class*="right floated"] + .ui.segment,
[class*="res right floated"] + .ui.segment { margin-top: 1rem; }

@media only screen and (max-width: 576px) {
    [class*="res right floated"], [class*="res left floated"] { margin-top: 1rem; float: none; }
    [class*="res right floated"] .button:not(.mini),
    [class*="res left floated"] .button:not(.mini) { width: 100%; text-align: center; }
    [class*="res right floated"] .button:not(:first-child),
    [class*="res left floated"] .button:not(:first-child) { margin-top: 0.5rem; }
}

/* ----------------------------------------------------------------
 *  DISPLAY / VISIBILITY
 * ---------------------------------------------------------------- */
[display="block"]        { display: block !important; }
[display="inline"]       { display: inline !important; }
[display="inline block"] { display: inline-block !important; }

@media only screen and (max-width: 576px) {
    [class*="mobile hidden"], [class*="tablet only"]:not(.mobile),
    [class*="computer only"]:not(.mobile), [class*="large screen only"]:not(.mobile),
    [class*="widescreen only"]:not(.mobile), [class*="or lower hidden"] { display: none !important; }
}
@media only screen and (min-width: 576px) and (max-width: 768px) {
    [class*="mobile only"]:not(.tablet), [class*="tablet hidden"],
    [class*="computer only"]:not(.tablet), [class*="large screen only"]:not(.tablet),
    [class*="widescreen only"]:not(.tablet), [class*="or lower hidden"]:not(.mobile) { display: none !important; }
}
@media only screen and (min-width: 768px) and (max-width: 992px) {
    [class*="mobile only"]:not(.computer), [class*="tablet only"]:not(.computer),
    [class*="computer hidden"], [class*="large screen only"]:not(.computer),
    [class*="widescreen only"]:not(.computer), [class*="or lower hidden"]:not(.tablet):not(.mobile) { display: none !important; }
}
@media only screen and (min-width: 992px) and (max-width: 1280px) {
    [class*="mobile only"]:not([class*="large screen"]), [class*="tablet only"]:not([class*="large screen"]),
    [class*="computer only"]:not([class*="large screen"]), [class*="large screen hidden"],
    [class*="widescreen only"]:not([class*="large screen"]),
    [class*="or lower hidden"]:not(.computer):not(.tablet):not(.mobile) { display: none !important; }
}
@media only screen and (min-width: 1280px) {
    [class*="mobile only"]:not([class*="widescreen"]), [class*="tablet only"]:not([class*="widescreen"]),
    [class*="computer only"]:not([class*="widescreen"]), [class*="large screen only"]:not([class*="widescreen"]),
    [class*="widescreen hidden"], [class*="widescreen or lower hidden"] { display: none !important; }
}

/* ----------------------------------------------------------------
 *  DARK MODE TOGGLE
 * ---------------------------------------------------------------- */
#darkmode { display: inline-block; }

.darkmode-toggle {
    opacity: 0;
    position: absolute;
}

.darkmode-toggle:checked + .darkmode-toggle-label .darkmode-ball {
    transform: translateX(24px);
}

.darkmode-toggle-label {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 50px;
    position: relative;
    padding: 5px;
    height: 26px;
    width: 50px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.darkmode-toggle-label:hover { border-color: var(--accent); }

.darkmode-ball {
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    height: 22px;
    width: 22px;
    transition: transform 0.2s linear;
    box-shadow: 0 2px 6px rgba(247,148,29,0.4);
}

.fa-moon { color: #94a3b8; }
.fa-sun  { color: var(--yellow); }

/* ----------------------------------------------------------------
 *  EMOJI
 * ---------------------------------------------------------------- */
.joypixels, .twemoji { height: 1em; width: 1em; vertical-align: middle; }

/* ----------------------------------------------------------------
 *  IE WARNING
 * ---------------------------------------------------------------- */
#ie-message { display: none; }
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    #ie-message { display: initial; }
}

/* ----------------------------------------------------------------
 *  SCROLLBAR
 * ---------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::-webkit-scrollbar-corner { background: transparent; }

/* ----------------------------------------------------------------
 *  UTILITIES
 * ---------------------------------------------------------------- */
.white { color: #fff !important; }

.screenreader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ----------------------------------------------------------------
 *  SUGGESTIONS MODULE
 * ---------------------------------------------------------------- */
#suggestions .ui.segment,
[id*="suggestion"] .ui.segment {
    border-left: 3px solid var(--blue);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#suggestions .ui.segment:hover,
[id*="suggestion"] .ui.segment:hover {
    border-left-color: var(--accent);
    box-shadow: var(--shadow-md) !important;
}

#suggestions .ui.green.label,
[id*="suggestion"] .ui.green.label {
    background: rgba(34,197,94,0.12) !important;
    color: var(--green) !important;
    border: 1px solid rgba(34,197,94,0.35) !important;
}

#suggestions .ui.red.label,
[id*="suggestion"] .ui.red.label {
    background: rgba(239,68,68,0.12) !important;
    color: var(--red) !important;
    border: 1px solid rgba(239,68,68,0.35) !important;
}

#suggestions .ui.yellow.label,
[id*="suggestion"] .ui.yellow.label,
#suggestions .ui.orange.label,
[id*="suggestion"] .ui.orange.label {
    background: rgba(247,148,29,0.12) !important;
    color: var(--accent) !important;
    border: 1px solid rgba(247,148,29,0.35) !important;
}

.vote-up, .suggestion-vote-up {
    color: var(--green) !important;
    background: rgba(34,197,94,0.08) !important;
    border: 1px solid rgba(34,197,94,0.3) !important;
    transition: all 0.15s ease;
}

.vote-up:hover, .suggestion-vote-up:hover {
    background: rgba(34,197,94,0.2) !important;
    border-color: rgba(34,197,94,0.5) !important;
}

.vote-down, .suggestion-vote-down {
    color: var(--red) !important;
    background: rgba(239,68,68,0.08) !important;
    border: 1px solid rgba(239,68,68,0.3) !important;
    transition: all 0.15s ease;
}

.vote-down:hover, .suggestion-vote-down:hover {
    background: rgba(239,68,68,0.2) !important;
    border-color: rgba(239,68,68,0.5) !important;
}

/* ----------------------------------------------------------------
 *  FORMS MODULE
 * ---------------------------------------------------------------- */
#forms .ui.segment,
[id*="form-"] .ui.segment,
.forms-module .ui.segment { border-top: 3px solid var(--blue); }

#forms .ui.form .field > label,
[id*="form-"] .ui.form .field > label { color: var(--text-secondary) !important; font-weight: 700; }

#forms .ui.success.message,
[id*="form-"] .ui.success.message {
    background: rgba(34,197,94,0.08) !important;
    border: 1px solid rgba(34,197,94,0.35) !important;
    color: var(--green) !important;
}

/* ----------------------------------------------------------------
 *  RESOURCES MODULE
 * ---------------------------------------------------------------- */
/* AFTER */
#resources .ui.card,
[id*="resource"] .ui.card,
.resource-card {
    position: relative;
    border-left: 3px solid var(--accent) !important;
    transition: all 0.2s ease;
    overflow: hidden;        /* ← added */
    max-width: 100%;         /* ← added */
    word-break: break-word;  /* ← added */
}

#resources .ui.card:hover,
[id*="resource"] .ui.card:hover,
.resource-card:hover {
    border-left-color: var(--accent-bright) !important;
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(247,148,29,0.25) !important;
}

.resource-card .price,
#resources .price,
[id*="resource"] .price { color: var(--accent) !important; font-weight: 800; font-size: 1.15rem; font-family: 'Space Grotesk', sans-serif; }

.resource-card .price.free,
#resources .price.free { color: var(--green) !important; }

.resource-download-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-dim)) !important;
    color: #fff !important;
    border: none !important;
    font-weight: 700 !important;
    box-shadow: var(--shadow-accent) !important;
}

.resource-download-btn:hover {
    background: linear-gradient(135deg, var(--accent-bright), var(--accent)) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(247,148,29,0.5) !important;
}

.resource-version,
[id*="resource"] .version {
    background: rgba(59,130,246,0.12) !important;
    color: var(--blue) !important;
    border: 1px solid rgba(59,130,246,0.3) !important;
    border-radius: var(--r-sm) !important;
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    padding: 0.2em 0.55em !important;
}

#resources .ui.statistic .value,
[id*="resource"] .ui.statistic .value { color: var(--accent) !important; font-family: 'Space Grotesk', sans-serif; }
#resources .ui.statistic .label,
[id*="resource"] .ui.statistic .label { color: var(--text-muted) !important; text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.08em; }

/* ----------------------------------------------------------------
 *  SHOP MODULE
 * ---------------------------------------------------------------- */
#shop .ui.card, [id*="shop"] .ui.card, .shop-card {
    border-top: 3px solid var(--accent) !important;
    transition: all 0.2s ease;
}

#shop .ui.card:hover, [id*="shop"] .ui.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md), var(--shadow-accent) !important;
}

.shop-price, #shop .price {
    color: var(--accent) !important;
    font-weight: 800;
    font-size: 1.35rem;
    font-family: 'Space Grotesk', sans-serif;
}

.shop-price.free { color: var(--green) !important; }

/* ----------------------------------------------------------------
 *  ANNOUNCEMENTS / NEWS
 * ---------------------------------------------------------------- */
.news-card, #news .ui.card, #announcements .ui.card {
    border-left: 3px solid var(--blue) !important;
}

/* ----------------------------------------------------------------
 *  CARD COLOUR VARIANTS
 * ---------------------------------------------------------------- */
.ui.cards > .green.card, .ui.green.card, .ui.green.cards > .card {
    box-shadow: 0 0 0 1px var(--border), 0 5px 0 0 var(--green), var(--shadow-sm) !important;
}
.ui.cards > .red.card, .ui.red.card, .ui.red.cards > .card {
    box-shadow: 0 0 0 1px var(--border), 0 5px 0 0 var(--red), var(--shadow-sm) !important;
}
.ui.cards > .orange.card, .ui.orange.card {
    box-shadow: 0 0 0 1px var(--border), 0 5px 0 0 var(--accent), var(--shadow-sm) !important;
}

/* ----------------------------------------------------------------
 *  RATINGS
 * ---------------------------------------------------------------- */
.ui.rating .icon { color: var(--text-muted) !important; }
.ui.rating .active.icon, .ui.rating .selected.icon { color: var(--yellow) !important; }
.ui.star.rating .active.icon, .ui.star.rating .selected.icon { color: var(--yellow) !important; }

/* ----------------------------------------------------------------
 *  STATISTICS
 * ---------------------------------------------------------------- */
.ui.statistic > .value, .ui.statistics .statistic > .value { color: var(--text-bright) !important; font-family: 'Space Grotesk', sans-serif; }
.ui.statistic > .label, .ui.statistics .statistic > .label { color: var(--text-secondary) !important; }

/* ----------------------------------------------------------------
 *  LISTS
 * ---------------------------------------------------------------- */
.ui.list .list > .item .header, .ui.list > .item .header { color: var(--text-bright) !important; }
.ui.list .list > .item .description, .ui.list > .item .description { color: var(--text-secondary) !important; }
.ui.relaxed.list .item .content { color: var(--text-secondary) !important; }
.ui.list > .item a.header { color: var(--text-link) !important; transition: color 0.12s ease; }
.ui.list > .item a.header:hover { color: var(--text-link-hover) !important; }

/* ----------------------------------------------------------------
 *  MISC
 * ---------------------------------------------------------------- */

/* Progress bars */
.ui.progress { background: var(--bg-elevated) !important; border-radius: var(--r-sm) !important; border: 1px solid var(--border) !important; }
.ui.progress .bar { background: var(--accent) !important; border-radius: var(--r-sm) !important; min-width: 2em; }
.ui.progress.success .bar { background: var(--green) !important; }
.ui.progress.error .bar { background: var(--red) !important; }
.ui.progress.warning .bar { background: var(--yellow) !important; }

/* Steps */
.ui.steps .step { background: var(--bg-card) !important; border-color: var(--border) !important; color: var(--text-secondary) !important; }
.ui.steps .step.active { color: var(--accent) !important; }
.ui.steps .step.active .title { color: var(--accent) !important; }
.ui.steps .step .title { color: var(--text-bright) !important; }
.ui.steps .step .description { color: var(--text-secondary) !important; }

/* Dimmer */
.ui.dimmer { background: rgba(0,0,0,0.82) !important; }

/* Loader */
.ui.loader::before { border-color: var(--border) !important; }
.ui.loader::after { border-color: var(--accent) transparent transparent !important; }

/* Items */
.ui.items > .item > .content > .meta { color: var(--text-secondary) !important; }
/* ----------------------------------------------------------------
 *  CODE BLOCKS — mobile overflow fix
 * ---------------------------------------------------------------- */
pre,
code,
.forum_post pre,
.forum_post code,
[id*="resource"] pre,
[id*="resource"] code,
#resources pre,
#resources code {
    display: block;
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
    font-size: 0.78rem;
    line-height: 1.55;
    background: var(--bg-base) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-sm) !important;
    padding: 0.75rem 1rem !important;
    color: var(--text-primary) !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Inline code (not block) */
p code,
li code,
td code {
    display: inline;
    white-space: nowrap;
    padding: 0.1em 0.45em !important;
    font-size: 0.82em;
}
/* ----------------------------------------------------------------
 *  MOBILE — Resources page overrides
 * ---------------------------------------------------------------- */
@media (max-width: 768px) {

    /* Prevent any resource container from causing horizontal scroll */
    [id*="resource"],
    #resources {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Stack resource meta info vertically */
    [id*="resource"] .ui.statistics,
    #resources .ui.statistics {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem;
    }

    [id*="resource"] .ui.statistic,
    #resources .ui.statistic {
        flex: 1 1 45% !important;
        min-width: 100px;
    }

    /* Make tables inside resource pages horizontally scrollable */
    [id*="resource"] .ui.table,
    #resources .ui.table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* Reduce font size on config/code dumps */
    [id*="resource"] pre,
    #resources pre {
        font-size: 0.72rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    /* Resource download button — full width on phone */
    .resource-download-btn {
        width: 100% !important;
        text-align: center;
        margin-top: 0.5rem;
    }

    /* Shrink price text slightly */
    .resource-card .price,
    #resources .price,
    [id*="resource"] .price {
        font-size: 1rem !important;
    }
}