:root {
    color-scheme: dark;
    scrollbar-width: thin;
    scrollbar-color: #3d414d transparent;

    --phc-bg: #0d0e11;
    --phc-canvas: #15161a;
    --phc-card: #1c1d22;
    --phc-card-hover: #23252c;
    --phc-border: #2e313a;
    --phc-border-light: #3d414d;
    
    --phc-header-bg: #0a0b0d;
    --phc-navbar-bg: #15161a;
    --phc-subnav-bg: #101114;

    --phc-primary: #00a8ff;
    --phc-primary-hover: #38bdf8;
    --phc-accent: #00e5ff;
    --phc-link: #38bdf8;
    --phc-link-hover: #7dd3fc;

    /* High-contrast text tokens - ZERO washed out gray */
    --phc-text: #ffffff;
    --phc-text-muted: #e2e8f0;
    --phc-text-dim: #94a3b8;

    /* Legacy alias tokens for template compatibility */
    --bg-main: var(--phc-bg);
    --bg-card: var(--phc-card);
    --border-color: var(--phc-border);
    --text-main: var(--phc-text);
    --text-muted: var(--phc-text-muted);
    --text-dim: var(--phc-text-dim);
    --accent-cyan: var(--phc-accent);

    --phc-badge-bg: #282a30;
    --phc-radius: 6px;
    --phc-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="light"] {
    --phc-bg: #f1f5f9;
    --phc-canvas: #ffffff;
    --phc-card: #ffffff;
    --phc-card-hover: #f8fafc;
    --phc-border: #cbd5e1;
    --phc-border-light: #e2e8f0;
    
    --phc-header-bg: #0284c7;
    --phc-navbar-bg: #0369a1;
    --phc-subnav-bg: #ffffff;

    --phc-primary: #0284c7;
    --phc-primary-hover: #0369a1;
    --phc-accent: #0284c7;
    --phc-link: #0369a1;
    --phc-link-hover: #075985;

    /* Light mode high-contrast text - Solid Black and Slate */
    --phc-text: #090a0f;
    --phc-text-muted: #1e293b;
    --phc-text-dim: #334155;

    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #cbd5e1;
    --text-main: #090a0f;
    --text-muted: #1e293b;
    --text-dim: #334155;
    --accent-cyan: #0284c7;

    --phc-badge-bg: #e2e8f0;
}

/* Base Form Inputs & Strict Light/Dark Contrast */
input, select, textarea {
    color: var(--phc-text);
    background-color: var(--phc-card);
    border: 1px solid var(--phc-border);
    font-family: inherit;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    color: #0f172a;
    background-color: #ffffff;
    border-color: #cbd5e1;
}

[data-theme="light"] select option {
    background-color: #ffffff;
    color: #0f172a;
}

[data-theme="dark"] select option {
    background-color: #1c1d22;
    color: #ffffff;
}

[data-theme="light"] ::placeholder {
    color: #64748b;
    opacity: 1;
}

html {
    box-sizing: border-box;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

*, *::before, *::after {
    box-sizing: inherit;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--phc-bg);
    color: var(--phc-text);
    font-family: var(--phc-font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

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

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

/* Layout container */
.phc-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .phc-container {
        padding: 0 12px;
    }
}

/* Top Branding Bar */
.phc-header {
    background: var(--phc-header-bg);
    border-bottom: 1px solid var(--phc-border);
    padding: 14px 0;
}

.phc-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.phc-header__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.phc-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px 0 4px;
    background: var(--phc-card);
    border: 1px solid var(--phc-border);
    border-radius: var(--phc-radius);
    color: var(--phc-text);
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.phc-user-pill:hover {
    border-color: var(--phc-primary);
    background: var(--phc-card-hover);
    color: var(--phc-primary);
    transform: translateY(-1px);
}

.phc-user-pill__avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.phc-user-pill__name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phc-user-pill__caret {
    font-size: 10px;
    color: var(--phc-text-muted);
    opacity: 0.7;
    margin-left: 2px;
    transition: transform 0.15s ease;
}

.phc-header__login-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    background: var(--phc-primary);
    color: #041018 !important;
    font-weight: 700;
    font-size: 13px;
    border-radius: var(--phc-radius);
    text-decoration: none !important;
    white-space: nowrap;
}

.phc-header__login-btn:hover {
    background: var(--phc-primary-hover);
    color: #041018 !important;
}

.phc-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
}

.phc-logo__img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: block;
}

.phc-logo__text {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.phc-logo__text span {
    color: #00e5ff;
}

.phc-header__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.phc-mobile-toggle,
.phc-theme-btn,
.phc-header-btn,
.phc-icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--phc-card);
    border: 1px solid var(--phc-border);
    border-radius: var(--phc-radius);
    color: var(--phc-text);
    font-size: 14px;
    position: relative;
    cursor: pointer;
    text-decoration: none !important;
    padding: 0;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.phc-mobile-toggle {
    display: none;
    font-size: 15px;
}

.phc-mobile-toggle:hover,
.phc-theme-btn:hover,
.phc-header-btn:hover,
.phc-icon-btn:hover {
    background: var(--phc-card-hover);
    border-color: var(--phc-primary);
    color: var(--phc-primary);
    transform: translateY(-1px);
}

.phc-header-btn__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    background: #ef4444;
    color: #ffffff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    padding: 0 4px;
    border: 2px solid var(--phc-header-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Mobile Drawer Elements (Hidden on Desktop) */
.phc-drawer-header {
    display: none;
}

.phc-nav-backdrop {
    display: none;
}

/* Navigation Bar */
.phc-nav {
    background: var(--phc-navbar-bg);
    border-bottom: 1px solid var(--phc-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.phc-nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.phc-menu {
    display: flex;
    list-style: none;
    gap: 4px;
}

.phc-menu__item a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color 0.15s ease, background 0.15s ease;
    opacity: 0.85;
}

.phc-menu__item.active a,
.phc-menu__item a:hover {
    color: #ffffff;
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
    border-bottom-color: var(--phc-primary);
}

.phc-nav__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sub-Navigation Strip */
.phc-subnav {
    background: var(--phc-subnav-bg);
    border-bottom: 1px solid var(--phc-border);
    padding: 4px 0;
    font-size: 12.5px;
    width: 100%;
}

.phc-subnav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.phc-sublinks {
    display: flex;
    gap: 4px;
    list-style: none;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0;
}

.phc-sublinks a {
    color: var(--phc-text-muted);
    font-weight: 600;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 5px;
    transition: all 0.15s ease;
    opacity: 0.9;
}

.phc-sublinks a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    opacity: 1;
    text-decoration: none;
}

[data-theme="light"] .phc-sublinks a {
    color: #475569;
}

[data-theme="light"] .phc-sublinks a:hover {
    background: #f1f5f9;
    color: #0284c7;
}

@media (max-width: 768px) {
    .phc-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .phc-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999990;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .phc-nav-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .phc-nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 300px;
        max-width: 84vw;
        height: 100dvh;
        background: var(--phc-card);
        border-right: 1px solid var(--phc-border);
        border-bottom: none;
        z-index: 999999;
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 4px 0 28px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .phc-nav.open {
        transform: translateX(0);
    }

    .phc-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 18px;
        background: var(--phc-header-bg);
        border-bottom: 1px solid var(--phc-border);
        flex-shrink: 0;
    }

    .phc-drawer-title {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 18px;
        font-weight: 800;
        color: #ffffff;
    }

    .phc-drawer-logo {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }

    .phc-drawer-close {
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.22);
        color: #ffffff;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 16px;
        transition: background 0.15s ease;
    }

    .phc-drawer-close:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .phc-nav__inner {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 12px;
        gap: 14px;
        width: 100%;
        max-width: 100%;
    }

    .phc-nav .phc-search-box {
        order: -1;
        width: 100%;
        margin-bottom: 6px;
    }

    .phc-nav .phc-search-box__input {
        width: 100%;
        background: var(--phc-bg);
        color: var(--phc-text);
        border: 1px solid var(--phc-border);
        box-sizing: border-box;
    }

    .phc-nav .phc-search-box__input:focus {
        width: 100%;
    }

    .phc-menu {
        flex-direction: column;
        gap: 4px;
        width: 100%;
    }

    .phc-menu__item a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: var(--phc-radius);
        border-bottom: none;
        border-left: none;
        color: var(--phc-text);
        font-size: 14px;
        font-weight: 600;
        background: transparent;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .phc-menu__item.active a,
    .phc-menu__item a:hover {
        background: var(--phc-card-hover);
        color: var(--phc-primary);
    }

    [data-theme="light"] .phc-menu__item a {
        color: #0f172a;
    }

    [data-theme="light"] .phc-menu__item a:hover,
    [data-theme="light"] .phc-menu__item.active a {
        background: #f1f5f9;
        color: #0284c7;
    }

    .phc-nav__actions {
        padding: 0 14px 10px 14px;
        justify-content: stretch;
    }

    .phc-nav__actions .phc-btn {
        flex: 1;
        text-align: center;
        justify-content: center;
    }

    /* Subnav horizontal touch-scrolling */
    .phc-subnav {
        padding: 6px 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .phc-subnav__inner {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .phc-subnav__inner::-webkit-scrollbar {
        display: none;
    }

    .phc-sublinks {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .phc-sublinks a {
        white-space: nowrap;
        padding: 4px 10px;
        background: rgba(255, 255, 255, 0.04);
        border-radius: 6px;
        font-size: 12px;
    }
}

@media (max-width: 640px) {
    .phc-header {
        padding: 8px 0;
    }

    .phc-header__inner {
        gap: 8px;
    }

    .phc-logo {
        gap: 8px;
    }

    .phc-logo__img {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .phc-logo__text {
        font-size: 20px;
    }

    .phc-header__right {
        gap: 6px;
    }

    .phc-user-pill {
        height: 34px;
        padding: 0 8px 0 4px;
    }

    .phc-user-pill__avatar {
        width: 24px;
        height: 24px;
    }

    .phc-user-pill__name {
        max-width: 75px;
        font-size: 12px;
    }

    .phc-mobile-toggle,
    .phc-theme-btn,
    .phc-header-btn,
    .phc-icon-btn {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .phc-user-pill__name,
    .phc-user-pill .phc-user-pill__caret,
    .phc-user-pill i.fa-angle-down {
        display: none;
    }

    .phc-user-pill {
        width: 34px;
        height: 34px;
        padding: 0;
        justify-content: center;
    }

    .phc-user-pill__avatar {
        width: 24px;
        height: 24px;
    }

    .phc-logo__img {
        width: 32px;
        height: 32px;
    }

    .phc-logo__text {
        font-size: 18px;
    }

    .phc-header__login-btn span {
        display: none;
    }

    .phc-header__login-btn {
        padding: 7px 10px;
    }
}

.phc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--phc-radius);
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.phc-btn--primary {
    background: var(--phc-primary);
    color: #ffffff;
}

.phc-btn--primary:hover {
    background: var(--phc-primary-hover);
    color: #ffffff;
}

.phc-btn--outline {
    background: transparent;
    border: 1px solid var(--phc-border-light);
    color: var(--phc-text);
}

.phc-btn--outline:hover {
    background: var(--phc-card-hover);
    color: var(--phc-primary);
    border-color: var(--phc-primary);
}


/* User & Action Dropdown Menus */
.phc-dropdown-menu {
    background: var(--phc-card) !important;
    border: 1px solid var(--phc-border) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

.phc-dropdown-menu a {
    color: var(--phc-text) !important;
    border-bottom: 1px solid var(--phc-border) !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.phc-dropdown-menu a:hover {
    background: var(--phc-card-hover) !important;
    color: var(--phc-primary) !important;
}

[data-theme="light"] .phc-dropdown-menu {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .phc-dropdown-menu a {
    color: #0f172a !important;
    border-bottom-color: #f1f5f9 !important;
}

[data-theme="light"] .phc-dropdown-menu a:hover {
    background: #f8fafc !important;
    color: #0284c7 !important;
}

/* Breadcrumb */
.phc-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 10px 0;
    font-size: 13px;
    color: var(--phc-text-muted);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.phc-breadcrumb::-webkit-scrollbar {
    display: none;
}

.phc-breadcrumb a {
    color: var(--phc-text);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.phc-breadcrumb a:hover {
    color: var(--phc-link);
}

.phc-breadcrumb__sep {
    font-size: 10px;
    opacity: 0.5;
}

@media (max-width: 640px) {
    .phc-breadcrumb {
        padding: 8px 0 6px 0;
        font-size: 11.5px;
        gap: 6px;
    }
}

/* Main Two-Column Layout */
.phc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    padding-bottom: 40px;
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.phc-main {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.phc-sidebar {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 992px) {
    .phc-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}

/* Category Block */
.phc-block {
    background: var(--phc-canvas);
    border: 1px solid var(--phc-border);
    border-radius: var(--phc-radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.phc-block__header {
    background: var(--phc-card);
    border-bottom: 1px solid var(--phc-border);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.phc-block__title {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--phc-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.phc-block__title i {
    color: var(--phc-primary);
}

.phc-block__toggle {
    color: var(--phc-text);
    font-size: 14px;
    transition: transform 0.2s ease;
}

.phc-block.collapsed .phc-block__body {
    display: none;
}

.phc-block.collapsed .phc-block__toggle {
    transform: rotate(-90deg);
}

/* Forum Node Row */
.phc-node {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) 130px 250px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--phc-border);
    background: var(--phc-canvas);
    transition: background 0.15s ease;
}

.phc-node:last-child {
    border-bottom: none;
}

.phc-node:hover {
    background: var(--phc-card-hover);
}

.phc-node__icon {
    font-size: 24px;
    color: var(--phc-primary);
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.phc-node__main {
    padding-right: 18px;
    min-width: 0;
}

.phc-node__title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.phc-node__title a {
    color: var(--phc-text);
}

.phc-node__title a:hover {
    color: var(--phc-link);
}

.phc-node__desc {
    font-size: 13px;
    color: var(--phc-text-muted);
    line-height: 1.45;
}

.phc-node__stats {
    font-size: 12.5px;
    color: var(--phc-text-muted);
    line-height: 1.6;
}

.phc-node__stats span {
    font-weight: 700;
    color: var(--phc-text);
}

.phc-node__lastpost {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    min-width: 0;
}

.phc-node__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--phc-border-light);
    object-fit: cover;
    flex-shrink: 0;
}

.phc-node__lastpost-info {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phc-node__lastpost-title {
    font-weight: 700;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--phc-text);
    margin-bottom: 2px;
}

.phc-node__lastpost-title:hover {
    color: var(--phc-link);
}

.phc-node__lastpost-meta {
    color: var(--phc-text-dim);
    font-size: 12px;
}

@media (max-width: 768px) {
    .phc-node {
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 12px;
        padding: 14px 16px;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .phc-node__stats,
    .phc-node__lastpost {
        display: none;
    }
}

@media (max-width: 480px) {
    .phc-node {
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 10px;
        padding: 12px 10px;
    }
    .phc-node__title {
        font-size: 14px;
    }
    .phc-node__desc {
        font-size: 12px;
    }
}

/* Sidebar Widgets */
.phc-widget {
    background: var(--phc-canvas);
    border: 1px solid var(--phc-border);
    border-radius: var(--phc-radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.phc-widget__header {
    background: var(--phc-card);
    border-bottom: 1px solid var(--phc-border);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--phc-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.phc-widget__header i {
    color: var(--phc-primary);
}

.phc-widget__body {
    padding: 16px;
}

.phc-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    text-align: center;
}

.phc-stat-box {
    background: var(--phc-card);
    border: 1px solid var(--phc-border);
    padding: 12px 8px;
    border-radius: var(--phc-radius);
}

.phc-stat-box__num {
    font-size: 19px;
    font-weight: 800;
    color: var(--phc-accent);
}

.phc-stat-box__label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--phc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.phc-online-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Thread List Table */
.phc-thread-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 110px 190px;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--phc-border);
    background: var(--phc-canvas);
    transition: background 0.15s ease;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.phc-thread-row__avatar-wrap {
    text-align: center;
}

.phc-thread-row__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto;
}

.phc-thread-row__main {
    min-width: 0;
}

.phc-thread-row__title {
    font-size: 14.5px;
    font-weight: 600;
    margin: 0;
    color: var(--phc-text);
    line-height: 1.4;
    word-break: break-word;
}

.phc-thread-row__title a {
    color: inherit;
    text-decoration: none;
}

.phc-thread-row__title a:hover {
    color: var(--phc-primary);
}

.phc-thread-row__meta {
    font-size: 12px;
    color: var(--phc-text-muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.phc-thread-row__mobile-stats {
    display: none;
}

.phc-thread-row__stats {
    font-size: 12px;
    color: var(--phc-text-muted);
    text-align: right;
    line-height: 1.4;
}

.phc-thread-row__latest {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 11.5px;
    color: var(--phc-text-dim);
}

.phc-thread-row__latest-info {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phc-thread-row__latest-user {
    color: var(--phc-text);
    font-weight: 500;
}

.phc-thread-row__latest-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .phc-thread-row {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 12px;
        padding: 12px 14px;
    }
    .phc-thread-row__avatar {
        width: 32px;
        height: 32px;
    }
    .phc-thread-row__stats,
    .phc-thread-row__latest {
        display: none !important;
    }
    .phc-thread-row__mobile-stats {
        display: inline;
        color: var(--phc-primary);
    }
}

@media (max-width: 480px) {
    .phc-thread-row {
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 10px;
        padding: 10px 12px;
    }
    .phc-thread-row__avatar {
        width: 28px;
        height: 28px;
    }
    .phc-thread-row__title {
        font-size: 13.5px;
    }
}

.phc-thread-row:hover {
    background: var(--phc-card-hover);
}

.phc-thread-row.pinned {
    background: rgba(0, 168, 255, 0.05);
}

.phc-prefix {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 800;
    border-radius: 3px;
    text-transform: uppercase;
    margin-right: 6px;
    letter-spacing: 0.3px;
}

.phc-prefix--just-for-fun { background: #7c3aed; color: #ffffff; }
.phc-prefix--tutorial { background: #0284c7; color: #ffffff; }
.phc-prefix--help { background: #dc2626; color: #ffffff; }
.phc-prefix--poll { background: #16a34a; color: #ffffff; }
.phc-prefix--trivia { background: #ea580c; color: #ffffff; }
.phc-prefix--closed { background: #64748b; color: #ffffff; }

/* Thread Detail & XenForo Post Box */
.phc-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.phc-thread-header__main {
    flex: 1 1 300px;
    min-width: 0;
}

.phc-thread-header__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.phc-btn--danger-subtle {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
    color: #ef4444 !important;
}

.phc-btn--danger-subtle:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
}

.phc-message {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    border: 1px solid var(--phc-border);
    background: var(--phc-canvas);
    border-radius: var(--phc-radius);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.phc-message__content {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.phc-message__body {
    font-size: 15px;
    line-height: 1.75;
    color: var(--phc-text);
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
}

.phc-message__author {
    background: var(--phc-card);
    border-right: 1px solid var(--phc-border);
    padding: 20px 16px;
    text-align: center;
}

.phc-message__author-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.phc-message__author-avatar-wrap {
    display: inline-block;
    margin-bottom: 10px;
}

.phc-message__author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 1px solid var(--phc-border-light);
    object-fit: cover;
    display: block;
}

.phc-message__author-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.phc-message__author-name-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.phc-message__author-name {
    font-weight: 800;
    font-size: 15px;
}

.phc-message__author-name a {
    color: var(--phc-text);
}

.phc-message__author-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--phc-text-muted);
    margin-bottom: 10px;
}

.phc-message__author-meta {
    font-size: 12px;
    color: var(--phc-text-muted);
    line-height: 1.7;
    border-top: 1px solid var(--phc-border);
    padding-top: 10px;
    text-align: left;
}

.phc-message__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--phc-border);
    padding-top: 14px;
    margin-top: 20px;
    font-size: 13px;
    color: var(--phc-text-muted);
    flex-wrap: wrap;
    gap: 10px;
}

.phc-reactions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.phc-message__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.phc-react-btn {
    background: none;
    border: none;
    color: var(--phc-text-muted);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.phc-react-btn:hover {
    color: var(--phc-primary);
    background: rgba(255, 255, 255, 0.04);
}

.phc-react-btn.reacted {
    color: #e11d48;
}

.phc-qr-emoji-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--phc-border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.phc-qr-emoji-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
}

.phc-quickreply__user-badge {
    font-size: 12px;
    color: var(--phc-text-muted);
}

.phc-quickreply__user-badge strong {
    color: var(--phc-text);
}

@media (max-width: 640px) {
    .phc-message {
        grid-template-columns: minmax(0, 1fr);
    }

    .phc-message__author {
        border-right: none !important;
        border-bottom: 1px solid var(--phc-border);
        padding: 12px 14px;
        text-align: left !important;
    }

    .phc-message__author-identity {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: 100%;
    }

    .phc-message__author-avatar-wrap {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .phc-message__author-avatar {
        width: 44px;
        height: 44px;
        border-radius: 8px;
    }

    .phc-message__author-info {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        min-width: 0;
        flex: 1;
        gap: 3px;
    }

    .phc-message__author-name-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        margin-bottom: 0;
    }

    .phc-message__author-title {
        font-size: 11.5px;
        color: var(--phc-text-muted);
        margin-bottom: 0;
    }

    .phc-message__author-meta {
        display: none;
    }

    .phc-message__content {
        padding: 14px 14px;
    }

    .phc-message__footer {
        padding-top: 10px;
        margin-top: 16px;
        gap: 8px;
    }

    .phc-message__actions {
        gap: 4px;
    }

    .phc-react-btn {
        padding: 6px 8px;
        font-size: 12px;
        background: rgba(255, 255, 255, 0.03);
    }
}

@media (max-width: 480px) {
    .phc-message__actions .phc-react-btn .phc-btn-text {
        display: none;
    }

    .phc-message__actions .phc-react-btn {
        padding: 6px 9px;
        font-size: 13px;
    }
}

/* Quick Reply Box */
.phc-quickreply {
    background: var(--phc-canvas);
    border: 1px solid var(--phc-border);
    border-radius: var(--phc-radius);
    padding: 20px;
    margin-top: 24px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.phc-editor-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.phc-tool-btn {
    background: var(--phc-card);
    border: 1px solid var(--phc-border);
    color: var(--phc-text);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.phc-tool-btn:hover {
    background: var(--phc-primary);
    color: #ffffff;
    border-color: var(--phc-primary);
}

.phc-textarea {
    width: 100%;
    min-height: 130px;
    background: var(--phc-card);
    border: 1px solid var(--phc-border);
    border-radius: var(--phc-radius);
    padding: 14px;
    color: var(--phc-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s ease;
}

.phc-textarea:focus {
    border-color: var(--phc-primary);
}

/* Footer */
.phc-footer {
    background: var(--phc-header-bg);
    border-top: 1px solid var(--phc-border);
    padding: 28px 0;
    margin-top: 40px;
    font-size: 12.5px;
    color: var(--phc-text-muted);
    text-align: center;
}

.phc-footer a {
    color: var(--phc-text);
    font-weight: 600;
}

/* User Rank Colors (Matching PHCorner colored username tiers) */
.phc-username {
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.15s ease, filter 0.15s ease;
}

.phc-username:hover {
    text-decoration: underline;
    filter: brightness(1.2);
}

.phc-username--admin {
    color: #00cec9 !important;
    text-shadow: 0 0 10px rgba(0, 206, 201, 0.65), 0 0 20px rgba(0, 206, 201, 0.3);
}

.phc-username--staff {
    color: #ff7675 !important;
    text-shadow: 0 0 8px rgba(255, 118, 117, 0.45);
}

.phc-username--luminary {
    color: #bb86fc !important;
    text-shadow: 0 0 10px rgba(187, 134, 252, 0.6), 0 0 18px rgba(187, 134, 252, 0.35);
}

.phc-username--premier {
    color: #a29bfe !important;
    text-shadow: 0 0 8px rgba(162, 155, 254, 0.4);
}

.phc-username--master {
    color: #fd9644 !important;
}

.phc-username--elite {
    color: #f1c40f !important;
    text-shadow: 0 0 6px rgba(241, 196, 15, 0.35);
}

.phc-username--senior {
    color: #2ecc71 !important;
}

.phc-username--established {
    color: #00d2d3 !important;
}

.phc-username--verified {
    color: #3498db !important;
}

.phc-username--member {
    color: var(--phc-text) !important;
}

/* --- Light Theme High-Contrast Rank Usernames (WCAG AAA) --- */
[data-theme="light"] .phc-username--admin {
    color: #0e7490 !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--staff {
    color: #b91c1c !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--luminary {
    color: #6b21a8 !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--premier {
    color: #7c3aed !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--master {
    color: #c2410c !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--elite {
    color: #a16207 !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--senior {
    color: #15803d !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--established {
    color: #0369a1 !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--verified {
    color: #1d4ed8 !important;
    text-shadow: none !important;
    font-weight: 700;
}
[data-theme="light"] .phc-username--member {
    color: #0f172a !important;
    text-shadow: none !important;
}

/* --- Top Contributors Widget Component --- */
.phc-contributor-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--phc-border);
}
.phc-contributor-item:last-child {
    border-bottom: none;
}
.phc-contributor-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.phc-contributor-rank {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    font-weight: 800;
    border: 2px solid var(--phc-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.phc-contributor-rank--1 {
    background: #f59e0b;
    color: #000000;
}
.phc-contributor-rank--2 {
    background: #94a3b8;
    color: #000000;
}
.phc-contributor-rank--3 {
    background: #d97706;
    color: #ffffff;
}
.phc-contributor-rank--other {
    background: #1e293b;
    color: #ffffff;
}
[data-theme="light"] .phc-contributor-rank--other {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #ffffff;
}
.phc-contributor-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    padding: 2.5px 7.5px;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.2;
    letter-spacing: 0.3px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--badge-color, #bb86fc);
    border: 1px solid var(--badge-color, rgba(255, 255, 255, 0.25));
}
[data-theme="dark"] .phc-contributor-badge {
    color: var(--badge-color, #f8fafc);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--badge-color, rgba(255, 255, 255, 0.25));
}
[data-theme="light"] .phc-contributor-badge {
    color: var(--badge-light-color, #6b21a8) !important;
    background: var(--badge-light-bg, #f3e8ff) !important;
/* ==========================================================================
   Mobile Bottom Navigation Bar (Site-wide)
   ========================================================================== */
.phc-bottom-nav {
    display: none;
}

@media (max-width: 767px) {
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    .phc-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--phc-navbar-bg, #15161a);
        border-top: 1px solid var(--phc-border, #2e313a);
        z-index: 1000;
        align-items: center;
        justify-content: space-around;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
    }

    .phc-bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: var(--phc-text-dim, #94a3b8);
        font-size: 10.5px;
        font-weight: 600;
        flex: 1;
        height: 100%;
        transition: color 150ms ease;
    }

    .phc-bottom-nav__item i {
        font-size: 16px;
    }

    .phc-bottom-nav__item.is-active,
    .phc-bottom-nav__item:hover {
        color: var(--phc-accent, #00e5ff);
    }
}


