/* ==========================================
   GLOBAL
   ========================================== */

* {

    box-sizing: border-box;

}


body {

    margin: 0;

    padding: 30px;

    background:
        #111;

    color:
        #eee;

    font-family:
        Arial,
        sans-serif;

}


.hidden {

    display: none !important;

}


/* ==========================================
   PLAYER MODE
   ========================================== */

.mode {

    max-width:
        1200px;

    margin:
        0 auto;

}


h1 {

    text-align:
        center;

    margin-bottom:
        30px;

}


.panel {

    background:
        #1c1c1c;

    border:
        1px solid #333;

    border-radius:
        12px;

    padding:
        20px;

    margin-bottom:
        20px;

}


.panel h2 {

    margin-top:
        0;

}


/* ==========================================
   SESSION INFO
   ========================================== */

#sessionInfo {

    display:
        flex;

    justify-content:
        space-around;

    gap:
        20px;

    text-align:
        center;

}


#sessionInfo div {

    display:
        flex;

    flex-direction:
        column;

    gap:
        5px;

}


#connectionStatus {

    color:
        #aaa;

}


/* ==========================================
   ROLE SELECTION
   ========================================== */

.roleSelection {

    text-align:
        center;

    margin-bottom:
        25px;

}


.roleSelection h2 {

    margin-bottom:
        20px;

}


.roleButtons {

    display:
        flex;

    justify-content:
        center;

    gap:
        20px;

    flex-wrap:
        wrap;

}


.roleButton {

    min-width:
        240px;

    padding:
        18px 25px;

    border:
        1px solid #555;

    border-radius:
        10px;

    background:
        #222;

    color:
        white;

    font-size:
        16px;

    cursor:
        pointer;

    transition:
        0.2s;

}


.roleButton:hover {

    background:
        #333;

    transform:
        translateY(-2px);

}


/* ==========================================
   PLAYER SELECTION
   ========================================== */

.playerChoices {

    display:
        grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                180px,
                1fr
            )
        );

    gap:
        15px;

}


.playerChoice {

    background:
        #222;

    border:
        1px solid #444;

    border-radius:
        10px;

    padding:
        15px;

    cursor:
        pointer;

    text-align:
        center;

    transition:
        0.2s;

}


.playerChoice:hover {

    background:
        #2c2c2c;

    transform:
        translateY(-2px);

}


.playerChoice.taken {

    opacity:
        0.35;

    cursor:
        not-allowed;

}


.playerChoice img {

    width:
        90px;

    height:
        90px;

    object-fit:
        cover;

    border-radius:
        50%;

    margin-bottom:
        10px;

}


.characterName {

    font-weight:
        bold;

    font-size:
        18px;

}


.playerName {

    margin-top:
        5px;

    color:
        #aaa;

    font-style:
        italic;

}


/* ==========================================
   CURRENT PLAYER / DM
   ========================================== */

#currentPlayerName {

    font-size:
        22px;

    font-weight:
        bold;

    margin-bottom:
        15px;

}


.currentDMTitle {

    font-weight:
        bold;

    font-size:
        22px;

}


.currentDMName {

    margin-top:
        5px;

    color:
        #aaa;

}


.primaryButton,
.secondaryButton {

    padding:
        10px 18px;

    border-radius:
        8px;

    cursor:
        pointer;

    font-size:
        14px;

}


.primaryButton {

    background:
        #333;

    color:
        white;

    border:
        1px solid #666;

}


.primaryButton:hover {

    background:
        #444;

}


.secondaryButton {

    background:
        transparent;

    color:
        #aaa;

    border:
        1px solid #444;

}


.secondaryButton:hover {

    color:
        white;

    border-color:
        #777;

}


/* ==========================================
   CONNECTED PLAYERS
   ========================================== */

.connectedPlayerList {

    display:
        flex;

    flex-wrap:
        wrap;

    gap:
        10px;

}


.connectedPlayer {

    background:
        #252525;

    border:
        1px solid #444;

    border-radius:
        20px;

    padding:
        8px 14px;

    font-size:
        14px;

}


.connectedPlayer.dm {

    border-color:
        #b66cff;

}


/* ==========================================
   PLAYER CARDS
   ========================================== */

.playerContainer {

    display:
        grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                220px,
                1fr
            )
        );

    gap:
        20px;

}


.playerCard {

    position:
        relative;

    background:
        #1b1b1b;

    border:
        1px solid #333;

    border-radius:
        14px;

    padding:
        18px;

    text-align:
        center;

    transition:
        0.2s;

}


.playerCard.yourPlayer {

    border-color:
        #777;

}


/* ==========================================
   CHARACTER-SPECIFIC SPEAKING COLORS
   ========================================== */

/*
   DM
   Purple
*/

#dmDisplayCard {

    --speaker-color:
        #b66cff;

}


/*
   Archevelon
   Mauve / Light Grey
*/

.playerCard[data-player-id="archevelon"] {

    --speaker-color:
        #e7d8ea;

}


/*
   Asch
   Blue
*/

.playerCard[data-player-id="asch"] {

    --speaker-color:
        #4da3ff;

}


/*
   Coriolis
   Red
*/

.playerCard[data-player-id="coriolis"] {

    --speaker-color:
        #ff4d4d;

}


/*
   Hughes
   Orange
*/

.playerCard[data-player-id="hughes"] {

    --speaker-color:
        #ff9f43;

}


/*
   Portobello
   Brown
*/

.playerCard[data-player-id="portobello"] {

    --speaker-color:
        #c98a5b;

}


/*
   Zemisia
   Green
*/

.playerCard[data-player-id="zemisia"] {

    --speaker-color:
        #6cff75;

}


.playerCard.speaking {

    border-color:
        var(--speaker-color);

    box-shadow:
        0 0 20px
        color-mix(
            in srgb,
            var(--speaker-color) 45%,
            transparent
        );

}


/* ==========================================
   PLAYER CARD NAME
   ========================================== */

.playerCardName {

    font-weight:
        bold;

    font-size:
        22px;

    margin-bottom:
        12px;

}


/* ==========================================
   PORTRAIT
   ========================================== */

.portrait {

    width:
        130px;

    height:
        130px;

    border-radius:
        50%;

    object-fit:
        cover;

    border:
        4px solid #333;

    transition:
        0.2s;

}


.playerCard.speaking .portrait {

    border-color:
        var(--speaker-color);

    box-shadow:
        0 0 18px
        var(--speaker-color);

}


/* ==========================================
   STATUS
   ========================================== */

.status {

    margin-top:
        12px;

    font-weight:
        bold;

    color:
        #888;

}


.playerCard.speaking .status {

    color:
        var(--speaker-color);

}


/* ==========================================
   VOLUME
   ========================================== */

.volume {

    margin-top:
        10px;

    font-size:
        13px;

    color:
        #999;

}


.volumeBar {

    height:
        8px;

    background:
        #333;

    border-radius:
        5px;

    margin-top:
        6px;

    overflow:
        hidden;

}


.volumeLevel {

    height:
        100%;

    width:
        0%;

    background:
        #aaa;

    transition:
        width
        0.05s
        linear;

}


/* ==========================================
   PLAYER NAME
   ========================================== */

.playerCardPlayerName {

    margin-top:
        18px;

    color:
        #aaa;

    font-size:
        15px;

    font-style:
        italic;

}


/* ==========================================
   MICROPHONE
   ========================================== */

.microphoneStatus {

    margin-top:
        10px;

    font-size:
        13px;

    color:
        #777;

}


.micButton,
.calibrateButton {

    margin-top:
        8px;

    padding:
        7px 12px;

    border-radius:
        6px;

    background:
        #222;

    color:
        #aaa;

    border:
        1px solid #444;

    cursor:
        pointer;

}


.micButton:disabled,
.calibrateButton:disabled {

    opacity:
        0.35;

    cursor:
        not-allowed;

}


/* ==========================================
   CONTROLS
   ========================================== */

.controls {

    text-align:
        center;

    margin-top:
        25px;

}


/* ==========================================
   DM DISPLAY CARD
   ========================================== */

.dmDisplayCard {

    --speaker-color:
        #b66cff;

    position:
        absolute;

    top:
        20px;

    left:
        50%;

    transform:
        translateX(-50%);

    width:
        280px;

    text-align:
        center;

    padding:
        14px 18px;

    background:
        rgba(
            20,
            20,
            20,
            0.92
        );

    border:
        1px solid #444;

    border-radius:
        12px;

    z-index:
        10;

    transition:
        0.15s;

}


.dmTitle {

    font-weight:
        bold;

    font-size:
        18px;

}


.dmName {

    color:
        #aaa;

    margin-top:
        4px;

}


.dmStatus {

    margin-top:
        8px;

    font-size:
        12px;

    color:
        #777;

}


.dmDisplayCard.active {

    border-color:
        #777;

}


.dmDisplayCard.speaking {

    border-color:
        var(--speaker-color);

    box-shadow:
        0 0 30px
        var(--speaker-color);

}


.dmDisplayCard.speaking
.dmStatus {

    color:
        var(--speaker-color);

}


/* ==========================================
   DM MICROPHONE CONTROLS
   ========================================== */

#dmMicrophoneControls {

    margin-top:
        18px;

    padding-top:
        15px;

    border-top:
        1px solid #333;

}


.dmMicrophoneStatus {

    color:
        #6cff75;

    font-size:
        13px;

}


.dmSpeakingStatus {

    margin-top:
        6px;

    font-weight:
        bold;

}


.dmVolume {

    margin-top:
        6px;

    font-size:
        12px;

    color:
        #888;

}


.dmVolumeBar {

    height:
        7px;

    margin-top:
        5px;

    background:
        #333;

    border-radius:
        5px;

    overflow:
        hidden;

}


.dmVolumeLevel {

    width:
        0%;

    height:
        100%;

    background:
        #b66cff;

}


/* ==========================================
   DISPLAY MODE
   ========================================== */

.displayMode {

    width:
        100vw;

    height:
        100vh;

    min-height:
        700px;

    margin:
        0;

    padding:
        20px;

    overflow:
        hidden;

    background:
        transparent;

    position:
        relative;

}


body:has(.displayMode:not(.hidden)) {

    padding:
        0;

    overflow:
        hidden;

}


/* ==========================================
   DISPLAY STAGE
   ========================================== */

.displayStage {

    position:
        absolute;

    top:
        100px;

    left:
        0;

    right:
        0;

    bottom:
        0;

    display:
        grid;

    grid-template-columns:
        250px
        1fr
        250px;

    gap:
        20px;

    padding:
        20px;

}


/* ==========================================
   PLAYER COLUMNS
   ========================================== */

.displayColumn {

    display:
        flex;

    flex-direction:
        column;

    justify-content:
        space-around;

    gap:
        20px;

}


.displaySeat {

    min-height:
        170px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

}


/* ==========================================
   CENTER
   ========================================== */

.displayCenter {

    min-width:
        0;

    min-height:
        0;

}


/* ==========================================
   DISPLAY PLAYER CARDS
   ========================================== */

.displayPlayerCard {

    --speaker-color:
        #6cff75;

    width:
        220px;

    padding:
        12px;

    background:
        rgba(
            20,
            20,
            20,
            0.88
        );

    border:
        1px solid #333;

    border-radius:
        12px;

    text-align:
        center;

    transition:
        0.15s;

}


/* ==========================================
   DISPLAY CHARACTER COLORS
   ========================================== */

/*
   Archevelon
   Mauve / Light Grey
*/

.displayPlayerCard[data-player-id="archevelon"] {

    --speaker-color:
        #e7d8ea;

}


/*
   Asch
   Blue
*/

.displayPlayerCard[data-player-id="asch"] {

    --speaker-color:
        #4da3ff;

}


/*
   Coriolis
   Red
*/

.displayPlayerCard[data-player-id="coriolis"] {

    --speaker-color:
        #ff4d4d;

}


/*
   Hughes
   Orange
*/

.displayPlayerCard[data-player-id="hughes"] {

    --speaker-color:
        #ff9f43;

}


/*
   Portobello
   Brown
*/

.displayPlayerCard[data-player-id="portobello"] {

    --speaker-color:
        #c98a5b;

}


/*
   Zemisia
   Green
*/

.displayPlayerCard[data-player-id="zemisia"] {

    --speaker-color:
        #6cff75;

}


.displayCharacterName {

    font-weight:
        bold;

    font-size:
        18px;

    margin-bottom:
        8px;

}


.displayPortrait {

    width:
        100px;

    height:
        100px;

    object-fit:
        cover;

    border-radius:
        50%;

    border:
        3px solid #333;

    transition:
        0.15s;

}


.displaySpeaking {

    margin-top:
        8px;

    font-size:
        12px;

    color:
        #777;

}


.displayPlayerName {

    margin-top:
        8px;

    font-size:
        13px;

    color:
        #aaa;

    font-style:
        italic;

}


/* ==========================================
   DISPLAY SPEAKING EFFECT
   ========================================== */

.displayPlayerCard.speaking {

    border-color:
        var(--speaker-color);

    box-shadow:
        0 0 25px
        var(--speaker-color);

}


.displayPlayerCard.speaking
.displayPortrait {

    border-color:
        var(--speaker-color);

    box-shadow:
        0 0 18px
        var(--speaker-color);

}


.displayPlayerCard.speaking
.displaySpeaking {

    color:
        var(--speaker-color);

}


/* ==========================================
   DISPLAY CONNECTION
   ========================================== */

.displayConnectionStatus {

    position:
        absolute;

    bottom:
        8px;

    left:
        50%;

    transform:
        translateX(-50%);

    font-size:
        11px;

    color:
        #444;

}


/* ==========================================
   SMALLER SCREENS
   ========================================== */

@media (max-width: 900px) {

    .displayStage {

        grid-template-columns:
            180px
            1fr
            180px;

    }


    .displayPlayerCard {

        width:
            165px;

    }


    .displayPortrait {

        width:
            75px;

        height:
            75px;

    }

}


@media (max-width: 700px) {

    .displayStage {

        grid-template-columns:
            1fr;

        overflow-y:
            auto;

    }


    .displayCenter {

        display:
            none;

    }


    .displayColumn {

        flex-direction:
            row;

        flex-wrap:
            wrap;

        justify-content:
            center;

    }

}

/* ==========================================
   CURRENT PLAYER CARD STRUCTURE
   ========================================== */

.playerPortraitWrapper {

    display:
        flex;

    justify-content:
        center;

    margin-bottom:
        12px;

}


.playerPortrait {

    width:
        130px;

    height:
        130px;

    border-radius:
        50%;

    object-fit:
        cover;

    border:
        4px solid #333;

    transition:
        0.2s;

}


.playerCard.speaking
.playerPortrait {

    border-color:
        var(--speaker-color);

    box-shadow:
        0 0 18px
        var(--speaker-color);

}


.playerCharacterName {

    font-weight:
        bold;

    font-size:
        22px;

    margin-bottom:
        10px;

}


.playerStatus {

    margin-top:
        8px;

    font-weight:
        bold;

    color:
        #888;

}


.playerCard.speaking
.playerStatus {

    color:
        var(--speaker-color);

}


.playerVolume {

    margin-top:
        12px;

}


.volumeLabel {

    font-size:
        13px;

    color:
        #999;

}


.volumeBarBackground {

    height:
        8px;

    background:
        #333;

    border-radius:
        5px;

    margin-top:
        6px;

    overflow:
        hidden;

}


.volumeBar {

    height:
        100%;

    width:
        0%;

    background:
        var(--speaker-color);

    transition:
        width 0.05s linear;

}


.playerControls {

    display:
        flex;

    justify-content:
        center;

    gap:
        8px;

    flex-wrap:
        wrap;

    margin-top:
        10px;

}


.enableMicrophoneButton {

    margin-top:
        8px;

    padding:
        7px 12px;

    border-radius:
        6px;

    background:
        #222;

    color:
        #aaa;

    border:
        1px solid #444;

    cursor:
        pointer;

}


.enableMicrophoneButton:disabled {

    opacity:
        0.5;

    cursor:
        default;

}


.playerRealName {

    margin-top:
        18px;

    color:
        #aaa;

    font-size:
        15px;

    font-style:
        italic;

}