/* ════════════════════════════════════════════════════════════
   KATOMU — UI Components
   ════════════════════════════════════════════════════════════ */

/* --- 1. Tabs & Navigation --- */
/* Glassmorphic Navbar Styles */
.nav-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 24px auto 32px auto;
    padding: 6px;
    background: rgba(30, 30, 40, 0.56);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    max-width: 600px;
    width: 100%;
    z-index: 10;
}

body.light .nav-bar {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.nav-link {
    color: var(--text-2);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
}

.nav-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

body.light .nav-link:hover {
    background: rgba(0, 0, 0, 0.04);
}

.nav-link.active {
    color: white;
    background: var(--c-basic);
    box-shadow: 0 4px 12px rgba(58, 174, 122, 0.2);
}

.tabs-header {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-bottom: 24px;
    background: var(--surface-2);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.tab-btn {
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-2);
    transition: color var(--duration), background var(--duration);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    font-size: var(--fs-sm);
    border: none;
    background: transparent;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

body.light .tab-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.tab-icon {
    vertical-align: middle;
}

/* Per-tab active colors */
.tab-btn.active[data-target="tab-basic"] {
    background: rgba(58, 174, 122, 0.12);
    color: var(--c-basic);
}

.tab-btn.active[data-target="tab-flirt"] {
    background: rgba(238, 93, 123, 0.12);
    color: var(--c-flirt);
}

.tab-btn.active[data-target="tab-rp"] {
    background: rgba(124, 58, 237, 0.12);
    color: var(--c-rp);
}

.tab-btn.active[data-target="tab-stats"] {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.tab-btn.active[data-target="tab-account"] {
    background: rgba(58, 174, 122, 0.12);
    color: var(--c-basic);
}

body.light .tab-btn.active[data-target="tab-basic"] {
    background: rgba(58, 174, 122, 0.1);
}

body.light .tab-btn.active[data-target="tab-flirt"] {
    background: rgba(238, 93, 123, 0.1);
}

body.light .tab-btn.active[data-target="tab-rp"] {
    background: rgba(124, 58, 237, 0.1);
    color: #6d28d9;
}

body.light .tab-btn.active[data-target="tab-stats"],
body.light .tab-btn.active[data-target="tab-account"] {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

/* Disabled tab (topic locked by admin) */
.tab-btn.is-disabled {
    opacity: 0.38;
    cursor: not-allowed;
    color: var(--text-3);
    position: relative;
    text-decoration: line-through;
    text-decoration-color: currentColor;
}

.tab-btn.is-disabled:hover {
    background: transparent;
    color: var(--text-3);
}

/* Lock icon appended after the label text */
.tab-btn.is-disabled::after {
    content: '🔒';
    font-size: 10px;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.8;
    text-decoration: none;
    display: inline-block;
}

.flirt-badge {
    background: var(--c-flirt);
    color: white;
    font-size: var(--fs-xs);
    padding: 1px 5px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    line-height: 1.4;
}

/* --- 2. Action & Interaction Buttons --- */
.start-chat-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: var(--fs-lg);
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    border: none;
    transition: opacity var(--duration), transform var(--duration);
    margin-top: 0;
}

.start-chat-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.start-chat-btn:active {
    transform: translateY(0);
    opacity: 1;
}

.basic-btn {
    background: var(--c-basic);
}

.flirt-btn {
    background: var(--c-flirt);
}

.rp-btn {
    background: var(--c-rp);
}


.top-icon-btn {
    background: color-mix(in srgb, var(--accent-color) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-color) 35%, transparent);
    color: inherit;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s, border-color 0.25s;
}

.top-icon-btn:hover {
    background: color-mix(in srgb, var(--accent-color) 22%, transparent);
    border-color: color-mix(in srgb, var(--accent-color) 55%, transparent);
}


.theme-toggle-btn {
    gap: 5px;
}


.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration);
    line-height: 1;
    position: relative;
}

@keyframes sidebarBadgePop {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1);   opacity: 1; }
}

/* --- 3. Toggle Rows & Labels --- */
.toggle-row {
    display: flex;
    gap: 8px;
}

.toggle-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.vertical-toggle-row {
    flex-direction: column;
}

.toggle-label {
    flex: 1;
    padding: 11px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease);
    color: var(--text-2);
    font-size: var(--fs-base);
}

.toggle-label:hover {
    background: var(--surface-3);
    color: var(--text);
}

.toggle-row input[type="radio"],
.toggle-row input[type="checkbox"],
.toggle-group input[type="radio"],
.toggle-group input[type="checkbox"],
.rp-plot-radios input[type="radio"] {
    display: none;
}

/* Per-tab checked accent */
input[type="radio"]:checked+.toggle-label,
input[type="checkbox"]:checked+.toggle-label {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

/* --- 4. RP Submode Switch Tabs --- */
.rp-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
}

.rp-mode-tab {
    flex: 1;
    padding: 11px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease);
    color: var(--text-2);
    font-size: var(--fs-base);
    font-family: inherit;
}

.rp-mode-tab:hover {
    background: var(--surface-3);
    color: var(--text);
}

.rp-mode-tab[aria-selected="true"] {
    background: rgba(124, 58, 237, 0.12);
    border-color: var(--c-rp);
    color: var(--c-rp);
}

body.light .rp-mode-tab[aria-selected="true"] {
    background: rgba(124, 58, 237, 0.08);
    color: #6d28d9;
}

/* --- 5. Notifications Dropdown --- */
.notif-dropdown {
    position: absolute;
    top: 42px;
    left: 0;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    padding: 10px;
    border-radius: 8px;
    width: min(320px, calc(100vw - 24px));
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
    z-index: 100;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    max-height: 360px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.notif-dropdown::-webkit-scrollbar {
    width: 6px;
}

.notif-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.notif-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-2, rgba(255, 255, 255, 0.1));
    border-radius: 3px;
}

.notif-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--border, rgba(255, 255, 255, 0.2));
}

.notif-dropdown-title {
    font-weight: 800;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-2);
    padding: 2px 2px 8px;
    font-size: 14px;
    color: var(--text);
}

.notif-dropdown-empty {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.4;
}

body.light .notif-dropdown {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
}

/* Notification item (admin messages) */
.notif-item {
    padding: 10px 34px 10px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    background: transparent;
    transition: background 0.18s, border-color 0.18s;
}

.notif-item.is-unread {
    background: color-mix(in srgb, var(--accent-color) 7%, transparent);
    border-color: color-mix(in srgb, var(--accent-color) 18%, transparent);
}

.notif-item--clickable {
    cursor: pointer;
}

.notif-item--clickable:hover {
    background: color-mix(in srgb, var(--accent-color) 11%, transparent);
    border-color: color-mix(in srgb, var(--accent-color) 26%, transparent);
}

/* Delete button for notification items */
.notif-item-delete {
    position: absolute;
    top: 7px;
    right: 7px;
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

.notif-item-delete:hover {
    opacity: 1;
    color: #ef4444;
}

.notif-item:last-child {
    margin-bottom: 0;
}

.notif-item-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.notif-item--admin .notif-item-title {
    color: var(--c-rp, #7c3aed);
}

.notif-item--friend .notif-item-title {
    color: #34d399;
}

.notif-item-body {
    font-size: 13px;
    color: var(--text);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.notif-item-time {
    font-size: 11px;
    color: var(--text-3);
}

/* Unread badge on the bell button */
.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    border: 2px solid var(--bg, #111418);
    pointer-events: none;
    box-sizing: border-box;
    animation: sidebarBadgePop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#notif-btn {
    position: relative;
}

#notif-btn .ui-icon,
.sidebar-toggle-btn .ui-icon {
    width: 18px;
    height: 18px;
}


/* --- 6. Modal Shells --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 900;
}

.agreement-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(calc(100vw - 32px), 420px);
    max-height: 80dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    z-index: 901;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.agreement-modal h3 {
    color: var(--text);
    font-size: var(--fs-lg);
    font-weight: 800;
    margin: 0 0 16px;
}

.agreement-modal-body {
    color: var(--text-2);
    font-size: var(--fs-sm);
    line-height: 1.6;
}

.agreement-modal-body p {
    margin: 0 0 10px;
}

.agreement-modal-body p:last-child {
    margin-bottom: 0;
}

.agreement-modal-actions,
.modal-actions {
    display: flex;
    gap: 10px;
}

.agreement-modal-actions {
    margin-top: 20px;
}

.agreement-secondary-btn {
    background: var(--surface-3) !important;
    color: var(--text-2) !important;
}

.system-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    z-index: 1002;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    color: var(--text);
    display: none;
}

.system-modal h3 {
    color: var(--c-basic);
    margin-bottom: 12px;
    font-size: var(--fs-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.system-modal p {
    font-size: var(--fs-sm);
    color: var(--text-2);
    margin-bottom: 20px;
}

.system-modal input,
.system-modal select,
.system-modal textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-base);
    outline: none;
}

.system-modal input:focus,
.system-modal select:focus,
.system-modal textarea:focus {
    border-color: var(--c-rp);
}

#report-cancel-btn {
    flex: 1;
    background: var(--surface-3);
    color: var(--text);
}

#report-submit-btn {
    flex: 1;
    background: #ef4444;
    color: white;
}

#report-modal.report-modal {
    width: min(92vw, 480px);
    max-width: 480px;
    padding: 0;
    overflow: hidden;
    text-align: left;
    background: color-mix(in srgb, var(--surface) 88%, #111827 12%);
    border: 1px solid color-mix(in srgb, var(--border) 70%, #ef4444 30%);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.report-modal__header {
    display: grid;
    grid-template-columns: 46px 1fr 36px;
    gap: 12px;
    align-items: start;
    padding: 22px 22px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(139, 92, 246, 0.08));
}

.report-modal__icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.report-modal__icon .ui-icon,
.report-modal__notice .ui-icon {
    width: 20px;
    height: 20px;
}

#report-modal .report-modal__heading h3 {
    justify-content: flex-start;
    margin: 0 0 6px;
    color: var(--text);
    font-size: var(--fs-lg);
    line-height: 1.2;
}

#report-modal .report-modal__heading p {
    margin: 0;
    color: var(--text-2);
    font-size: var(--fs-sm);
    line-height: 1.45;
}

.report-modal__close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.report-modal__close:hover,
.report-modal__close:focus-visible {
    color: var(--text);
    border-color: rgba(239, 68, 68, 0.45);
}

.report-modal__label {
    display: block;
    margin: 16px 22px 8px;
    color: var(--text-2);
    font-size: var(--fs-xs);
    font-weight: 800;
    text-transform: uppercase;
}

#report-modal select,
#report-modal textarea {
    width: calc(100% - 44px);
    margin: 0 22px 0;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

#report-modal textarea {
    min-height: 96px;
    line-height: 1.45;
    resize: vertical;
}

.report-modal__notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 22px 0;
    padding: 10px 12px;
    border-radius: 12px;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.18);
    font-size: var(--fs-sm);
}

.report-modal__actions {
    padding: 18px 22px 22px;
}

#report-modal #report-cancel-btn,
#report-modal #report-submit-btn {
    min-height: 44px;
    border-radius: 999px;
}

#report-modal #report-submit-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.captcha-title {
    color: #ef4444;
}

#captcha-question {
    margin-bottom: 15px;
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--text);
}

#captcha-input {
    text-align: center;
}

#captcha-submit-btn {
    width: 100%;
    background: var(--c-basic);
    color: white;
}

.endorse-opts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.endorse-btn {
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(58, 174, 122, 0.3);
    background: rgba(58, 174, 122, 0.1);
    color: var(--c-basic);
    font-size: var(--fs-base);
    cursor: pointer;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.endorse-btn:hover {
    background: rgba(58, 174, 122, 0.15);
    transform: translateY(-1px);
}

#endorse-skip-btn {
    margin-top: 16px;
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: var(--fs-sm);
    cursor: pointer;
    text-decoration: underline;
    transition: color var(--duration);
}

#endorse-skip-btn:hover {
    color: var(--text-2);
}


/* --- 7. Custom Confirm Dialog --- */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), visibility 0.25s var(--ease);
}

.confirm-modal-overlay:not(.is-hidden) {
    opacity: 1;
    visibility: visible;
}

.confirm-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: min(calc(100vw - 32px), 360px);
    padding: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: transform 0.25s var(--ease);
}

.confirm-modal-overlay:not(.is-hidden) .confirm-modal {
    transform: scale(1);
}

.confirm-modal__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.confirm-modal__text {
    font-size: 0.95rem;
    color: var(--text-2);
    line-height: 1.5;
    margin-bottom: 24px;
}

.confirm-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.confirm-modal__btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.confirm-modal__btn.btn--cancel {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border-2);
}

.confirm-modal__btn.btn--cancel:hover {
    background: var(--surface-2);
    color: var(--text);
}

.confirm-modal__btn.btn--confirm {
    background: #ef4444;
    color: #ffffff;
    border: none;
}

.confirm-modal__btn.btn--confirm:hover {
    background: #dc2626;
}


/* --- 8. Toasts --- */
.katomu-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    width: min(calc(100vw - 32px), 380px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
    z-index: 10000;
    font-size: var(--fs-sm);
    color: var(--text);
    animation: toastSlideIn 0.4s var(--ease) forwards;
}

.katomu-toast.toast-success {
    border-color: rgba(34, 197, 94, 0.3);
}

.katomu-toast.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
}

.katomu-toast.toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
    to {
        transform: translateX(-50%) translateY(120%);
        opacity: 0;
    }
}

/* --- 9. Loading & Placeholder Components --- */
#app-loading {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #0f1117;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease;
}

#app-loading.hiding {
    opacity: 0;
    pointer-events: none;
}

.app-loading-logo {
    font-family: 'Manrope', sans-serif;
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.9;
    animation: loadingPulse 1.2s ease-in-out infinite alternate;
}

@keyframes loadingPulse {
    from {
        opacity: 0.5;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1.05);
    }
}

.notice {
    padding: 14px 18px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: bold;
    text-align: center;
}

.notice--error {
    background: #7f1d1d;
    color: #fca5a5;
}

.pending-image {
    opacity: 0.5;
    font-size: 13px;
    color: #9ca3af;
}

.pending-image-error {
    opacity: 1;
    font-size: 13px;
    padding: 10px 15px;
    border-radius: 12px;
    background: #7f1d1d;
    color: #fca5a5;
    max-width: 80%;
    margin-left: auto;
}

.img-placeholder {
    max-width: 200px;
    border-radius: 8px;
    padding: 20px 16px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed #555;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}

/* --- 10. Utility Components --- */
.ui-icon {
    display: inline-block;
    vertical-align: -0.15em;
    margin-right: 2px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rep-badge {
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    margin-left: 4px;
}

.rep-badge-pos {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.rep-badge-neg {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-2);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: var(--fs-xs);
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.rank-badge.rank-doubtful {
    color: #fb7185;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.28);
}

.rank-badge.rank-confident {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.28);
}

.rank-badge.rank-stable {
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.28);
}

.rank-badge.rank-reliable {
    color: #22d3ee;
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.28);
}

.rank-badge.rank-trusted {
    color: #a78bfa;
    background: rgba(124, 58, 237, 0.14);
    border-color: rgba(124, 58, 237, 0.32);
}

.rank-badge.rank-elite {
    color: #fbbf24;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(124, 58, 237, 0.14));
    border-color: rgba(251, 191, 36, 0.38);
}

/* Mastery Rank Badges */
.rank-badge.mrank-beginner {
    color: #a3e635;
    background: rgba(163, 230, 53, 0.1);
    border-color: rgba(163, 230, 53, 0.25);
}

.rank-badge.mrank-novice {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.25);
}

.rank-badge.mrank-expert {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.25);
}

.rank-badge.mrank-adept {
    color: #c084fc;
    background: rgba(192, 132, 252, 0.1);
    border-color: rgba(192, 132, 252, 0.25);
}

.rank-badge.mrank-master {
    color: #f97316;
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.3);
}

.rank-badge.mrank-legend {
    color: #fbbf24;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(124, 58, 237, 0.14));
    border-color: rgba(251, 191, 36, 0.38);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
}

body.light .rank-badge.mrank-beginner {
    color: #65a30d;
    background: rgba(101, 163, 13, 0.08);
    border-color: rgba(101, 163, 13, 0.2);
}

body.light .rank-badge.mrank-novice {
    color: #059669;
    background: rgba(5, 150, 105, 0.08);
    border-color: rgba(5, 150, 105, 0.2);
}

body.light .rank-badge.mrank-expert {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
}

body.light .rank-badge.mrank-adept {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.2);
}

body.light .rank-badge.mrank-master {
    color: #ea580c;
    background: rgba(234, 88, 12, 0.08);
    border-color: rgba(234, 88, 12, 0.2);
}

body.light .rank-badge.mrank-legend {
    color: #d97706;
    background: rgba(217, 119, 6, 0.08);
    border-color: rgba(217, 119, 6, 0.2);
}

.is-hidden {
    display: none !important;
}

/* Admin-hidden: tabs fully removed from layout when an admin disables them.
   Uses a CSS class (not inline style) so hiding is resilient to cached JS versions. */
.is-admin-hidden {
    display: none !important;
}

/* Logo visibility - driven by [data-logo] on <html>.
   Set atomically by the head script before any body element paints.
   All logos hidden by default; only the matching variant is shown.
   Runtime changes via applyChatTheme() update the data-logo attribute. */
.main-logo-img { display: none; }

:root[data-logo="basic"] #main-logo-basic,
:root:not([data-logo]) #main-logo-basic    { display: block; }

:root[data-logo="rp"]    #main-logo-rp     { display: block; }
:root[data-logo="ai"]    #main-logo-ai     { display: block; }
:root[data-logo="flirt"] #main-logo-flirt  { display: block; }

/* ─── Help Button & Tooltip ─────────────────────────────── */
.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent-color) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-color) 40%, transparent);
    color: var(--accent-color);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    vertical-align: middle;
    margin-left: 5px;
    position: relative;
    top: -1px;
    padding: 0;
    font-family: var(--font);
}

.help-btn:hover {
    background: color-mix(in srgb, var(--accent-color) 30%, transparent);
    border-color: color-mix(in srgb, var(--accent-color) 65%, transparent);
    transform: scale(1.15);
}

.help-btn:focus {
    outline: none;
}

.help-tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.help-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    width: 220px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-md);
    padding: 10px 13px;
    font-size: var(--fs-xs);
    line-height: 1.55;
    color: var(--text-2);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s, transform 0.18s;
}

.help-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-2);
}

.help-tooltip::before {
    content: '';
    position: absolute;
    top: calc(100% - 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--surface);
    z-index: 1;
}

.help-btn.open+.help-tooltip,
.help-btn[aria-expanded="true"]+.help-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

/* Adjust tooltip when too close to left/right edge */
.help-tooltip.tip-left {
    left: 0;
    transform: translateX(0) scale(0.9);
}

.help-tooltip.tip-left::after,
.help-tooltip.tip-left::before {
    left: 20px;
}

.help-btn.open+.help-tooltip.tip-left,
.help-btn[aria-expanded="true"]+.help-tooltip.tip-left {
    transform: translateX(0) scale(1);
}

/* Premium Custom Range Sliders */
.rep-filter-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-3);
    outline: none;
    margin: 12px 0;
    transition: background 0.2s;
}

.rep-filter-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--surface-3);
    border-radius: 3px;
}

.rep-filter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid var(--bg);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform var(--duration), background var(--duration);
}

.rep-filter-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.rep-filter-slider::-webkit-slider-thumb:active {
    transform: scale(0.95);
}

.rep-filter-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--surface-3);
    border-radius: 3px;
}

.rep-filter-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid var(--bg);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform var(--duration), background var(--duration);
}

.rep-filter-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.rep-filter-slider::-moz-range-thumb:active {
    transform: scale(0.95);
}

/* Announcement Card styling */
.announcement-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--theme-color, var(--accent-color));
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    box-shadow: none;
    margin-top: 24px;
    margin-bottom: 24px;
    box-sizing: border-box;
    text-align: left;
}

.announcement-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.announcement-badge {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    color: var(--theme-color, var(--accent-color));
    background: var(--theme-color-op, rgba(58, 174, 122, 0.1));
    border: 1px solid var(--theme-color-op-strong, rgba(58, 174, 122, 0.25));
}

.announcement-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.02em;
    line-height: 1.3;
    text-transform: uppercase;
    margin: 0;
}

.announcement-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--theme-color, var(--accent-color));
    display: flex;
    align-items: center;
    gap: 6px;
}

.announcement-body {
    color: var(--text-2);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    margin: 0;
}

/* Gender & Age Badges */
.profile-gender-badge,
.profile-age-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-sm, 6px);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--surface-3, rgba(255,255,255,0.06));
    border: 1px solid var(--border-2, rgba(255,255,255,0.12));
    color: var(--text-2);
}

.profile-gender-badge.gender--male,
.profile-gender-badge.male {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(96, 165, 250, 0.2);
}

.profile-gender-badge.gender--female,
.profile-gender-badge.female {
    color: #f472b6;
    background: rgba(244, 114, 182, 0.08);
    border-color: rgba(244, 114, 182, 0.2);
}

.profile-gender-badge.gender--other,
.profile-gender-badge.other {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.08);
    border-color: rgba(167, 139, 250, 0.2);
}

body.light .profile-gender-badge,
body.light .profile-age-badge {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    color: var(--text-2);
}

body.light .profile-gender-badge.gender--male,
body.light .profile-gender-badge.male {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.15);
}

body.light .profile-gender-badge.gender--female,
body.light .profile-gender-badge.female {
    color: #db2777;
    background: rgba(219, 39, 119, 0.06);
    border-color: rgba(219, 39, 119, 0.15);
}

body.light .profile-gender-badge.gender--other,
body.light .profile-gender-badge.other {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.06);
    border-color: rgba(124, 58, 237, 0.15);
}
