/* Floating Changelog / News — emoX accent (warm orange + coral) */

:root {
    --cl-fab-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(251, 157, 99, 0.35);
    --cl-modal-bg: rgba(6, 12, 10, 0.92);
    --cl-card-bg: rgba(8, 22, 14, 0.88);
    --cl-accent: #fb9d63;
    --cl-accent2: #f5575f;
    --cl-text: #d8f0e4;
    --cl-muted: rgba(180, 220, 200, 0.55);
}

#changelogNewsFab {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 10050;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 14px 18px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #0a120e;
    background: linear-gradient(135deg, #fb9d63 0%, #f5a84a 45%, #e8886a 100%);
    box-shadow: var(--cl-fab-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

#changelogNewsFab:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 200, 140, 0.5);
}

#changelogNewsFab:active {
    transform: translateY(0);
}

#changelogNewsFab .cl-fab-icon {
    font-size: 1.25rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

#changelogNewsFab .cl-fab-label {
    white-space: nowrap;
}

@media (max-width: 520px) {
    #changelogNewsFab .cl-fab-label {
        display: none;
    }

    #changelogNewsFab {
        /* Kompakt: unten rechts in die Ecke, weniger Überlappung mit P&L-Bars */
        right: max(6px, env(safe-area-inset-right));
        bottom: max(6px, env(safe-area-inset-bottom));
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0;
        gap: 0;
        justify-content: center;
        align-items: center;
        border-radius: 50%;
        font-size: 0;
        box-shadow:
            0 4px 14px rgba(0, 0, 0, 0.35),
            0 0 0 1px rgba(251, 157, 99, 0.28);
    }

    #changelogNewsFab:hover {
        transform: scale(1.05);
    }

    #changelogNewsFab .cl-fab-icon {
        font-size: 1rem;
    }
}

/* Modal */
#changelogNewsModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10060;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: rgba(2, 8, 5, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#changelogNewsModal.is-open {
    display: flex;
}

#changelogNewsModal .cl-modal-panel {
    width: 100%;
    max-width: 560px;
    max-height: min(88vh, 820px);
    margin: 0 auto max(12px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 12px 12px;
    background: var(--cl-modal-bg);
    border: 1px solid rgba(251, 157, 99, 0.28);
    box-shadow: 0 -8px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 255, 136, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: clModalUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (min-width: 600px) {
    #changelogNewsModal {
        align-items: center;
        padding: 24px;
    }
    #changelogNewsModal .cl-modal-panel {
        margin: 0;
        border-radius: 20px;
        max-height: min(85vh, 780px);
        animation: clModalIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
}

@keyframes clModalUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes clModalIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#changelogNewsModal .cl-modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid rgba(251, 157, 99, 0.12);
    background: linear-gradient(180deg, rgba(251, 157, 99, 0.08) 0%, transparent 100%);
}

#changelogNewsModal .cl-modal-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#changelogNewsModal .cl-modal-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #fff 0%, var(--cl-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#changelogNewsModal .cl-modal-sub {
    margin: 0;
    font-size: 0.75rem;
    color: var(--cl-muted);
    font-weight: 500;
}

#changelogNewsModal .cl-modal-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(251, 157, 99, 0.25);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--cl-accent);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

#changelogNewsModal .cl-modal-close:hover {
    background: rgba(251, 157, 99, 0.12);
    border-color: rgba(251, 157, 99, 0.45);
}

#changelogNewsModal .cl-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px 24px;
    -webkit-overflow-scrolling: touch;
}

#changelogNewsModal .cl-loading,
#changelogNewsModal .cl-empty,
#changelogNewsModal .cl-error {
    text-align: center;
    padding: 48px 20px;
    color: var(--cl-muted);
    font-size: 0.9rem;
}

#changelogNewsModal .cl-error {
    color: #ff8a8a;
}

#changelogNewsModal .cl-news-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#changelogNewsModal article.cl-news-card {
    background: var(--cl-card-bg);
    border: 1px solid rgba(0, 255, 136, 0.1);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#changelogNewsModal article.cl-news-card:hover {
    border-color: rgba(251, 157, 99, 0.28);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

#changelogNewsModal .cl-news-card-inner {
    padding: 16px 18px 18px;
}

#changelogNewsModal .cl-news-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

#changelogNewsModal .cl-news-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cl-accent);
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(251, 157, 99, 0.12);
    border: 1px solid rgba(251, 157, 99, 0.22);
}

#changelogNewsModal .cl-news-title {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--cl-text);
    line-height: 1.35;
    letter-spacing: -0.01em;
}

#changelogNewsModal .cl-news-img-wrap {
    margin: -16px -18px 14px;
    border-radius: 0;
    overflow: hidden;
    border-bottom: 1px solid rgba(251, 157, 99, 0.12);
    max-height: 220px;
    background: #000;
}

#changelogNewsModal .cl-news-img-wrap img {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: cover;
    display: block;
}

#changelogNewsModal .cl-news-body {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(220, 240, 228, 0.92);
    word-break: break-word;
}

#changelogNewsModal .cl-news-body a {
    color: var(--cl-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

#changelogNewsModal .cl-news-body a:hover {
    color: #ffc8a8;
}

#changelogNewsModal .cl-news-body b,
#changelogNewsModal .cl-news-body strong {
    color: #fff;
    font-weight: 700;
}

#changelogNewsModal .cl-news-body code {
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(251, 157, 99, 0.2);
}

#changelogNewsModal .cl-news-body p {
    margin: 0 0 0.75em;
}

#changelogNewsModal .cl-news-body p:last-child {
    margin-bottom: 0;
}

/* ═══ Giveaway FAB + Modal ═══ */

#giveawayFab {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 10050;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px 12px 14px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #0a120e;
    background: linear-gradient(135deg, #00ff88 0%, #00e67a 40%, #00cc6e 100%);
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.3), 0 0 0 1px rgba(0, 255, 136, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    animation: gw-fab-pulse 2.5s ease-in-out infinite;
}
#giveawayFab:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow: 0 12px 40px rgba(0, 255, 136, 0.4), 0 0 0 1px rgba(0, 255, 136, 0.6);
}
#giveawayFab:active { transform: translateY(0); }
.gw-fab-icon { font-size: 1.15rem; line-height: 1; }
.gw-fab-label { white-space: nowrap; }

@keyframes gw-fab-pulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(0,255,136,0.3), 0 0 0 1px rgba(0,255,136,0.4); }
    50% { box-shadow: 0 8px 32px rgba(0,255,136,0.5), 0 0 12px 2px rgba(0,255,136,0.25); }
}

@media (max-width: 600px) {
    #giveawayFab {
        padding: 10px 14px 10px 12px;
        font-size: 0.72rem;
        gap: 5px;
        bottom: max(12px, env(safe-area-inset-bottom));
        right: max(10px, env(safe-area-inset-right));
    }
    .gw-fab-icon { font-size: 1rem; }
}

.gw-modal-container {
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
}

.gw-modal-body {
    padding: 0 24px 24px;
}

.gw-user-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.gw-stat {
    flex: 1 1 130px;
    min-width: 0;
    background: rgba(0, 255, 136, 0.06);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
}
.gw-stat-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45);
    margin-bottom: 4px;
}
.gw-stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: #00ff88;
    font-variant-numeric: tabular-nums;
}

/* Reflink block — referral contests only, inserted between stats and visibility toggle */
.gw-reflink-block {
    margin-bottom: 16px;
    padding: 14px 16px 12px;
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.08) 0%, rgba(0, 255, 136, 0.025) 100%);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 12px;
}
.gw-reflink-block-disabled {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}
.gw-reflink-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.gw-reflink-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
}
.gw-reflink-hint {
    font-size: 0.72rem;
    color: rgba(0, 255, 136, 0.75);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.gw-reflink-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.gw-reflink-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #e7edf2;
    font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    cursor: text;
    outline: none;
    transition: border-color 0.15s;
}
.gw-reflink-input:hover,
.gw-reflink-input:focus {
    border-color: rgba(0, 255, 136, 0.45);
}
.gw-reflink-copy {
    flex-shrink: 0;
    height: 38px;
    padding: 0 18px;
    background: #00ff88;
    color: #001a0d;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    transition: all 0.15s;
    box-shadow: 0 2px 10px rgba(0, 255, 136, 0.22);
}
.gw-reflink-copy:hover {
    background: #5eead4;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 255, 136, 0.35);
}
.gw-reflink-copy:active {
    transform: translateY(0);
}
.gw-reflink-copy.is-copied {
    background: #00c66b;
    color: #fff;
}
.gw-reflink-share {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.gw-reflink-share-btn {
    flex: 1 1 130px;
    height: 34px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #e7edf2;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.gw-reflink-share-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.4);
    color: #00ff88;
    transform: translateY(-1px);
}
.gw-reflink-share-btn:active {
    transform: translateY(0);
}
.gw-reflink-share-btn.is-copied {
    background: rgba(0, 255, 136, 0.18);
    border-color: rgba(0, 255, 136, 0.55);
    color: #00ff88;
}
.gw-reflink-tip {
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.55);
}
.gw-reflink-tip a {
    color: #00ff88;
    text-decoration: none;
    font-weight: 600;
}
.gw-reflink-tip a:hover {
    text-decoration: underline;
}
.gw-reflink-disabled-msg {
    margin: 0;
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

/* Responsive — stack actions on narrow viewports */
@media (max-width: 480px) {
    .gw-reflink-row {
        flex-direction: column;
        gap: 8px;
    }
    .gw-reflink-copy {
        height: 36px;
        width: 100%;
    }
    .gw-reflink-share-btn {
        flex: 1 1 100%;
    }
}

.gw-visibility-toggle {
    margin-bottom: 16px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
}
.gw-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.7);
}
.gw-toggle-input {
    width: 36px;
    height: 18px;
    accent-color: #00ff88;
    cursor: pointer;
    flex-shrink: 0;
}

.gw-leaderboard {
    margin-bottom: 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    overflow: hidden;
}
.gw-lb-title {
    margin: 0;
    padding: 12px 16px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.gw-lb-body { padding: 0; }
.gw-lb-empty {
    text-align: center;
    padding: 20px 16px;
    color: rgba(255,255,255,0.3);
    font-size: 0.82rem;
    margin: 0;
}
.gw-lb-row {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.12s;
}
.gw-lb-row:last-child { border-bottom: none; }
.gw-lb-row:hover { background: rgba(255,255,255,0.03); }
.gw-lb-rank {
    width: 28px;
    text-align: center;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.gw-lb-rank-1 { color: #ffd700; }
.gw-lb-rank-2 { color: #c0c0c0; }
.gw-lb-rank-3 { color: #cd7f32; }
.gw-lb-name {
    flex: 1;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gw-lb-name-hidden {
    color: rgba(255,255,255,0.3);
    font-style: italic;
}
.gw-lb-vol {
    font-size: 0.82rem;
    font-weight: 700;
    color: #00ff88;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

.gw-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0;
}
.gw-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255,255,255,0.4);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.15s;
}
.gw-tab-btn:hover { color: rgba(255,255,255,0.7); }
.gw-tab-btn.is-active {
    color: #00ff88;
    border-bottom-color: #00ff88;
}

.gw-tab-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.75);
}
.gw-tab-content h2 { font-size: 1.15rem; color: #00ff88; margin: 0 0 10px; }
.gw-tab-content h3 { font-size: 0.95rem; color: #fff; margin: 16px 0 6px; }
.gw-tab-content p { margin: 0 0 10px; }
.gw-tab-content b, .gw-tab-content strong { color: #fff; }
.gw-tab-content small { color: rgba(255,255,255,0.45); }
