
    [data-theme="light"] .search-results {
        background: #ffffff !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06) !important;
    }
    [data-theme="light"] .search-item {
        border-bottom-color: rgba(0, 0, 0, 0.04) !important;
    }
    [data-theme="light"] .search-item:hover {
        background: rgba(0, 0, 0, 0.03) !important;
    }
    [data-theme="light"] .s-name {
        color: #1e293b !important;
    }

    [data-theme="light"] .spin-btn {
        background: #f8fafc !important;
        color: #3a415c !important;
        border: 2px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    }
    [data-theme="light"] .spin-btn:hover {
        border-color: var(--accent) !important;
        background: #f1f5f9 !important;
    }

    [data-theme="light"] .mode-switch-container {
        background: #f1f5f9 !important;
        border-color: rgba(0, 0, 0, 0.1) !important;
    }
    [data-theme="light"] .mode-btn {
        color: #64748b !important;
    }
    [data-theme="light"] .mode-btn.active {
        background: var(--accent) !important;
        color: #e0e5eb !important;
        box-shadow: 0 4px 12px rgba(210,169,105, 0.3) !important;
    }

    [data-theme="light"] .slot-machine-window {
        background: #ffffff !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: inset 0 2px 8px rgba(0,0,0,0.04) !important;
    }
    [data-theme="light"] .slot-machine-window::after {
        background: linear-gradient(to bottom, rgba(0,0,0,0.06) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.06) 100%) !important;
    }

    [data-theme="light"] .winner-revealed .slot-strip .slot-item:last-child img {
        filter: brightness(1) drop-shadow(0 4px 12px rgba(210,169,105, 0.45)) !important;
        animation: winnerBounceLight 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
    }

    @keyframes winnerBounceLight {
        0% {
            transform: scale(0.7);
            filter: brightness(1) drop-shadow(0 0 0px transparent);
        }
        50% {
            transform: scale(1.3);
            filter: brightness(1.1) drop-shadow(0 0 15px rgba(210,169,105, 0.7));
        }
        100% {
            transform: scale(1.15);
            filter: brightness(1) drop-shadow(0 4px 10px rgba(210,169,105, 0.45));
        }
    }

    #player-card-0 { z-index: 40; }
    #player-card-1 { z-index: 30; }
    #player-card-2 { z-index: 20; }
    #player-card-3 { z-index: 10; }

    .rnd-header { text-align: center; margin-bottom: 40px; }
    .rnd-title { font-size: 2.5rem; font-weight: 900; color: var(--text-main); margin-bottom: 10px; }
    .rnd-subtitle { color: var(--text-muted); font-size: 1.05rem; }

    .spin-btn-container { text-align: center; margin-bottom: 40px; padding: 0 15px; }

    .spin-btn {
        background: #2b2f42 !important;
        color: var(--accent) !important;
        font-size: 1.5rem !important;
        font-weight: 900 !important;
        padding: 15px 50px !important;
        border: 2px solid var(--border) !important;
        border-radius: 20px !important;
        cursor: pointer !important;
        transition: 0.2s !important;
        box-shadow: var(--shadow) !important;
        text-transform: uppercase !important;
        letter-spacing: 2px !important;
        width: 100% !important;
        max-width: 400px !important;
        display: inline-block !important;
    }
    .spin-btn:hover {
        border-color: var(--accent) !important;
        transform: scale(1.05) translateY(-3px) !important;
        box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important;
    }
    .spin-btn:active { transform: scale(0.95) !important; }
    .spin-btn:disabled { opacity: 0.5 !important; cursor: not-allowed !important; transform: none !important; box-shadow: none !important; }

    .mode-switch-container {
        display: flex;
        justify-content: center;
        background: var(--surface);
        border: 2px solid var(--border);
        padding: 5px;
        border-radius: 16px;
        width: max-content;
        margin: 0 auto 15px auto;
        box-shadow: var(--shadow);
    }
    .mode-btn {
        background: transparent;
        border: none;
        color: var(--text-muted);
        padding: 8px 20px;
        border-radius: 12px;
        font-weight: 800;
        font-size: 0.9rem;
        cursor: pointer;
        transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .mode-btn.active {
        background: var(--accent);
        color: #291e0a;
        box-shadow: 0 4px 12px rgba(210,169,105, 0.2);
    }
    .mode-btn.active-purple {
        background: #a855f7 !important;
        color: #fff !important;
        box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3) !important;
    }

    .players-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        margin-bottom: 30px;
    }

    .player-card {
        background: var(--surface);
        border: 2px solid var(--border);
        border-radius: 16px;
        height: 56px;
        position: relative;
        box-shadow: var(--shadow);
        transition: 0.3s;
        display: flex;
        align-items: center;
        min-width: 0;
    }
    .player-card.active { border-color: var(--accent); background: var(--bg); }
    .player-card.span-all-columns { grid-column: 1 / span 4 !important; }

    .user-search-wrapper { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 10; min-width: 0; }
    .user-search-input {
        width: 100%; height: 100%; padding: 0 15px; border-radius: 14px; border: none;
        background: transparent; color: var(--text-main); font-size: 0.95rem; outline: none; box-sizing: border-box;
    }
    .user-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }

    .search-results {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-top: 5px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
        max-height: 200px;
        overflow-y: auto;
        display: none;
        z-index: 2000 !important;
        transform-origin: top center;
        animation: slideDownFade 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes slideDownFade {
        from { opacity: 0; transform: translateY(-8px) scaleY(0.96); }
        to { opacity: 1; transform: translateY(0) scaleY(1); }
    }
    .search-item {
        padding: 10px 15px; display: flex; align-items: center; gap: 10px; cursor: pointer; border-bottom: 1px solid var(--border);
        overflow: hidden; min-width: 0;
    }
    .search-item:last-child { border-bottom: none; }
    .search-item:hover { background: var(--bg); }
    .s-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; overflow: hidden; border: 1px solid var(--border); flex-shrink: 0;}
    .s-avatar img { width: 100%; height: 100%; object-fit: cover; }
    .s-name { font-weight: 700; color: var(--text-main); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; display: block; }

    .selected-user {
        display: none; align-items: center; justify-content: space-between;
        width: 100%; height: 100%; padding: 0 10px; box-sizing: border-box; overflow: hidden;
        min-width: 0;
        animation: fadeInFast 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes fadeInFast {
        from { opacity: 0; transform: scale(0.97); }
        to { opacity: 1; transform: scale(1); }
    }

    .su-info-row { display: flex; align-items: center; gap: 10px; flex: 1; margin-right: 8px; overflow: hidden; min-width: 0; }
    .su-avatar-big {
        width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--accent);
        background: var(--surface); display: flex; align-items: center; justify-content: center;
        overflow: hidden; font-weight: 800; color: var(--accent); font-size: 1rem; flex-shrink: 0;
    }
    .su-avatar-big img { width: 100%; height: 100%; object-fit: cover; }
    .su-name { font-weight: 800; color: var(--text-main); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; min-width: 0; flex: 1; }

    .su-remove {
        width: 28px; height: 28px; border-radius: 8px; background: rgba(239, 68, 68, 0.1); color: #ef4444;
        display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; flex-shrink: 0;
    }
    .su-remove:hover { background: #ef4444; color: white; transform: scale(1.05); }

    .slots-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
        margin-bottom: 40px;
        justify-items: center;
        width: 100%;
        transition: 0.3s ease;
    }

    .slots-grid.with-boss {
        grid-template-columns: repeat(5, 1fr);
    }

    .slot-card-window {
        background: var(--surface);
        border: 2px solid var(--border);
        border-radius: 24px;
        padding: 16px;
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        align-items: center;
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 100%;
        box-sizing: border-box;
    }
    .slot-card-window.active {
        border-color: var(--accent) !important;
        box-shadow: 0 10px 30px rgba(210,169,105, 0.15);
    }
    .slot-card-window.active-purple {
        border-color: #a855f7 !important;
        box-shadow: 0 10px 30px rgba(168, 85, 247, 0.2) !important;
    }

    .slot-machine-window {
        width: 100%;
        aspect-ratio: 1 / 1;
        background: var(--bg);
        border: 2px solid var(--border);
        border-radius: 16px;
        overflow: hidden;
        position: relative;
        box-shadow: inset 0 5px 15px rgba(0,0,0,0.3);
        display: flex;
        justify-content: center;
    }

    .slot-machine-window::after {
        content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
        background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.4) 100%);
        pointer-events: none; z-index: 2;
    }

    .slot-strip {
        display: flex;
        flex-direction: column;
        width: 100%;
        transform: translateY(0);
        will-change: transform;
    }

    :root {
        --dynamic-slot-height: 140px;
    }

    .slot-item {
        width: 100%;
        height: var(--dynamic-slot-height);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        padding: 10px;
        box-sizing: border-box;
        overflow: hidden;
    }
    .slot-item img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35));
        transition: 0.3s;
    }

    .slot-icon {
        width: 35%;
        height: 35%;
        color: var(--text-muted);
        transition: color 0.3s ease;
    }
    .slot-card-window.active .slot-icon {
        color: var(--accent);
    }
    .slot-card-window.active-purple .slot-icon {
        color: #a855f7;
    }

    .char-winner-name {
        margin-top: 8px;
        font-size: 0.8rem;
        font-weight: 800;
        color: var(--accent);
        text-align: center;
        line-height: 1.2;
        height: 2.4em;
        width: 100%;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        text-overflow: ellipsis;
        white-space: normal;
        word-break: break-word;
        cursor: help;
    }

    .history-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: var(--bg);
        padding: 15px 20px;
        border-radius: 18px;
        border: 1px solid var(--border);
        gap: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    .history-row:hover {
        border-color: var(--accent);
    }
    .history-left {
        display: flex;
        align-items: center;
        gap: 15px;
        flex: 1;
        min-width: 0;
    }
    .history-time-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }
    .history-date {
        font-family: 'Fira Code', monospace;
        font-size: 0.7rem;
        color: var(--accent);
        font-weight: 700;
        background: var(--surface);
        padding: 1px 6px;
        border-radius: 5px;
        border: 1px solid var(--border);
        line-height: 1;
    }
    .history-time {
        font-family: 'Fira Code', monospace;
        font-size: 0.75rem;
        color: var(--text-muted);
        background: var(--surface);
        padding: 2px 6px;
        border-radius: 6px;
        border: 1px solid var(--border);
        line-height: 1;
    }
    .history-players-container {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .history-card-cell {
        display: inline-flex;
        align-items: center;
        background: var(--surface);
        padding: 4px 8px;
        border-radius: 12px;
        border: 1px solid var(--border);
        gap: 8px;
        min-width: 0;
        flex-shrink: 0;
        width: 145px; 
        height: 46px;
        box-sizing: border-box;
    }
    .history-boss-cell {
        background: rgba(168, 85, 247, 0.05);
        border-color: rgba(168, 85, 247, 0.15);
    }
    .history-cell-avatar {
        width: 30px; 
        height: 30px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
        border: 1px solid var(--border);
    }
    .history-boss-cell .history-cell-avatar {
        border-radius: 8px;
    }
    .history-cell-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
        flex: 1;
    }
    .history-cell-top, .history-cell-bottom {
        font-size: 0.72rem;
        font-weight: 800;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        box-sizing: border-box;
    }
    .history-cell-bottom {
        font-size: 0.68rem;
        font-weight: 600;
        color: var(--accent);
        margin-top: 1px;
    }
    .history-boss-cell .history-cell-bottom {
        color: #a855f7;
        font-weight: 800;
    }

    @media(max-width: 900px) {
        .players-grid { grid-template-columns: repeat(2, 1fr); }
        .player-card.span-all-columns { grid-column: 1 / span 2 !important; }
    }

    @media(max-width: 768px) {
        .history-row {
            flex-direction: column;
            align-items: stretch;
            padding: 12px;
            gap: 12px;
        }
        .history-left {
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
            width: 100%;
        }
        .history-time-container {
            flex-direction: row !important; 
            gap: 6px !important;
            align-self: flex-start;
        }
        .history-players-container {
            width: 100%;
            display: grid !important;
            grid-template-columns: repeat(2, 1fr) !important; 
            gap: 8px !important;
        }
        .history-card-cell {
            width: 100% !important;
            max-width: none !important;
            justify-content: flex-start !important; 
        }

        .history-boss-cell {
            width: 100% !important;
            max-width: none !important;
            height: auto !important;
            min-height: 50px;
            padding: 8px 12px !important;
            justify-content: flex-start !important;
        }
        .history-boss-cell .history-cell-top {
            display: none !important; 
        }
        .history-boss-cell .history-cell-bottom {
            font-size: 0.75rem !important;
            font-weight: 800 !important;
            white-space: normal !important;
            display: -webkit-box !important;
            -webkit-line-clamp: 2 !important;
            -webkit-box-orient: vertical !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
            line-height: 1.2 !important;
            width: 100% !important;
            max-width: none !important;
        }
    }

    @media(max-width: 550px) {
        .players-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 20px;}
        .player-card.span-all-columns { grid-column: 1 / span 1 !important; }

        .slots-grid { gap: 8px; margin-bottom: 30px; }

        .slot-card-window {
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
            padding: 0 !important;
            max-width: none !important;
            border-radius: 0 !important;
        }

        .slot-machine-window {
            border-radius: 12px !important;
            border-width: 1.5px !important;
            box-shadow: inset 0 3px 10px rgba(0,0,0,0.3) !important;
            transition: border-color 0.3s ease, box-shadow 0.3s ease;
        }

        .slot-card-window.active .slot-machine-window {
            border-color: var(--accent) !important;
            box-shadow: 0 0 15px rgba(210,169,105, 0.25), inset 0 3px 10px rgba(0,0,0,0.3) !important;
        }
        .slot-card-window.active-purple .slot-machine-window {
            border-color: #a855f7 !important;
            box-shadow: 0 0 15px rgba(168, 85, 247, 0.25), inset 0 3px 10px rgba(0,0,0,0.3) !important;
        }

        .slot-item {
            padding: 4px !important;
        }

        .char-winner-name {
            display: block !important;
            font-size: 0.75rem !important;
            margin-top: 6px !important;
            max-width: 100% !important;
            height: 28px !important;
        }

        .mode-switch-container {
            width: calc(100% - 10px);
            box-sizing: border-box;
            display: flex;
            gap: 4px;
        }
        .mode-switch-container .mode-btn {
            flex: 1;
            padding: 8px 2px !important;
            font-size: 0.75rem !important;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
        }

        .slots-grid.with-boss {
            grid-template-columns: repeat(4, 1fr) !important;
        }
        .slots-grid.with-boss #slot-card-window-boss {
            grid-column: 1 / span 4 !important;
            margin-top: 15px !important;
            width: var(--dynamic-slot-height) !important; 
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
            padding: 0 !important;
        }
        .slots-grid.with-boss #slot-card-window-boss .slot-machine-window {
            width: var(--dynamic-slot-height) !important;
            height: var(--dynamic-slot-height) !important;
            margin: 0 auto !important;
        }
    }

    @media(max-width: 480px) {
        .history-players-container {
            grid-template-columns: 1fr !important;
        }
    }