/* --- Body and page --- */
body {
    background: #1e1e2f;
    font-family: Arial, sans-serif;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: center;
    margin: 0;
}

/* --- Main container --- */
.container {
    display: flex;
    flex-direction: column;    /* stack on mobile */
    gap: 20px;
    width: 95%;
    max-width: 1200px;
    padding: 30px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 15px;
}

/* --- Desktop layout --- */
@media (min-width: 768px) {
    .container {
        flex-direction: row; /* main + sidebar side by side */
    }

    .main {
        flex: 3; /* main content wider */
    }

    .sidebar {
        flex: 1; /* leaderboard narrower */
        border-left: 1px solid rgba(255,255,255,0.2);
        padding-left: 20px;
    }
}

/* --- Mobile: stack and adjust --- */
@media (max-width: 767px) {
    .sidebar {
        border-left: none;
        padding-left: 0;
    }

    .sidebar table, .main table {
        font-size: 12px;  /* slightly smaller text */
    }

    input[type="email"], button {
        font-size: 14px;  /* smaller inputs/buttons */
        padding: 8px;
    }
}

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    vertical-align: middle;
    word-wrap: break-word;   /* prevent overflow */
}

/* Battle results table headers */
#resultsTable th {
    text-align: center;
}

#resultsTable th:first-child {
    text-align: left;
}

/* Data cells */
#resultsTable td {
    text-align: center;
}

#resultsTable td:first-child {
    text-align: left;
}

/* Sidebar tables */
.sidebar table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.sidebar th, .sidebar td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 14px;
    text-align: left;
}

/* --- Inputs and Buttons --- */
input[type="email"],
button {
    width: 100%;
    padding: 10px;
    font-size: 15px;
    border-radius: 8px;
    border: none;
    margin-top: 5px;
    margin-bottom: 15px;
    box-sizing: border-box;
    display: block;
}

/* Button-specific styles */
button {
    background: #4CAF50;
    color: white;
    cursor: pointer;
}

button:hover {
    background: #45a049;
}

/* --- Icons --- */
.icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 8px;
    vertical-align: middle;
}

/* --- Tooltip --- */
.tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 160px;
    background: black;
    color: #fff;
    text-align: center;
    padding: 5px;
    border-radius: 6px;

    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* --- Spinner --- */
.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #888;
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Overall winner animation --- */
#overall {
    font-weight: bold;
    font-size: 18px;
    color: #FFD700;
    background-color: rgba(255, 215, 0, 0.1);
    text-align: center;
    border-top: 2px solid #FFD700;
    opacity: 0;
    transition: opacity 1s ease-in-out, text-shadow 1s ease-in-out;
}

.glow {
    text-shadow: 0 0 8px #FFD700, 0 0 15px #FFD700;
    opacity: 1;
}

/* --- Top player row animation --- */
.top-player {
    animation: pulseGold 1s ease-in-out 0s 4;
}

@keyframes pulseGold {
    0% { background-color: rgba(255, 215, 0, 0.1); }
    50% { background-color: rgba(255, 215, 0, 0.4); }
    100% { background-color: rgba(255, 215, 0, 0.1); }
}

/* Make top banner image responsive */
.banner {
    width: 100%;       /* fill available width */
    max-width: 875px;  /* don't exceed original size */
    height: auto;      /* maintain aspect ratio */
    display: block;    /* remove inline spacing issues */
    margin: 0 auto 20px auto; /* center with bottom margin */
}