
/* =========================================================
   BATLINGO - PVP SOCIAL LOBBY
========================================================= */

.pvp-screen:not(.battle-mode):not(.result-mode) {
    align-items: flex-start;
    overflow-y: auto;
}

.pvp-screen:not(.battle-mode):not(.result-mode)
.pvp-container {
    width: min(100%, 950px);
    margin: auto;
    padding: 18px 0 55px;
}

/* HEADER */

.pvp-social-head,
.pvp-social-actions,
.pvp-room-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pvp-social-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 900;
    color: #fbbf24;
}

#pvpOnlineCount {
    color: #86efac;
    font-size: 12px;
    font-weight: 800;
}

/* CREATE / JOIN */

.pvp-social-actions {
    margin: 16px 0;
}

.pvp-social-actions > button,
.pvp-code-join button,
.pvp-list-item > button,
.pvp-room-controls button,
#pvpToggleSettings,
#pvpSaveSettings,
#pvpTransferHost,
#pvpFriendAction {
    min-height: 44px;
    padding: 12px 18px;
    border: 1px solid #475569;
    border-radius: 10px;
    background: #fbbf24;
    color: #111827;
    font-weight: 800;
    cursor: pointer;
}

.pvp-social-actions > button:first-child {
    flex: 1;
}

.pvp-code-join {
    display: flex;
    flex: 1;
    gap: 8px;
    min-width: 230px;
}

.pvp-code-join input,
.pvp-social-panel input,
.pvp-social-panel select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px;
    background: #111827;
    color: #f8fafc;
    border: 1px solid #475569;
    border-radius: 10px;
    outline: none;
    font-size: 14px;
}

.pvp-code-join input:focus,
.pvp-social-panel input:focus,
.pvp-social-panel select:focus {
    border-color: #fbbf24;
}

.pvp-code-join input {
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 3px;
}

/* TABS */

.pvp-social-tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0 12px;
    overflow-x: auto;
}

.pvp-social-tabs button {
    flex: 1;
    padding: 13px 10px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #111827;
    color: #cbd5e1;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.pvp-social-tabs button.selected {
    border-color: #fbbf24;
    background: #334155;
    color: #fbbf24;
}

/* ROOM / PLAYER LIST */

.pvp-social-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 100px;
    max-height: 48vh;
    overflow-y: auto;
    text-align: left;
}

.pvp-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px;
    background: rgba(15, 23, 42, .94);
    border: 1px solid #334155;
    border-radius: 13px;
    color: #f8fafc;
    text-align: left;
}

.pvp-list-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.pvp-list-item strong {
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pvp-list-item small {
    color: #94a3b8;
    font-size: 12px;
}

.pvp-list-item > button {
    margin-left: auto;
    padding: 9px 17px;
}

.pvp-player-row {
    cursor: pointer;
    font: inherit;
}

.pvp-player-row:hover,
.pvp-list-item:hover {
    border-color: #fbbf24;
}

.pvp-mini-avatar {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #334155;
    overflow: hidden;
    font-size: 25px;
}

.pvp-mini-avatar img,
.player-avatar img,
.pvp-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.pvp-online-dot {
    color: #22c55e;
}

.pvp-empty {
    padding: 28px 10px;
    text-align: center;
    color: #94a3b8;
}

/* SETTINGS */

.pvp-social-panel {
    display: grid;
    gap: 12px;
    padding: 20px;
    margin: 15px 0;
    background: rgba(15, 23, 42, .97);
    border: 1px solid #475569;
    border-radius: 16px;
    text-align: left;
}

.pvp-social-panel h3 {
    margin: 0;
    color: #fbbf24;
    font-size: 16px;
}

.pvp-social-panel label {
    display: grid;
    gap: 7px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}

.pvp-subtle,
#pvpTransferHost {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

.pvp-room-controls {
    margin-bottom: 15px;
    color: #fbbf24;
}

#pvpWaitingTitle {
    font-size: 17px;
}

#pvpWaitingVisibility {
    color: #cbd5e1;
    font-size: 12px;
}

#pvpToggleSettings {
    width: 100%;
    background: #1e293b;
    color: #ffffff;
}

#pvpSocialMessage {
    min-height: 18px;
    color: #fca5a5;
    font-size: 12px;
}

/* PLAYER AVATAR */

.player-avatar[role="button"] {
    cursor: pointer;
    overflow: hidden;
    transition: transform .2s, border-color .2s;
}

.player-avatar[role="button"]:hover {
    transform: scale(1.06);
    border-color: #fbbf24;
}

/* PROFILE MODAL */

.pvp-profile-modal {
    position: fixed;
    z-index: 20000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, .78);
}

.pvp-profile-modal.hidden {
    display: none !important;
}

.pvp-profile-card {
    position: relative;
    width: min(100%, 390px);
    padding: 28px 22px;
    background: #101827;
    border: 1px solid #475569;
    border-radius: 20px;
    color: #f8fafc;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .5);
}

.pvp-profile-close {
    position: absolute;
    right: 15px;
    top: 12px;
    padding: 5px;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
}

.pvp-profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 86px;
    height: 86px;
    margin: 0 auto 12px;
    background: #334155;
    border-radius: 50%;
    overflow: hidden;
    font-size: 40px;
}

.pvp-profile-card h3 {
    margin: 8px 0;
    font-size: 21px;
}

.pvp-profile-card p {
    color: #cbd5e1;
    font-size: 13px;
    overflow-wrap: anywhere;
}

#pvpFriendAction {
    width: 100%;
}

#pvpFriendFeedback {
    min-height: 16px;
}

/* MOBILE */

@media (max-width: 600px) {

    .pvp-screen:not(.battle-mode):not(.result-mode) {
        padding: 65px 12px 25px;
    }

    .pvp-screen:not(.battle-mode):not(.result-mode)
    .pvp-container {
        width: 100%;
        padding: 0;
    }

    .pvp-social-head h2 {
        font-size: 17px;
    }

    .pvp-social-tabs button {
        padding: 12px 6px;
        font-size: 11px;
    }

    .pvp-code-join {
        flex-basis: 100%;
        width: 100%;
    }

    .pvp-social-actions > button:first-child {
        flex-basis: 100%;
    }

    .pvp-list-item {
        padding: 11px;
        gap: 9px;
    }

    .pvp-mini-avatar {
        width: 39px;
        height: 39px;
    }

    .pvp-list-item strong {
        font-size: 12px;
    }
}


/* =========================================================
   BATLINGO - PREMIUM ROOM CODE INPUT
========================================================= */

.pvp-code-join {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.pvp-code-join #roomCodeInput {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 54px;

    padding: 12px 14px;

    background: linear-gradient(
        145deg,
        #0b1220,
        #172338
    );

    border: 2px solid #334155;
    border-radius: 13px;

    color: #fbbf24;
    font-family: inherit;
    font-size: 22px;
    font-weight: 900;

    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;

    font-variant-numeric: tabular-nums;

    outline: none;

    transition:
        border-color .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}

.pvp-code-join #roomCodeInput::placeholder {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    opacity: 1;
}

.pvp-code-join #roomCodeInput:focus {
    border-color: #fbbf24;

    background: #0b1425;

    box-shadow:
        0 0 0 3px rgba(251, 191, 36, .12),
        0 0 20px rgba(251, 191, 36, .10);
}

.pvp-code-join #roomCodeInput:not(:placeholder-shown) {
    border-color: #64748b;
}

.pvp-code-join #roomCodeInput:not(:placeholder-shown):focus {
    border-color: #fbbf24;
}

.pvp-code-join #joinRoomButton {
    flex: 0 0 auto;

    min-width: 93px;
    height: 54px;

    padding: 0 18px;

    border: 0;
    border-radius: 13px;

    background: linear-gradient(
        135deg,
        #fbbf24,
        #f59e0b
    );

    color: #111827;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .5px;

    cursor: pointer;

    box-shadow:
        0 4px 14px rgba(245, 158, 11, .20);

    transition:
        transform .2s ease,
        filter .2s ease;
}

.pvp-code-join #joinRoomButton:hover {
    filter: brightness(1.10);
    transform: translateY(-2px);
}

.pvp-code-join #joinRoomButton:active {
    transform: scale(.97);
}

@media (max-width: 600px) {

    .pvp-code-join {
        gap: 8px;
        width: 100%;
    }

    .pvp-code-join #roomCodeInput {
        height: 50px;
        font-size: 19px;
        letter-spacing: 3px;
    }

    .pvp-code-join #joinRoomButton {
        min-width: 78px;
        height: 50px;
        padding: 0 12px;
        font-size: 12px;
    }
}

/* ==========================================
   PVP WAITING ROOM TOOLBAR
========================================== */

#pvpScreen .pvp-room-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    width: 100%;
    margin-bottom: 14px;
}

.pvp-room-toolbar-left,
.pvp-room-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pvp-room-toolbar-left {
    position: relative;
}

.pvp-toolbar-icon,
.pvp-toolbar-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    height: 38px;
    min-height: 38px;

    padding: 0 12px;

    border: 1px solid #475569;
    border-radius: 10px;

    background: rgba(15, 23, 42, .95);
    color: #f8fafc;

    font-size: 13px;
    font-weight: 800;

    cursor: pointer;

    transition:
        background .2s,
        border-color .2s,
        transform .2s;
}

.pvp-toolbar-icon {
    width: 38px;
    padding: 0;
    font-size: 19px;
}

.pvp-toolbar-icon:hover,
.pvp-toolbar-small:hover {
    background: #334155;
    border-color: #fbbf24;
    transform: translateY(-1px);
}

#pvpScreen #pvpToggleSettings {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;

    background: rgba(15, 23, 42, .95);
    color: #f8fafc;
    border: 1px solid #475569;
}

#pvpScreen #pvpCopyCode {
    min-height: 38px;
    height: 38px;
    padding: 0 12px;

    background: #1e293b;
    color: #fbbf24;
}

#pvpWaitingVisibility {
    font-size: 11px;
    white-space: nowrap;
}

@media (max-width: 600px) {

    .pvp-toolbar-small {
        font-size: 11px;
        padding: 0 9px;
    }

    .pvp-room-toolbar-right {
        gap: 5px;
    }
}
/* ==========================================
   PVP EMOJI PICKER
========================================== */

.pvp-emoji-picker {
    position: absolute;
    top: 46px;
    left: 0;
    z-index: 100;

    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;

    width: 216px;
    padding: 10px;

    background: #101827;
    border: 1px solid #475569;
    border-radius: 14px;

    box-shadow: 0 12px 35px rgba(0, 0, 0, .5);
}

.pvp-emoji-picker.hidden {
    display: none !important;
}

.pvp-emoji-option {
    width: 42px;
    height: 42px;
    padding: 0;

    border: 1px solid transparent;
    border-radius: 9px;

    background: #1e293b;
    font-size: 23px;

    cursor: pointer;
}

.pvp-emoji-option:hover {
    background: #334155;
    border-color: #fbbf24;
}

.pvp-reaction-display {
    min-height: 42px;
    text-align: center;
    font-size: 29px;
    letter-spacing: 12px;
}

/* ==========================================
   PVP INVITE SYSTEM
========================================== */

.pvp-invite-section {
    margin: 14px 0 20px;
}

.pvp-invite-main-btn {
    width: 100%;
    min-height: 46px;
    padding: 12px;

    border: 1px solid #fbbf24;
    border-radius: 12px;

    background: rgba(251, 191, 36, .10);
    color: #fbbf24;

    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.pvp-invite-main-btn:hover {
    background: rgba(251, 191, 36, .20);
}

.pvp-invite-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pvp-invite-tabs button {
    padding: 12px;
    border: 1px solid #475569;
    border-radius: 10px;

    background: #1e293b;
    color: #f8fafc;
    font-weight: 800;

    cursor: pointer;
}

#pvpInviteList {
    display: flex;
    flex-direction: column;
    gap: 9px;

    max-height: 300px;
    overflow-y: auto;
}

.pvp-incoming-invites {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.pvp-invite-notification {
    padding: 18px;
    border: 1px solid #fbbf24;
    border-radius: 14px;

    background: #172338;
    color: #fff;

    box-shadow: 0 5px 25px rgba(0, 0, 0, .3);
}

.pvp-invite-notification > strong {
    color: #fbbf24;
    font-size: 14px;
}

.pvp-invite-notification p {
    color: #cbd5e1;
    line-height: 1.6;
}

.pvp-invite-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pvp-invite-actions button {
    padding: 12px;
    min-height: 44px;

    border: 1px solid #475569;
    border-radius: 10px;

    background: #334155;
    color: #fff;
    font-weight: 800;

    cursor: pointer;
}

.pvp-invite-actions button:last-child {
    background: #fbbf24;
    border-color: #fbbf24;
    color: #111827;
}

/* =========================================================
   BATLINGO PVP - WAITING ROOM LAYOUT FIX
========================================================= */

/* Main container */

#pvpScreen:not(.battle-mode):not(.result-mode)
.pvp-container {
    width: min(100%, 900px);
    margin: 0 auto;
    padding: 24px 0 50px;
}

/* Waiting room */

#pvpScreen #waitingRoomPanel {
    box-sizing: border-box;

    width: 100%;
    max-width: 760px;

    margin: 20px auto 0;
    padding: 24px;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;

    min-width: 0;

    border: 1px solid #334155;
    border-radius: 18px;

    background: rgba(15, 23, 42, .96);

    text-align: center;
}

/* Hidden must override display:flex */

#pvpScreen #waitingRoomPanel.hidden,
#pvpScreen #roomSelectPanel.hidden,
#pvpScreen .pvp-social-panel.hidden,
#pvpScreen .pvp-invite-section.hidden {
    display: none !important;
}

/* Room title */

#pvpScreen .pvp-room-title {
    max-width: 100%;
    margin: 0;

    font-size: clamp(16px, 2vw, 21px);
    font-weight: 900;

    color: #f8fafc;

    overflow-wrap: anywhere;
}

/* Toolbar */

#pvpScreen .pvp-room-controls {
    width: 100%;
    min-width: 0;

    margin: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-wrap: wrap;
    gap: 10px;
}

#pvpScreen .pvp-room-toolbar-left,
#pvpScreen .pvp-room-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;

    min-width: 0;
}

/* Room code */

#pvpScreen .current-room-code {
    max-width: 100%;

    margin: 0;
    padding: 4px 0;

    font-size: clamp(25px, 5vw, 43px);
    line-height: 1.2;

    letter-spacing: .12em;
    font-weight: 900;

    color: #fbbf24;

    overflow-wrap: anywhere;
}

#pvpScreen .waiting-label {
    margin: 0;
    font-size: 11px;
    letter-spacing: 2px;
}

#pvpScreen .room-code-help {
    margin: 0;

    font-size: 10px;
    line-height: 1.5;

    letter-spacing: 1px;
}

/* Players */

#pvpScreen .players-area {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        54px
        minmax(0, 1fr);

    align-items: center;
    gap: 12px;

    width: 100%;
    margin: 8px 0;
}

#pvpScreen .player-slot {
    min-width: 0;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 8px;
}

#pvpScreen .player-avatar {
    flex-shrink: 0;

    width: 78px;
    height: 78px;

    margin: 0;

    border-radius: 50%;
    overflow: hidden;
}

#pvpScreen .player-avatar img {
    display: block;

    width: 100%;
    height: 100%;

    border-radius: 50%;
    object-fit: cover;
}

#pvpScreen .room-player-name {
    width: 100%;
    max-width: 220px;

    font-size: 14px;
    font-weight: 900;
    line-height: 1.5;

    color: #ffffff;

    overflow-wrap: anywhere;
}

#pvpScreen .player-status {
    margin: 0;
    font-size: 10px;
}

#pvpScreen .room-vs {
    font-size: 23px;
    font-weight: 900;
    color: #fbbf24;
}

/* Emoji */

#pvpScreen .pvp-reaction-display {
    min-height: 0;

    font-size: 27px;
    line-height: 1.4;

    letter-spacing: 5px;
}

/* Settings panel */

#pvpScreen #pvpSettingsPanel {
    width: 100%;
    min-width: 0;

    margin: 0;
    box-sizing: border-box;
}

#pvpScreen #pvpSettingsPanel label {
    min-width: 0;
}

#pvpScreen #pvpSettingsPanel input,
#pvpScreen #pvpSettingsPanel select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

/* Invite section */

#pvpScreen #pvpInviteSection {
    width: 100%;
    margin: 0;
}

#pvpScreen #pvpInvitePanel {
    width: 100%;
    margin: 12px 0 0;
    box-sizing: border-box;
}

/* Buttons */

#pvpScreen #startBattleButton,
#pvpScreen #leaveRoomButton {
    width: 100%;
    box-sizing: border-box;
}

/* Responsive */

@media (max-width: 600px) {

    #pvpScreen #waitingRoomPanel {
        padding: 17px 12px;
        gap: 13px;
        border-radius: 14px;
    }

    #pvpScreen .players-area {
        grid-template-columns:
            minmax(0, 1fr)
            34px
            minmax(0, 1fr);

        gap: 5px;
    }

    #pvpScreen .player-avatar {
        width: 62px;
        height: 62px;
    }

    #pvpScreen .room-player-name {
        font-size: 12px;
    }

    #pvpScreen .room-vs {
        font-size: 17px;
    }

    #pvpScreen .pvp-room-controls {
        gap: 6px;
    }

    #pvpScreen .pvp-room-toolbar-right {
        gap: 5px;
    }

    #pvpScreen .current-room-code {
        font-size: clamp(24px, 7vw, 35px);
        letter-spacing: .08em;
    }
}


/* =========================================================
   BATLINGO PVP - 4 VERTICAL ANSWERS
========================================================= */

#pvpScreen #pvpAnswers {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 11px !important;

    width: 100%;
    max-width: 760px;
    margin: 16px auto 0;
}

#pvpScreen #pvpAnswers .answer-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;

    width: 100%;
    min-width: 0;
    min-height: 67px;
    margin: 0;

    padding: 13px 18px;

    border: 2px solid #334155;
    border-radius: 14px;

    background: #1e293b;
    color: #f8fafc;

    font-size: clamp(15px, 2vw, 19px);
    font-weight: 750;
    line-height: 1.5;
    text-align: left;

    overflow-wrap: anywhere;
    white-space: normal;

    cursor: pointer;

    transition:
        background .18s,
        border-color .18s,
        transform .18s;
}

/* A, B, C, D */

#pvpScreen #pvpAnswers .answer-button::before {
    content: attr(data-answer-label);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 35px;
    height: 35px;

    margin-right: 15px;

    border-radius: 9px;
    background: #334155;
    color: #fbbf24;

    font-size: 14px;
    font-weight: 900;
}

#pvpScreen #pvpAnswers .answer-button:hover:not(:disabled) {
    border-color: #fbbf24;
    background: #293951;
    transform: translateY(-1px);
}

/* Selected but waiting for opponent */

#pvpScreen #pvpAnswers .answer-button.selected {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, .15);
    opacity: 1;
}

/* Correct answer */

#pvpScreen #pvpAnswers .answer-button.correct-answer {
    border-color: #22c55e;
    background: #14532d;
    color: #ffffff;
    opacity: 1;
    transform: none;
}

/* My wrong answer */

#pvpScreen #pvpAnswers .answer-button.wrong-answer {
    border-color: #ef4444;
    background: #7f1d1d;
    color: #ffffff;
    opacity: 1;
    transform: none;
}

/* Reading appears under the question */

#pvpScreen #pvpReading {
    display: block;

    min-height: 28px;
    margin: 4px auto 10px;

    color: #fbbf24;
    text-align: center;

    font-size: clamp(17px, 3vw, 23px);
    font-weight: 750;
    line-height: 1.5;

    opacity: 0;
    visibility: hidden;

    transition: opacity .18s ease;
}

#pvpScreen #pvpReading.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile */

@media (max-width: 600px) {
    #pvpScreen #pvpAnswers {
        gap: 9px !important;
        margin-top: 10px;
    }

    #pvpScreen #pvpAnswers .answer-button {
        min-height: 62px;
        padding: 11px 12px;
        font-size: 15px;
    }

    #pvpScreen #pvpAnswers .answer-button::before {
        flex-basis: 31px;
        height: 31px;
        margin-right: 11px;
    }
}

