/* Group Battle Premium Stylesheet */

.group-battle-wrapper {
    display: flex;
    gap: 24px;
    margin: 20px auto;
    width: 100%;
    max-width: 100%;
    align-items: flex-start;
    justify-content: center;
    box-sizing: border-box;
    padding: 0 20px;
    position: relative;
}

.gb-main-container {
    flex: 0 0 792px;
    width: 792px;
    max-width: 792px;
    margin: 0 auto;
    box-sizing: border-box;
}

.gb-layout {
    display: flex;
    gap: 24px;
    width: 100%;
}

.gb-game-column {
    flex: 1;
    min-width: 0; /* Prevents flex items from overflowing */
}

.gb-sidebar-column {
    width: 300px;
    max-width: 300px;
    height: 100%;
    flex-shrink: 0;
    position: absolute;
    right: 20px;
    top: 0;
}

/* Glassmorphic Card Styling */
.gb-card {
    background: rgba(26, 32, 44, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    margin-bottom: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gb-title {
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #ffffff;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #a578fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gb-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin-bottom: 30px;
}

/* Lobby Action Layout */
.lobby-action-boxes {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.lobby-action-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.lobby-divider-vertical {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    align-self: stretch;
}

.gb-section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    color: #a578fa;
    margin-bottom: 20px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Input Fields */
.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    align-items: center;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    width: 100%;
}

.input-group input {
    background: rgba(15, 20, 28, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    color: #ffffff !important;
    font-family: 'Space Grotesk', sans-serif !important;
    font-size: 1rem !important;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.input-group select,
.game-select-custom,
.host-settings-row select {
    background: rgba(15, 20, 28, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    color: #ffffff !important;
    font-family: 'Space Grotesk', sans-serif !important;
    font-size: 1rem !important;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 18px !important;
    padding-right: 36px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.input-group input:focus,
.input-group select:focus,
.game-select-custom:focus {
    border-color: #a578fa !important;
    box-shadow: 0 0 0 3px rgba(165, 120, 250, 0.25) !important;
}

/* Buttons */
.btn-gb {
    background: linear-gradient(135deg, #a578fa, #5d5491);
    border: none;
    color: #ffffff;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(165, 120, 250, 0.25);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    font-family: 'Space Grotesk', sans-serif;
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
    margin: 10px auto 0 auto;
}

.btn-gb:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(165, 120, 250, 0.35);
    filter: brightness(1.05);
}

.btn-gb:active {
    transform: translateY(0);
}

.btn-gb--secondary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

.btn-gb--secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-gb--success {
    background: linear-gradient(135deg, #00c9ff, #92fe9d);
    box-shadow: 0 10px 20px rgba(146, 254, 157, 0.25);
    color: #121820;
}

.btn-gb--success:hover {
    box-shadow: 0 14px 24px rgba(146, 254, 157, 0.35);
}

.lobby-error {
    color: #ff6d6d;
    font-weight: 500;
    margin-top: 15px;
    text-align: center;
    font-size: 0.9rem;
}

/* Waiting Room / Invite Section */
.invite-card {
    background: rgba(15, 20, 28, 0.5);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.invite-card p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.invite-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.lobby-code-badge {
    background: #a578fa;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.2rem;
    padding: 10px 16px;
    border-radius: 10px;
    font-family: 'Space Grotesk', monospace;
    letter-spacing: 1px;
}

#copy-link-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
}

.btn-copy {
    background: #ffffff;
    color: #121820;
    border: none;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn-copy:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.copy-success-text {
    color: #92fe9d;
    font-size: 0.85rem;
    margin-top: 8px;
    display: none;
}

/* Host Settings */
.host-controls-card {
    background: rgba(165, 120, 250, 0.05);
    border: 1px solid rgba(165, 120, 250, 0.2);
    border-radius: 16px;
    padding: 20px;
}

.host-settings-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.host-settings-row .input-group {
    flex: 1;
    margin-bottom: 0;
}

.btn-start-game {
    width: 100%;
}

.player-wait-card {
    text-align: center;
    padding: 30px 20px;
}

.waiting-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(165, 120, 250, 0.2);
    border-top: 3px solid #a578fa;
    border-radius: 50%;
    margin: 0 auto 20px auto;
    animation: spin 1s linear infinite;
}

.settings-summary {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 10px;
}

/* Active Game Status Bar */
.round-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.round-index-badge {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.countdown-badge {
    background: rgba(255, 109, 109, 0.15);
    border: 1px solid rgba(255, 109, 109, 0.3);
    color: #ff6d6d;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulse 1.5s infinite;
}

/* Sidebar Leaderboard */
.sidebar-leaderboard-card {
    padding: 24px;
    position: sticky;
    top: 20px;
}

.sidebar-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-meta {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.sidebar-divider {
    border: none;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 16px 0;
}

.sidebar-player-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.player-list-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 14px;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.player-list-item.is-me {
    background: rgba(165, 120, 250, 0.08);
    border-color: rgba(165, 120, 250, 0.25);
}

.player-list-item.is-offline {
    opacity: 0.5;
}

.player-rank {
    width: 24px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
    font-family: 'Space Grotesk', sans-serif;
    margin-right: 12px;
}

.player-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 0.8rem;
    color: #ffffff;
}

.player-list-item.is-host .player-avatar {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.player-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #ffffff;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-status-text {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 2px;
}

.player-status-text.status-thinking {
    color: rgba(255, 255, 255, 0.4);
}

.player-status-text.status-guessed {
    color: #92fe9d;
    font-weight: 600;
}

.player-status-text.status-disconnected {
    color: #ff6d6d;
}

.player-score-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.player-score {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffffff;
}

.player-points-badge {
    background: #92fe9d;
    color: #121820;
    font-weight: 700;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 3px;
    animation: fadeInUp 0.4s ease both;
}

.player-points-badge.points-zero {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
}

/* Guess Result Locked Overlay */
.result-message-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(18, 24, 32, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
}

.locked-rank-img-placeholder img {
    height: 90px;
    margin: 20px 0;
    filter: drop-shadow(0 0 15px rgba(165, 120, 250, 0.3));
}

/* Review Phase Results Card */
.round-review-card {
    background: rgba(26, 32, 44, 0.95);
    border-color: rgba(165, 120, 250, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    animation: fadeInUp 0.5s ease both;
}

.review-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    text-align: center;
    color: #ffffff;
    margin-bottom: 24px;
    text-transform: uppercase;
}

.review-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.review-rank-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.review-rank-details p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.correct-rank-image img {
    height: 100px;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 20px rgba(165, 120, 250, 0.4));
}

#review-correct-rank-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: #ffffff;
    text-transform: uppercase;
}

.review-stats {
    flex: 2;
    display: flex;
    flex-direction: column;
}

.review-stats p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 14px;
    text-transform: uppercase;
}

/* Distribution Chart */
.dist-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 170px;
    overflow-y: auto;
    padding-right: 8px;
}

.dist-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dist-label {
    width: 80px;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.dist-bar-container {
    flex: 1;
    height: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.dist-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #5d5491, #a578fa);
    border-radius: 6px;
    transition: width 1s ease-out;
}

.dist-bar-row.is-correct .dist-bar-fill {
    background: linear-gradient(90deg, #3cb371, #92fe9d);
}

.dist-percent {
    width: 45px;
    font-size: 0.8rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: #ffffff;
    text-align: right;
}

.review-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 20px;
}

#review-countdown-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

/* Game Finished Scoreboard */
.game-over-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    color: #ffd700;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.final-scoreboard-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 30px;
}

.final-scoreboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.final-scoreboard-table th {
    padding: 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.final-scoreboard-table td {
    padding: 16px 14px;
    font-size: 1rem;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.final-scoreboard-table tr:last-child td {
    border-bottom: none;
}

.final-scoreboard-table tr.scoreboard-row-1 {
    background: rgba(255, 215, 0, 0.05);
}

.final-scoreboard-table tr.scoreboard-row-1 td {
    font-weight: 700;
    color: #ffd700;
}

.scoreboard-place-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

tr.scoreboard-row-1 .scoreboard-place-badge {
    background: #ffd700;
    color: #121820;
}

tr.scoreboard-row-2 .scoreboard-place-badge {
    background: #c0c0c0;
    color: #121820;
}

tr.scoreboard-row-3 .scoreboard-place-badge {
    background: #cd7f32;
    color: #121820;
}

.game-over-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
}

.player-finished-info {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
}

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

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

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

/* General Layout Utilities */
.is-hidden {
    display: none !important;
}

.gb-view-section {
    animation: fadeInUp 0.4s ease both;
}

/* Responsive Overrides */
@media (max-width: 900px) {
    .group-battle-wrapper {
        flex-direction: column;
        position: static;
    }
    .gb-main-container {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
    }
    .gb-layout {
        flex-direction: column;
    }
    .gb-sidebar-column {
        position: static;
        width: 100%;
        max-width: 100%;
    }
    .lobby-action-boxes {
        flex-direction: column;
        gap: 20px;
    }
    .lobby-divider-vertical {
        height: 1px;
        width: 100%;
    }
    .review-layout {
        flex-direction: column;
        gap: 20px;
    }
}



/* Group Battle Styles Overrides & Layout Polish */
.round-status-bar {
    justify-content: center !important;
    gap: 16px !important;
}

.lobby-action-box {
    align-items: center !important;
    text-align: center !important;
}

.lobby-action-box .input-group,
#nickname-prompt-screen .input-group {
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto 20px auto !important;
    align-items: center !important;
}

.input-group label {
    text-align: center !important;
    display: block !important;
    width: 100% !important;
}

.lobby-action-box .input-group input,
.lobby-action-box .input-group select,
.lobby-action-box .game-select-custom,
#nickname-prompt-screen .input-group input,
#host-controls select {
    width: 100% !important;
    max-width: 320px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    text-align-last: center !important;
}

.lobby-action-box select option,
#host-controls select option {
    text-align: center !important;
}

.lobby-action-box .btn-gb,
#nickname-prompt-screen .btn-gb {
    width: 100% !important;
    max-width: 320px !important;
    margin: 10px auto 0 auto !important;
    box-sizing: border-box !important;
}

#nickname-prompt-screen {
    text-align: center !important;
}

@media (min-width: 901px) {
    .group-battle-wrapper {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 20px auto !important;
        align-items: flex-start !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        padding: 0 20px !important;
        position: relative !important;
    }

    .gb-main-container {
        flex: 0 0 792px !important;
        width: 792px !important;
        max-width: 792px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

    .gb-sidebar-column {
        position: absolute !important;
        right: 20px !important;
        top: 0 !important;
        width: 300px !important;
        max-width: 300px !important;
        height: 100% !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }

    .group-battle-wrapper > .side {
        position: absolute !important;
        left: 20px !important;
        top: 0 !important;
        margin: 0 !important;
    }
}

#host-controls {
    text-align: center !important;
}

#host-controls .host-settings-row {
    justify-content: center !important;
}

#host-controls .input-group {
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto 20px auto !important;
    align-items: center !important;
}

#host-controls .btn-start-game {
    width: 100% !important;
    max-width: 320px !important;
    margin: 20px auto 0 auto !important;
    box-sizing: border-box !important;
}

.player-wait-card {
    color: #ffffff !important;
    text-align: center !important;
}

.player-wait-card p {
    color: rgba(255, 255, 255, 0.9) !important;
}

.player-wait-card b {
    color: #a578fa !important;
}

.gb-main-container .ranks {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    margin-top: 40px !important;
    margin-bottom: 50px !important;
    width: 100% !important;
}

.gb-main-container .ranks img {
    width: 7.2% !important;
    min-width: 42px !important;
    max-width: 60px !important;
    height: auto !important;
    margin-left: 1% !important;
    margin-right: 1% !important;
    margin-bottom: 1rem !important;
    transform: translateZ(0) !important;
    transition: opacity var(--gr-motion-fast) ease, filter var(--gr-motion-fast) ease, transform var(--gr-motion-fast) var(--gr-motion-ease) !important;
}

.gb-main-container .ranks-cs img {
    width: 9.8% !important;
    min-width: 52px !important;
    max-width: 80px !important;
    height: auto !important;
    margin-left: 1.2% !important;
    margin-right: 1.2% !important;
    margin-bottom: 1rem !important;
    transform: translateZ(0) !important;
    transition: opacity var(--gr-motion-fast) ease, filter var(--gr-motion-fast) ease, transform var(--gr-motion-fast) var(--gr-motion-ease) !important;
}

.input-help-text {
    font-size: 0.75rem !important;
    color: rgba(255, 255, 255, 0.4) !important;
    margin-top: 6px !important;
    text-align: center !important;
    line-height: 1.3 !important;
    display: block !important;
}



