/* RS Haven - Dark Theme Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-surface: #16213e;
    --bg-surface-hover: #1a2745;
    --bg-input: #1a1a2e;
    --accent: #e94560;
    --accent-hover: #c73e54;
    --accent-soft: #e9456033;
    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --text-muted: #888;
    --text-label: #ccc;
    --border: #0f3460;
    --border-input: #333;
    --btn-secondary: #333;
    --btn-secondary-hover: #444;
    --timing-fast: 0.12s;
    --timing-normal: 0.25s;
    --timing-slow: 0.5s;
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent);
    }
    50% {
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
    }
}

@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Theme Definitions ===== */
[data-theme="midnight"] {
    --bg-primary: #0d1117;
    --bg-surface: #161b22;
    --bg-surface-hover: #1c2128;
    --bg-input: #0d1117;
    --accent: #58a6ff;
    --accent-hover: #4a90d9;
    --accent-soft: #58a6ff33;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-label: #b0b8c0;
    --border: #30363d;
    --border-input: #30363d;
    --btn-secondary: #21262d;
    --btn-secondary-hover: #30363d;
}

[data-theme="forest"] {
    --bg-primary: #0a1a0a;
    --bg-surface: #1a2e1a;
    --bg-surface-hover: #1f3a1f;
    --bg-input: #0a1a0a;
    --accent: #4ade80;
    --accent-hover: #3cc070;
    --accent-soft: #4ade8033;
    --text-primary: #d4e8d4;
    --text-secondary: #8aab8a;
    --text-muted: #5a7a5a;
    --text-label: #b0ccb0;
    --border: #2d4a2d;
    --border-input: #2d4a2d;
    --btn-secondary: #1a2e1a;
    --btn-secondary-hover: #2d4a2d;
}

[data-theme="ember"] {
    --bg-primary: #1a0a0a;
    --bg-surface: #2e1a1a;
    --bg-surface-hover: #3a2020;
    --bg-input: #1a0a0a;
    --accent: #f97316;
    --accent-hover: #d96212;
    --accent-soft: #f9731633;
    --text-primary: #e8d4d4;
    --text-secondary: #ab8a8a;
    --text-muted: #7a5a5a;
    --text-label: #ccb0b0;
    --border: #4a2d2d;
    --border-input: #4a2d2d;
    --btn-secondary: #2e1a1a;
    --btn-secondary-hover: #4a2d2d;
}

[data-theme="slate"] {
    --bg-primary: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #253344;
    --bg-input: #0f172a;
    --accent: #94a3b8;
    --accent-hover: #7d8da0;
    --accent-soft: #94a3b833;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-label: #cbd5e1;
    --border: #334155;
    --border-input: #334155;
    --btn-secondary: #1e293b;
    --btn-secondary-hover: #334155;
}

[data-theme="royal"] {
    --bg-primary: #0a0a1a;
    --bg-surface: #1a1a3e;
    --bg-surface-hover: #222250;
    --bg-input: #0a0a1a;
    --accent: #a78bfa;
    --accent-hover: #8b6fd9;
    --accent-soft: #a78bfa33;
    --text-primary: #e0e0f0;
    --text-secondary: #9090b0;
    --text-muted: #6060a0;
    --text-label: #c0c0e0;
    --border: #2d2d5a;
    --border-input: #2d2d5a;
    --btn-secondary: #1a1a3e;
    --btn-secondary-hover: #2d2d5a;
}

/* ===== Font Size Settings ===== */
body[data-fontsize="small"] { font-size: 0.95rem; }
body[data-fontsize="medium"] { font-size: 1rem; }
body[data-fontsize="large"] { font-size: 1.05rem; }

/* ===== Compact Mode ===== */
body[data-compact="true"] .card { padding: 1.2rem; margin-bottom: 1rem; }
body[data-compact="true"] .container { max-width: 1100px; padding-top: 1.5rem; padding-bottom: 1.5rem; }




body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ===== Navigation ===== */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}
.nav-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.nav-left .nav-link {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
}
.nav-left .nav-link:hover { color: var(--accent); }
.nav-right {
    display: flex;
    align-items: center;
}
.nav-login {
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
}
.nav-login:hover { color: var(--accent); }


/* ===== Game Fullscreen Mode ===== */
body.game-active .container {
    max-width: none;
    padding: 0;
    height: calc(100vh - 90px);
    overflow: hidden;
}
body.game-active footer {
    display: none;
}
#game-container {
    width: 100%;
    height: 100%;
    position: relative;
}
#game-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    display: block;
}
#game-exit-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    color: #ccc;
    padding: 6px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.3s;
}
#game-container:hover #game-exit-btn,
#game-exit-btn:focus {
    opacity: 1;
}
#game-exit-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
}
/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.5rem; }

.btn-secondary { background: var(--btn-secondary); }
.btn-secondary:hover { background: var(--btn-secondary-hover); }
.btn-secondary.active { background: var(--border); }

.btn-danger { background: #a33; }
.btn-danger:hover { background: #c44; }

/* ===== Typography ===== */
h1, h2, h3 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-danger { color: #ff6b6b; }
.text-center { text-align: center; }

/* ===== Cards ===== */
.card {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

/* ===== Alerts ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}
.alert-error { background: #3a1a1a; color: #ff6b6b; border: 1px solid #5a2a2a; }
.alert-success { background: #1a3a1a; color: #6bff6b; border: 1px solid #2a5a2a; }
.alert-info { background: #1a2a3a; color: #6b9fff; border: 1px solid #2a3a5a; }

/* ===== Forms ===== */
.auth-form {
    max-width: 420px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--bg-surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-label);
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-input);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
}
.form-group input:focus, .form-input:focus {
    outline: none;
    border-color: var(--accent);
}
.form-group small { color: var(--text-muted); font-size: 0.8rem; }

.form-select-sm {
    padding: 0.3rem 0.5rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-input);
    border-radius: 4px;
    font-size: 0.85rem;
}

.form-row { display: flex; gap: 1rem; align-items: end; }

.inline-form { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.inline-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    align-items: center;
}
.search-form .form-input { max-width: 300px; }

.form-links {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}
.form-links a { color: var(--accent); }

/* ===== Data Tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}
.data-table th, .data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.data-table th { color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; }
.data-table tr:hover { background: var(--bg-surface-hover); }

.info-table { width: 100%; }
.info-table td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); }
.info-table td:first-child { color: var(--text-secondary); width: 160px; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}
.badge-helper { background: #1a3a5a; color: #4a9eff; }
.badge-moderator {
    background: #8b5cf6;
    color: #fff;
}

.badge-admin { background: #3a3a1a; color: #ffa500; }
.badge-owner { background: #3a1a2a; color: #e94560; }
.badge-sticky { background: #3a3a1a; color: #ffd700; }
.badge-locked { background: #3a2a1a; color: #ff8c00; }
.badge-deleted { background: #3a1a1a; color: #ff6b6b; }
.badge-role { margin-bottom: 0.25rem; }

/* ===== Breadcrumb ===== */
.breadcrumb {
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.breadcrumb a { color: var(--accent); }

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    justify-content: center;
}
.page-current {
    padding: 0.3rem 0.6rem;
    background: var(--accent);
    color: #fff;
    border-radius: 4px;
    font-size: 0.85rem;
}
.page-link {
    padding: 0.3rem 0.6rem;
    color: var(--text-primary);
    font-size: 0.85rem;
}
.page-link:hover { color: var(--accent); }
.page-dots { color: var(--text-muted); }

/* ===== Forum ===== */
.forum-categories td:first-child { width: 50%; }

.row-sticky { border-left: 3px solid #ffd700; }
.row-deleted { opacity: 0.6; }

/* Forum Post Layout */
.forum-posts { margin-top: 1rem; }
.forum-post {
    display: flex;
    gap: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}
.post-sidebar {
    width: 120px;
    min-width: 120px;
    padding: 1rem;
    background: var(--accent-soft);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}
.post-body {
    flex: 1;
    padding: 1rem;
    min-width: 0;
}
.post-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.post-content img { max-width: 100%; height: auto; }
.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}
.post-actions { display: flex; gap: 0.25rem; }
.post-author-name { font-weight: bold; font-size: 0.9rem; }
.post-author-name a { color: inherit; text-decoration: none; }
.post-author-name a:hover { color: var(--accent); }
.post-deleted { border-color: #5a2a2a; }
.deleted-banner {
    background: #3a1a1a;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

/* Avatars */
.post-avatar img { border-radius: 4px; }
.avatar-default, .avatar-default-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    color: var(--accent);
    font-weight: bold;
    border-radius: 4px;
}
.avatar-default { width: 150px; height: 150px; font-size: 3rem; }
.avatar-default-sm { width: 80px; height: 80px; font-size: 2rem; }

/* ===== Account Page ===== */
.account-info {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.account-info p { margin-bottom: 0.5rem; }

.avatar-section { display: flex; align-items: center; gap: 1.5rem; }
.avatar-controls { display: flex; flex-direction: column; gap: 0.5rem; }

/* ===== Admin ===== */
.admin-nav { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}
.stat-number { font-size: 2rem; font-weight: bold; color: var(--accent); }
.stat-label { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }

.action-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.action-group:last-child { border-bottom: none; margin-bottom: 0; }

.category-edit-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ===== Homepage ===== */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--border) 100%);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero p { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 1.5rem; }

.homepage-section {
    margin-bottom: 2rem;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.news-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}
.news-card h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.news-preview { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.5rem; }

.roadmap-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

/* ===== Hiscores ===== */
.hiscores-layout { display: flex; gap: 1.5rem; }
.hiscores-nav {
    width: 180px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.skill-link {
    padding: 0.4rem 0.75rem;
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 0.85rem;
}
.skill-link:hover { background: var(--bg-surface-hover); text-decoration: none; }
.skill-link.active { background: var(--border); color: var(--accent); font-weight: bold; }

.hiscores-content { flex: 1; min-width: 0; }
.hiscores-table td:first-child { width: 60px; text-align: center; font-weight: bold; color: var(--text-muted); }

/* ===== Quill Dark Theme Overrides ===== */
.ql-toolbar.ql-snow {
    background: var(--bg-surface);
    border-color: var(--border);
}
.ql-container.ql-snow {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-primary);
    font-size: 1rem;
}
.ql-editor { min-height: 200px; }
.ql-editor.ql-blank::before { color: var(--text-muted); }
.ql-snow .ql-stroke { stroke: #ccc; }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: #ccc; }
.ql-snow .ql-picker-label { color: #ccc; }
.ql-snow .ql-picker-options {
    background: var(--bg-surface);
    border-color: var(--border);
}
.ql-snow .ql-picker-item { color: var(--text-primary); }
.ql-snow .ql-picker-item:hover { color: var(--accent); }
.ql-snow .ql-active { color: var(--accent); }
.ql-snow .ql-active .ql-stroke { stroke: var(--accent); }
.ql-snow .ql-active .ql-fill { fill: var(--accent); }

/* ===== Thread Actions ===== */
.thread-actions { margin-top: 1rem; }

/* ===== Responsive ===== */

/* Status page indicators */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.status-online { background: #4ecca3; }
.status-starting { background: #f0c040; }
.status-offline { background: var(--accent); }
.badge-member { background: var(--accent); color: #fff; }
.badge-free { background: var(--border); color: #fff; }


/* Utility classes */
.flex-row { display: flex; gap: 1rem; align-items: center; }
.flex-row-sm { display: flex; gap: 0.5rem; align-items: center; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.mb-1 { margin-bottom: 1rem; }
.mt-half { margin-top: 0.5rem; }
.text-center { text-align: center; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 { margin: 0; }
.page-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .separator { color: var(--text-muted); }

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    color: #fff;
    z-index: 1000;
    animation: toast-in 0.3s ease;
    cursor: pointer;
}
.toast-success { background: #22c55e; }
.toast-error { background: #ef4444; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Nav active indicator */
.nav-link { position: relative; padding: 0.25rem 0; }
.nav-link.active { color: var(--accent); }
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Dropdown transition */
.nav-dropdown-menu, .game-dropdown-menu {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}
.nav-dropdown-menu.open, .game-dropdown-menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    padding: 1.5rem 0;
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}
.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
}
.footer-links a:hover { color: var(--accent); }

/* Typography scale */
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1.35rem; font-weight: 600; margin-top: 0; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }

/* Table hover */
.data-table tbody tr:hover {
    background: var(--bg-surface-hover, rgba(255,255,255,0.03));
}

/* Form input focus */
.form-input:focus, .form-select-sm:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Auth page centering */
.auth-card {
    max-width: 420px;
    margin: 2rem auto;
}
.auth-card .card {
    padding: 2rem;
}
.auth-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Danger zone */
.danger-zone {
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 1.25rem;
    background: rgba(239, 68, 68, 0.05);
}
.danger-zone h2 { color: #ef4444; }


/* News item polish */
.news-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.news-item:last-child { border-bottom: none; }
.news-date { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; margin-left: 1rem; }

/* Forum post edit indicator */
.post-edit-indicator {
    font-style: italic;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Forum blockquote (Quill) */
.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

/* Reply section separator */
.reply-section {
    border-top: 2px solid var(--border);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}
.reply-section h3 { margin-bottom: 1rem; }

/* Hiscores table */
.data-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Card consistency */
.card {
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Alert improvements */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Button improvements */
.btn {
    transition: background 0.2s ease, transform 0.1s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-secondary {
    transition: background 0.2s ease, border-color 0.2s ease;
}

/* Form field error state */
.form-input.error, .form-select-sm.error {
    border-color: #ef4444;
}
.form-error {
    color: #f87171;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state p { font-size: 1.1rem; margin-bottom: 1rem; }

/* Admin nav active button */
.admin-nav .btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}


/* Settings unsaved changes bar */
.settings-unsaved-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 2px solid var(--accent);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    animation: toast-in 0.3s ease;
}
.settings-unsaved-bar .unsaved-text {
    margin-right: auto;
    color: var(--accent);
    font-weight: 600;
}

/* Dashboard panels */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.dashboard-full { grid-column: 1 / -1; }
.health-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.health-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border-radius: 6px;
    font-size: 0.9rem;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-today { font-size: 0.8rem; color: #4ade80; }
.stat-today.zero { color: var(--text-muted); }
.mod-alert {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.mod-alert:last-child { border-bottom: none; }
.mod-count { font-weight: 700; font-size: 1.1rem; }
.mod-count.warn { color: #f97316; }
.activity-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--text-muted); white-space: nowrap; font-size: 0.8rem; min-width: 70px; }
.activity-icon { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-icon.registration { background: #58a6ff; }
.activity-icon.post { background: #4ade80; }
.activity-icon.world { background: #f97316; }
.activity-icon.error { background: #ef4444; }

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }

    .footer-links { flex-wrap: wrap; gap: 1rem; }

    .forum-post { flex-direction: column; }
    .post-sidebar {
        width: 100%;
        flex-direction: row;
        min-width: 100%;
        padding: 0.5rem 1rem;
    }

    .hiscores-layout { flex-direction: column; }
    .hiscores-nav {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 100%;
    }

    .page-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
    .hero h1 { font-size: 1.8rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .news-grid { grid-template-columns: 1fr; }

    .search-form { flex-direction: column; }
    .search-form .form-input { max-width: 100%; }
}
/* ===== Nav Dropdown ===== */
.nav-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 1.5rem;
}
.nav-dropdown-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    padding: 0.4rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 6px;
    transition: background 0.15s;
}
.nav-dropdown-toggle:hover {
    background: var(--bg-surface-hover);
}
.nav-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
}
.nav-avatar-icon {
    font-size: 1.5rem;
}
.nav-username {
    font-size: 1rem;
    font-weight: 500;
}
.nav-caret {
    font-size: 0.7rem;
    opacity: 0.6;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    min-width: 160px;
    z-index: 100;
    padding: 0.4rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
/* Removed hover - now using click-to-toggle via JS */
.nav-dropdown-menu.open {
    display: block;
}
.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    margin-left: 0;
}
.nav-dropdown-menu a:hover {
    background: var(--bg-surface-hover);
    color: var(--accent);
    text-decoration: none;
}
.dropdown-form {
    display: block;
    margin: 0;
    padding: 0;
}
.dropdown-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: inherit;
}
.dropdown-toggle-label:hover {
    background: var(--bg-surface-hover);
}
.dropdown-toggle-label input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ===== News Cards ===== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.news-grid-home {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
    gap: 1.5rem;
}
.news-grid-home .news-card {
    width: 380px;
    max-width: 100%;
}
.news-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.news-card:hover {
    border-color: var(--accent);
}
.game-card:hover {
    border-color: var(--accent);
}
.news-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}
.news-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.news-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.news-card-body h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.news-card-body h3 a { color: var(--text-primary); text-decoration: none; }
.news-card-body h3 a:hover { color: var(--accent); }
.news-excerpt {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    flex: 1;
}
.news-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
}
.news-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.news-article {
    max-width: 800px;
    margin: 0 auto;
}
.news-article-thumbnail {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}
.news-article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.news-body {
    line-height: 1.7;
}
.news-body img {
    max-width: 100%;
    border-radius: 4px;
}
.news-section {
    margin-bottom: 2rem;
    text-align: center;
}
.news-section .news-grid {
    text-align: left;
}

/* Game nav dropdown */
.nav-game-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
    border-radius: 4px;
}

.nav-game-link:hover {
    color: var(--accent);
}

.game-dropdown {
    position: relative;
    display: inline-block;
}

.game-dropdown-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.game-dropdown-toggle:hover {
    border-color: var(--accent);
}

.game-dropdown-menu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 0.3rem);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-dropdown-menu.open {
    display: block;
}

.game-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.game-dropdown-menu a:last-child {
    border-bottom: none;
}

.game-dropdown-menu a:hover {
    background: var(--bg-surface-hover);
    color: var(--accent);
}


/* ===== Impersonation Banner ===== */
.impersonation-banner {
    background: var(--accent);
    color: #fff;
    text-align: center;
    padding: 8px;
    font-weight: bold;
    font-size: 0.9rem;
}
.btn-impersonate-exit {
    background: #fff;
    color: var(--accent);
    border: none;
    padding: 2px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
}

/* ===== Game Cards ===== */
.games-section {
    margin-bottom: 2rem;
    text-align: center;
}
.games-section .games-grid {
    text-align: left;
}
.games-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
    gap: 1.5rem;
}
.game-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: 100%;
}
.game-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.game-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.game-thumbnail-placeholder {
    font-size: 4rem;
    color: #333;
}
.game-card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.game-card-body h3 { margin-bottom: 0.5rem; }
.game-tagline {
    color: var(--text-label);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.game-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    flex: 1;
}
.game-card-body .btn {
    align-self: flex-start;
}

/* ===== Homepage News List (compact) ===== */
.news-list {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0;
}
.news-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.news-item:last-child { border-bottom: none; }
.news-item a { flex: 1; }
.news-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    margin-left: 1rem;
}

/* ===== Hero Heading (text-focused) ===== */
.hero-heading {
    font-size: 2.2rem;
    line-height: 1.3;
    max-width: 600px;
    margin: 0 auto 0.75rem;
}
.hero-subheading {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .games-grid { justify-content: center; }
    .game-card { width: 100%; }
    .hero-heading { font-size: 1.6rem; }
    .nav-dropdown-menu { right: 0; left: auto; max-width: calc(100vw - 1rem); }
    .news-item { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
    .news-date { margin-left: 0; }
}

/* ===== Profile Page ===== */
.profile-page {
    padding: 2rem 1rem;
    border-radius: 8px;
    min-height: 80vh;
    margin: -2rem -1rem;
}
.profile-page .card {
    background: rgba(22, 33, 62, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.3s ease;
}

.profile-top {
    border-radius: 8px 8px 0 0;
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.profile-banner {
    height: 200px;
    position: relative;
    overflow: hidden;
}
.profile-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
}
.profile-header.no-banner {
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
}
.profile-header.no-banner .profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.profile-avatar.has-banner { margin-top: -50px; }
.profile-avatar img, .profile-avatar .avatar-default {
    border: 3px solid var(--bg-surface);
    border-radius: 8px;
}
.profile-info h1 { margin-bottom: 0.25rem; }
.profile-status {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0.25rem;
}
.profile-badges {
    display: flex;
    gap: 0.3rem;
    margin: 0.5rem 0;
    font-size: 1.5rem;
}
.profile-badge {
    cursor: help;
}
.profile-socials {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}
.social-link {
    padding: 0.15rem 0.5rem;
    background: var(--border);
    border-radius: 3px;
    font-size: 0.8rem;
    color: var(--text-primary);
}
.social-link:hover { background: var(--bg-surface-hover); text-decoration: none; }

.profile-about img { max-width: 100%; height: auto; }

.profile-characters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.profile-char-card {
    background: var(--border);
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    text-align: center;
}

/* Guestbook */
.guestbook-entries { }
.guestbook-entry {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.guestbook-entry:last-child { border-bottom: none; }
.guestbook-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}
.guestbook-content {
    color: var(--text-label);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .profile-avatar.has-banner { margin-top: -40px; }
    .profile-badges { justify-content: center; }
    .profile-socials { justify-content: center; }
    .profile-banner { height: 150px; }
    .profile-page { margin: -1rem -0.5rem; padding: 1rem 0.5rem; }
}

/* ===== Settings Page ===== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.theme-swatch {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s;
}
.theme-swatch:hover { border-color: var(--text-secondary); }
.theme-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-swatch-colors {
    display: flex;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.theme-swatch-colors span { flex: 1; }
.theme-swatch-name { font-size: 0.85rem; color: var(--text-primary); }
.theme-swatch-preview {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    justify-content: center;
    margin-top: 0.3rem;
    font-size: 0.75rem;
}
.theme-swatch-preview .dot { width: 8px; height: 8px; border-radius: 50%; }
.theme-swatch-preview .line { height: 2px; width: 24px; border-radius: 1px; }

.custom-theme-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}
.custom-theme-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.custom-theme-row label { min-width: 140px; color: var(--text-label); font-size: 0.9rem; }
.custom-theme-row input[type="color"] {
    width: 50px; height: 35px; border: none; cursor: pointer; border-radius: 4px;
}
.theme-preview-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}
.theme-preview-card .preview-btn {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #fff;
}
.theme-preview-card .preview-link { font-size: 0.9rem; }

.font-size-options {
    display: flex;
    gap: 1.5rem;
}
.font-size-options label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* ===== Live Preview Preference Overrides ===== */
body[data-fontsize="large"] h1,
body[data-fontsize="large"] h2,
body[data-fontsize="large"] h3 {
    font-size: 1.08em;
}
body[data-fontsize="large"] .btn {
    font-size: 1.03rem;
}
body[data-fontsize="large"] .btn-sm {
    font-size: 0.9rem;
}
body[data-fontsize="large"] .data-table th,
body[data-fontsize="large"] .data-table td,
body[data-fontsize="large"] .info-table td {
    font-size: 1.02em;
}
body[data-fontsize="large"] .theme-preview-card {
    font-size: 1.03em;
}
body[data-fontsize="large"] .theme-preview-card .preview-btn {
    font-size: 0.9rem;
}
body[data-fontsize="large"] .theme-preview-card .preview-link {
    font-size: 0.98rem;
}

body[data-compact="true"] .main-nav {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}
body[data-compact="true"] .nav-left {
    gap: 1.1rem;
}
body[data-compact="true"] .card {
    padding: 1rem;
    margin-bottom: 1rem;
}
body[data-compact="true"] .page-section h1,
body[data-compact="true"] .page-section h2,
body[data-compact="true"] .page-section h3 {
    margin-bottom: 0.75rem;
}
body[data-compact="true"] .form-group {
    margin-bottom: 0.75rem;
}
body[data-compact="true"] .form-input,
body[data-compact="true"] textarea,
body[data-compact="true"] select {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}
body[data-compact="true"] .btn {
    padding: 0.65rem 1.2rem;
}
body[data-compact="true"] .btn-sm {
    padding: 0.3rem 0.65rem;
}
body[data-compact="true"] .data-table th,
body[data-compact="true"] .data-table td {
    padding: 0.45rem 0.6rem;
}
body[data-compact="true"] .info-table td {
    padding: 0.3rem 0.6rem;
}
body[data-compact="true"] .inline-form,
body[data-compact="true"] .inline-actions,
body[data-compact="true"] .page-actions,
body[data-compact="true"] .flex-row {
    gap: 0.65rem;
}
body[data-compact="true"] .font-size-options {
    gap: 1rem;
}
body[data-compact="true"] .custom-theme-panel {
    padding: 0.85rem;
    margin-top: 0.75rem;
}
body[data-compact="true"] .custom-theme-row {
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}
body[data-compact="true"] .theme-preview-card {
    padding: 0.75rem;
    margin-top: 0.5rem;
}
body[data-compact="true"] .theme-preview-card .preview-btn {
    padding: 0.25rem 0.65rem;
}

/* Game landing page */
.game-landing { max-width: 800px; margin: 0 auto; }
.game-hero { text-align: center; }
.game-hero-img { max-width: 200px; border-radius: 8px; margin-bottom: 1rem; }
.game-hero-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.game-tagline { color: var(--text-muted); font-size: 1.1rem; margin-top: 0.5rem; }

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .main-nav { padding: 0.6rem 1rem; }
    .nav-left { gap: 1rem; }
    .nav-username { display: none; }
    .nav-dropdown-toggle { padding: 0.3rem; }
    .news-grid { grid-template-columns: 1fr; }
    .games-grid { justify-content: center; }
    .game-card { width: 100%; }
}

/* ===== Dashboard World Health (WEB-017) ===== */
.world-health-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}
.health-count {
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
}
.health-count.online { color: #4ade80; }
.health-count.offline { color: #f87171; }
.health-count.starting { color: #facc15; }
.health-count.total { color: var(--text-secondary); }

.world-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.filter-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-right: 0.15rem;
}
.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.form-input-sm { padding: 0.2rem 0.5rem; font-size: 0.85rem; width: 140px; }

.world-list { display: flex; flex-direction: column; gap: 0.25rem; }
.world-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: background 0.1s;
}
.world-row:hover { background: rgba(255,255,255,0.03); }
.world-row strong { min-width: 80px; }
.world-status-text { margin-left: auto; font-size: 0.85rem; color: var(--text-secondary); }

.badge-env-sm {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.text-muted-sm { font-size: 0.8rem; color: var(--text-secondary); }

/* Admin refresh settings grid (WEB-017) */
.refresh-settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.75rem; }

/* ===== Motion Polish (POLISH-001) ===== */
.stagger-reveal {
    --stagger-delay: 0s;
}

.page-section {
    --stagger-delay: 0s;
}

tbody tr {
    position: relative;
    transition: background-color var(--timing-fast) var(--ease-smooth);
}

tbody tr::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    opacity: 0;
    transform: scaleY(0.2);
    transform-origin: top;
    transition: opacity var(--timing-fast) var(--ease-smooth), transform var(--timing-normal) var(--ease-out);
    pointer-events: none;
}

tbody tr:hover::before {
    opacity: 1;
    transform: scaleY(1);
}

.btn {
    transition: transform var(--timing-fast) var(--ease-smooth), background-color var(--timing-fast) var(--ease-smooth), box-shadow var(--timing-fast) var(--ease-smooth);
}

.btn:hover {
    box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 14%, transparent);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-input,
.form-select,
.form-select-sm,
textarea {
    transition: border-color var(--timing-fast) var(--ease-smooth), box-shadow var(--timing-fast) var(--ease-smooth), transform var(--timing-fast) var(--ease-smooth);
}

.form-group input:focus,
.form-input:focus,
.form-select:focus,
.form-select-sm:focus,
textarea:focus {
    transform: scale(1.005);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.news-card,
.game-card,
.profile-card {
    transition: transform var(--timing-normal) var(--ease-smooth), box-shadow var(--timing-normal) var(--ease-smooth), border-color var(--timing-fast) var(--ease-smooth);
}

.news-card:hover,
.game-card:hover,
.profile-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.game-thumbnail,
.news-thumbnail,
.profile-card .profile-image,
.profile-card .profile-banner {
    overflow: hidden;
}

.game-thumbnail img,
.news-thumbnail img,
.profile-card .profile-image img,
.profile-card .profile-banner img {
    transition: transform var(--timing-slow) var(--ease-out);
    transform-origin: center;
}

.game-card:hover .game-thumbnail img,
.news-card:hover .news-thumbnail img,
.profile-card:hover .profile-image img,
.profile-card:hover .profile-banner img {
    transform: scale(1.04);
}

.nav-dropdown-menu,
.game-dropdown-menu {
    transition: opacity var(--timing-fast) var(--ease-smooth), transform var(--timing-fast) var(--ease-smooth), visibility var(--timing-fast) var(--ease-smooth);
}

.nav-dropdown-menu,
.game-dropdown-menu {
    display: block;
    visibility: hidden;
}

.nav-dropdown-menu.open,
.game-dropdown-menu.open {
    visibility: visible;
}

.badge {
    transition: background-color var(--timing-fast) var(--ease-smooth), transform var(--timing-fast) var(--ease-smooth);
}

.badge:hover {
    transform: translateY(-1px);
}

.toast-stack,
.toast-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    z-index: 1000;
    pointer-events: none;
}

.toast-stack .toast,
.toast-stack .toast-msg,
.toast-container .toast,
.toast-container .toast-msg {
    position: static;
    pointer-events: auto;
}

.toast,
.toast-msg {
    transform: translateY(20px);
    opacity: 0;
    animation-fill-mode: both;
}

.toast.is-leaving,
.toast-msg.is-leaving {
    animation: toast-out var(--timing-fast) var(--ease-out) forwards;
}

.toast-stack .toast:nth-child(1),
.toast-stack .toast-msg:nth-child(1),
.toast-container .toast:nth-child(1),
.toast-container .toast-msg:nth-child(1) { animation-delay: 0s; }
.toast-stack .toast:nth-child(2),
.toast-stack .toast-msg:nth-child(2),
.toast-container .toast:nth-child(2),
.toast-container .toast-msg:nth-child(2) { animation-delay: 0.04s; }
.toast-stack .toast:nth-child(3),
.toast-stack .toast-msg:nth-child(3),
.toast-container .toast:nth-child(3),
.toast-container .toast-msg:nth-child(3) { animation-delay: 0.08s; }

.modal-overlay,
.modal-backdrop {
    transition: opacity var(--timing-normal) var(--ease-smooth), visibility var(--timing-normal) var(--ease-smooth);
}

.modal-overlay {
    opacity: 0;
    visibility: hidden;
}

.modal-overlay.is-open,
.modal-overlay[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.modal-overlay > .modal,
.modal-overlay > .modal-content,
.modal-overlay > .modal-panel {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity var(--timing-normal) var(--ease-smooth), transform var(--timing-normal) var(--ease-smooth);
}

.modal-overlay.is-open > .modal,
.modal-overlay.is-open > .modal-content,
.modal-overlay.is-open > .modal-panel,
.modal-overlay[aria-hidden="false"] > .modal,
.modal-overlay[aria-hidden="false"] > .modal-content,
.modal-overlay[aria-hidden="false"] > .modal-panel {
    opacity: 1;
    transform: scale(1);
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .stagger-reveal {
        opacity: 0;
        animation: fade-in-up var(--timing-slow) var(--ease-out) both;
        animation-delay: var(--stagger-delay, 0s);
    }

    .page-section {
        opacity: 0;
    }

    .page-section.is-visible {
        animation: fade-in-up var(--timing-slow) var(--ease-out) both;
        animation-delay: var(--stagger-delay, 0s);
    }

    .toast,
    .toast-msg {
        animation:
            toast-enter 0.3s var(--ease-bounce) both,
            toast-out 0.2s var(--ease-out) 3.8s forwards;
    }

    .modal-overlay.is-open > .modal,
    .modal-overlay.is-open > .modal-content,
    .modal-overlay.is-open > .modal-panel,
    .modal-overlay[aria-hidden="false"] > .modal,
    .modal-overlay[aria-hidden="false"] > .modal-content,
    .modal-overlay[aria-hidden="false"] > .modal-panel {
        animation: scale-in var(--timing-normal) var(--ease-smooth) both;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .page-section,
    .stagger-reveal {
        opacity: 1;
        animation: none;
    }

    .toast,
    .toast-msg {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .btn,
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group input[type="number"],
    .form-input,
    .form-select,
    .form-select-sm,
    textarea,
    .news-card,
    .game-card,
    .profile-card,
    .game-thumbnail img,
    .news-thumbnail img {
        transition-duration: 0.01ms !important;
    }
}
