:root {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --accent: #6c5ce7;
    --accent-hover: #5a4bd1;
    --gold: #fdcb6e;
    --green: #00b894;
    --red: #e17055;
    --text: #e0e0e0;
    --text-muted: #8888aa;
    --border: #2d2d44;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    background: var(--bg-card);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-brand a { color: var(--accent); font-size: 1.3rem; font-weight: bold; text-decoration: none; }
.nav-links { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--text); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: var(--accent); }

.container { max-width: 100%; margin: 2rem auto; padding: 0 1rem; flex: 1; width: 100%; }

.footer { text-align: center; padding: 2rem; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: 2rem; }

.btn, .btn-sm, .btn-outline, .btn-sm-outline, .btn-danger {
    display: inline-block; padding: 0.6rem 1.2rem; border-radius: 8px; text-decoration: none;
    font-size: 0.95rem; cursor: pointer; border: none; transition: all 0.2s; font-family: inherit;
}
.btn, .btn-sm { background: var(--accent); color: white; }
.btn:hover, .btn-sm:hover { background: var(--accent-hover); }
.btn-outline, .btn-sm-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover, .btn-sm-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm, .btn-sm-outline { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-success { background: rgba(0,184,148,0.15); border: 1px solid var(--green); color: var(--green); }
.alert-error, .alert-danger { background: rgba(225,112,85,0.15); border: 1px solid var(--red); color: var(--red); }
.alert-info, .alert-debug { background: rgba(108,92,231,0.15); border: 1px solid var(--accent); color: var(--accent); }
.alert-warning { background: rgba(253,203,110,0.15); border: 1px solid var(--gold); color: var(--gold); }

.hero { text-align: center; padding: 4rem 1rem; }
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero-subtitle { color: var(--text-muted); font-size: 1.2rem; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin-top: 3rem; }
.feature-card { background: var(--bg-card); padding: 2rem; border-radius: 12px; border: 1px solid var(--border); }
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); }

.form-card { max-width: 500px; margin: 2rem auto; background: var(--bg-card); padding: 2rem; border-radius: 12px; border: 1px solid var(--border); }
.form-card h2 { margin-bottom: 1.5rem; text-align: center; }
.form-card form p { margin-bottom: 1rem; }
.form-card label { display: block; margin-bottom: 0.3rem; color: var(--text-muted); }
.form-input, input[type=text], input[type=password], input[type=email], input[type=number], input[type=datetime-local], select, textarea {
    width: 100%; padding: 0.6rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-family: inherit;
}
.text-center { text-align: center; margin-top: 1rem; }
.text-center a { color: var(--accent); }

.profile-card { max-width: 600px; margin: 2rem auto; background: var(--bg-card); padding: 2rem; border-radius: 12px; border: 1px solid var(--border); }
.profile-info { display: flex; gap: 2rem; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.avatar, .avatar-placeholder { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder { background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: bold; }
.profile-details p { margin-bottom: 0.5rem; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }

.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.match-card { background: var(--bg-card); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); transition: border-color 0.2s; }
.match-card:hover { border-color: var(--accent); }
.match-card-header { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.match-card h3 { margin-bottom: 1rem; }
.match-info p { margin-bottom: 0.4rem; color: var(--text-muted); }
.match-info strong { color: var(--text); }

.badge { padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.8rem; }
.badge-format { background: var(--accent); color: white; }
.badge-open { background: var(--green); color: white; }
.badge-full { background: var(--gold); color: #333; }
.badge-teams_formed { background: #0984e3; color: white; }
.badge-in_progress { background: #6c5ce7; color: white; }
.badge-completed { background: #2d3436; color: #888; }
.badge-cancelled { background: var(--red); color: white; }
.badge-confirmed { background: var(--green); color: white; }
.badge-pending { background: var(--gold); color: #333; }

.match-detail { max-width: 900px; margin: 0 auto; }
.match-detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.match-badges { display: flex; gap: 0.5rem; }

.match-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat { background: var(--bg-card); padding: 1rem; border-radius: 8px; text-align: center; border: 1px solid var(--border); }
.stat-label { display: block; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.3rem; }
.stat-value { display: block; font-size: 1.2rem; font-weight: bold; }

.organizer-actions, .player-actions { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; align-items: center; }
.declare-winner { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.declare-winner h4 { margin-right: 0.5rem; }

.teams-section, .participants-section, .screenshots-section { margin-bottom: 2rem; }
.teams-section h3, .participants-section h3, .screenshots-section h3 { margin-bottom: 1rem; }

.teams-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.team-card { background: var(--bg-card); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); }
.team-winner { border-color: var(--gold); box-shadow: 0 0 10px rgba(253,203,110,0.3); }
.team-card h4 { margin-bottom: 1rem; }
.team-card ul { list-style: none; }
.team-card li { padding: 0.3rem 0; border-bottom: 1px solid var(--border); }

.participant-list { list-style: none; }
.participant-list li { padding: 0.5rem; background: var(--bg-card); border-radius: 6px; margin-bottom: 0.3rem; display: flex; justify-content: space-between; align-items: center; }

.screenshots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.screenshot-item { background: var(--bg-card); padding: 0.5rem; border-radius: 8px; border: 1px solid var(--border); }
.screenshot-item img { width: 100%; border-radius: 6px; }
.screenshot-item p { text-align: center; margin-top: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }

.wallet-card { max-width: 500px; margin: 2rem auto; background: var(--bg-card); padding: 2rem; border-radius: 12px; border: 1px solid var(--border); text-align: center; }
.balance-display { font-size: 2.5rem; font-weight: bold; color: var(--gold); margin: 1rem 0; }
.wallet-actions { display: flex; gap: 1rem; justify-content: center; }

.transactions-section { max-width: 800px; margin: 2rem auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.7rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-size: 0.85rem; }

.notifications-list { max-width: 700px; margin: 0 auto; }
.notification-item { background: var(--bg-card); padding: 1rem; border-radius: 8px; margin-bottom: 0.5rem; border: 1px solid var(--border); }
.notification-item.unread { border-left: 3px solid var(--accent); }
.notification-time { color: var(--text-muted); font-size: 0.8rem; }

.empty-state { color: var(--text-muted); text-align: center; padding: 2rem; }

@media (max-width: 768px) {
    .teams-grid { grid-template-columns: 1fr; }
    .navbar { flex-direction: column; }
    .nav-links { justify-content: center; }
}

.requisites-box { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-bottom: 1.5rem; }
.requisites-note { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.requisite-item { margin-bottom: 0.5rem; }
.requisite-label { color: var(--text-muted); }
.badge-pending { background: var(--gold); color: #333; }
.badge-processing { background: #0984e3; color: white; }
.badge-rejected { background: var(--red); color: white; }
.pending-section { max-width: 800px; margin: 2rem auto; }

.luckyball-page { max-width: 720px; margin: 0 auto; }

/* ===== Game Area ===== */
.game-area {
    height: 420px;
    background: radial-gradient(ellipse at 50% 100%, #1a1a4e 0%, #0a0a1a 70%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    box-shadow: inset 0 0 60px rgba(108,92,231,0.08);
}
.game-area::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.35), transparent),
        radial-gradient(1px 1px at 30% 80%, rgba(255,255,255,0.25), transparent),
        radial-gradient(1px 1px at 90% 50%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 10% 60%, rgba(255,255,255,0.2), transparent),
        radial-gradient(2px 2px at 70% 40%, rgba(108,92,231,0.3), transparent),
        radial-gradient(1px 1px at 45% 15%, rgba(255,255,255,0.3), transparent);
    background-size: 100% 100%;
    pointer-events: none;
    z-index: 0;
    animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.5; } to { opacity: 1; } }

.game-area::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(108,92,231,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108,92,231,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.multiplier-display {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: 900;
    color: var(--green);
    z-index: 2;
    text-shadow: 0 0 30px rgba(0,184,148,0.4), 0 0 60px rgba(0,184,148,0.15);
    letter-spacing: -2px;
    transition: color 0.3s, text-shadow 0.3s;
    font-variant-numeric: tabular-nums;
}
.multiplier-display.crashed {
    color: var(--red);
    text-shadow: 0 0 30px rgba(225,112,85,0.5);
    animation: shake 0.4s ease;
}
@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(-52%, -50%) rotate(-2deg); }
    75% { transform: translate(-48%, -50%) rotate(2deg); }
}

.balloon {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4.5rem;
    z-index: 1;
    transition: transform 0.05s linear;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
.balloon.flying { animation: sway 2s ease-in-out infinite; }
@keyframes sway {
    0%, 100% { margin-left: -8px; }
    50% { margin-left: 8px; }
}
.balloon.popped { animation: pop 0.3s ease-out forwards; }
@keyframes pop {
    0% { transform: translateX(-50%) scale(1); opacity: 1; }
    50% { transform: translateX(-50%) scale(1.5); opacity: 0.5; }
    100% { transform: translateX(-50%) scale(0.3); opacity: 0; }
}
.balloon.exploded { animation: explode 0.6s ease-out; }
@keyframes explode {
    0% { transform: translateX(-50%) scale(0.3); opacity: 0; }
    15% { transform: translateX(-50%) scale(2.2); opacity: 1; }
    30% { transform: translateX(-50%) scale(1.8); opacity: 1; }
    100% { transform: translateX(-50%) scale(1.8); opacity: 0.8; }
}
.game-area.crashed-bg { animation: crashFlash 0.5s ease; }
@keyframes crashFlash {
    0% { background: radial-gradient(ellipse at 50% 100%, #1a1a4e 0%, #0a0a1a 70%); }
    20% { background: radial-gradient(ellipse at 50% 100%, #4a1a1a 0%, #0a0a1a 70%); }
    100% { background: radial-gradient(ellipse at 50% 100%, #1a1a4e 0%, #0a0a1a 70%); }
}

.crash-message {
    position: absolute;
    top: 58%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.3rem;
    font-weight: bold;
    display: none;
    z-index: 3;
    text-align: center;
    white-space: nowrap;
}
.crash-message.show {
    display: block;
    animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.countdown-display {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: var(--text-muted);
    z-index: 3;
    background: rgba(0,0,0,0.4);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.trail-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(253,203,110,0.6);
    pointer-events: none;
    z-index: 1;
    animation: trailFade 0.8s ease-out forwards;
}
@keyframes trailFade {
    from { opacity: 0.8; transform: scale(1); }
    to { opacity: 0; transform: scale(0.2); }
}

/* ===== Info Bar ===== */
.game-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1.2rem;
    background: var(--bg-card);
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}
.game-info-bar strong { color: var(--gold); font-size: 1.1rem; }

/* ===== Controls ===== */
.game-controls {
    background: var(--bg-card);
    padding: 1.2rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}
.bet-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.bet-field { flex: 1; position: relative; }
.bet-field label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.bet-field input {
    width: 100%;
    padding: 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: bold;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.bet-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.15);
}

.btn-play {
    width: 100%;
    font-size: 1.15rem;
    padding: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--accent) 0%, #8e7ce8 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}
.btn-play:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(108,92,231,0.4);
    transform: translateY(-1px);
}
.btn-play:active:not(:disabled) { transform: translateY(0); }
.btn-play:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Cashout Buttons ===== */
.cashout-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.btn-cashout {
    flex: 1;
    min-width: 130px;
    padding: 0.7rem;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
}
.btn-cashout:hover:not(:disabled) {
    box-shadow: 0 4px 15px rgba(0,184,148,0.35);
    transform: translateY(-1px);
}
.btn-cashout:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-cashout.cashed { background: linear-gradient(135deg, #2d3436 0%, #4a4a4a 100%); opacity: 0.7; }

.btn-cashout-all {
    flex: 2;
    padding: 0.7rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
    background: linear-gradient(135deg, #fdcb6e 0%, #ffeaa7 100%);
    color: #333;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
.btn-cashout-all:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(253,203,110,0.4);
    transform: translateY(-1px);
}
.btn-cashout-all:disabled { opacity: 0.35; cursor: not-allowed; }

#stopAutoBtn {
    width: 100%;
    padding: 0.6rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: bold;
}

/* ===== Game Cards ===== */
.game-card-icon { font-size: 3rem; text-align: center; margin-bottom: 0.5rem; }

/* ===== Win popup ===== */
.win-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,184,148,0.15);
    border: 2px solid var(--green);
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--green);
    z-index: 4;
    pointer-events: none;
    animation: winPop 1.5s ease-out forwards;
    white-space: nowrap;
}
@keyframes winPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    30% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

@media (max-width: 600px) {
    .game-area { height: 320px; }
    .multiplier-display { font-size: 2.8rem; }
    .balloon { font-size: 3.5rem; }
    .bet-row { flex-direction: column; }
    .cashout-row { flex-direction: column; }
    .btn-cashout, .btn-cashout-all { min-width: 100%; }
}

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin: 2rem 0; }
.pagination span { color: var(--text-muted); }
.game-history { margin-top: 2rem; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* LuckyBall new layout */
.lb-layout { display: flex; gap: 1rem; }
.lb-history { flex: 0 0 120px; }
.lb-history h3 { font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--text-muted); text-transform: uppercase; }
.lb-history-list { display: flex; flex-direction: column; gap: 4px; max-height: 400px; overflow-y: auto; }
.lb-history-item { background: var(--bg-card); padding: 0.3rem 0.6rem; border-radius: 6px; font-size: 0.85rem; font-weight: bold; text-align: center; border: 1px solid var(--border); }
.lb-main { flex: 1; }
@media (max-width: 600px) { .lb-layout { flex-direction: column; } .lb-history { flex: none; } .lb-history-list { flex-direction: row; flex-wrap: wrap; max-height: none; } }

.bonus-card { max-width: 600px; margin: 1rem auto; background: var(--bg-card); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); text-align: center; }
.bonus-card h3 { margin-bottom: 0.5rem; }
.referral-card { max-width: 600px; margin: 1rem auto; background: var(--bg-card); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); }
.referral-card h3 { margin-bottom: 0.5rem; }
.referral-link-box { margin: 1rem 0; }
.referral-link-box label { display: block; margin-bottom: 0.3rem; color: var(--text-muted); font-size: 0.85rem; }
.referral-stats { display: flex; gap: 2rem; margin-top: 1rem; }
.referral-stats span { color: var(--text-muted); }
.referral-stats strong { color: var(--gold); }
.profile-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.analytics-chart { margin: 1rem 0; max-width: 800px; }
.analytics-bar { display: flex; align-items: end; gap: 4px; height: 120px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.analytics-bar-item { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.analytics-bar-label { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }
.analytics-bar-value { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 0.7rem; color: var(--text); white-space: nowrap; }

.bracket { display: flex; flex-direction: column; gap: 0.5rem; }
.bracket-match { background: var(--bg-card); padding: 0.8rem; border-radius: 8px; border: 1px solid var(--border); }
.bracket-match.bracket-completed { border-color: var(--green); }
.bracket-round { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; display: block; margin-bottom: 0.3rem; }
.bracket-teams { display: flex; gap: 0.5rem; margin-bottom: 0.3rem; }
.bracket-team { flex: 1; padding: 0.3rem 0.5rem; background: var(--bg); border-radius: 4px; text-align: center; font-size: 0.85rem; }
.bracket-team.bracket-winner { background: rgba(0,184,148,0.15); color: var(--green); font-weight: bold; }
.bracket-actions { display: flex; gap: 0.3rem; }
.bracket-actions button { flex: 1; }

/* Tournament Bracket */
.bracket-container { display: flex; gap: 1.5rem; overflow-x: auto; padding: 1rem 0; }
.bracket-column { display: flex; flex-direction: column; gap: 1rem; min-width: 220px; }
.bracket-round-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; text-align: center; margin-bottom: 0.3rem; font-weight: 600; }
.bracket-match { background: var(--bg-card); padding: 0.6rem; border-radius: 8px; border: 1px solid var(--border); transition: border-color 0.2s; }
.bracket-match.bracket-completed { border-color: var(--green); }
.bracket-match.bracket-final { border-color: var(--gold); }
.bracket-match.bracket-third { border-color: #cd7f32; }
.bracket-round-title { font-size: 0.75rem; color: var(--text-muted); text-align: center; margin-bottom: 0.3rem; font-weight: 600; }
.bracket-team { display: flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.5rem; background: var(--bg); border-radius: 4px; margin-bottom: 0.3rem; font-size: 0.8rem; }
.bracket-team.bracket-winner { background: rgba(0,184,148,0.15); border-left: 3px solid var(--green); font-weight: bold; }
.team-num { background: var(--accent); color: white; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.7rem; font-weight: bold; min-width: 24px; text-align: center; }
.bracket-winner .team-num { background: var(--green); }
.team-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: 0.75rem; }
.bracket-winner .team-name { color: var(--text); }
.bracket-result { font-size: 0.75rem; text-align: center; padding: 0.2rem; color: var(--green); font-weight: 600; }
.bracket-result.champion { color: var(--gold); font-size: 0.85rem; }
.bracket-result.pending { color: var(--text-muted); font-weight: 400; }
.bracket-actions { display: flex; gap: 0.3rem; margin-top: 0.3rem; }
.bracket-actions form { display: flex; gap: 0.3rem; width: 100%; }
.bracket-actions button { flex: 1; font-size: 0.7rem; padding: 0.3rem; }
@media (max-width: 768px) { .bracket-container { flex-direction: column; } .bracket-column { min-width: 100%; } }

/* Player stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.8rem; max-width: 700px; margin: 1rem auto; }
.stat-card { background: var(--bg-card); padding: 1rem; border-radius: 10px; border: 1px solid var(--border); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.stat-icon { font-size: 1.5rem; }
.stat-num { font-size: 1.3rem; font-weight: bold; color: var(--gold); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-align: center; }
.tournament-history { max-width: 700px; margin: 1rem auto; }
.tournament-history h3 { margin-bottom: 0.5rem; }
/* Mobile responsive */
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .match-stats { grid-template-columns: repeat(2, 1fr) !important; }
    .teams-grid { grid-template-columns: 1fr !important; }
    .bracket-container { flex-direction: column; }
    .bracket-column { min-width: 100%; }
    .form-card { max-width: 100%; }
    .profile-info { flex-direction: column; align-items: center; }
    .referral-stats { flex-direction: column; gap: 0.5rem; }
    .hero h1 { font-size: 1.5rem; }
    .features { grid-template-columns: 1fr !important; }
    .match-grid { grid-template-columns: 1fr !important; }
    .table { font-size: 0.8rem; }
    .table th, .table td { padding: 0.4rem; }
}

.rank-gold { background: rgba(255,215,0,0.1); }
.rank-silver { background: rgba(192,192,192,0.1); }
.rank-bronze { background: rgba(205,127,50,0.1); }

/* Mini-games as mini-cards */
.minigame-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.minigame-mini { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.7rem 0.4rem; border-radius: 10px; border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: border-color 0.2s, background 0.2s; text-align: center; }
.minigame-mini:hover:not(.disabled) { border-color: var(--accent); background: rgba(0,184,148,0.05); }
.minigame-mini.disabled { opacity: 0.5; cursor: default; }
.minigame-mini-icon { font-size: 1.6rem; }
.minigame-mini-name { font-size: 0.8rem; }
.minigame-mini-soon { font-size: 0.6rem; color: var(--text-muted); }

/* === Profile row layout === */
.profile-row { display: flex; gap: 1.5rem; max-width: 1300px; margin: 2rem auto; align-items: flex-start; }
.profile-left-col { flex: 0 0 260px; display: flex; flex-direction: column; gap: 1rem; }
.profile-center-col { flex: 1; min-width: 0; }
.profile-right-col { flex: 0 0 240px; }

/* Override old max-width/margin for cards inside profile-row */
.profile-row .profile-card { max-width: none; margin: 0; }
.profile-row .profile-mini-card { background: var(--bg-card); padding: 1.2rem; border-radius: 12px; border: 1px solid var(--border); }
.profile-row .profile-mini-card h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.profile-row .profile-mini-card p { font-size: 0.85rem; margin-bottom: 0.5rem; }
.profile-row .referral-link-box { margin: 0.5rem 0; }
.profile-row .referral-stats { display: flex; gap: 1rem; margin-top: 0.5rem; font-size: 0.8rem; }
.profile-row .stats-grid { max-width: none; margin: 1rem 0; }
.profile-row .tournament-history { max-width: none; }

/* Mini-game cards grid */
.mg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.mg-card { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.8rem 0.5rem; border-radius: 10px; border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: border-color 0.2s, background 0.2s; text-align: center; background: var(--bg-card); }
.mg-card:hover:not(.mg-disabled) { border-color: var(--accent); background: rgba(0,184,148,0.08); transform: translateY(-2px); }
.mg-disabled { opacity: 0.45; cursor: default; }
.mg-icon { font-size: 1.8rem; }
.mg-name { font-size: 0.8rem; font-weight: 600; }
.mg-soon { font-size: 0.65rem; color: var(--text-muted); }

/* === Combined leaderboard === */
.leaderboard-combined { display: flex; gap: 2rem; max-width: 1000px; margin: 0 auto; }
.leaderboard-column { flex: 1; min-width: 0; }
.leaderboard-column h3 { margin-bottom: 1rem; text-align: center; }

/* === Mobile === */
@media (max-width: 768px) {
    .profile-row { flex-direction: column; }
    .profile-left-col, .profile-right-col { flex: none; width: 100%; }
    .leaderboard-combined { flex-direction: column; gap: 1.5rem; }
}

.footer-legal { font-size: 12px; color: var(--text-muted); margin-top: 0.5rem; opacity: 0.7; line-height: 1.5; }
