@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #0a0a1a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --primary-gold: #f5c842;
    --primary-gold-glow: rgba(245, 200, 66, 0.5);
    --secondary-blue: #4a90e2;
    --accent-purple: #7b2cbf;
    --text-white: #ffffff;
    --text-muted: #a0a0b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --transition-speed: 0.4s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a3a 0%, #0a0a1a 100%);
}

/* Background Animated Glows */
body::before, body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.3;
}

body::before {
    top: 10%;
    left: 10%;
    background: var(--accent-purple);
    animation: float 10s infinite alternate;
}

body::after {
    bottom: 10%;
    right: 10%;
    background: var(--secondary-blue);
    animation: float 12s infinite alternate-reverse;
}

@keyframes float {
    from { transform: translate(0, 0); }
    to { transform: translate(50px, 50px); }
}

/* Container & Sections */
.game-container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    position: relative;
}

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1200px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 0 0 24px 24px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #000;
}

.profile-name {
    font-weight: 600;
    color: var(--text-white);
}

.balance {
    display: flex;
    align-items: center;
    gap: 10px;
}

.balance-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.balance-amount {
    font-weight: 700;
    color: var(--primary-gold);
    font-size: 1.1rem;
}

/* Adjust body padding for fixed topbar */
body {
    background-color: var(--bg-color);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a3a 0%, #0a0a1a 100%);
    padding-top: 80px; /* Space for topbar */
}

.section {
    display: none;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.6s ease-out forwards;
}

.section.active {
    display: flex;
}

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

/* Glassmorphism Components */
.home-container {
    display: flex;
    gap: 20px;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    flex: 1;
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
}

.side-panel {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.4s ease;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    position: relative;
    flex: 0 0 300px;
}

.side-panel.collapsed {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    height: 60px;
    min-height: 60px;
    max-height: 60px;
    padding: 0;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 60px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    aspect-ratio: 1;
}

.side-panel.collapsed .panel-title,
.side-panel.collapsed .bets-content,
.side-panel.collapsed .history-content {
    display: none;
}

.panel-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--primary-gold);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.3s ease;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-toggle:hover {
    transform: scale(1.2);
}

.panel-toggle img {
    width: 35px;
    height: 35px;
    opacity: 0.5;
    display: block;
}

.side-panel.collapsed .panel-toggle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    width: auto;
    height: auto;
    padding: 0;
    right: auto;
}

.left-panel.collapsed {
    left: -45px;
}

.right-panel.collapsed {
    right: -45px;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-gold);
    text-align: center;
    margin-bottom: 16px;
    width: 100%;
}

.bets-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: calc(100% - 50px);
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 200, 66, 0.3) transparent;
}

.bets-content::-webkit-scrollbar {
    width: 6px;
}

.bets-content::-webkit-scrollbar-track {
    background: transparent;
}

.bets-content::-webkit-scrollbar-thumb {
    background: rgba(245, 200, 66, 0.3);
    border-radius: 3px;
}

.bets-content::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 200, 66, 0.5);
}

.bets-table {
    width: 100%;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

.bets-header {
    display: grid;
    grid-template-columns: 1.5fr 0.6fr 0.6fr 0.4fr;
    gap: 8px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.bets-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 200, 66, 0.3) transparent;
}

.bets-list::-webkit-scrollbar {
    width: 6px;
}

.bets-list::-webkit-scrollbar-track {
    background: transparent;
}

.bets-list::-webkit-scrollbar-thumb {
    background: rgba(245, 200, 66, 0.3);
    border-radius: 3px;
}

.bets-list::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 200, 66, 0.5);
}

.bet-row {
    display: grid;
    grid-template-columns: 1.5fr 0.6fr 0.6fr 0.4fr;
    gap: 8px;
    padding: 10px 8px;
    border-radius: 6px;
    align-items: center;
    transition: background 0.2s ease;
}

.bet-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.bet-row.highlight {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.bet-row[data-matches="2"],
.bet-row[data-matches="3"],
.bet-row[data-matches="4"],
.bet-row[data-matches="5"] {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.col-player {
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-avatar {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary-gold), #b38b1d);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #000;
    flex-shrink: 0;
}

.player-name {
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-bet, .col-match, .col-win {
    text-align: right;
    color: var(--text-muted);
}

.col-matches {
    text-align: left;
    color: var(--text-muted);
}

.col-win {
    color: var(--primary-gold);
    font-weight: 600;
}

.col-time {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 400;
}


.bet-row.highlight .col-win {
    color: #4caf50;
    font-weight: 700;
}

.history-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: calc(100% - 50px);
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 200, 66, 0.3) transparent;
}

.history-content::-webkit-scrollbar {
    width: 6px;
}

.history-content::-webkit-scrollbar-track {
    background: transparent;
}

.history-content::-webkit-scrollbar-thumb {
    background: rgba(245, 200, 66, 0.3);
    border-radius: 3px;
}

.history-content::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 200, 66, 0.5);
}

.draw-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.draw-num {
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
}

.draw-set {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.draw-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.history-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    margin: 4px 0;
}

.side-panel:hover {
    background: rgba(255, 255, 255, 0.08);
}

.left-panel {
    order: -1;
}

.right-panel {
    order: 1;
}

/* Typography */
h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-gold), #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--text-white);
}

p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.glass-card > p {
    margin-bottom: 0.75rem;
}

/* Buttons */
.btn {
    padding: 16px 32px;
    border-radius: 12px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-gold), #b38b1d);
    color: #000;
    box-shadow: 0 0 20px var(--primary-gold-glow);
}

.btn-primary:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 0 30px var(--primary-gold-glow);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Prize Cards */
.prize-cards {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 30px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.prize-card {
    text-align: center;
    white-space: nowrap;
    font-size: clamp(0.5rem, 1.5vw, 0.8rem);
    font-weight: 600;
    color: var(--text-white);
    overflow: hidden;
    text-overflow: ellipsis;
}

.prize-card .matches-text {
    color: var(--text-muted);
}

.prize-card .multiplier-text {
    color: var(--primary-gold);
    font-weight: 700;
}

/* Stake Area */
.stake-area {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.stake-card {
    width: 100%;
    max-width: 520px;
    padding: 28px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    backdrop-filter: blur(18px);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
}

.stake-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
}

.stake-card-label {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.stake-card-min {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-gold);
}
.stake-card-value {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.04);
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stake-card-currency {
    font-size: 1.6rem;
    color: var(--primary-gold);
    line-height: 1;
    min-width: 28px;
    margin-right: 10px;
    font-weight: 800;
    flex-shrink: 0;
}

/* Stake Input Field - Best Practices Implementation */
.custom-stake-input {
    flex: 1;
    width: auto;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 2rem;
    font-weight: 800;
    text-align: left;
    padding: 0;
    outline: none;
    transition: color 0.2s ease;
    font-family: 'Outfit', sans-serif;
    /* Remove number spinner across all browsers */
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: none;
}

/* Remove spinner buttons in Chrome, Safari, Edge */
.custom-stake-input::-webkit-outer-spin-button,
.custom-stake-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.custom-stake-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 600;
}

.custom-stake-input:focus {
    color: var(--primary-gold);
}

.custom-stake-input.invalid {
    color: #ff6b6b;
}

.custom-stake-input.invalid::placeholder {
    color: rgba(255, 107, 107, 0.5);
}

.stake-card-value:focus-within {
    border-color: var(--primary-gold);
    box-shadow: 0 0 18px rgba(245, 200, 66, 0.15), inset 0 0 12px rgba(245, 200, 66, 0.05);
    background: rgba(0, 0, 0, 0.65);
}

.stake-card-value:focus-within .stake-card-currency {
    text-shadow: 0 0 12px rgba(245, 200, 66, 0.4);
}

    .stake-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        justify-content: center;
        margin-bottom: 24px;
        padding-bottom: 4px;
    }

    .stake-option {
        flex: 0 0 auto;
        min-width: 72px;
        padding: 10px 14px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: 700;
        font-size: 0.85rem;
        color: var(--text-white);
        white-space: nowrap;
    }

    .stake-option.active {
        background: var(--primary-gold);
        color: #000;
        border-color: var(--primary-gold);
        box-shadow: 0 0 16px rgba(245, 200, 66, 0.22);
    }

    .stake-option:hover {
        background: rgba(255, 255, 255, 0.16);
    }

    .btn-large {
        width: 100%;
        padding: 18px 24px;
        font-size: 1rem;
        letter-spacing: 1px;
    }

/* Number Picking Area - Tabbed Interface */
.pick-card {
    max-width: 550px;
    width: 100%;
    margin-top: 15px;
    padding: 0;
    overflow: hidden;
    backdrop-filter: blur(15px);
}

.tab-buttons {
    display: flex;
    gap: 0;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 24px 24px 0 0;
}

.tab-button {
    flex: 1;
    padding: 14px 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

.tab-button.active {
    background: linear-gradient(135deg, var(--primary-gold), #b38b1d);
    color: #000;
    box-shadow: 0 0 15px var(--primary-gold-glow);
}

.tab-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    height: auto;
}

.tab-pane {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

.tab-pane.active {
    display: flex;
}

.tab-pane h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-white);
    font-weight: 700;
}

.tab-pane p {
    font-size: 0.95rem;
    margin-bottom: 24px;
}

/* Number Picking Area */
.pick-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    width: 100%;
    margin-top: 30px;
}

@media (max-width: 1024px) {
    .game-container {
        padding: 16px;
    }

    .glass-card {
        padding: 32px;
    }

    .topbar {
        padding: 12px 16px;
    }

    .profile-avatar {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .profile-name {
        font-size: 0.95rem;
    }

    .balance-amount {
        font-size: 1rem;
    }

    .prize-cards {
        gap: 10px;
        margin-bottom: 25px;
    }

    .prize-card .matches-text {
        font-size: 0.7rem;
    }

    .prize-card .multiplier-text {
        font-size: 0.8rem;
    }

    .custom-stake-input {
        font-size: 1.6rem;
    }

    .stake-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        justify-content: center;
        max-width: 100%;
    }
    .stake-option {
        min-width: 72px;
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .pick-card {
        max-width: 100%;
    }

    #btn-back-home {
        display: none;
    }

    .tab-button {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .tab-content {
        padding: 32px;
        min-height: 400px;
    }

    .pick-panel {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 14px;
    }

    .panel-toggle {
        display: none;
    }

    .side-panel.collapsed {
        width: 100%;
        height: auto;
        border-radius: 24px;
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        transform: none;
        flex: 0 0 auto;
    }

    .side-panel.collapsed .panel-title,
    .side-panel.collapsed .bets-content,
    .side-panel.collapsed .history-content {
        display: flex;
    }

    .side-panel {
        flex: 0 0 auto;
    }

    .home-container {
        flex-direction: column;
        gap: 16px;
        width: 100%;
    }

    .glass-card {
        padding: 24px;
        order: 1;
    }

    .left-panel {
        order: 2;
    }

    .right-panel {
        order: -1;
    }

    .side-panel {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .right-panel {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        overflow: visible;
    }

    .right-panel .panel-title {
        display: none;
    }

    .history-content {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        gap: 2px;
        overflow-x: auto;
        overflow-y: visible;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }

    .draw-set {
        flex-shrink: 0;
    }

    .draw-time {
        display: none;
    }

    .draw-row {
        display: flex;
        gap: 6px;
        background: rgba(255, 255, 255, 0.06);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        padding: 8px 10px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .draw-row:active {
        background: rgba(255, 255, 255, 0.12);
        border-color: var(--primary-gold);
        transform: scale(0.98);
    }

    .history-divider {
        width: 1px;
        height: 30px;
        margin: 0 8px;
        background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.3), transparent);
    }

    .topbar {
        padding: 10px 14px;
    }

    .profile-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .profile-name {
        font-size: 0.9rem;
    }

    .balance-amount {
        font-size: 0.95rem;
    }

    .prize-cards {
        gap: 8px;
        margin-bottom: 20px;
    }

    .prize-card .matches-text {
        font-size: 0.65rem;
    }

    .prize-card .multiplier-text {
        font-size: 0.75rem;
    }

    .stake-input-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .custom-stake-input {
        font-size: 1.4rem;
    }

    /* Hide 100 stake option on narrow tablets/phones */
    .stake-option[data-value="100"] {
        display: none;
    }

    .stake-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        justify-content: center;
    }
    
    .stake-option {
        min-width: 66px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .bets-content {
        width: 100%;
        max-width: 100%;
        max-height: 300px;
        overflow-y: auto;
    }

    .bets-list {
        display: flex;
        flex-direction: column;
        gap: 4px;
        flex: 1;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(245, 200, 66, 0.3) transparent;
    }

    .bets-list::-webkit-scrollbar {
        width: 6px;
    }

    .bets-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .bets-list::-webkit-scrollbar-thumb {
        background: rgba(245, 200, 66, 0.3);
        border-radius: 3px;
    }

    .bets-list::-webkit-scrollbar-thumb:hover {
        background: rgba(245, 200, 66, 0.5);
    }

    .tab-buttons {
        gap: 0;
        padding: 6px;
    }

    .tab-button {
        padding: 10px 12px;
        font-size: 0.85rem;
        letter-spacing: 0px;
    }

    .tab-content {
        padding: 24px;
        height: auto;
    }

    .pick-container {
        grid-template-columns: 1fr;
    }

    .ball-scene {
        width: 180px;
        height: 180px;
    }

    .manual-inputs {
        flex-wrap: wrap;
        gap: 8px;
    }

    .number-input {
        width: calc(20% - 8px);
        min-width: 48px;
        font-size: 1rem;
        -moz-appearance: textfield;
        -webkit-appearance: none;
        appearance: none;
    }

    .number-input::-webkit-outer-spin-button,
    .number-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .selection-display,
    .draw-slots {
        flex-wrap: wrap;
        justify-content: center;
    }

    .slot,
    .draw-slot {
        width: 52px;
        height: 52px;
        font-size: 1.1rem;
    }

    .draw-slot {
        width: 64px;
        height: 64px;
    }

    .results-modal {
        padding: 28px;
        width: 95%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 16px 0;
        padding-top: 70px; /* Adjust for smaller topbar */
    }

    h1 {
        font-size: 2.4rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .topbar {
        padding: 8px 12px;
        border-radius: 0 0 16px 16px;
    }

    .profile-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .profile-name {
        font-size: 0.85rem;
    }

    .balance-amount {
        font-size: 0.9rem;
    }

    .prize-cards {
        gap: 6px;
        margin-bottom: 15px;
        justify-content: center;
    }

    .prize-card .matches-text {
        font-size: 0.6rem;
    }

    .prize-card .multiplier-text {
        font-size: 0.7rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .stake-card {
        padding: 20px;
    }

    .stake-card-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .stake-card-min {
        font-size: 0.8rem;
    }

    /* hide the 100 quick-select on small screens */
    .stake-option[data-value="100"] {
        display: none;
    }

    .custom-stake-input {
        font-size: 1.2rem;
    }

    .stake-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        justify-content: center;
    }

    .stake-option {
        min-width: 62px;
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .btn-large {
        font-size: 0.95rem;
        padding: 16px 18px;
    }

    .tab-button {
        font-size: 0.8rem;
        padding: 10px 8px;
    }

    .tab-content {
        padding: 20px;
        height: auto;
    }

    .tab-pane h3 {
        font-size: 1.3rem;
    }

    .tab-pane p {
        font-size: 0.9rem;
    }

    .ball-scene {
        width: 140px;
        height: 140px;
        margin: 15px auto !important;
    }

    .ball-logo {
        width: 60px;
        height: 60px;
        font-size: 1rem;
    }

    .draw-slots {
        gap: 12px;
    }

    .slot,
    .draw-slot {
        width: 48px;
        height: 48px;
        font-size: 1rem;
    }

    .results-modal {
        padding: 20px;
    }
}

.pick-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
}

/* 3D Magic Ball Pick */
.ball-scene {
    width: 200px;
    height: 200px;
    perspective: 800px;
    margin-bottom: 20px;
}

.magic-ball {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s;
    animation: idleFloat 4s infinite ease-in-out;
}

.magic-ball svg {
    width: 100%;
    height: 100%;
    display: block;
}

.ball-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: default;
    animation: idle-float 3s ease-in-out infinite;
}

.ball-wrap.ball-shake {
    animation: shake 0.08s linear infinite;
    cursor: default;
}

.ball-wrap .shadow {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 22px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.32) 0%, transparent 70%);
    border-radius: 50%;
    animation: shadow-pulse 3s ease-in-out infinite;
    pointer-events: none;
}

.ball-wrap.ball-shake .shadow {
    animation: none;
    width: 160px;
    opacity: 0.5;
}

.ball-body {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, #d32f2f, #610b0b);
    border-radius: 50%;
    position: absolute;
    box-shadow: inset -20px -20px 50px rgba(0,0,0,0.75),
                inset 16px 16px 40px rgba(255,140,140,0.16),
                0 0 30px rgba(255, 80, 80, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
}

.ball-wrap.draw-ball .ball-body {
    background: radial-gradient(circle at 30% 30%, #b71c1c, #3e0505);
    box-shadow: inset -20px -20px 50px rgba(0,0,0,0.8),
                inset 16px 16px 40px rgba(255,120,120,0.18),
                0 0 30px rgba(255, 90, 90, 0.45);
}

.ball-logo {
    background: #ffd700;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #000;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 0 15px rgba(255, 215, 0, 0.3);
}

.ball-logo span {
    font-size: 0.8rem;
    line-height: 1;
}

@keyframes idleFloat {
    0%, 100% { transform: translateY(0) rotateX(10deg) rotateY(10deg); }
    50% { transform: translateY(-15px) rotateX(-10deg) rotateY(-10deg); }
}

@keyframes idle-float {
    0%, 100% { transform: translateY(0px) rotate(-1deg); }
    50% { transform: translateY(-14px) rotate(1deg); }
}

.ball-shake {
    animation: shake 0.15s infinite;
}

.ball-shake-intense {
    animation: shake 0.05s infinite;
}

@keyframes shake {
    0% { transform: translate(2px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@keyframes shadow-pulse {
    0%, 100% { width: 180px; opacity: 0.32; }
    50% { width: 140px; opacity: 0.18; }
}

/* Confetti Particles */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-gold);
    top: -10px;
    z-index: 1001;
    border-radius: 2px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.winner-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Manual Inputs */
.manual-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.number-input {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: #fff;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: none;
}

.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-input:hover,
.number-input:active,
.number-input:focus {
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: none;
}

.number-input:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 10px var(--primary-gold-glow);
}

/* Selection Display */
.selection-display {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.slot {
    width: 60px;
    height: 60px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.slot.filled {
    border: none;
    background: radial-gradient(circle at 30% 30%, var(--primary-gold), #b38b1d);
    color: #000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Draw Section */
.draw-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.draw-slots {
    display: flex;
    gap: 20px;
    margin: 40px 0;
}

.draw-slot {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 800;
    position: relative;
}

.draw-slot.revealed {
    background: #fff;
    color: #000;
    animation: drawReveal 0.5s forwards;
}

.draw-slot.match {
    background: var(--primary-gold);
    box-shadow: 0 0 20px var(--primary-gold-glow);
}

@keyframes drawReveal {
    0% { transform: scale(0) rotate(180deg); }
    100% { transform: scale(1) rotate(0); }
}

/* Results Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 24, 0.85);
    backdrop-filter: blur(14px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.results-modal {
    background: rgba(20, 20, 44, 0.96);
    border: 1px solid rgba(245, 200, 66, 0.16);
    border-radius: 28px;
    padding: 24px 20px;
    max-width: 420px;
    width: min(420px, 92%);
    text-align: center;
    transform: translateY(28px);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .results-modal {
    transform: translateY(0);
}

.results-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    text-align: center;
}

.modal-logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 900;
    color: #000;
    background: linear-gradient(135deg, var(--primary-gold), #f7d05f);
    box-shadow: 0 0 16px rgba(245, 200, 66, 0.22);
}

.results-summary h2 {
    margin: 0 0 6px;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
}

.results-summary p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.result-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 14px;
    text-align: center;
}

.result-label {
    margin: 0 0 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-numbers {
    gap: 10px;
    justify-content: center;
    margin-top: 0;
    flex-wrap: wrap;
}

.result-numbers .slot {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    justify-content: center;
}

/* History Modal */
.history-modal {
    background: rgba(20, 20, 44, 0.96);
    border: 1px solid rgba(245, 200, 66, 0.16);
    border-radius: 28px;
    padding: 24px 20px;
    max-width: 500px;
    width: min(500px, 92%);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(28px);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .history-modal {
    transform: translateY(0);
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.history-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-white);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--primary-gold);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.modal-close-btn:hover {
    transform: scale(1.2);
}

.history-modal-content {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 200, 66, 0.3) transparent;
}

.history-modal-content::-webkit-scrollbar {
    width: 6px;
}

.history-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.history-modal-content::-webkit-scrollbar-thumb {
    background: rgba(245, 200, 66, 0.3);
    border-radius: 3px;
}

.history-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 200, 66, 0.5);
}

.history-item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item-numbers {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.history-item-number {
    background: linear-gradient(135deg, var(--primary-gold), #b38b1d);
    color: #000;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.history-item-time {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-actions .btn {
    width: 100%;
    max-width: 220px;
}

.win-amount {
    font-size: 2.5rem;
    color: var(--primary-gold);
    font-weight: 800;
    margin: 8px 0;
    text-shadow: 0 0 16px rgba(245, 200, 66, 0.22);
}

@media (max-width: 520px) {
    .results-modal {
        padding: 28px 20px;
    }

    .results-header {
        flex-direction: column;
        align-items: center;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions .btn {
        max-width: 100%;
    }
}
