:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #2d2d2dea;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --text-primary: #ffffff;
    --text-secondary: #b9bbbe;
    --success: #43b581;
    --danger: #f04747;
    --border: #40444b;
    --rank-1: #ffd700;
    --rank-2: #c0c0c0;
    --rank-3: #cd7f32;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--bg-primary);
    color-scheme: dark light;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary) url(https://aszgaming.eu/images/bg.jpg) center / cover no-repeat fixed;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Announcement banner */
.announcement-banner {
    background:rgba(75, 35, 83, 0.87); /* ~8.5% white on dark (85% alpha of text background equivalent) */
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 16px 18px 12px 18px; /* no extra bottom padding; tools are outside */
    border-radius: 15px;
    margin: 16px 0 8px 0; /* small gap above tools row */
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.announcement-banner.announcement-important {
    background:rgba(75, 35, 83, 0.87); 
    border-color: var(--danger);
    box-shadow: 0 8px 25px rgba(240, 71, 71, 0.2);
}
.announcement-banner.announcement-hidden {
    background: rgba(255, 255, 255, 0.085);
    border-color: var(--border);
}
.announcement-content.editing {
    outline: 2px dashed #5aa2ff;
    background: rgba(59,130,246,0.06);
    border-radius: 6px;
    padding: 6px;
}
.announcement-content { white-space: pre-line; }
.announcement-actions .tool-btn {
    margin-left: 6px;
}
.announcement-actions { display: none; text-align: right; margin-top: 10px; }
.announcement-actions.open { display: block; }
.announcement-meta { text-align: right; }
.announcement-meta .meta-text { font-size: 1rem; opacity: 0.7; color: var(--text-secondary); }

/* New announcement structure: flag + body with wrapping */
.announcement-body { display: flow-root; line-height: 1.6; font-size: 1.1rem; }
.ann-flag {
    float: left;
    width: 26px;
    height: 26px;
    margin: 2px 10px 6px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(240, 71, 71, 0.15);
    color: #ffd6d6;
    border: 1px solid rgba(240, 71, 71, 0.4);
    font-size: 15px;
}
.announcement-meta.meta-abs { position: absolute; right: 12px; top: 10px; }

/* Tools button below the card */
.announcement-tools-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}
.ann-tools-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2000;
    width: 62px;
    height: 62px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 22px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.ann-tools-btn:hover { background: var(--accent-hover); }
.ann-tools-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: auto;
    min-width: 30px;
    height: 30px;
    padding: 0 10px;
    line-height: 30px;
    font-size: 13px;
    text-align: center;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    cursor: pointer;
}
.ann-tools-btn:hover { background: var(--accent-hover); }

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: left;
    margin-bottom: 40px;
    padding: 30px;
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.landing-header .header {
    margin-bottom: 0;
}

.header-with-bg {
    position: relative;
    overflow: hidden;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.header-with-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.header-with-bg .header-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: saturate(0.85) brightness(0.9);
    z-index: 0;
    pointer-events: none;
}

.header-with-bg > *:not(.header-bg) {
    position: relative;
    z-index: 1;
}

.landing-header {
    position: relative;
    margin-bottom: 30px;
    isolation: isolate;
}

.landing-header.is-expanded {
    z-index: 140;
}

.landing-header.animating {
    z-index: 140 !important;
}

.header-toggle {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    padding: 12px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    z-index: 150;
}

.header-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.toggle-icon {
    transition: transform 0.35s ease;
}

.header-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.header-collapse {
    position: absolute;
    top: calc(100% + 16px);
    left: 0;
    width: min(100%, 1200px);
    opacity: 0;
    pointer-events: none;
    transform-origin: top center;
    transform: translateY(-28px) scaleY(0.9);
    filter: drop-shadow(0 20px 45px rgba(0, 0, 0, 0.45));
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    border-radius: 22px;
    z-index: 200;
    will-change: transform, opacity;
}

.header-collapse.is-open {
    opacity: 1;
    pointer-events: auto;
    animation: landingHeaderSlideDown 0.55s cubic-bezier(0.2, 0.8, 0.35, 1) forwards;
}

.header-collapse.is-closing {
    pointer-events: none;
    animation: landingHeaderSlideUp 0.45s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}


.landing-header-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 120;
}

.landing-header-scrim.is-active {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

@keyframes landingHeaderSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-36px) scaleY(0.88);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

@keyframes landingHeaderSlideUp {
    0% {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-32px) scaleY(0.9);
    }
}

.mod-panel-switch {
    margin-top: 18px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.mod-panel-switch p {
    margin: 4px 0 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.mod-panel-toggle-btn {
    white-space: nowrap;
    min-width: 210px;
    text-align: center;
}

h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--accent), #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-weight: 800;
}

.user-info {
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.user-info-text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.policy-info-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.policy-info-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.policy-info-btn .info-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.policy-info-btn:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

.policy-info-btn.needs-action {
    color: var(--warning);
    border-color: rgba(255, 193, 7, 0.6);
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.35);
}

.policy-info-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 6, 10, 0.9);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 5;
}

.policy-info-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.policy-menu-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.policy-menu-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent);
}

.policy-menu-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.account-summary {
    margin: 8px 0;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(17, 17, 17, 0.32);
    font-size: 0.95em;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.account-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.account-mod-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    margin-left: 8px;
}

.mod-panel-inline-switch {
    transform: scale(0.92);
    transform-origin: center;
}

.autoplay-switch {
    position: relative;
    width: 46px;
    height: 24px;
    display: inline-flex;
    align-items: center;
}

.autoplay-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.autoplay-slider {
    flex: 1;
    height: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.25s ease;
    position: relative;
}

.autoplay-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.25s ease, background 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.autoplay-switch input:checked + .autoplay-slider {
    background: var(--accent);
}

.autoplay-switch input:checked + .autoplay-slider::after {
    transform: translateX(22px);
    background: #05060a;
}

.mod-panel-state {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

@media (max-width: 640px) {
    .account-mod-toggle {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
}

.ranking-container {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.ranking-list {
    list-style: none;
}

.ranking-item {
    display: grid;
    grid-template-columns: 80px 60px 1fr auto auto;
    align-items: center;
    gap: 20px;
    padding: 20px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid transparent;
    transition: transform 0.6s ease, box-shadow 0.6s ease, background 0.6s ease, border-color 0.6s ease;
    position: relative;
    overflow: hidden;
    user-select: none; /* prevent selection during DOM moves */
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(88, 101, 242, 0.2);
}

.ranking-item.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), transparent);
    border-color: var(--rank-1);
}

.ranking-item.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1), transparent);
    border-color: var(--rank-2);
}

.ranking-item.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1), transparent);
    border-color: var(--rank-3);
}

/* Global bottom-5 warning */
.ranking-item.rank-bottom {
    background: linear-gradient(135deg, rgba(240, 71, 71, 0.08), transparent);
    border-color: var(--danger);
}

.rank {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
}

.rank-1 .rank {
    background: var(--rank-1);
    color: #000;
    border-color: var(--rank-1);
}

.rank-2 .rank {
    background: var(--rank-2);
    color: #000;
    border-color: var(--rank-2);
}

.rank-3 .rank {
    background: var(--rank-3);
    color: #000;
    border-color: var(--rank-3);
}

.avatar-container {
    position: relative;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    transition: all 0.3s ease;
}

/* Make moderators clearly visible: gold border + subtle outer ring.
   Use !important so hover styles don't override the gold border. */
.avatar-container.mod .avatar {
    border-color: #FFD700 !important; /* gold border */
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.55); /* outer ring */
}

.ranking-item:hover .avatar {
    transform: scale(1.1);
    border-color: var(--accent-hover);
}

.name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.score {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--accent);
    background: rgba(88, 101, 242, 0.1);
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid var(--accent);
}

.badge-excluded {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.8rem;
    color: #ffd6d6;
    background: rgba(240,71,71,0.25);
    border: 1px solid var(--danger);
    border-radius: 999px;
    vertical-align: middle;
}

.logout-btn {
    color: var(--danger);
    text-decoration: none;
    margin-left: 10px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
}

.vote-btn.active {
    transform: scale(1.1);
}

.vote-up-btn.active {
    color: var(--accent);
    filter: drop-shadow(0 0 5px var(--accent));
}

.vote-down-btn.active {
    color: #e74c3c;
    filter: drop-shadow(0 0 5px #e74c3c);
}

.vote-buttons {
    display: flex;
    gap: 10px;
}

.vote-btn {
    padding: 2px;
    border: none;
    border-radius: 4px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    background: transparent;
    color: var(--text-secondary);
}

.vote-btn:hover {
    transform: scale(1.1);
    color: var(--text-primary);
}

.vote-up-btn:hover {
    color: var(--accent);
}

.vote-down-btn:hover {
    color: #e74c3c;
}

.upvote {
    background: var(--success);
    color: white;
}

.downvote {
    background: var(--danger);
    color: white;
}

.reset-btn {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
}

.reset-btn:hover {
    background: var(--danger);
    color: white;
}

.vote-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.vote-btn:active {
    transform: scale(0.95);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
}

.pagination.is-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.pagination.is-loading::after {
    content: '';
    position: absolute;
    right: -10px;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.page-btn {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.page-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.page-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Inline reset confirmation UI */
.reset-wrapper {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.reset-confirm.hidden {
    display: none !important;
}

.confirm-btn {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.confirm-btn:hover {
    background: var(--accent);
    color: white;
}

.cancel-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border);
}

.cancel-btn:hover {
    background: var(--border);
    color: white;
}

/* Animation classes */
.ranking-item.moving-up {
    animation: moveUp 0.6s ease;
}

.ranking-item.moving-down {
    animation: moveDown 0.6s ease;
}

.ranking-item.new-highlight {
    animation: highlight 1s ease;
}

@keyframes moveUp {
    0% { background-color: rgba(67, 181, 129, 0.3); }
    100% { background-color: transparent; }
}

@keyframes moveDown {
    0% { background-color: rgba(240, 71, 71, 0.3); }
    100% { background-color: transparent; }
}

@keyframes highlight {
    0% { box-shadow: 0 0 0 0 rgba(88, 101, 242, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(88, 101, 242, 0); }
    100% { box-shadow: 0 0 0 0 rgba(88, 101, 242, 0); }
}

/* Loading animation */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .ranking-item {
        grid-template-columns: 50px 50px 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .vote-buttons {
        grid-column: 1 / -1;
        justify-content: center;
        margin-top: 10px;
    }
    
    .score {
        text-align: center;
    }
    
    h1 {
        font-size: 2rem;
    }
}

.avatar,
.vote-btn,
.vote-btn:hover,
.page-btn,
.page-btn:hover:not(:disabled) {
    transition: transform 0.6s ease, box-shadow 0.6s ease, background 0.6s ease, color 0.6s ease;
}

/* Also update animation durations */
@keyframes moveUp {
    0% { background-color: rgba(67, 181, 129, 0.3); }
    100% { background-color: transparent; }
}
/* Use like this: */
.ranking-item.moving-up {
    animation: moveUp 1.2s ease; /* Slower */
}

.ranking-item.moving-down {
    animation: moveDown 1.2s ease; /* Slower */
}

.ranking-item.new-highlight {
    animation: highlight 2s ease; /* Slower */
}

/* Alert banner (rate limit notice) */
.alert-banner {
    background: linear-gradient(180deg, rgba(240,71,71,0.2), rgba(240,71,71,0.15));
    color: #ffd6d6;
    border: 1px solid var(--danger);
    padding: 14px 18px;
    border-radius: 10px;
    margin: 16px 0 24px 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.6s ease, transform 0.6s ease; /* Smooth reveal */
}

.alert-banner.show {
    opacity: 1;
    transform: translateY(0);
}

/* Moderator tools panel */
.mod-tools {
    max-width: 1200px;
    margin: 24px auto 0 auto;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.mod-tools-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.mod-tools h2 {
    font-size: 1.4rem;
    margin: 0;
}

.mod-tools-toggle {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--accent);
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.mod-tools-toggle:hover {
    background: var(--accent);
    color: white;
}

.mod-tools-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.6s ease, opacity 0.6s ease;
    opacity: 0;
}

.mod-tools-content.open {
    opacity: 1;
    max-height: 5000px; /* Increased to prevent clipping */
    overflow-y: auto; /* Allow scrolling if content is still too tall */
}

.mod-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 18px 22px 22px 22px;
}

.mod-tool {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.3s ease;
}

.mod-tool .tool-title {
    font-weight: 700;
    margin-bottom: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.mod-tool .tool-title::after {
    content: '▼';
    font-size: 0.8em;
    transition: transform 0.3s;
    opacity: 0.7;
}

.mod-tool.collapsed .tool-title::after {
    transform: rotate(-90deg);
}

.mod-tool.collapsed .tool-desc,
.mod-tool.collapsed .tool-form,
.mod-tool.collapsed .message,
.mod-tool.collapsed #message-container,
.mod-tool.collapsed #delete-song-feedback,
.mod-tool.collapsed #edit-song-feedback {
    display: none;
}

.mod-tool.collapsed {
    padding-bottom: 10px;
}

.tool-desc {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.tool-btn {
    display: inline-block;
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-decoration: none;
}

.tool-btn-disabled {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-secondary);
    cursor: not-allowed;
    pointer-events: none;
}

.tool-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .mod-tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Moderator tool form elements */
.tool-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.tool-label {
    grid-column: 1 / -1;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.tool-input {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
}

.tool-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

.tool-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Page overlay to avoid white flash between navigations */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}
.overlay.show {
    display: flex;
    animation: overlayFade 200ms ease;
}
.overlay .spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 5px solid var(--bg-secondary);
    border-top-color: var(--accent);
    animation: spinOnly 1s linear infinite;
}

@keyframes overlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spinOnly {
    to { transform: rotate(360deg); }
}

.video-list {
    display: flex;
    flex-direction: column;
}

/* Pending Controls */
.pending-status {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pending-text {
    color: var(--warning);
    font-size: 0.85rem;
    font-style: italic;
}

.pending-status .tool-btn {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    color: white;
    font-weight: 600;
    transition: filter 0.2s, transform 0.1s;
}

.pending-status .tool-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.pending-status .tool-btn:active {
    transform: translateY(0);
}

.pending-status .approve-btn {
    background: var(--success);
}

.pending-status .delete-btn {
    background: var(--danger);
}

.confirm-wrapper {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.cancel-action-btn {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    padding: 4px 8px !important;
}

.cancel-action-btn:hover {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.pending-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Online Users Section */
.online-users-container {
    margin: 10px 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
}

.online-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.online-avatars {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.online-avatar-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.online-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    transition: transform 0.2s ease;
}

.online-avatar-wrapper:hover .online-avatar-img {
    transform: scale(1.1);
}

.online-avatar-wrapper.mod-online .online-avatar-img {
    border-color: #FFD700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.online-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, bottom 0.2s ease;
    margin-bottom: 6px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.online-avatar-wrapper:hover .online-tooltip {
    opacity: 1;
    bottom: 110%;
}


/* Game Mode Modal & Transitions */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.game-mode-card {
    background: linear-gradient(145deg, #1e1e24, #1a1a1f);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .game-mode-card {
    transform: translateY(0);
}

body.modal-open {
    overflow: hidden;
}

.premium-card {
    background: linear-gradient(140deg, rgba(5, 6, 10, 0.96), rgba(10, 14, 20, 0.9));
    border: 1px solid rgba(67, 181, 129, 0.35);
    border-radius: 16px;
    width: 92%;
    max-width: 520px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    transform: translateY(24px);
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

.modal-overlay.active .premium-card {
    transform: translateY(0);
}

.premium-intro {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.premium-checklist {
    margin: 12px 0 0;
    padding-left: 20px;
    color: var(--text-primary);
    line-height: 1.4;
}

.premium-checklist li {
    margin-bottom: 8px;
}

.premium-note {
    margin-top: 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.premium-modal .tool-btn {
    min-width: 200px;
}

.premium-modal .tool-btn-outline {
    border-color: rgba(255, 255, 255, 0.35);
    color: var(--text-secondary);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.gm-subtitle {
    color: var(--accent);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-weight: 600;
}

.gm-info-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gm-info-item {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
}

.gm-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.2));
}

.gm-info-item strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.gm-info-item p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0;
}

.gm-status {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    color: var(--success);
    font-weight: bold;
    font-size: 0.9rem;
}

.pulsing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.7); }
    70% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 6px rgba(67, 181, 129, 0); }
    100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(67, 181, 129, 0); }
}

/* Update State for Ranking List */
.ranking-container {
    position: relative;
    min-height: 200px;
}

/* Loading Overlay */
.ranking-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(2px);
    border-radius: 15px;
}

.ranking-loading-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.ranking-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* While updating, suppress transitions to prevent Firefox rendering glitches */
.ranking-list.is-updating .ranking-item {
    transition: none !important;
}

/* Ensure background is dark to prevent white flashes */
.ranking-list {
    background-color: transparent; /* Container itself is transparent, items carry bg */
}

/* Landing showcase */
.showcase-section {
    padding: 300px 48px 48px 48px;
    border-radius: 16px;
}

.showcase-body {
    margin-top: 20px;
}

.showcase-slider {
    display: flex;
    align-items: center;
    gap: 12px;
}

.showcase-window {
    overflow: hidden;
    flex: 1;
}

.showcase-track {
    display: flex;
    gap: 16px;
    transition: transform 0.4s ease;
}

.project-card {
    position: relative;
    min-width: min(320px, 85vw);
    height: 250px;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.project-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.8) 100%);
    z-index: 1;
    opacity: 0.75;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.project-card:hover {
    transform: translateY(0px);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.project-card:hover::before {
    opacity: 0.95;
}

.cover-link {
    position: absolute;
    inset: 0;
    display: block;
    z-index: 0;
}

.cover-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-card-content {
    position: absolute;
    bottom: 18px;
    left: 18px;
    right: 18px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.project-card-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-card-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(26, 30, 45, 0.8);
    color: #d6ff6b;
    font-weight: 600;
    width: fit-content;
}

.project-card-disabled {
    opacity: 0.9;
}

.project-card-disabled::before {
    opacity: 0.9;
}

.cover-link-disabled {
    position: absolute;
    inset: 0;
    display: block;
    pointer-events: none;
}

.cover-link-disabled img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.25);
}

.card-status-pill {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 86, 86, 0.9);
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    z-index: 2;
}

.card-status-pill-passive {
    background: rgba(255, 255, 255, 0.25);
    color: #fefefe;
}

.project-card-content h3 {
    margin: 0;
    font-size: 1.05rem;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.project-card-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    color: #1f1f1f;
    background: #dbd7c6;
    transition: transform 0.1s ease, background 0.2s ease;
}

.project-card-btn:hover {
    background: #b1cf43;
    transform: translateX(-3px);
}

.project-card-btn:active {
    transform: translateY(1px);
}

.showcase-arrow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    color: #000;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.showcase-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.showcase-arrow:not(:disabled):hover {
    background: rgba(255, 255, 255, 1);
}

.showcase-placeholder {
    margin-top: 20px;
    padding: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.showcase-modals {
    display: contents;
}

.project-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 11000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.project-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.project-modal-inner {
    width: min(960px, 94vw);
    background: #ffffff;
    color: #000;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    position: relative;
}

.project-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: transparent;
    color: #000;
    font-size: 1.8rem;
    cursor: pointer;
}

.project-modal-media {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    margin-bottom: 24px;
    border-radius: 10px;
    overflow: hidden;
}

.project-modal-media iframe,
.project-modal-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
}

.project-modal-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-modal-content h2 {
    margin: 0;
    color: #111;
}

.project-modal-content p {
    margin: 0;
    color: #2c2c2c;
    line-height: 1.5;
}

.project-modal-cta {
    margin-top: 8px;
}

.project-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    background: #dbd7c6;
    color: #111;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.project-modal-link:hover {
    background: #b1cf43;
    transform: translateY(-1px);
}

body.showcase-modal-open {
    overflow: hidden;
}

.landing-mod-tools {
    margin-top: 40px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.landing-mod-tools.is-hidden {
    display: none;
}

.landing-mod-tools-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
}

.landing-mod-tools-header h2 {
    margin: 0;
    font-size: 1.4rem;
}

.landing-mod-tool {
    display: flex;
    justify-content: space-between;
    gap: 28px;
    flex-wrap: wrap;
    align-items: center;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    padding: 20px;
}

.landing-mod-tool h3 {
    margin: 0 0 6px 0;
}

.landing-mod-tool p {
    margin: 0;
    color: var(--text-secondary);
}

.landing-mod-tool form {
    align-self: center;
}

.current-value {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@media (max-width: 960px) {
    .project-modal-inner {
        padding: 24px;
    }
}

@media (max-width: 720px) {
    .project-card {
        min-width: 260px;
        height: 220px;
    }

    .showcase-header {
        flex-direction: column;
    }

    .project-card-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .landing-mod-tool {
        flex-direction: column;
        align-items: flex-start;
    }
}
