* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

/* ── Auto-hide site header: reveal on hover near the top ─────────────── */
.gm-site-header {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    transform: translateY(-100%);
    transition: transform 0.28s ease;
    will-change: transform;
    z-index: 1000 !important;
    pointer-events: none; /* hidden header must not block clicks on content below */
}
body.gm-header-peek .gm-site-header {
    transform: translateY(0);
    pointer-events: auto; /* interactive only while revealed */
}

:root {
    --youtube-red: #ff0000; --youtube-dark: #0f0f0f; --youtube-light: #f8f8f8;
    --youtube-gray: #606060; --success-green: #2ecc71; --warning-orange: #f39c12;
    --info-blue: #3498db; --purple: #9b59b6; --dark-bg: #0a0a0a;
    --gold: #FFD700; --silver: #C0C0C0; --bronze: #CD7F32;
}

body {
    background-color: var(--dark-bg); color: var(--youtube-light); min-height: 100vh;
    padding: 20px 6px; overflow-x: hidden;
    background-image: radial-gradient(circle at 20% 30%, rgba(255, 0, 0, 0.03) 0%, transparent 20%),
                    radial-gradient(circle at 80% 70%, rgba(46, 204, 113, 0.03) 0%, transparent 20%);
}

.container { max-width: 100%; margin: 0 auto; padding: 0 6px; }

.app-header {
    text-align: center; margin-bottom: 30px; padding: 25px;
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.1), rgba(15, 15, 15, 0.95));
    border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); backdrop-filter: blur(10px);
}

.pro-badge {
    display: inline-block; background: linear-gradient(45deg, #ff0000, #ff6b00);
    color: white; padding: 8px 20px; border-radius: 25px; font-weight: bold;
    font-size: 0.9rem; margin-bottom: 15px; animation: pulse 2s infinite;
}

@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }

h1 {
    color: white; margin-bottom: 10px; display: flex; align-items: center;
    justify-content: center; gap: 15px; font-size: 2.5rem;
    font-family: 'Montserrat', sans-serif; text-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
}

h1 i { color: var(--youtube-red); font-size: 3rem; filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.5)); }

.subtitle { color: #aaa; font-size: 1.1rem; max-width: 800px; margin: 0 auto; line-height: 1.6; }

.main-layout {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(0, 2.6fr);
    gap: 20px;
    margin-bottom: 0;
    align-items: stretch;
    height: calc(100vh - 40px);
    min-height: 0;
}
/* Every column scrolls internally so the page itself doesn't scroll */
.main-layout > .panel { height: 100%; overflow-y: auto; overflow-x: hidden; min-height: 0; }
/* Filters column: outer wrapper does not scroll so the side toggle stays visible.
   Inner .filters-panel-content handles the scroll. */
.main-layout > .filters-panel { overflow: visible !important; }
.filters-panel .filters-panel-content { height: 100%; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }

/* ─── Light-mode readability for Live Comments rail ──────────────────── */
[data-theme="light"] .comments-panel,
[data-theme="light"] .comments-panel .comments-collapsible,
[data-theme="light"] .comments-panel .comments-collapsible-content,
[data-theme="light"] .comments-panel .comments-container {
    background: #ffffff !important;
}
[data-theme="light"] .comments-panel { border: 1px solid #cdd5e8 !important; box-shadow: 0 4px 16px rgba(15,23,42,0.08) !important; }

[data-theme="light"] .comments-panel .comments-collapsible-header {
    background: linear-gradient(90deg, #f4f7ff, #eef2fc) !important;
    border-bottom: 1px solid #cdd5e8 !important;
}
[data-theme="light"] .comments-panel .comments-collapsible-header h2,
[data-theme="light"] .comments-panel .comments-collapsible-header h2 i,
[data-theme="light"] .comments-panel .comments-collapsible-header .panel-title {
    color: #0f172a !important;
}
[data-theme="light"] .comments-panel .comments-count-badge {
    background: #e94560 !important; color: #ffffff !important;
}

/* Comment card — white surface, dark text, colored left rail kept */
[data-theme="light"] .comments-panel .comment-item {
    background: #f8faff !important;
    border: 1px solid #dde4f0 !important;
    border-left: 4px solid #22c55e !important;
    box-shadow: 0 1px 3px rgba(15,23,42,0.05) !important;
}
[data-theme="light"] .comments-panel .comment-item.filtered { border-left-color: #f59e0b !important; }
[data-theme="light"] .comments-panel .comment-item.eligible { border-left-color: #22c55e !important; }
[data-theme="light"] .comments-panel .comment-item:hover {
    background: #ffffff !important;
    box-shadow: 0 3px 10px rgba(15,23,42,0.10) !important;
}

/* Inline-styled bits inside each comment — override author colour, time, body text */
[data-theme="light"] .comments-panel .comment-item strong,
[data-theme="light"] .comments-panel .comment-item strong[style*="color"] {
    color: #1d4ed8 !important;
    font-weight: 700 !important;
}
[data-theme="light"] .comments-panel .comment-item span[style*="float: right"],
[data-theme="light"] .comments-panel .comment-item span[style*="float:right"] {
    color: #64748b !important;
}
[data-theme="light"] .comments-panel .comment-item div[style*="margin-top"] {
    color: #0f172a !important;
    font-weight: 500 !important;
}
[data-theme="light"] .comments-panel .comment-item .badge {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}
[data-theme="light"] .comments-panel .empty-state p { color: #475569 !important; }
[data-theme="light"] .comments-panel .empty-state i { color: #cbd5e1 !important; }

/* ── Reply on YouTube button ─────────────────────────────────────── */
.reply-on-yt-btn {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 10px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ff0000, #c41200);
    color: #fff;
    border: none;
    border-radius: 18px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255,0,0,0.30);
    transition: all 0.15s ease;
}
.reply-on-yt-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255,0,0,0.45);
    background: linear-gradient(135deg, #ff1f1f, #d31600);
}
.reply-on-yt-btn:active { transform: translateY(0); }
.reply-on-yt-btn i { font-size: 0.85rem; }

[data-theme="light"] .reply-on-yt-btn {
    box-shadow: 0 2px 8px rgba(255,0,0,0.25);
}

/* ── Filters panel collapse → mini-rail ───────────────────────────── */
/* Wrap the filter column so we can pin the toggle outside the scrolling panel */
.filters-panel { position: relative; overflow: visible !important; z-index: 50; transition: max-width 0.25s ease, padding 0.25s ease; }
.filters-panel .filters-collapse-btn {
    position: absolute;
    top: 50%; right: 2px;
    transform: translateY(-50%);
    width: 30px; height: 60px; border-radius: 10px;
    background: #e94560;
    border: 2px solid #ffffff;
    color: #ffffff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.55);
    z-index: 60;
    transition: all 0.2s;
}
.filters-panel .filters-collapse-btn:hover { background: #c8344f; color: #fff; box-shadow: 0 6px 22px rgba(233,69,96,0.7); }
.filters-panel .filters-collapse-btn i { font-size: 0.9rem; }
[data-theme="light"] .filters-panel .filters-collapse-btn { background: #ffffff; color: #1a2035; border-color: #1a2035; }
[data-theme="light"] .filters-panel .filters-collapse-btn:hover { background: #e94560; color: #ffffff; border-color: #e94560; }
.filters-panel .filters-mini-rail { display: none; }
.filters-panel .filters-panel-content { display: block; }

/* Collapsed state — only mini-rail shows */
.filters-panel.is-collapsed { padding: 8px 0 !important; }
.filters-panel.is-collapsed .filters-panel-content { display: none; }
.filters-panel.is-collapsed .filters-mini-rail {
    display: flex; flex-direction: column; gap: 8px;
    padding: 44px 8px 8px;
    align-items: center;
}
.filters-panel.is-collapsed .filters-collapse-btn { right: 2px; }
.filters-panel.is-collapsed .filters-collapse-btn i { transform: rotate(180deg); }

.mini-rail-btn {
    width: 40px; height: 40px; border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #cbd5e1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem; transition: all 0.18s;
}
.mini-rail-btn i { color: inherit !important; }
.mini-rail-btn:hover { background: rgba(233,69,96,0.18); border-color: #e94560; color: #e94560; }

/* Light-mode mini-rail icons */
[data-theme="light"] .mini-rail-btn {
    background: #f4f7ff;
    border: 1px solid #cdd5e8;
    color: #1d4ed8;
    box-shadow: 0 1px 3px rgba(15,23,42,0.06);
}
[data-theme="light"] .mini-rail-btn i { color: #1d4ed8 !important; }
[data-theme="light"] .mini-rail-btn:hover {
    background: #e94560;
    border-color: #e94560;
    color: #ffffff;
}
[data-theme="light"] .mini-rail-btn:hover i { color: #ffffff !important; }

/* Grid uses a variable so collapsing the left column resizes the layout */
.main-layout { --filters-w: minmax(320px, 1fr); grid-template-columns: var(--filters-w) minmax(0, 2.6fr) !important; }
.main-layout:has(.filters-panel.is-collapsed) { --filters-w: 56px; }

@media (max-width: 1400px) { .main-layout { grid-template-columns: minmax(300px, 1fr) minmax(0, 2.4fr); gap: 16px; } }
@media (max-width: 1100px) {
    .main-layout { grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); height: auto; }
    .main-layout > .panel { height: auto; overflow: visible; }
}
@media (max-width: 768px)  {
    .main-layout { grid-template-columns: 1fr; height: auto; }
}

/* Right-rail Live Comments panel — fills its column, internal scroll only */
/* Live Comments now lives inside the left filter panel as a collapsible section */
.comments-panel {
    margin-bottom: 15px;
}
.comments-panel .comments-collapsible-content,
.comments-panel .comments-collapsible-content.expanded {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}
.comments-panel .comments-collapsible-content.expanded {
    max-height: 60vh;
    opacity: 1;
    padding-top: 12px;
}
.comments-panel .comments-container {
    max-height: calc(60vh - 24px);
    overflow-y: auto;
}

.panel {
    background: rgba(20, 20, 20, 0.85); border-radius: 16px; padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px); min-height: 100%;
}

.panel-title {
    font-size: 1.5rem; margin-bottom: 20px; padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1); color: white;
    display: flex; align-items: center; gap: 12px; font-family: 'Poppins', sans-serif;
}

.panel-title i { color: var(--youtube-red); }

.filter-section { margin-bottom: 25px; }
.filter-group { margin-bottom: 15px; position: relative; }

.filter-label {
    display: block; margin-bottom: 8px; font-weight: 600; color: #ddd;
    font-size: 0.95rem; display: flex; align-items: center; gap: 8px;
}

.filter-input {
    width: 100%; padding: 10px 14px; background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 10px;
    font-size: 0.95rem; color: white; transition: all 0.3s;
}

.filter-input:focus {
    outline: none; border-color: var(--info-blue); background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.filter-textarea { min-height: 80px; resize: vertical; }
.filter-hint { font-size: 0.85rem; color: #888; margin-top: 5px; display: block; }

.password-toggle {
    position: absolute; right: 10px; top: 35px; background: transparent;
    border: none; color: #aaa; cursor: pointer; padding: 5px;
    font-size: 0.9rem; transition: color 0.3s;
}

.password-toggle:hover { color: var(--info-blue); }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }

.stat-card {
    background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1); text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); }

.stat-value {
    font-size: 2.2rem; font-weight: 800; color: var(--info-blue); margin-bottom: 5px;
    font-family: 'Montserrat', sans-serif; text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.stat-label { font-size: 0.9rem; color: #aaa; font-weight: 600; }
.stat-card.total .stat-value { color: var(--info-blue) !important; }
.stat-card.eligible .stat-value { color: var(--success-green) !important; }
.stat-card.excluded .stat-value { color: var(--warning-orange) !important; }
.stat-card.winners .stat-value { color: var(--youtube-red) !important; }

.wheel-winner-settings { margin-bottom: 25px; }
.wheel-winner-collapsible { margin-bottom: 15px; }

.wheel-winner-header {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; padding: 12px 16px;
    background: linear-gradient(90deg, rgba(155, 89, 182, 0.08), rgba(255, 140, 0, 0.08));
    border-radius: 12px; margin-bottom: 0; border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.wheel-winner-header:hover {
    background: linear-gradient(90deg, rgba(155, 89, 182, 0.12), rgba(255, 140, 0, 0.12));
    transform: translateY(-2px);
}

.wheel-winner-header h3 {
    margin: 0; font-size: 1.1rem; color: white;
    display: flex; align-items: center; gap: 10px;
}

.wheel-winner-content {
    max-height: 0; overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease; opacity: 0;
}

.wheel-winner-content.expanded { max-height: 350px; opacity: 1; padding-top: 15px; }

.api-collapsible { margin-bottom: 20px; }

.api-collapsible-header {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; padding: 14px 18px;
    background: linear-gradient(90deg, rgba(255, 0, 0, 0.08), rgba(52, 152, 219, 0.08));
    border-radius: 12px; margin-bottom: 0; border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.api-collapsible-header:hover {
    background: linear-gradient(90deg, rgba(255, 0, 0, 0.12), rgba(52, 152, 219, 0.12));
    transform: translateY(-2px);
}

.api-collapsible-header h3 {
    margin: 0; font-size: 1.1rem; color: white;
    display: flex; align-items: center; gap: 10px;
}

.api-collapsible-content {
    max-height: 0; overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease; opacity: 0;
}

.api-collapsible-content.expanded { max-height: 400px; opacity: 1; padding-top: 20px; }

.api-config-section {
    background: rgba(255, 255, 255, 0.03); border-radius: 12px; padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.config-group { margin-bottom: 18px; position: relative; }

.config-group label {
    display: block; margin-bottom: 8px; font-weight: 600; color: #ddd;
    font-size: 0.95rem; display: flex; align-items: center; gap: 8px;
}

.config-input {
    width: 100%; padding: 12px 16px; background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 10px;
    font-size: 0.95rem; color: white; transition: all 0.3s;
}

.config-input:focus {
    outline: none; border-color: var(--youtube-red); background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

.api-status {
    display: flex; align-items: center; gap: 10px; padding: 10px 18px;
    border-radius: 10px; font-weight: 600; margin-top: 15px;
    justify-content: center; font-size: 0.9rem;
}

.status-connected { background: rgba(46, 204, 113, 0.15); color: var(--success-green); border: 1px solid rgba(46, 204, 113, 0.3); }
.status-disconnected { background: rgba(231, 76, 60, 0.15); color: #e74c3c; border: 1px solid rgba(231, 76, 60, 0.3); }
.status-fetching { background: rgba(52, 152, 219, 0.15); color: var(--info-blue); border: 1px solid rgba(52, 152, 219, 0.3); }

.button-group { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.btn {
    padding: 12px 20px; border: none; border-radius: 10px; font-size: 0.95rem;
    font-weight: 600; cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 8px; transition: all 0.3s ease;
    min-width: 120px; font-family: 'Poppins', sans-serif;
}

.btn-primary {
    background: linear-gradient(45deg, var(--youtube-red), #ff3333);
    color: white; box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(45deg, #cc0000, #ff0000);
    transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 0, 0, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1); color: #ddd;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2); transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(45deg, var(--success-green), #27ae60);
    color: white; box-shadow: 0 4px 12px rgba(46, 204, 113, 0.25);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(45deg, #27ae60, #219a52); transform: translateY(-2px);
}

.btn-spin {
    background: linear-gradient(45deg, var(--purple), #8e44ad);
    color: white; box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

.btn-spin:hover:not(:disabled) {
    background: linear-gradient(45deg, #8e44ad, #9b59b6); transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4);
}

.btn-shuffle {
    background: linear-gradient(45deg, #FF8C00, #FFA500);
    color: white; box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.btn-shuffle:hover:not(:disabled) {
    background: linear-gradient(45deg, #FF7F00, #FF8C00); transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.4);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.wheel-section { margin-top: 30px; }
.wheel-container {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #ff9a00, var(--youtube-red));
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.6);
}

.wheel-pointer {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 0;
    height: 0;
}

.wheel-pointer::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-top: 40px solid #FF0000;
    filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.8));
    transform: translateX(-50%);
}

.wheel-controls {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.progress-container {
    margin-top: 20px;
}

.progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9a00, var(--youtube-red));
    border-radius: 6px;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    opacity: 0.8;
}

.winner-name {
    background: linear-gradient(90deg, #ff9a00, var(--youtube-red));
    padding: 10px 25px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(255, 0, 128, 0.4);
    animation: pulse 2s infinite;
}

.slot-machine-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.98); z-index: 2000; justify-content: center;
    align-items: center; flex-direction: column;
}

.slot-machine-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); border-radius: 25px;
    padding: 40px; width: 95%; max-width: 1200px; border: 4px solid var(--youtube-red);
    box-shadow: 0 0 60px rgba(255, 0, 0, 0.4), 0 0 120px rgba(255, 0, 0, 0.2),
    inset 0 0 30px rgba(255, 255, 255, 0.1); position: relative; overflow: hidden;
}

.slot-machine-container::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
    animation: slotShine 4s linear infinite;
}

@keyframes slotShine { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.slot-machine-title {
    font-size: 3rem; font-weight: 900; color: white; text-align: center; margin-bottom: 30px;
    text-shadow: 0 0 20px var(--youtube-red), 0 0 40px rgba(255, 0, 0, 0.5);
    display: flex; align-items: center; justify-content: center; gap: 20px;
    font-family: 'Montserrat', sans-serif;
}

.slot-machine-title i { color: var(--gold); animation: spin 1s linear infinite; filter: drop-shadow(0 0 15px var(--gold)); }

.slot-machine {
    display: flex; align-items: center; justify-content: center; gap: 20px;
    margin: 40px 0; padding: 40px; background: rgba(0, 0, 0, 0.6);
    border-radius: 20px; border: 3px solid rgba(255, 255, 255, 0.15);
    position: relative; height: 220px; overflow: visible;
}

.reel-container {
    width: 220px; height: 180px; position: relative; overflow: hidden; border-radius: 15px;
    border: 4px solid #333; background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9), 0 8px 25px rgba(0, 0, 0, 0.7);
    perspective: 500px;
}

.reel-container::before, .reel-container::after {
    content: ''; position: absolute; left: 0; right: 0; height: 40px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15) 0%, transparent 100%);
    z-index: 3; pointer-events: none;
}

.reel-container::before { top: 0; }
.reel-container::after {
    bottom: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
}

.reel-content { position: absolute; width: 100%; top: 0; transition: transform 0.1s linear; will-change: transform; }

.reel-item {
    height: 90px; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; font-weight: 800; color: white; text-shadow: 0 0 10px currentColor;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1); padding: 0 20px;
    background: rgba(255, 255, 255, 0.05); transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

.reel-item.current {
    background: rgba(255, 215, 0, 0.2); color: var(--gold); font-size: 2rem;
    transform: scale(1.05); z-index: 2; position: relative;
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.3), 0 0 30px rgba(255, 215, 0, 0.4);
}

.reel-content.spinning .reel-item { animation: reelBlur 0.5s linear infinite; }
@keyframes reelBlur { 0% { filter: blur(0px); opacity: 1; } 50% { filter: blur(2px); opacity: 0.8; } 100% { filter: blur(0px); opacity: 1; } }

.reel-content.accelerating { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.reel-content.decelerating { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }

#reelContainer1 .reel-item { color: #FF416C; border-left: 4px solid #FF416C; }
#reelContainer2 .reel-item { color: #36D1DC; border-left: 4px solid #36D1DC; }
#reelContainer3 .reel-item { color: #A8FF78; border-left: 4px solid #A8FF78; }

.winner-reel-container {
    border-color: var(--gold); box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.2),
    0 8px 30px rgba(255, 215, 0, 0.3), 0 0 50px rgba(255, 215, 0, 0.2);
}

.winner-reel-container::before {
    content: ''; position: absolute; top: -4px; left: -4px; right: -4px; bottom: -4px;
    background: linear-gradient(45deg, var(--gold), #FF8C00, var(--gold), #FF8C00);
    border-radius: 19px; z-index: -1; animation: borderGlow 2s linear infinite; filter: blur(5px);
}

.winner-reel-container .reel-item {
    color: var(--gold); background: rgba(255, 215, 0, 0.1); font-size: 2.2rem; font-weight: 900;
}

.slot-separator {
    font-size: 5rem; color: var(--gold); font-weight: 900; margin: 0 20px;
    text-shadow: 0 0 20px var(--gold), 0 0 40px rgba(255, 215, 0, 0.5); animation: pulse 1.5s infinite;
}

.slot-machine-controls { margin-top: 40px; text-align: center; }
.slot-machine-progress { margin-bottom: 30px; }

.slot-progress-bar {
    width: 100%; height: 25px; background: rgba(255, 255, 255, 0.1);
    border-radius: 12px; overflow: hidden; margin-bottom: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2); box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.slot-progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--youtube-red), #FF8C00, var(--gold));
    width: 0%; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 12px;
    position: relative; overflow: hidden;
}

.slot-progress-fill::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: progressShine 2s infinite;
}

@keyframes progressShine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.slot-progress-text { color: #ddd; font-size: 1.1rem; text-align: center; font-weight: 600; text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); }

.slot-machine-message {
    background: rgba(255, 255, 255, 0.08); padding: 20px; border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.15); color: #eee; font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center; gap: 15px;
    animation: messagePulse 2s infinite; font-family: 'Poppins', sans-serif;
}

@keyframes messagePulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.2); border-color: rgba(255, 255, 255, 0.15); }
    50% { box-shadow: 0 0 40px rgba(255, 0, 0, 0.4); border-color: rgba(255, 255, 255, 0.3); }
}

.reel-content.stopping { animation: dramaticStop 1.5s cubic-bezier(0.36, 0, 0.66, -0.56) forwards; }
@keyframes dramaticStop {
    0% { transform: translateY(0); } 20% { transform: translateY(-10px); }
    40% { transform: translateY(5px); } 60% { transform: translateY(-3px); }
    80% { transform: translateY(1px); } 100% { transform: translateY(0); }
}

.comment-item {
    padding: 15px; margin-bottom: 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid transparent; animation: fadeIn 0.4s ease; position: relative;
}

.comment-item.live { border-left-color: var(--youtube-red); }
.comment-item.filtered { border-left-color: var(--warning-orange); opacity: 0.7; }
.comment-item.eligible { border-left-color: var(--success-green); }

.copy-username-btn {
    position: absolute; top: 15px; right: 15px; background: rgba(52, 152, 219, 0.2);
    border: 1px solid rgba(52, 152, 219, 0.3); color: var(--info-blue); border-radius: 6px;
    padding: 4px 8px; font-size: 0.8rem; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 5px; z-index: 5;
}

.copy-username-btn:hover { background: rgba(52, 152, 219, 0.3); transform: scale(1.05); }
.copy-username-btn.copied { background: rgba(46, 204, 113, 0.2); border-color: rgba(46, 204, 113, 0.3); color: var(--success-green); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.winners-table-section { margin-top: 30px; }

/* Winners History header — title + Add Manual Winner button on one row */
.winners-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 2px solid rgba(255,255,255,0.10);
}
.winners-header .panel-title { white-space: nowrap; }
[data-theme="light"] .winners-header { border-bottom-color: #cdd5e8; }
@media (max-width: 600px) {
    .winners-header { flex-direction: column; align-items: stretch; }
    .winners-header #addManualWinnerBtn { width: 100%; }
}

/* ════════════════════════════════════════════════════════════════════
   WINNERS HISTORY — Card-style redesign (works in both light & dark)
   The existing markup is a <table>; we restyle it to behave like a
   stack of winner cards similar to the Live Comments rail.
   ════════════════════════════════════════════════════════════════════ */
.winners-table-container {
    overflow-x: hidden !important;
    border-radius: 14px !important;
    border: none !important;
    background: transparent !important;
    padding: 4px;
}
.winners-table {
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 10px !important;
    display: block;
}
.winners-table caption { display: none; }
.winners-table thead { display: none; }
.winners-table tbody { display: block; }

/* Each winner row becomes a card */
.winners-table tbody tr {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1.1fr) minmax(0, 2fr) 70px 80px minmax(180px, auto) !important;
    gap: 12px;
    align-items: center;
    padding: 14px 16px !important;
    border-radius: 12px !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
    border-left: 4px solid #94a3b8 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
}
.winners-table tbody tr:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.07) !important;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35) !important;
}

/* Wheel winners — gold accent; Comment winners — cyan accent */
.winners-table tbody tr.wheel-winner-row { border-left-color: #facc15 !important; background: rgba(250,204,21,0.06) !important; }
.winners-table tbody tr.comment-winner-row { border-left-color: #38bdf8 !important; }

.winners-table td {
    padding: 0 !important;
    border: none !important;
    color: #e8e8f0 !important;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* # column → circular index badge */
.winners-table td:nth-child(1) {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e94560, #c23150);
    color: #fff !important;
    font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(233,69,96,0.45);
}
.winners-table tbody tr.wheel-winner-row td:nth-child(1) {
    background: linear-gradient(135deg, #facc15, #f59e0b);
    box-shadow: 0 2px 8px rgba(245,158,11,0.45);
    color: #422006 !important;
}

/* Username */
.winners-table td:nth-child(2) {
    font-weight: 700 !important;
    color: #4FC3F7 !important;
    font-size: 0.95rem;
}

/* Comment text */
.winners-table td:nth-child(3) {
    color: #cbd5e1 !important;
    font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Round */
.winners-table td:nth-child(4) {
    color: #94a3b8 !important;
    font-size: 0.8rem;
    text-align: center;
}
.winners-table td:nth-child(4)::before { content: "R"; opacity: 0.6; margin-right: 2px; }

/* Type badge column */
.winners-table td:nth-child(5) { text-align: center; }
.winners-table td:nth-child(5) .badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 28px;
    border-radius: 14px;
    padding: 0 12px;
    background: rgba(255,255,255,0.10) !important;
    color: #fff !important;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.15) !important;
}
.winners-table td:nth-child(5) .wheel-winner-badge {
    background: rgba(250,204,21,0.18) !important;
    color: #facc15 !important;
    border-color: rgba(250,204,21,0.5) !important;
}

/* Actions */
.winners-table td:nth-child(6) {
    display: inline-flex; gap: 6px; justify-content: flex-end;
}
.winners-table td:nth-child(6) .action-btn {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #e8e8f0;
    cursor: pointer;
    transition: all 0.15s;
}
.winners-table td:nth-child(6) .edit-btn:hover { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.winners-table td:nth-child(6) .delete-btn { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.4); color: #fca5a5; }
.winners-table td:nth-child(6) .delete-btn:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

/* Separator rows */
.winners-table tbody tr:has(td[colspan]) {
    display: block !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 6px 0 !important;
}
.winners-table tbody tr:has(td[colspan]):hover { transform: none; background: transparent !important; }
.winners-table tbody tr td[colspan] {
    text-align: center !important;
    color: #94a3b8 !important;
    font-size: 0.78rem !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    position: relative;
    padding: 8px 16px !important;
}
.winners-table tbody tr td[colspan]::before,
.winners-table tbody tr td[colspan]::after {
    content: "";
    display: inline-block;
    width: 40px; height: 1px;
    background: rgba(255,255,255,0.15);
    vertical-align: middle;
    margin: 0 12px;
}

/* ──── LIGHT THEME ──── */
[data-theme="light"] .winners-table tbody tr {
    background: #f8faff !important;
    border: 1px solid #dde4f0 !important;
    border-left: 4px solid #94a3b8 !important;
    box-shadow: 0 1px 3px rgba(15,23,42,0.06) !important;
}
[data-theme="light"] .winners-table tbody tr:hover {
    background: #ffffff !important;
    box-shadow: 0 4px 14px rgba(15,23,42,0.10) !important;
}
[data-theme="light"] .winners-table tbody tr.wheel-winner-row {
    background: linear-gradient(90deg, #fffbeb 0%, #f8faff 60%) !important;
    border-left-color: #f59e0b !important;
}
[data-theme="light"] .winners-table tbody tr.comment-winner-row {
    border-left-color: #0284c7 !important;
}
[data-theme="light"] .winners-table td { color: #0f172a !important; }
[data-theme="light"] .winners-table td:nth-child(2) { color: #1d4ed8 !important; }
[data-theme="light"] .winners-table td:nth-child(3) { color: #1e293b !important; }
[data-theme="light"] .winners-table td:nth-child(4) { color: #64748b !important; }
[data-theme="light"] .winners-table td:nth-child(5) .badge {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}
[data-theme="light"] .winners-table td:nth-child(5) .wheel-winner-badge {
    background: #fef3c7 !important;
    color: #92400e !important;
    border-color: #fcd34d !important;
}
[data-theme="light"] .winners-table td:nth-child(6) .action-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(15,23,42,0.05);
}
[data-theme="light"] .winners-table td:nth-child(6) .edit-btn:hover { background: #2563eb; color: #fff; border-color: #2563eb; }
[data-theme="light"] .winners-table td:nth-child(6) .delete-btn {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}
[data-theme="light"] .winners-table td:nth-child(6) .delete-btn:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
[data-theme="light"] .winners-table tbody tr td[colspan] { color: #475569 !important; }
[data-theme="light"] .winners-table tbody tr td[colspan]::before,
[data-theme="light"] .winners-table tbody tr td[colspan]::after { background: #cbd5e1; }

/* Responsive — collapse to 2-row layout on narrow viewports */
@media (max-width: 900px) {
    .winners-table tbody tr {
        grid-template-columns: 44px 1fr auto !important;
        grid-template-rows: auto auto !important;
        row-gap: 8px;
    }
    .winners-table td:nth-child(1) { grid-row: 1 / span 2; }
    .winners-table td:nth-child(2) { grid-column: 2; grid-row: 1; }
    .winners-table td:nth-child(3) {
        grid-column: 2 / -1; grid-row: 2;
        white-space: normal; line-height: 1.5;
    }
    .winners-table td:nth-child(4),
    .winners-table td:nth-child(5) { grid-column: 3; grid-row: 1; }
    .winners-table td:nth-child(6) { grid-column: 2 / -1; grid-row: 3; justify-content: flex-start; flex-wrap: wrap; }
}
.winners-table-container { overflow-x: auto; margin-top: 20px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.03); }

.winners-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.winners-table th {
    background: rgba(255, 255, 255, 0.07); padding: 15px; text-align: left;
    font-weight: 600; color: white; border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    font-family: 'Poppins', sans-serif;
}

.winners-table td { padding: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: #ddd; }
.winners-table tr:hover { background: rgba(255, 255, 255, 0.03); }

.action-btn {
    padding: 6px 12px; border-radius: 6px; font-size: 0.85rem; cursor: pointer;
    border: none; transition: all 0.2s; display: inline-flex; align-items: center; gap: 5px;
}

.delete-btn { background: rgba(231, 76, 60, 0.2); color: #e74c3c; border: 1px solid rgba(231, 76, 60, 0.3); }
.delete-btn:hover { background: rgba(231, 76, 60, 0.3); }
.reveal-btn { background: rgba(52, 152, 219, 0.2); color: var(--info-blue); border: 1px solid rgba(52, 152, 219, 0.3); }
.reveal-btn:hover { background: rgba(52, 152, 219, 0.3); }
.hidden-winner { font-family: monospace; letter-spacing: 2px; color: #888; }

.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95); z-index: 1000; justify-content: center; align-items: center;
}

.modal-content {
    background: color-mix(in srgb, var(--dark-bg), #0000ff  15%);
    border-radius: clamp(15px, 3vw, 25px);
    padding: clamp(20px, 5vw, 50px);
    max-width: min(950px, 90vw);
    width: 80%;
    max-height: 90vh;
    overflow-y: auto;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 100px rgba(255, 0, 0, 0.3);
    text-align: center;
    margin: 0 auto;
    z-index: 10011 !important;
}

.modal-title {
    font-size: 2.8rem; color: #ffffff !important; margin-bottom: 30px; font-family: 'Montserrat', sans-serif;
    text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 2px 10px rgba(255, 0, 0, 0.5), 0 4px 20px rgba(255, 0, 0, 0.3);
}

.modal-winner {
    font-size: 4rem; font-weight: 900; color: #4ade80 !important; margin: 40px 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 2px 15px rgba(46, 204, 113, 0.5), 0 4px 30px rgba(46, 204, 113, 0.3);
    font-family: 'Montserrat', sans-serif; animation: winnerGlow 2s infinite alternate;
}

/* Winner modal background is always dark — force readable text in both themes */
.modal-content .round-info,
.modal-content .round-label { color: #cbd5e1; }
[data-theme="light"] .modal-title { color: #ffffff !important; }
[data-theme="light"] .modal-winner { color: #4ade80 !important; }
[data-theme="light"] .modal-comment { color: #e2e8f0 !important; background: rgba(255,255,255,0.08) !important; }
[data-theme="light"] .modal-content .round-info,
[data-theme="light"] .modal-content .round-label { color: #cbd5e1 !important; }

@keyframes winnerGlow {
    0% { text-shadow: 0 2px 15px rgba(46, 204, 113, 0.5), 0 4px 30px rgba(46, 204, 113, 0.3); }
    100% { text-shadow: 0 2px 25px rgba(46, 204, 113, 0.7), 0 6px 40px rgba(46, 204, 113, 0.5), 0 0 60px rgba(46, 204, 113, 0.3); }
}

.modal-comment {
    color: #aaa; font-style: italic; margin: 30px 0; padding: 25px;
    background: rgba(255, 255, 255, 0.05); border-radius: 15px; font-size: 1.1rem; line-height: 1.6;
}

.countdown-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.98); z-index: 2000; justify-content: center;
    align-items: center; flex-direction: column;
}

.countdown-number {
    font-size: 18rem; font-weight: 900; color: var(--youtube-red); position: absolute;
    text-shadow: 0 0 40px rgba(255, 0, 0, 0.9), 0 0 80px rgba(255, 0, 0, 0.7),
    0 0 120px rgba(255, 0, 0, 0.5); animation: countdownPop 1s ease-out forwards;
    opacity: 0; transform: scale(0.5); font-family: 'Montserrat', sans-serif;
}

@keyframes countdownPop {
    0% { opacity: 0; transform: scale(0.5) rotate(-20deg); filter: blur(30px); }
    20% { opacity: 1; transform: scale(1.3) rotate(5deg); filter: blur(0); }
    40% { opacity: 1; transform: scale(1) rotate(0); filter: blur(0); }
    80% { opacity: 1; transform: scale(1) rotate(0); filter: blur(0); }
    100% { opacity: 0; transform: scale(0.5) rotate(20deg); filter: blur(30px); }
}

.countdown-text {
    font-size: 4rem; color: white; margin-top: 2rem;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.5), 0 4px 20px rgba(255, 255, 255, 0.3);
    animation: pulse 1s infinite; font-family: 'Montserrat', sans-serif;
}

@media (max-width: 768px) {
    .main-layout { gap: 20px; } .panel { padding: 20px; }
    .wheel-container { width: 320px; height: 320px; }
    .wheel-pointer { font-size: 50px; top: -15px; }
    .slot-machine { flex-wrap: wrap; height: auto; padding: 20px; gap: 15px; }
    .reel-container { width: 150px; height: 140px; } .reel-item { height: 70px; font-size: 1.4rem; }
    .winner-reel-container .reel-item { font-size: 1.6rem; }
    .slot-separator { font-size: 3rem; margin: 10px 0; }
    .slot-machine-title { font-size: 2rem; }
    .countdown-number { font-size: 10rem; } .countdown-text { font-size: 2.5rem; }
    h1 { font-size: 2rem; flex-direction: column; gap: 10px; }
    .button-group { flex-direction: column; } .btn { width: 100%; }
    .stats-grid { grid-template-columns: 1fr; }
    .modal-winner { font-size: 2.5rem; } .modal-title { font-size: 2rem; }
}

.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.3); border-radius: 50%; border-top-color: var(--info-blue); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; margin-left: 10px; }
.badge-live { background: rgba(255, 0, 0, 0.2); color: var(--youtube-red); }
.badge-winner { background: rgba(46, 204, 113, 0.2); color: var(--success-green); }
.badge-filtered { background: rgba(243, 156, 18, 0.2); color: var(--warning-orange); }

.toggle-icon i { transition: transform 0.3s ease; }
.api-collapsible-header.expanded .toggle-icon i, .wheel-winner-header.expanded .toggle-icon i { transform: rotate(45deg); }

.toast {
    position: fixed; bottom: 20px; right: 20px; background: rgba(46, 204, 113, 0.95);
    color: white; padding: 15px 30px; border-radius: 12px; z-index: 1001;
    transform: translateY(100px); opacity: 0; transition: all 0.4s ease;
    font-family: 'Poppins', sans-serif; font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 30px rgba(46, 204, 113, 0.3);
}

.toast.show { transform: translateY(0); opacity: 1; }

.app-footer { display: none !important; }

/* Winners History moved to its own full-width panel below the main layout */
.winners-history-panel {
    margin: 16px 6px 24px;
    padding: 16px 20px;
}

.empty-state { text-align: center; padding: 60px 20px; color: #666; }
.empty-state i { font-size: 4rem; color: rgba(255, 255, 255, 0.1); margin-bottom: 20px; }
.empty-state p { font-size: 1.2rem; color: #888; font-family: 'Poppins', sans-serif; }

.comment-item .copy-username-btn,
.winners-table .copy-winner-btn {
    display: none !important;
}

.comment-item {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.comment-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.comment-item:active {
    transform: translateY(0);
}

.winners-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.winners-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.winners-table .action-btn {
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.badge,
.badge-live,
.badge-winner,
.badge-filtered,
.comment-item .badge,
.winners-table .badge,
.winners-table td span {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ddd !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.wheel-winner-row {
    background: linear-gradient(90deg,
        rgba(155, 89, 182, 0.08) 0%,
        rgba(155, 89, 182, 0.03) 50%,
        rgba(155, 89, 182, 0.08) 100%) !important;
    border-left: 4px solid var(--purple) !important;
    position: relative;
    animation: wheelWinnerPulse 3s ease;
}

.wheel-winner-badge {
    background: linear-gradient(45deg, var(--purple), #8e44ad) !important;
    color: white !important;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3) !important;
}

.wheel-winner-badge i {
    animation: spin 2s linear infinite;
    font-size: 0.9rem;
}

@keyframes wheelWinnerPulse {
    0% { background: rgba(155, 89, 182, 0.2); }
    50% { background: rgba(155, 89, 182, 0.1); }
    100% { background: linear-gradient(90deg,
        rgba(155, 89, 182, 0.08) 0%,
        rgba(155, 89, 182, 0.03) 50%,
        rgba(155, 89, 182, 0.08) 100%); }
}

.wheel-winner-row td:nth-child(2)::before {
    content: '📡';
    margin-right: 8px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.wheel-winner-row:hover {
    background: linear-gradient(90deg,
        rgba(155, 89, 182, 0.15) 0%,
        rgba(155, 89, 182, 0.08) 50%,
        rgba(155, 89, 182, 0.15) 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.2);
}

.wheel-winner-row {
    background: rgba(46, 204, 113, 0.15) !important;
    border-left: 4px solid var(--success-green) !important;
}

.wheel-winner-row:hover {
    background: rgba(46, 204, 113, 0.25) !important;
}

.wheel-winner-badge {
    background: rgba(46, 204, 113, 0.25) !important;
    color: var(--success-green) !important;
    border: 1px solid rgba(46, 204, 113, 0.4) !important;
}

.comment-winner-row {
}

.wheel-container {
    width: 100% !important;
    height: 100% !important;
    max-width: 800px !important;
    margin: 0 auto;
}

#wheelCanvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 1000px !important;
    max-height: 1000px !important;
}

.data-management-panel {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.data-management-panel .panel-title {
    border-bottom: 2px solid rgba(255, 100, 100, 0.5);
}

.btn-warning {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.btn-warning:hover:not(:disabled) {
    background: linear-gradient(45deg, #e67e22, #d35400);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(45deg, #c0392b, #a93226);
    transform: translateY(-2px);
}

.eligible-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.eligible-users-table th {
    background: rgba(46, 204, 113, 0.2);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #2ecc71;
    border-bottom: 2px solid rgba(46, 204, 113, 0.3);
}

.eligible-users-table td {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.eligible-users-table tbody tr:hover {
    background: rgba(46, 204, 113, 0.05);
}

.eligible-users-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

#wheelCanvas {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.wheel-container {
    background: transparent !important;
    border: none !important;
}

.wheel-collapsible {
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(30, 30, 40, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wheel-collapsible-header {
    background: rgba(52, 152, 219, 0.3);
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.wheel-collapsible-header:hover {
    background: rgba(52, 152, 219, 0.4);
}

.wheel-collapsible-header.expanded {
    background: rgba(52, 152, 219, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wheel-collapsible-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
}

.wheel-collapsible-content.expanded {
    padding: 20px;
    max-height: 500px;
}

.wheel-collapsible-content .button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

#addAllToWheelBtn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    border: none;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(155, 89, 182, 0.3);
}

#addAllToWheelBtn:hover:not(:disabled) {
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

#addAllToWheelBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

#addAllToWheelBtn i {
    margin-right: 5px;
}

.wheel-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 70vh;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wheel-logo-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 4px solid #FF0000;
    pointer-events: none;
}

.wheel-logo-center img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
}

#wheelCanvas {
    position: relative;
    z-index: 10;
}

.panel-title-with-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.header-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid #FF0000;
}

#roundWinnerOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#roundWinnerOverlay.active {
    opacity: 1;
    pointer-events: all;
}

.round-winner-container {
    width: 600px;
    height: 600px;
    position: relative;
}

.round-winner-content {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e, #0c0c1a);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    border: 3px solid #FFD700;
    box-shadow:
        0 0 60px rgba(255, 215, 0, 0.5),
        inset 0 0 40px rgba(255, 215, 0, 0.2);
    animation: roundPulse 2s infinite alternate;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    z-index: 1;
}

@keyframes roundPulse {
    0% {
        box-shadow:
            0 0 60px rgba(255, 215, 0, 0.5),
            inset 0 0 40px rgba(255, 215, 0, 0.2);
        transform: scale(1);
    }
    100% {
        box-shadow:
            0 0 100px rgba(255, 215, 0, 0.8),
            inset 0 0 60px rgba(255, 215, 0, 0.3);
        transform: scale(1.02);
    }
}

.round-winner-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        transparent,
        rgba(255, 215, 0, 0.3),
        transparent 30%
    );
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

.round-winner-icon {
    font-size: 6rem;
    color: #00ff00;
    margin-bottom: 20px;
    animation: starGlow 1.5s infinite alternate;
}

@keyframes starGlow {
    0% {
        transform: scale(1);
        text-shadow: 0 0 10px #FFD700;
    }
    100% {
        transform: scale(1.2);
        text-shadow: 0 0 30px #FFD700, 0 0 40px #FFD700;
    }
}

.round-winner-title {
    color: #4FC3F7;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

.round-winner-name {
    color: #FFD700;
    font-size: 2.2rem;
    font-weight: 800;
    margin: 10px 0;
    text-shadow: 0 0 20px #FFD700;
    word-break: break-word;
    max-width: 90%;
}

.round-winner-comment {
    color: #ddd;
    font-size: 1rem;
    margin: 10px 0;
    max-height: 80px;
    overflow-y: auto;
    padding: 0 10px;
    font-style: italic;
}

.round-winner-round {
    color: #2ecc71;
    font-size: 1.1rem;
    margin-top: 10px;
    font-weight: 600;
}

.close-round-winner-btn {
    margin-top: 25px;
    padding: 10px 25px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.close-round-winner-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.wheel-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 500px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent !important;
}

#wheelCanvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    background: transparent !important;
    border: none !important;
    box-shadow:
        0 0 40px rgba(255, 0, 0, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.5) !important;
    transition: all 0.5s ease;
    position: relative;
    z-index: 10;
}

.wheel-center-logo .logo-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.logo-fallback i {
    font-size: 40px;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.logo-upload-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 30;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    gap: 10px;
    align-items: center;
}

.wheel-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.wheel-pointer::before {
    content: '▼';
    font-size: 50px;
    color: #ff0000;
    text-shadow:
        0 0 20px rgba(255, 0, 0, 0.9),
        0 0 40px rgba(255, 0, 0, 0.6);
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.5));
    animation: pointerGlow 1.5s infinite alternate;
}

.wheel-container {
    z-index: 1;
}

#wheelCanvas {
    z-index: 10;
}

.wheel-center-logo img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 20;
    pointer-events: none;
}

.wheel-pointer {
    z-index: 30;
}

.wheel-confetti {
    z-index: 40;
}

.wheel-container > * {
    position: absolute;
}

.api-collapsible,
.filter-collapsible,
.wheel-winner-collapsible {
    border-radius: 8px;
    margin-bottom: 15px;
    background: var(--card-bg, #2a2a3a);
    overflow: hidden;
    transition: all 0.3s ease;
}

.api-collapsible-header,
.filter-collapsible-header,
.wheel-winner-header {
    padding: 15px 20px;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    border: none;
    width: 100%;
    text-align: left;
}

.api-collapsible-header:hover,
.filter-collapsible-header:hover,
.data-collapsible-header:hover,
.logo-collapsible-header:hover,
.comments-collapsible-header:hover,
.wheel-winner-header:hover {
    background: var(--primary-dark, #3a5bef);
}

.api-collapsible-content,
.filter-collapsible-content,
.wheel-winner-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 0 20px;
}

.api-collapsible-content.expanded,
.filter-collapsible-content.expanded,
.wheel-winner-content.expanded {
    max-height: 1000px;
    opacity: 1;
    padding: 20px;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.api-collapsible-header[aria-expanded="true"] .toggle-icon,
.filter-collapsible-header[aria-expanded="true"] .toggle-icon,
.wheel-winner-header[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.api-collapsible-content .api-config-section,
.filter-collapsible-content .filter-section,
.wheel-winner-content .filter-section {
    padding: 0;
}

.panel {
    height: auto !important;
    min-height: fit-content;
    display: flex;
    flex-direction: column;
}

.comments-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.comments-container {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 500px;
}

.wheel-section {
    height: auto;
    min-height: fit-content;
}

.wheel-container {
    height: 300px;
    position: relative;
}

.winners-table-section {
    height: auto;
    min-height: 400px;
}

.winners-table-container {
    max-height: auto;
    overflow-y: auto;
}

.data-management-panel {
    height: auto;
    min-height: fit-content;
}

@media (max-width: 1200px) {
    .api-collapsible-content.expanded,
    .filter-collapsible-content.expanded,
    .wheel-winner-content.expanded {
        max-height: 1500px;
    }

    .comments-container {
        max-height: 600px;
    }
}

@media (max-width: 768px) {
    .api-collapsible-content,
    .api-collapsible-content,
    .filter-collapsible-content,
    .wheel-winner-content {
        padding: 0 15px;
    }

    .api-collapsible-content.expanded,
    .filter-collapsible-content.expanded,
    .wheel-winner-content.expanded {
        padding: 15px;
    }

    .comments-container {
        max-height: 600px;
    }
}
.main-layout > .panel {
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.main-layout {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(0, 2.6fr);
    gap: 20px;
    margin-bottom: 0;
    align-items: stretch;
    height: calc(100vh - 40px);
    min-height: 0;
}

.api-collapsible-content:not(.expanded),
.filter-collapsible-content:not(.expanded),
.wheel-winner-content:not(.expanded) {
    max-height: 0 !important;
    opacity: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.api-config-section,
.filter-section,
.wheel-winner-content .filter-section {
    height: auto !important;
}

.comments-section {
    height: auto;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.comments-container {
    height: auto;
    min-height: 200px;
    max-height: 700px;
    flex-shrink: 0;
}

/* Comments section inside the filter panel — capped, internally scrollable */
.comments-panel .comments-container {
    height: auto !important;
    max-height: calc(60vh - 24px) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
}

.wheel-section {
    height: auto;
    min-height: fit-content;
}

@media (max-width: 1100px) {
    .main-layout {
        grid-template-columns: 1fr 1.6fr;
        height: auto;
        align-items: start;
    }
    .main-layout > .panel { height: auto !important; overflow: visible !important; }
    .main-layout > .comments-panel { grid-column: 1 / -1; height: 60vh !important; overflow: hidden !important; }
}
@media (max-width: 768px) {
    .main-layout { grid-template-columns: 1fr; }
    .main-layout > .comments-panel { grid-column: auto; }
}

.data-management-panel {
    height: auto;
    min-height: fit-content;
}

.logo-collapsible {
    border-radius: 8px;
    margin-bottom: 15px;
    background: var(--card-bg, #2a2a3a);
    overflow: hidden;
    transition: all 0.3s ease;
}

.logo-collapsible-header {
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.08), rgba(155, 89, 182, 0.08));
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
    text-align: left;
    border-radius: 12px;
    margin-bottom: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
}

.logo-collapsible-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 0 20px;
}

.logo-collapsible-content.expanded {
    max-height: 200px;
    opacity: 1;
    padding: 20px;
}

.logo-collapsible-header[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.logo-collapsible-header.expanded .toggle-icon i {
    transform: rotate(45deg);
}

.logo-collapsible-content.expanded {
    padding-top: 15px;
}

.logo-config-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .logo-collapsible-content {
        padding: 0 15px;
    }

    .logo-collapsible-content.expanded {
        padding: 15px;
        max-height: 220px;
    }
}

.api-collapsible-header .toggle-icon i,
.filter-collapsible-header .toggle-icon i,
.wheel-winner-header .toggle-icon i,
.logo-collapsible-header .toggle-icon i {
    transition: transform 0.3s ease;
}

.api-collapsible-header.expanded .toggle-icon i,
.filter-collapsible-header.expanded .toggle-icon i,
.wheel-winner-header.expanded .toggle-icon i,
.logo-collapsible-header.expanded .toggle-icon i {
    transform: rotate(45deg);
}

.comments-collapsible {
    border-radius: 8px;
    margin-bottom: 15px;
    background: var(--card-bg, #2a2a3a);
    overflow: hidden;
    transition: all 0.3s ease;
}

.comments-collapsible-header {
    padding: 12px 16px;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.08), rgba(46, 204, 113, 0.08));
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
    text-align: left;
    border-radius: 12px;
    margin-bottom: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.comments-collapsible-header:hover {
    background: linear-gradient(45deg, #cc0000, #ff0000);
    transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 0, 0, 0.35);
}

.comments-collapsible-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comments-collapsible-header h2 i {
    color: #3498db;
}

.comments-collapsible-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 0;
}

.comments-collapsible-content.expanded {
    max-height: 600px;
    opacity: 1;
    padding-top: 15px;
}

.comments-collapsible-content .comments-container {
    height: 600px;
    max-height: 600px;
    min-height: 200px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    background: rgba(10, 10, 10, 0.6);
}

.comments-collapsible-header[aria-expanded="true"] .toggle-icon i,
.comments-collapsible-header.expanded .toggle-icon i {
    transform: rotate(45deg);
}

.comments-count-badge {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    margin-left: 10px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .comments-collapsible-content.expanded {
        max-height: 400px;
    }

    .comments-collapsible-content .comments-container {
        height: 300px;
        max-height: 300px;
    }
}

.data-collapsible {
    border-radius: 8px;
    margin-bottom: 15px;
    background: var(--card-bg, #2a2a3a);
    overflow: hidden;
    transition: all 0.3s ease;
}

.data-collapsible-header {
    padding: 12px 16px;
    background: linear-gradient(90deg, rgba(155, 89, 182, 0.08), rgba(231, 76, 60, 0.08));
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
    text-align: left;
    border-radius: 12px;
    margin-bottom: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.data-collapsible-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-collapsible-header h2 i {
    color: #e74c3c;
}

.data-collapsible-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 0;
}

.data-collapsible-content.expanded {
    max-height: 500px;
    opacity: 1;
    padding-top: 15px;
}

.data-collapsible-content .data-management-panel {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 12px;
    padding: 20px;
}

.data-collapsible-content .stats-grid {
    margin-bottom: 20px;
}

.data-collapsible-content .button-group {
    margin-top: 20px;
    margin-bottom: 20px;
}

.data-collapsible-header[aria-expanded="true"] .toggle-icon i,
.data-collapsible-header.expanded .toggle-icon i {
    transform: rotate(45deg);
}

.data-collapsible-content .data-info {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 15px;
}

.data-collapsible-content .data-info p {
    margin: 0;
    color: #aaa;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .data-collapsible-content.expanded {
        max-height: 600px;
    }

    .data-collapsible-content .data-management-panel {
        padding: 15px;
    }

    .data-collapsible-content .button-group {
        flex-direction: column;
    }

    .data-collapsible-content .button-group .btn {
        width: 100%;
    }
}

#eligibleUsersOverlay.modal-overlay {
    background: radial-gradient(
        ellipse at 20% 30%,
        rgba(30, 25, 45, 0.97) 0%,
        rgba(15, 12, 25, 0.99) 70%,
        #050510 100%
    ) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

#eligibleUsersOverlay.modal-overlay::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at 100% 0%,
        rgba(46, 204, 113, 0.08) 0%,
        transparent 50%
    );
    pointer-events: none;
    z-index: 9998;
}

#eligibleUsersOverlay.modal-overlay::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at 0% 100%,
        rgba(155, 89, 182, 0.06) 0%,
        transparent 50%
    );
    pointer-events: none;
    z-index: 9998;
}

#eligibleUsersOverlay .modal-content {
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow:
        0 30px 50px -20px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 0 30px rgba(46, 204, 113, 0.2) !important;
    border-radius: 28px !important;
}

#eligibleUsersOverlay .modal-header {
    background: rgba(35, 45, 65, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-top-left-radius: 28px !important;
    border-top-right-radius: 28px !important;
}

#eligibleUsersOverlay .eligible-count {
    background: rgba(46, 204, 113, 0.15) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(46, 204, 113, 0.3) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

#eligibleUsersOverlay .eligible-count i {
    color: #2ecc71 !important;
    filter: drop-shadow(0 0 8px rgba(46, 204, 113, 0.5)) !important;
}

#eligibleUsersOverlay .eligible-count span {
    color: white !important;
    font-weight: 700 !important;
}

#eligibleUsersOverlay #addAllToWheelBtn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3) !important;
    backdrop-filter: blur(8px) !important;
}

#eligibleUsersOverlay #addAllToWheelBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #8e44ad, #7d3c98) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4) !important;
}

#eligibleUsersOverlay #addPageToWheelBtn {
    background: linear-gradient(45deg, #3498db, #2980b9) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3) !important;
    backdrop-filter: blur(8px) !important;
}

#eligibleUsersOverlay #addPageToWheelBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #2980b9, #1f6a9a) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4) !important;
}

#eligibleUsersOverlay #closeEligibleOverlay {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ddd !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: none !important;
    backdrop-filter: blur(8px) !important;
}

#eligibleUsersOverlay #closeEligibleOverlay:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    transform: translateY(-2px);
}

#eligibleUsersOverlay .filter-info {
    background: rgba(30, 40, 55, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 16px 32px !important;
}

#eligibleUsersOverlay .filter-info-item {
    background: rgba(46, 204, 113, 0.08) !important;
    border: 1px solid rgba(46, 204, 113, 0.15) !important;
    border-radius: 40px !important;
    padding: 8px 20px !important;
}

#eligibleUsersOverlay .filter-info-item i {
    color: #2ecc71 !important;
}

#eligibleUsersOverlay .eligible-users-table th {
    background: rgba(46, 204, 113, 0.12) !important;
    color: #2ecc71 !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    font-size: 0.8rem !important;
    border-bottom: 2px solid rgba(46, 204, 113, 0.3) !important;
    padding: 16px 15px !important;
}

#eligibleUsersOverlay .eligible-users-table tbody {
    border-spacing: 0 6px !important;
    border-collapse: separate !important;
}

#eligibleUsersOverlay .eligible-users-table tbody tr {
    border-radius: 60px !important;
    margin-bottom: 4px !important;
    position: relative !important;
    overflow: hidden !important;
    border-style: hidden !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

#eligibleUsersOverlay .eligible-users-table tbody tr td {
    position: relative !important;
    border-bottom: none !important;
    border-top: none !important;
    padding: 14px 15px !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

#eligibleUsersOverlay .eligible-users-table tbody tr td:first-child {
    border-top-left-radius: 60px !important;
    border-bottom-left-radius: 60px !important;
    padding-left: 20px !important;
}

#eligibleUsersOverlay .eligible-users-table tbody tr td:last-child {
    border-top-right-radius: 60px !important;
    border-bottom-right-radius: 60px !important;
    padding-right: 20px !important;
}

#eligibleUsersOverlay .eligible-users-table tbody tr:hover td {
    background: rgba(46, 204, 113, 0.08) !important;
    backdrop-filter: blur(4px) !important;
}

#eligibleUsersOverlay .eligible-users-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

#eligibleUsersOverlay .eligible-users-table tbody tr:nth-child(even):hover td {
    background: rgba(46, 204, 113, 0.08);
}

#eligibleUsersOverlay .eligible-users-table td:last-child {
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
}

#eligibleUsersOverlay .eligible-users-table td:last-child::before {
    content: "●";
    margin-right: 8px;
    color: #2ecc71;
    font-size: 0.9rem;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.8);
    animation: pulse 2s infinite;
}

#eligibleUsersOverlay .eligible-users-table td:first-child {
    color: #2ecc71 !important;
    font-weight: 600 !important;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.3) !important;
}

#eligibleUsersOverlay .modal-footer {
    background: rgba(20, 30, 45, 0.7) !important;
    backdrop-filter: blur(12px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    border-bottom-left-radius: 28px !important;
    border-bottom-right-radius: 28px !important;
}

#eligibleUsersOverlay .modal-footer i {
    color: #2ecc71 !important;
    filter: drop-shadow(0 0 8px rgba(46, 204, 113, 0.5)) !important;
}

#eligibleUsersOverlay .eligible-users-container::-webkit-scrollbar {
    width: 6px;
}

#eligibleUsersOverlay .eligible-users-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03) !important;
    border-radius: 10px;
}

#eligibleUsersOverlay .eligible-users-container::-webkit-scrollbar-thumb {
    background: rgba(46, 204, 113, 0.3) !important;
    border-radius: 10px;
}

#eligibleUsersOverlay .eligible-users-container::-webkit-scrollbar-thumb:hover {
    background: rgba(46, 204, 113, 0.5) !important;
}

@keyframes glassFadeIn {
    0% { opacity: 0; backdrop-filter: blur(4px); transform: scale(0.98); }
    100% { opacity: 1; backdrop-filter: blur(12px); transform: scale(1); }
}

#eligibleUsersOverlay.modal-overlay:not([hidden]) {
    animation: glassFadeIn 0.3s ease-out !important;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#eligibleUsersOverlay.loading .modal-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.06),
        transparent
    );
    animation: shimmer 1.5s infinite;
    pointer-events: none;
    border-radius: inherit;
}

@media (max-width: 768px) {
    #eligibleUsersOverlay .modal-content {
        border-radius: 24px !important;
    }

    #eligibleUsersOverlay .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 20px !important;
    }

    #eligibleUsersOverlay .modal-header-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    #eligibleUsersOverlay .btn {
        flex: 1;
        justify-content: center;
        padding: 10px 16px !important;
    }

    #eligibleUsersOverlay .eligible-users-container {
        padding: 15px 20px !important;
    }

    #eligibleUsersOverlay .filter-info {
        padding: 16px 20px !important;
        flex-wrap: wrap;
    }

    #eligibleUsersOverlay .filter-info-item {
        width: 100%;
        justify-content: center;
    }

    #eligibleUsersOverlay .eligible-users-table tbody tr td:first-child {
        border-top-left-radius: 40px !important;
        border-bottom-left-radius: 40px !important;
    }

    #eligibleUsersOverlay .eligible-users-table tbody tr td:last-child {
        border-top-right-radius: 40px !important;
        border-bottom-right-radius: 40px !important;
    }

    #eligibleUsersOverlay .eligible-users-table tbody tr {
        border-radius: 40px !important;
    }
}

#eligibleUsersOverlay .eligible-users-container {
    height: 400px !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

#eligibleUsersOverlay .eligible-users-table {
    table-layout: fixed !important;
    width: 100% !important;
    border-collapse: collapse;
}

#eligibleUsersOverlay .eligible-users-table th:nth-child(1) {
    width: 8% !important;
}
#eligibleUsersOverlay .eligible-users-table th:nth-child(2) {
    width: 22% !important;
}
#eligibleUsersOverlay .eligible-users-table th:nth-child(3) {
    width: 50% !important;
}
#eligibleUsersOverlay .eligible-users-table th:nth-child(4) {
    width: 10% !important;
}
#eligibleUsersOverlay .eligible-users-table th:nth-child(5) {
    width: 10% !important;
}

#eligibleUsersOverlay .eligible-users-table tr {
    height: 60px !important;
    max-height: 60px !important;
}

#eligibleUsersOverlay .eligible-users-table td {
    height: 60px !important;
    max-height: 60px !important;
    padding: 8px 10px !important;
    vertical-align: middle !important;
    line-height: 1.4 !important;
    overflow: hidden !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#eligibleUsersOverlay .eligible-users-table td:nth-child(2) {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-weight: 700;
    color: #f8f8f8;
}

#eligibleUsersOverlay .eligible-users-table td:nth-child(3) {
    white-space: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    color: #ddd;
    scrollbar-width: thin !important;
    -webkit-overflow-scrolling: touch !important;
}

#eligibleUsersOverlay .eligible-users-table td:nth-child(4) {
    white-space: nowrap !important;
    color: #888;
    font-size: 0.85rem;
}

#eligibleUsersOverlay .eligible-users-table td:nth-child(5) {
    text-align: center !important;
    white-space: nowrap !important;
}

#eligibleUsersOverlay .eligible-users-table td:nth-child(3)::-webkit-scrollbar {
    height: 4px !important;
}

#eligibleUsersOverlay .eligible-users-table td:nth-child(3)::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1) !important;
    border-radius: 4px !important;
}

#eligibleUsersOverlay .eligible-users-table td:nth-child(3)::-webkit-scrollbar-thumb {
    background: rgba(79, 195, 247, 0.5) !important;
    border-radius: 4px !important;
}

#eligibleUsersOverlay .eligible-users-table td:nth-child(3)::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 195, 247, 0.8) !important;
}

@media screen and (max-width: 768px) {
    #eligibleUsersOverlay .eligible-users-table th:nth-child(1) { width: 10% !important; }
    #eligibleUsersOverlay .eligible-users-table th:nth-child(2) { width: 25% !important; }
    #eligibleUsersOverlay .eligible-users-table th:nth-child(3) { width: 40% !important; }
    #eligibleUsersOverlay .eligible-users-table th:nth-child(4) { width: 15% !important; }
    #eligibleUsersOverlay .eligible-users-table th:nth-child(5) { width: 10% !important; }
}

.comment-cell-truncate {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* ===========================================================
   Eligible Users overlay — compact desktop redesign
   Goal: reclaim vertical space from header/filter/footer so
   more user rows are visible. Applies on wider screens only;
   the ≤768px card-list redesign below is untouched.
   =========================================================== */
@media (min-width: 769px) {
    /* Make the modal a flex column that fills the viewport, so the
       list area can grow and show as many rows as fit. */
    #eligibleUsersOverlay .modal-content {
        max-width: min(1100px, 94vw) !important;
        width: 94% !important;
        height: 92vh !important;
        max-height: 92vh !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* Compact, single-row header */
    #eligibleUsersOverlay .modal-header {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        padding: 12px 20px !important;
        flex: 0 0 auto !important;
    }
    #eligibleUsersOverlay .modal-header h2 { margin: 0 !important; }
    #eligibleUsersOverlay .eligible-count {
        font-size: 1.05rem !important;
        padding: 6px 14px !important;
        border-radius: 30px !important;
        white-space: nowrap !important;
    }

    /* Compact button row */
    #eligibleUsersOverlay .modal-header-controls {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    #eligibleUsersOverlay .modal-header-controls .btn {
        padding: 8px 14px !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
        white-space: nowrap !important;
        gap: 6px !important;
    }
    #eligibleUsersOverlay .modal-header-controls .btn i { font-size: 0.85rem !important; }

    /* Slim filter bar */
    #eligibleUsersOverlay .filter-info {
        padding: 8px 20px !important;
        flex: 0 0 auto !important;
    }
    #eligibleUsersOverlay .filter-info-item {
        padding: 5px 16px !important;
        font-size: 0.85rem !important;
    }

    /* Let the list grow to fill remaining height instead of a fixed 400px */
    #eligibleUsersOverlay .eligible-users-container {
        flex: 1 1 auto !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        padding: 0 20px !important;
        border-radius: 0 !important;
        background: rgba(0, 0, 0, 0.15) !important;
    }

    /* Sticky header row so columns stay labelled while scrolling */
    #eligibleUsersOverlay .eligible-users-table thead th {
        position: sticky !important;
        top: 0 !important;
        z-index: 2 !important;
        padding: 10px 12px !important;
    }

    /* Shorter rows = more rows on screen */
    #eligibleUsersOverlay .eligible-users-table tr,
    #eligibleUsersOverlay .eligible-users-table td {
        height: 44px !important;
        max-height: 44px !important;
    }
    #eligibleUsersOverlay .eligible-users-table td {
        padding: 6px 12px !important;
    }

    /* Slim footer + pagination */
    #eligibleUsersOverlay .modal-footer {
        padding: 8px 20px !important;
        font-size: 0.8rem !important;
        flex: 0 0 auto !important;
    }
    #eligibleUsersOverlay .pagination-container {
        flex: 0 0 auto !important;
        padding: 8px 20px !important;
    }
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(46, 204, 113, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    font-weight: 500;
    pointer-events: none;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: rgba(231, 76, 60, 0.95);
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE TAB BAR — Stage 1
   Bottom nav for mobile; hidden on tablet/desktop.
   ═══════════════════════════════════════════════════════════════════════ */
.mobile-tabbar { display: none; }

@media (max-width: 768px) {
    .mobile-tabbar {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 9000;
        background: rgba(10, 10, 10, 0.96);
        backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .mobile-tab {
        background: transparent;
        border: none;
        color: #9aa3b2;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 2px;
        cursor: pointer;
        font-size: 0.68rem;
        font-weight: 600;
        border-radius: 10px;
        transition: color 0.15s, background 0.15s;
        min-height: 52px;
    }
    .mobile-tab i { font-size: 1.15rem; }
    .mobile-tab.is-active {
        color: #ff3b5c;
        background: rgba(233, 69, 96, 0.12);
    }
    .mobile-tab:active { background: rgba(255, 255, 255, 0.05); }
    [data-theme="light"] .mobile-tabbar {
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid #cdd5e8;
        box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.12);
    }
    [data-theme="light"] .mobile-tab { color: #64748b; }
    [data-theme="light"] .mobile-tab.is-active { color: #e94560; background: rgba(233, 69, 96, 0.10); }
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE LAYOUT — Stage 1
   ≤768px: single column, only active tab visible, full-width content.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    body {
        padding: 8px 0 78px;
    }
    .container { padding: 0 10px; }

    /* Force single column, kill desktop grid sizing */
    .main-layout {
        display: block !important;
        grid-template-columns: none !important;
        height: auto !important;
        gap: 0 !important;
        margin-bottom: 0;
    }
    .main-layout > .panel,
    .main-layout > [data-mobile-container="true"] {
        display: block !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        grid-column: auto !important;
        margin-bottom: 14px;
        padding: 12px !important;
        border-radius: 14px;
        min-height: 0 !important;
    }

    /* Hide desktop-only filter chrome on mobile */
    .filters-panel .filters-collapse-btn,
    .filters-panel .filters-mini-rail {
        display: none !important;
    }
    .filters-panel.is-collapsed .filters-panel-content {
        display: block !important;
    }
    .filters-panel.is-collapsed {
        padding: 12px !important;
    }
    .filters-panel .filters-panel-content {
        height: auto !important;
        overflow: visible !important;
        padding-right: 0 !important;
    }

    /* Comments panel — sized for the comments tab, not constrained */
    .comments-panel {
        max-height: none !important;
        height: auto !important;
        padding: 12px !important;
    }
    .comments-panel .comments-collapsible-content,
    .comments-panel .comments-collapsible-content.expanded {
        max-height: none !important;
    }
    .comments-panel .comments-container {
        max-height: calc(100vh - 220px) !important;
        min-height: 50vh;
    }

    /* ─── Tab-driven visibility ─── */
    /* Hide every tagged section by default; show only the one whose tab matches body[data-active-tab]. */
    body[data-active-tab="picker"]   [data-mobile-tab]:not([data-mobile-tab="picker"]),
    body[data-active-tab="wheel"]    [data-mobile-tab]:not([data-mobile-tab="wheel"]),
    body[data-active-tab="winners"]  [data-mobile-tab]:not([data-mobile-tab="winners"]),
    body[data-active-tab="comments"] [data-mobile-tab]:not([data-mobile-tab="comments"]),
    body[data-active-tab="settings"] [data-mobile-tab]:not([data-mobile-tab="settings"]) {
        display: none !important;
    }

    /* Hide parent containers that have NO visible child for the active tab.
       Filters panel: shown when picker or settings active (it holds both).
       Middle panel: shown when wheel or winners active.
       Comments panel: shown when comments active (handled by its own data-mobile-tab). */
    body[data-active-tab="wheel"] #filtersPanel,
    body[data-active-tab="winners"] #filtersPanel {
        display: none !important;
    }
    body[data-active-tab="picker"] .main-layout > .panel[aria-label="Wheel and Winners"],
    body[data-active-tab="settings"] .main-layout > .panel[aria-label="Wheel and Winners"],
    body[data-active-tab="comments"] .main-layout > .panel[aria-label="Wheel and Winners"] {
        display: none !important;
    }

    /* Hide app footer on mobile to free space (tab bar replaces it visually) */
    .app-footer { display: none !important; }

    /* Touch-friendly sizing */
    .btn {
        min-height: 44px;
        font-size: 0.92rem;
    }
    .filter-input, .config-input {
        font-size: 16px !important; /* prevent iOS zoom on focus */
        min-height: 44px;
    }
    .button-group {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .button-group .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    /* Stats grid — keep 2-col but tighten */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin: 14px 0 !important;
    }
    .stat-card { padding: 12px 8px !important; }
    .stat-value { font-size: 1.7rem !important; }
    .stat-label { font-size: 0.78rem !important; }

    /* Wheel canvas — keep square, fit width */
    .wheel-container {
        width: 100% !important;
        max-width: 100% !important;
    }
    #wheelCanvas {
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
    }

    /* Winners table — horizontal scroll inside its container */
    .winners-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .winners-table { min-width: 560px; font-size: 0.85rem; }

    /* Panel titles a touch smaller */
    .panel-title { font-size: 1.2rem !important; padding-bottom: 10px !important; margin-bottom: 14px !important; }

    /* Override the inline @media (max-width: 1200px) rule that adds margin-bottom: 20px */
    .panel { margin-bottom: 14px; }
}

@media (max-width: 420px) {
    .mobile-tab span { font-size: 0.62rem; }
    .mobile-tab i { font-size: 1.05rem; }
    .button-group .btn { flex: 1 1 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   STAGE 2 — VISUAL POLISH
   Modernized spacing, type, cards, buttons, tab bar. Additive only:
   no existing rules edited; brand colors and animations untouched.
   ═══════════════════════════════════════════════════════════════════════ */

/* — Design tokens — */
:root {
    --gm-radius-sm: 8px;
    --gm-radius-md: 12px;
    --gm-radius-lg: 16px;
    --gm-radius-pill: 999px;
    --gm-border: rgba(255, 255, 255, 0.08);
    --gm-border-strong: rgba(255, 255, 255, 0.14);
    --gm-surface-1: rgba(22, 22, 28, 0.78);
    --gm-surface-2: rgba(30, 30, 38, 0.6);
    --gm-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --gm-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --gm-shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.45);
    --gm-accent: #e94560;
    --gm-accent-soft: rgba(233, 69, 96, 0.14);
    --gm-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* — Panel cards: refined surfaces — */
.panel {
    background: var(--gm-surface-1);
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius-lg);
    box-shadow: var(--gm-shadow-md);
    padding: 18px;
}
[data-theme="light"] .panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

/* — Buttons: softer corners, smoother motion, subtle ring on focus — */
.btn {
    border-radius: var(--gm-radius-md);
    letter-spacing: 0.01em;
    transition: transform 0.18s var(--gm-ease),
                box-shadow 0.18s var(--gm-ease),
                background 0.18s var(--gm-ease),
                filter 0.18s var(--gm-ease);
    will-change: transform;
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.35), var(--gm-shadow-sm);
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.985); }

/* — Stat cards: accent bar + crisper text — */
.stat-card {
    position: relative;
    background: var(--gm-surface-2);
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius-md);
    overflow: hidden;
    transition: transform 0.18s var(--gm-ease), box-shadow 0.18s var(--gm-ease), border-color 0.18s var(--gm-ease);
}
.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    opacity: 0.55;
}
.stat-card.total    { color: var(--info-blue); }
.stat-card.eligible { color: var(--success-green); }
.stat-card.excluded { color: var(--warning-orange); }
.stat-card.winners  { color: var(--youtube-red); }
.stat-card:hover {
    border-color: var(--gm-border-strong);
    box-shadow: var(--gm-shadow-md);
}
.stat-value { letter-spacing: -0.02em; }
[data-theme="light"] .stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* — Filter inputs: cleaner radius, focus ring — */
.filter-input, .config-input {
    border-radius: var(--gm-radius-sm);
    transition: border-color 0.16s var(--gm-ease), background 0.16s var(--gm-ease), box-shadow 0.16s var(--gm-ease);
}
.filter-input:focus, .config-input:focus {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.18);
}

/* — Collapsible headers: tighter rhythm, subtle hover lift — */
.filter-collapsible-header,
.api-collapsible-header,
.logo-collapsible-header,
.data-collapsible-header,
.wheel-winner-header,
.comments-collapsible-header {
    border-radius: var(--gm-radius-md);
    transition: background 0.18s var(--gm-ease), transform 0.18s var(--gm-ease);
}

/* — Comment items: polished spacing, refined left rail — */
.comment-item {
    border-radius: var(--gm-radius-md);
    border: 1px solid var(--gm-border);
    transition: transform 0.18s var(--gm-ease), box-shadow 0.18s var(--gm-ease), background 0.18s var(--gm-ease);
}
.comment-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--gm-shadow-sm);
}

/* — Empty states: more breathing room, softer color — */
.empty-state {
    padding: 28px 16px;
    color: #94a3b8;
}
.empty-state i {
    opacity: 0.35;
    margin-bottom: 10px;
}
[data-theme="light"] .empty-state { color: #64748b; }

/* — Wheel controls / button group: consistent gap — */
.wheel-controls, .button-group { gap: 10px; }

/* — Winners header: nicer alignment — */
.winners-header {
    gap: 12px;
}

/* — Mobile tab bar polish: active pill indicator, smoother transitions — */
@media (max-width: 768px) {
    .mobile-tabbar {
        padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
        border-top-left-radius: var(--gm-radius-lg);
        border-top-right-radius: var(--gm-radius-lg);
        gap: 2px;
    }
    .mobile-tab {
        position: relative;
        transition: color 0.18s var(--gm-ease), background 0.18s var(--gm-ease), transform 0.18s var(--gm-ease);
    }
    .mobile-tab::before {
        content: "";
        position: absolute;
        top: 4px;
        left: 50%;
        width: 28px; height: 3px;
        background: var(--gm-accent);
        border-radius: var(--gm-radius-pill);
        transform: translateX(-50%) scaleX(0);
        transform-origin: center;
        transition: transform 0.22s var(--gm-ease);
    }
    .mobile-tab.is-active::before { transform: translateX(-50%) scaleX(1); }
    .mobile-tab.is-active i { transform: translateY(-1px); transition: transform 0.18s var(--gm-ease); }
    .mobile-tab span { letter-spacing: 0.02em; }

    /* Tighter, cleaner panels on mobile */
    .main-layout > .panel,
    .main-layout > [data-mobile-container="true"] {
        padding: 14px !important;
        border-radius: var(--gm-radius-lg) !important;
        box-shadow: var(--gm-shadow-sm) !important;
    }

    /* Buttons full-width feel on mobile groups */
    .button-group { gap: 8px; }
    .btn {
        border-radius: 10px;
        padding: 12px 16px;
    }

    /* Stat values slightly smaller on phones for balance */
    .stat-value { font-size: 1.6rem !important; }
    .stat-card { padding: 12px 10px !important; }

    /* Panel titles aligned with new scale */
    .panel-title {
        font-size: 1.15rem !important;
        font-weight: 700;
        border-bottom-color: var(--gm-border);
    }

    /* Comments container — better mobile spacing */
    .comments-container { padding: 8px !important; }
    .comment-item { margin-bottom: 8px; }
}

/* — Reduced motion: disable transforms/animations gracefully — */
@media (prefers-reduced-motion: reduce) {
    .btn, .stat-card, .comment-item, .mobile-tab, .mobile-tab::before {
        transition: none !important;
        animation: none !important;
    }
    .btn:hover:not(:disabled),
    .btn:active:not(:disabled),
    .comment-item:hover {
        transform: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   STAGE 3 — TABLET & DESKTOP REFINEMENT
   Polished gutters, balanced columns, refined scrollbars, ultra-wide cap.
   Additive only. Mobile (≤768px) unaffected.
   ═══════════════════════════════════════════════════════════════════════ */

/* — Wide screens: use full viewport width — */
@media (min-width: 1600px) {
    .container { max-width: 100%; padding: 0 6px; }
    .main-layout { gap: 24px; }
}

/* — Large desktop (1401–1599px): refined gutters — */
@media (min-width: 1401px) and (max-width: 1599px) {
    .container { padding: 0 24px; }
    .main-layout { gap: 22px; }
}

/* — Wheel sizing on desktop (≥1101px): keep wheel square and fit within viewport — */
@media (min-width: 1101px) {
    .wheel-container {
        width: 100% !important;
        max-width: min(1000px, calc(100vh - 120px)) !important;
        aspect-ratio: 1 / 1;
        height: auto !important;
        margin: 0 auto;
    }
    #wheelCanvas {
        width: 100% !important;
        height: 100% !important;
        aspect-ratio: 1 / 1 !important;
        object-fit: contain !important;
    }
    .wheel-section { margin-top: 6px; }
    .wheel-center-logo img { width: 28%; height: 28%; }

    /* Make the wheel panel fill its column; pin the status bar to the bottom */
    .main-layout > .panel[aria-label="Wheel and Winners"] {
        display: flex;
        flex-direction: column;
    }
    .panel[aria-label="Wheel and Winners"] .wheel-section {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    /* Wheel sits in a flexible area and grows to fill the vertical space */
    .panel[aria-label="Wheel and Winners"] .wheel-container {
        flex: 1 1 auto;
        height: auto !important;
        max-width: none !important;
        max-height: 100% !important;
        width: auto !important;
        aspect-ratio: 1 / 1;
        align-self: center;
        margin: 0 auto;
    }
    .panel[aria-label="Wheel and Winners"] .progress-container {
        margin-top: auto;
        flex-shrink: 0;
    }

    /* Compact icon-only wheel control buttons — maximize wheel space */
    .wheel-section .wheel-controls,
    .panel .wheel-section .wheel-controls {
        display: flex !important;
        justify-content: center !important;
        gap: 12px !important;
        flex-wrap: nowrap !important;
        margin: 4px 0 8px !important;
        margin-top: 4px !important;
    }
    .wheel-section .wheel-controls .btn,
    .panel .wheel-section .wheel-controls .btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        max-width: 44px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        position: relative;
    }
    .wheel-section .wheel-controls .btn i,
    .panel .wheel-section .wheel-controls .btn i {
        font-size: 1.05rem !important;
        margin: 0 !important;
    }
    .wheel-section .wheel-controls .btn .btn-label,
    .panel .wheel-section .wheel-controls .btn .btn-label {
        display: none !important;
    }
    /* Hover tooltip via the title attribute — small label above the icon */
    .wheel-section .wheel-controls .btn::after {
        content: attr(title);
        position: absolute;
        bottom: calc(100% + 6px);
        left: 50%;
        transform: translateX(-50%);
        background: rgba(15, 14, 23, 0.95);
        color: #fff;
        font-size: 0.72rem;
        font-weight: 600;
        padding: 4px 8px;
        border-radius: 6px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 50;
    }
    .wheel-section .wheel-controls .btn:hover::after { opacity: 1; }

    /* Compact icon-only filter-panel action buttons — match wheel controls */
    .filter-actions-compact {
        display: flex !important;
        justify-content: center !important;
        gap: 12px !important;
        flex-wrap: nowrap !important;
    }
    .filter-actions-compact .btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        max-width: 44px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        position: relative;
    }
    .filter-actions-compact .btn i {
        font-size: 1.05rem !important;
        margin: 0 !important;
    }
    .filter-actions-compact .btn .btn-label { display: none !important; }
    .filter-actions-compact .btn::after {
        content: attr(title);
        position: absolute;
        bottom: calc(100% + 6px);
        left: 50%;
        transform: translateX(-50%);
        background: rgba(15, 14, 23, 0.95);
        color: #fff;
        font-size: 0.72rem;
        font-weight: 600;
        padding: 4px 8px;
        border-radius: 6px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 50;
    }
    .filter-actions-compact .btn:hover::after { opacity: 1; }

    /* Kill the empty spacer div that pads above the wheel */
    .wheel-section > .config-group[style*="margin-bottom: 25px"],
    .wheel-section > .config-group[style*="margin-bottom:25px"] {
        margin-bottom: 0 !important;
        display: none;
    }
}

/* — Small desktop (1101–1400px): give middle column the wheel needs more breathing room — */
@media (min-width: 1101px) and (max-width: 1400px) {
    body { padding: 16px; }
    .container { padding: 0 12px; }
    .main-layout {
        grid-template-columns: minmax(240px, 0.95fr) minmax(0, 2.15fr) minmax(280px, 1fr) !important;
        gap: 16px;
    }
    .wheel-container {
        width: 100% !important;
        max-width: 460px !important;
        aspect-ratio: 1 / 1;
        height: auto !important;
    }
    #wheelCanvas { width: 100% !important; height: 100% !important; }
    .panel-title { font-size: 1.35rem; }
}

/* — Tablet (769–1100px): 2-column layout, comments below — refined — */
@media (min-width: 769px) and (max-width: 1100px) {
    body { padding: 14px; }
    .container { padding: 0 10px; }
    .main-layout {
        grid-template-columns: minmax(260px, 1fr) minmax(0, 1.6fr) !important;
        gap: 14px !important;
    }
    .main-layout > .panel {
        padding: 16px !important;
    }
    /* Comments panel: full-width below, capped height with internal scroll */
    .main-layout > .comments-panel {
        grid-column: 1 / -1 !important;
        max-height: 55vh !important;
        height: 55vh !important;
    }
    .comments-panel .comments-container {
        max-height: calc(55vh - 80px) !important;
    }
    /* Wheel: scale down so it fits the middle column on tablet */
    .wheel-container {
        width: 100% !important;
        max-width: 420px !important;
        aspect-ratio: 1 / 1;
        height: auto !important;
        margin: 0 auto;
    }
    #wheelCanvas { width: 100% !important; height: 100% !important; }
    /* Wheel controls wrap nicely */
    .wheel-controls {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .wheel-controls .btn { flex: 1 1 calc(50% - 5px); min-width: 0; }
    /* Stats grid tighter */
    .stats-grid { gap: 10px !important; }
    .stat-value { font-size: 1.8rem !important; }
    /* Winners table: horizontal scroll cleanly */
    .winners-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Filter panel mini-rail/collapse button hidden on tablet too — there's no need for it at this width */
    .filters-panel .filters-collapse-btn { display: none !important; }
    .filters-panel.is-collapsed .filters-panel-content { display: block !important; }
    .filters-panel.is-collapsed .filters-mini-rail { display: none !important; }
    .filters-panel.is-collapsed { padding: 16px !important; }
    .panel-title { font-size: 1.2rem; }
}

/* — Refined scrollbars for tablet/desktop (skip mobile to keep native feel) — */
@media (min-width: 769px) {
    .filters-panel-content,
    .comments-container,
    .winners-table-container,
    .main-layout > .panel {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
    }
    .filters-panel-content::-webkit-scrollbar,
    .comments-container::-webkit-scrollbar,
    .winners-table-container::-webkit-scrollbar,
    .main-layout > .panel::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    .filters-panel-content::-webkit-scrollbar-track,
    .comments-container::-webkit-scrollbar-track,
    .winners-table-container::-webkit-scrollbar-track,
    .main-layout > .panel::-webkit-scrollbar-track {
        background: transparent;
    }
    .filters-panel-content::-webkit-scrollbar-thumb,
    .comments-container::-webkit-scrollbar-thumb,
    .winners-table-container::-webkit-scrollbar-thumb,
    .main-layout > .panel::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.16);
        border-radius: var(--gm-radius-pill);
        transition: background 0.18s var(--gm-ease);
    }
    .filters-panel-content::-webkit-scrollbar-thumb:hover,
    .comments-container::-webkit-scrollbar-thumb:hover,
    .winners-table-container::-webkit-scrollbar-thumb:hover,
    .main-layout > .panel::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.28);
    }
    [data-theme="light"] .filters-panel-content,
    [data-theme="light"] .comments-container,
    [data-theme="light"] .winners-table-container,
    [data-theme="light"] .main-layout > .panel {
        scrollbar-color: rgba(15, 23, 42, 0.22) transparent;
    }
    [data-theme="light"] .filters-panel-content::-webkit-scrollbar-thumb,
    [data-theme="light"] .comments-container::-webkit-scrollbar-thumb,
    [data-theme="light"] .winners-table-container::-webkit-scrollbar-thumb,
    [data-theme="light"] .main-layout > .panel::-webkit-scrollbar-thumb {
        background: rgba(15, 23, 42, 0.18);
    }
    [data-theme="light"] .filters-panel-content::-webkit-scrollbar-thumb:hover,
    [data-theme="light"] .comments-container::-webkit-scrollbar-thumb:hover,
    [data-theme="light"] .winners-table-container::-webkit-scrollbar-thumb:hover,
    [data-theme="light"] .main-layout > .panel::-webkit-scrollbar-thumb:hover {
        background: rgba(15, 23, 42, 0.32);
    }
}

/* — Desktop panel hover affordance — subtle border highlight on focus-within — */
@media (min-width: 1101px) {
    .main-layout > .panel {
        transition: border-color 0.2s var(--gm-ease), box-shadow 0.2s var(--gm-ease);
    }
    .main-layout > .panel:focus-within {
        border-color: var(--gm-border-strong);
        box-shadow: var(--gm-shadow-lg);
    }
}

/* — Winners table: horizontal scroll fade affordance on tablet/desktop — */
@media (min-width: 769px) {
    .winners-table-container {
        position: relative;
        background-image:
            linear-gradient(90deg, var(--gm-surface-1), transparent 8%, transparent 92%, var(--gm-surface-1)),
            linear-gradient(90deg, transparent, transparent);
        background-repeat: no-repeat;
        background-attachment: local, scroll;
    }
    [data-theme="light"] .winners-table-container {
        background-image:
            linear-gradient(90deg, #ffffff, transparent 8%, transparent 92%, #ffffff),
            linear-gradient(90deg, transparent, transparent);
    }
}

/* — Hide wheel fullscreen toggle on mobile — */
@media (max-width: 768px) {
    #fullscreenWheelBtn,
    .wheel-fullscreen-btn {
        display: none !important;
    }
}

/* — Winners History: mobile card redesign — */
@media (max-width: 768px) {
    .winners-table-container {
        padding: 0 !important;
    }
    /* Each row stacks vertically; no horizontal squeeze */
    .winners-table tbody tr {
        display: grid !important;
        grid-template-columns: 36px minmax(0, 1fr) auto auto !important;
        grid-template-areas:
            "num   user  round badge"
            "comment comment comment comment"
            "actions actions actions actions" !important;
        gap: 8px 10px !important;
        padding: 12px !important;
        border-radius: 14px !important;
    }

    /* Index badge — slightly smaller */
    .winners-table td:nth-child(1) {
        grid-area: num;
        width: 32px !important;
        height: 32px !important;
        font-size: 0.8rem !important;
    }

    /* Username — uses available space, ellipsis on overflow */
    .winners-table td:nth-child(2) {
        grid-area: user;
        font-size: 0.92rem !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

    /* Comment — full width on its own row */
    .winners-table td:nth-child(3) {
        grid-area: comment;
        font-size: 0.85rem !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: break-word !important;
        background: rgba(0,0,0,0.22);
        padding: 8px 10px !important;
        border-radius: 8px;
        border-left: 3px solid rgba(255,255,255,0.12);
        color: #e2e8f0 !important;
        line-height: 1.45 !important;
    }
    .winners-table tbody tr.wheel-winner-row td:nth-child(3) {
        border-left-color: rgba(250,204,21,0.55);
    }
    .winners-table tbody tr.comment-winner-row td:nth-child(3) {
        border-left-color: rgba(56,189,248,0.55);
    }

    /* Round — compact pill, doesn't crowd the username */
    .winners-table td:nth-child(4) {
        grid-area: round;
        font-size: 0.72rem !important;
        font-weight: 700;
        padding: 3px 8px !important;
        background: rgba(255,255,255,0.07);
        border-radius: 999px;
        white-space: nowrap;
        color: #cbd5e1 !important;
    }

    /* Type badge */
    .winners-table td:nth-child(5) {
        grid-area: badge;
    }
    .winners-table td:nth-child(5) .badge {
        height: 24px !important;
        min-width: 32px !important;
        padding: 0 9px !important;
        font-size: 0.7rem !important;
        border-radius: 12px !important;
    }

    /* Actions — right-aligned row of buttons */
    .winners-table td:nth-child(6) {
        grid-area: actions;
        justify-content: flex-end !important;
        gap: 8px !important;
        margin-top: 2px;
    }
    .winners-table td:nth-child(6) .action-btn {
        padding: 7px 14px !important;
        font-size: 0.8rem !important;
        min-height: 34px;
    }

    /* Section separator rows ("WHEEL WINNERS" / "COMMENT WINNERS") */
    .winners-table tbody tr:has(td[colspan]) {
        display: block !important;
        padding: 14px 4px 6px !important;
    }
    .winners-table tbody tr td[colspan] {
        font-size: 0.72rem !important;
        letter-spacing: 0.12em !important;
        padding: 0 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }
    /* Remove the decorative side lines on mobile — they get clipped at narrow widths */
    .winners-table tbody tr td[colspan]::before,
    .winners-table tbody tr td[colspan]::after {
        width: 18px !important;
        margin: 0 8px !important;
    }

    /* Light theme — keep comment box readable */
    [data-theme="light"] .winners-table td:nth-child(3) {
        background: #f1f5fb;
        color: #0f172a !important;
        border-left-color: #cbd5e1;
    }
}

/* Very small phones — drop the round/badge into a row of their own to save space */
@media (max-width: 380px) {
    .winners-table tbody tr {
        grid-template-columns: 32px minmax(0, 1fr) !important;
        grid-template-areas:
            "num   user"
            "meta  meta"
            "comment comment"
            "actions actions" !important;
    }
    .winners-table td:nth-child(4),
    .winners-table td:nth-child(5) {
        grid-area: meta;
        display: inline-flex !important;
        align-self: start;
        margin-right: 6px;
    }
    .winners-table td:nth-child(5) { margin-left: auto; }
}

/* — Eligible Users overlay: mobile card-list redesign — */
@media (max-width: 768px) {
    #eligibleUsersOverlay.modal-overlay {
        padding: 8px !important;
        align-items: flex-start !important;
    }
    #eligibleUsersOverlay .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100vh - 80px) !important;
        margin: 8px 0 !important;
        border-radius: 18px !important;
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* Sticky compact header */
    #eligibleUsersOverlay .modal-header {
        flex-direction: column !important;
        gap: 10px !important;
        padding: 14px !important;
        position: sticky;
        top: 0;
        z-index: 5;
        background: inherit;
    }
    #eligibleUsersOverlay .eligible-count {
        font-size: 1rem !important;
        padding: 6px 12px !important;
    }
    #eligibleUsersOverlay .eligible-count i { font-size: 1rem !important; }
    #eligibleUsersOverlay .eligible-count span { font-size: 1rem !important; }

    /* Compact action buttons — 2-column grid for primary actions, full-width close */
    #eligibleUsersOverlay .modal-header-controls {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 6px !important;
        width: 100%;
    }
    #eligibleUsersOverlay .modal-header-controls .btn {
        flex: none !important;
        padding: 9px 8px !important;
        font-size: 0.78rem !important;
        min-height: 40px;
        min-width: 0 !important;
        border-radius: 10px !important;
        gap: 5px !important;
    }
    #eligibleUsersOverlay .modal-header-controls .btn i { font-size: 0.85rem; }
    #eligibleUsersOverlay #selectWinnerFromEligibleBtn,
    #eligibleUsersOverlay #closeEligibleOverlay {
        grid-column: span 2;
    }

    /* Filter info bar */
    #eligibleUsersOverlay .filter-info {
        padding: 8px 14px !important;
        font-size: 0.78rem !important;
    }
    #eligibleUsersOverlay .filter-info-item {
        font-size: 0.78rem !important;
        gap: 6px !important;
    }

    /* Scrollable list area */
    #eligibleUsersOverlay .eligible-users-container {
        flex: 1 1 auto;
        height: auto !important;
        max-height: none !important;
        padding: 10px 12px !important;
        overflow-x: hidden !important;
        background: transparent !important;
    }

    /* Convert the table into a card list */
    #eligibleUsersOverlay .eligible-users-table { display: block !important; width: 100% !important; }
    #eligibleUsersOverlay .eligible-users-table thead { display: none !important; }
    #eligibleUsersOverlay .eligible-users-table tbody { display: block !important; }
    #eligibleUsersOverlay .eligible-users-table tbody tr {
        display: grid !important;
        grid-template-columns: auto 1fr auto auto;
        grid-template-areas:
            "num user time status"
            "comment comment comment comment";
        column-gap: 10px;
        row-gap: 6px;
        align-items: center;
        height: auto !important;
        max-height: none !important;
        padding: 12px 14px !important;
        margin-bottom: 10px;
        background: rgba(255, 255, 255, 0.04) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 14px !important;
    }
    #eligibleUsersOverlay .eligible-users-table tbody tr:nth-child(even),
    #eligibleUsersOverlay .eligible-users-table tbody tr:nth-child(even) td,
    #eligibleUsersOverlay .eligible-users-table tbody tr:nth-child(even):hover td,
    #eligibleUsersOverlay .eligible-users-table tbody tr:hover td {
        background: transparent !important;
    }
    #eligibleUsersOverlay .eligible-users-table tbody tr td {
        display: block !important;
        height: auto !important;
        max-height: none !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.4 !important;
    }
    /* Column → card area mapping */
    #eligibleUsersOverlay .eligible-users-table td:nth-child(1) {
        grid-area: num;
        font-size: 0.78rem !important;
        font-weight: 700;
        color: #4FC3F7;
        background: rgba(79, 195, 247, 0.12) !important;
        padding: 3px 8px !important;
        border-radius: 999px !important;
        text-align: center;
        min-width: 28px;
    }
    #eligibleUsersOverlay .eligible-users-table td:nth-child(2) {
        grid-area: user;
        font-size: 0.95rem !important;
        font-weight: 700;
        color: #f8f8f8 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    #eligibleUsersOverlay .eligible-users-table td:nth-child(3) {
        grid-area: comment;
        font-size: 0.85rem !important;
        color: #cbd5e1 !important;
        background: rgba(0, 0, 0, 0.25) !important;
        padding: 8px 10px !important;
        border-radius: 8px !important;
        border-left: 3px solid rgba(79, 195, 247, 0.5) !important;
        overflow-x: hidden !important;
        white-space: normal !important;
        word-break: break-word !important;
    }
    #eligibleUsersOverlay .eligible-users-table td:nth-child(4) {
        grid-area: time;
        font-size: 0.72rem !important;
        color: #94a3b8 !important;
        white-space: nowrap !important;
        text-align: right;
    }
    #eligibleUsersOverlay .eligible-users-table td:nth-child(5) {
        grid-area: status;
        text-align: right !important;
        white-space: nowrap !important;
    }
    #eligibleUsersOverlay .eligible-users-table td:nth-child(5) .badge,
    #eligibleUsersOverlay .eligible-users-table td:last-child::before {
        font-size: 0.7rem !important;
    }
    /* Reset any rounded-corner overrides from earlier rule */
    #eligibleUsersOverlay .eligible-users-table tbody tr td:first-child,
    #eligibleUsersOverlay .eligible-users-table tbody tr td:last-child {
        border-radius: 999px !important;
    }
    #eligibleUsersOverlay .eligible-users-table tbody tr td:nth-child(3) {
        border-radius: 8px !important;
    }

    /* Modal footer compact */
    #eligibleUsersOverlay .modal-footer {
        padding: 10px 14px !important;
        font-size: 0.78rem !important;
    }
    /* Pagination compact */
    #eligibleUsersOverlay .pagination-container {
        padding: 8px 12px !important;
        font-size: 0.85rem;
    }
}

/* — Slot machine + Round winner overlays: shrink for mobile — */
@media (max-width: 768px) {
    .slot-machine-overlay { padding: 12px; }
    .slot-machine-container {
        padding: 16px !important;
        border-radius: 18px !important;
        border-width: 2px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .slot-machine-title {
        font-size: 1.35rem !important;
        margin-bottom: 14px !important;
        gap: 8px !important;
        flex-wrap: wrap;
    }
    .slot-machine-title i { font-size: 1.2rem !important; }
    .slot-machine {
        flex-direction: column;
        gap: 8px !important;
        margin: 14px 0 !important;
        padding: 12px !important;
        height: auto !important;
        border-radius: 14px !important;
        border-width: 2px !important;
    }
    .reel-container {
        width: 100% !important;
        max-width: 240px;
        height: 90px !important;
        border-width: 2px !important;
        border-radius: 10px !important;
        margin: 0 auto;
    }
    .reel-item {
        height: 45px !important;
        font-size: 0.95rem !important;
        padding: 0 10px !important;
    }
    .reel-item.current {
        font-size: 1rem !important;
    }
    .winner-reel-container .reel-item {
        font-size: 1.05rem !important;
    }
    .reel-container::before,
    .reel-container::after { height: 18px !important; }

    .slot-separator {
        font-size: 1.8rem !important;
        margin: 4px 0 !important;
        transform: rotate(90deg);
    }
    .slot-machine-controls { margin-top: 16px !important; }
    .slot-machine-progress { margin-bottom: 14px !important; }
    .slot-progress-bar { height: 14px !important; border-width: 1px !important; }
    .slot-progress-text { font-size: 0.85rem !important; }
    .slot-machine-message {
        font-size: 0.85rem !important;
        padding: 10px 12px !important;
        gap: 8px !important;
        border-radius: 10px !important;
    }

    /* — Round winner overlay (the gold circular popup) — */
    .round-winner-container {
        width: min(92vw, 360px) !important;
        height: min(92vw, 360px) !important;
    }
    .round-winner-content {
        padding: 18px !important;
        border-width: 2px !important;
    }
    .round-winner-icon {
        font-size: 2.4rem !important;
        margin-bottom: 8px !important;
    }
    .round-winner-title {
        font-size: 0.95rem !important;
        letter-spacing: 1px !important;
        margin-bottom: 8px !important;
    }
    .round-winner-round { font-size: 0.78rem !important; margin-top: 4px !important; }
    .round-winner-name {
        font-size: 1.1rem !important;
        margin: 6px 0 !important;
    }
    .round-winner-comment {
        font-size: 0.78rem !important;
        max-height: 50px !important;
        margin: 6px 0 !important;
    }
    .close-round-winner-btn {
        margin-top: 12px !important;
        padding: 7px 16px !important;
        font-size: 0.8rem !important;
    }
}

/* — Mobile-only mount point for "Select Random Winner" button — */
#selectWinnerBtnMobileMount { display: none; }
@media (max-width: 768px) {
    #selectWinnerBtnMobileMount {
        display: block;
        margin-bottom: 10px;
    }
    #selectWinnerBtnMobileMount > #selectWinnerBtn {
        width: 100%;
        min-height: 52px;
        font-size: 0.95rem;
        border-radius: 14px;
    }
}

/* — Wheel controls: compact icon buttons on mobile — */
@media (max-width: 768px) {
    .wheel-controls {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        margin-bottom: 12px;
        padding: 4px 2px;
    }
    .wheel-controls .btn {
        min-width: 0 !important;
        min-height: 52px !important;
        padding: 10px 6px !important;
        flex-direction: column;
        gap: 4px;
        font-size: 0.68rem !important;
        line-height: 1.1;
        border-radius: 14px;
        text-align: center;
        white-space: normal;
    }
    .wheel-controls .btn i {
        font-size: 1.15rem;
    }
    .wheel-controls .btn .btn-label {
        display: block;
        font-size: 0.65rem;
        font-weight: 600;
        letter-spacing: 0.01em;
        opacity: 0.95;
    }
}

@media (max-width: 380px) {
    .wheel-controls .btn .btn-label { display: none; }
    .wheel-controls .btn {
        aspect-ratio: 1 / 1;
        min-height: 0 !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }
    .wheel-controls .btn i { font-size: 1.3rem; }
}

/* — Comments tab action bar — */
.comments-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 8px 4px;
    flex: 0 0 auto;
}
.comments-actions .btn { min-width: 0; }
@media (max-width: 768px) {
    .comments-actions { padding: 8px 4px 6px; }
    .comments-actions .btn { width: 100%; }
}

/* — Responsive center wheel logo — scales with the wheel — */
.wheel-container { position: relative; }
.wheel-center-logo {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 32%;
    height: 32%;
    max-width: 200px;
    max-height: 200px;
    z-index: 20;
    pointer-events: none;
}
.wheel-center-logo img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    object-fit: cover;
}

@media (max-width: 1100px) {
    .wheel-center-logo { width: 30%; height: 30%; }
}
@media (max-width: 768px) {
    .wheel-center-logo { width: 28%; height: 28%; max-width: 110px; max-height: 110px; }
}
@media (max-width: 420px) {
    .wheel-center-logo { width: 26%; height: 26%; max-width: 90px; max-height: 90px; }
}

/* — Sticky panel titles inside scrolling panels (desktop only) — */
@media (min-width: 1101px) {
    .filters-panel-content .filter-collapsible-header {
        position: relative;
        z-index: 2;
    }
}

/* — Tablet/desktop: tighten the empty footer to feel less floaty — */
@media (min-width: 769px) {
    .app-footer {
        margin-top: 18px;
        padding: 14px 16px;
        text-align: center;
        color: #94a3b8;
        font-size: 0.85rem;
        border-top: 1px solid var(--gm-border);
        opacity: 0.85;
    }
    [data-theme="light"] .app-footer {
        color: #64748b;
        border-top-color: #e2e8f0;
    }
}
