* {
    box-sizing: border-box;
}

:root {
    --background: #101116;
    --panel: #191b22;
    --panel-light: #232630;
    --text: #f5f5f7;
    --muted: #969aa8;

    --blue: #3578e5;
    --blue-dark: #245bb5;

    --red: #dc4545;
    --red-dark: #a92d2d;

    --grey: #777c89;
    --gold: #d3a944;
}

html,
body {
    margin: 0;
    min-height: 100%;

    background:
        radial-gradient(
            circle at 15% 20%,
            rgba(53,120,229,.12),
            transparent 32%
        ),
        radial-gradient(
            circle at 85% 80%,
            rgba(220,69,69,.12),
            transparent 32%
        ),
        var(--background);

    color: var(--text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app {
    width: min(100%, 480px);

    min-height: 100vh;
    min-height: 100dvh;

    margin: auto;

    padding:
        max(28px, env(safe-area-inset-top))
        24px
        max(28px, env(safe-area-inset-bottom));
}

.screen {
    display: none;

    min-height: calc(100dvh - 56px);

    flex-direction: column;
}

.screen.active {
    display: flex;
}

#homeScreen {
    justify-content: center;
    text-align: center;
}


/* HOME */

.logo {
    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 26px;
}

.room {
    width: 72px;
    height: 72px;

    border-radius: 18px;
}

.room-blue {
    background: var(--blue);
    transform: rotate(-8deg);
}

.room-red {
    background: var(--red);
    transform: rotate(8deg);
}

.boom {
    position: relative;
    z-index: 2;

    margin: 0 -9px;

    font-size: 54px;
}

h1 {
    margin: 0;

    font-size: clamp(42px, 12vw, 62px);
    line-height: .92;

    letter-spacing: -3px;
}

.subtitle {
    margin: 16px 0 42px;

    color: var(--muted);

    text-transform: uppercase;

    letter-spacing: 5px;

    font-size: 13px;
}

.menu {
    display: grid;
    gap: 14px;
}


/* BUTTONS */

.button {
    width: 100%;

    min-height: 60px;

    border: 0;
    border-radius: 15px;

    color: white;

    font-size: 18px;
    font-weight: 750;

    transition:
        transform .1s ease,
        opacity .1s ease;
}

.button:active {
    transform: scale(.98);
}

.button:disabled {
    opacity: .35;
    cursor: default;
}

.button.blue {
    background:
        linear-gradient(
            180deg,
            var(--blue),
            var(--blue-dark)
        );
}

.button.red {
    background:
        linear-gradient(
            180deg,
            var(--red),
            var(--red-dark)
        );
}

.backButton {
    align-self: flex-start;

    margin: 4px 0 38px;
    padding: 0;

    border: 0;

    background: none;

    color: var(--muted);

    font-weight: 650;
}


/* INPUTS */

h2 {
    margin: 0 0 28px;

    font-size: 34px;
}

h3 {
    margin: 34px 0 13px;

    font-size: 20px;
}

label:not(.roleOption) {
    margin: 0 0 8px;

    color: var(--muted);

    font-size: 14px;
    font-weight: 650;
}

input[type="text"] {
    width: 100%;
    height: 58px;

    margin-bottom: 22px;
    padding: 0 17px;

    border: 1px solid #343741;
    border-radius: 13px;

    outline: none;

    background: var(--panel);
    color: white;

    font-size: 17px;
}

input[type="text"]:focus {
    border-color: #727784;
}

.codeInput {
    text-align: center;

    font-size: 28px !important;
    font-weight: 800;

    letter-spacing: 8px;
}

.error {
    min-height: 24px;

    color: #ff7676;

    text-align: center;
}


/* LOBBY */

.smallTitle {
    margin: 24px 0 8px;

    color: var(--muted);

    text-align: center;

    font-size: 12px;
    font-weight: 750;

    letter-spacing: 3px;
}

.gameCode {
    text-align: center;

    font-size: clamp(46px, 15vw, 68px);
    font-weight: 850;

    letter-spacing: 7px;
}

.smallButton {
    align-self: center;

    margin: 10px 0 42px;
    padding: 8px 14px;

    border: 1px solid #393c46;
    border-radius: 9px;

    background: var(--panel);
    color: var(--muted);
}

.lobbyHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lobbyHeader h2 {
    margin: 0;

    font-size: 25px;
}

#playerCount {
    color: var(--muted);

    font-weight: 750;
}

.playerList {
    display: grid;
    gap: 9px;

    margin: 17px 0 28px;
}

.player {
    display: flex;
    align-items: center;

    min-height: 55px;

    padding: 0 16px;

    border: 1px solid #2c2f38;
    border-radius: 12px;

    background: var(--panel);
}

.playerName {
    flex: 1;

    font-weight: 700;
}

.you {
    margin-left: 8px;

    color: var(--muted);

    font-size: 12px;
}

.hostBadge {
    margin-left: 8px;

    padding: 5px 8px;

    border-radius: 7px;

    background: #303440;

    color: #c8cad1;

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 1px;
}

.hostControls {
    margin-top: auto;
}

.hostNotice {
    margin-top: 18px;

    color: var(--muted);

    text-align: center;

    font-size: 13px;
}

.waiting {
    margin-top: auto;

    padding: 20px;

    border-radius: 13px;

    background: var(--panel);

    color: var(--muted);

    text-align: center;
}

.leaveButton {
    align-self: center;

    margin-top: 26px;
    padding: 10px 15px;

    border: 0;

    background: transparent;

    color: #c46666;
}


/* SETUP */

.setupSummary {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 10px;

    margin-bottom: 22px;
}

.setupSummary > div {
    padding: 14px;

    border: 1px solid #2e313a;
    border-radius: 12px;

    background: var(--panel);

    text-align: center;
}

.setupSummary span {
    display: block;

    margin-bottom: 4px;

    color: var(--muted);

    font-size: 12px;
}

.setupSummary strong {
    font-size: 25px;
}

.roleOption {
    display: flex;
    align-items: center;

    min-height: 68px;

    margin-bottom: 10px;
    padding: 10px 13px;

    border: 1px solid #2e313a;
    border-radius: 13px;

    background: var(--panel);
}

.selectableRole {
    cursor: pointer;
}

.roleCheckbox {
    width: 21px;
    height: 21px;

    margin-right: 12px;

    accent-color: var(--blue);
}

.roleIcon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    flex-shrink: 0;

    margin-right: 12px;

    border-radius: 11px;

    background: var(--panel-light);

    font-size: 25px;
}

.blueRole {
    background: rgba(53,120,229,.18);
}

.redRole {
    background: rgba(220,69,69,.18);
}

.roleInfo {
    display: flex;
    flex: 1;
    flex-direction: column;

    gap: 3px;
}

.roleInfo strong {
    font-size: 16px;
}

.roleInfo span {
    color: var(--muted);

    font-size: 12px;
}

.requiredBadge {
    color: var(--muted);

    font-size: 9px;
    font-weight: 850;

    letter-spacing: 1px;
}

.balanceBox {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 7px;

    margin: 28px 0 18px;
}

.balanceBox > div {
    padding: 11px 5px;

    border-radius: 10px;

    background: var(--panel);

    text-align: center;
}

.balanceBox span {
    display: block;

    color: var(--muted);

    font-size: 10px;
}

.balanceBox strong {
    display: block;

    margin-top: 5px;

    font-size: 21px;
}

.setupMessage {
    min-height: 42px;

    color: var(--muted);

    text-align: center;

    font-size: 13px;
}


/* SECRET ROLE */

.roleScreen {
    justify-content: center;
}

.roleRevealArea {
    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;
}

.lockIcon {
    margin: 36px 0 16px;

    font-size: 65px;
}

.roleRevealArea > h2 {
    margin-bottom: 12px;
}

.roleRevealArea > p {
    max-width: 330px;

    color: var(--muted);
}

.revealButton {
    margin-top: 28px;

    background:
        linear-gradient(
            180deg,
            #454955,
            #2c2f37
        );

    touch-action: none;

    user-select: none;
    -webkit-user-select: none;
}

.bigRoleEmoji {
    margin: 24px 0 12px;

    font-size: 82px;
}

.teamBadge {
    margin-bottom: 20px;
    padding: 7px 13px;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 850;

    letter-spacing: 1px;
}

.team-blue {
    background: rgba(53,120,229,.18);
    color: #75a7ff;
}

.team-red {
    background: rgba(220,69,69,.18);
    color: #ff8585;
}

.team-grey {
    background: rgba(130,135,145,.18);
    color: #c1c4cc;
}

.team-hidden {
    background: rgba(211,169,68,.16);
    color: #e5c36e;
}

.roleDescription {
    min-height: 62px;

    line-height: 1.5;
}

.drunkWarning {
    margin: 13px 0;
    padding: 13px;

    border: 1px solid rgba(211,169,68,.3);
    border-radius: 11px;

    background: rgba(211,169,68,.08);

    color: #e5c36e;

    font-size: 13px;
    line-height: 1.45;
}

.hideHint {
    font-size: 11px !important;
}

.gameWaiting {
    margin-top: 32px;
    padding: 15px;

    border-radius: 12px;

    background: var(--panel);

    color: var(--muted);

    text-align: center;

    font-size: 13px;
}


/* LOADING */

.hidden {
    display: none !important;
}

.loading {
    position: fixed;
    inset: 0;
    z-index: 100;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    background: rgba(16,17,22,.92);

    backdrop-filter: blur(8px);
}

.spinner {
    width: 38px;
    height: 38px;

    border: 4px solid #30333c;
    border-top-color: white;
    border-radius: 50%;

    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================================================
   ROLE SCREEN - MOBILE / TOUCH IMPROVEMENTS
   ================================================== */

#holdRevealButton {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

@media (max-width: 700px) {

    /*
       Make the role screen a compact, centred phone interface.
       !important is deliberate here so these rules override the
       generic desktop rules above.
    */
    .app {
        width: 100% !important;
        max-width: 480px;
        padding:
            max(18px, env(safe-area-inset-top))
            24px
            max(18px, env(safe-area-inset-bottom)) !important;
    }

    #roleScreen.roleScreen {
        position: relative;
        width: 100%;
        min-height: calc(100dvh - 36px) !important;
        justify-content: flex-start !important;
        align-items: center !important;
        text-align: center !important;
        overflow: hidden;
    }

    #roleScreen > .smallTitle {
        width: 100%;
        margin: clamp(32px, 7vh, 62px) 0 24px !important;
        font-size: 11px !important;
        line-height: 1.2;
        letter-spacing: 3px;
        text-align: center !important;
    }

    #roleHidden,
    #roleVisible {
        width: 100% !important;
        max-width: 390px;
        min-height: 300px;
        padding: 0 6px 190px !important;
        margin: 0 auto;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: center !important;
    }

    #roleHidden .lockIcon {
        margin: 8px auto 14px !important;
        font-size: 48px !important;
        line-height: 1;
    }

    #roleHidden h2,
    #roleVisible #roleName {
        width: 100%;
        margin: 0 0 14px !important;
        font-size: 30px !important;
        line-height: 1.1 !important;
        letter-spacing: -0.5px;
        text-align: center !important;
    }

    #roleHidden > p {
        width: 100%;
        max-width: 320px !important;
        margin: 4px auto 0 !important;
        color: var(--muted);
        font-size: 14px !important;
        line-height: 1.5 !important;
        text-align: center !important;
    }

    #roleVisible .bigRoleEmoji {
        margin: 4px auto 12px !important;
        font-size: 62px !important;
        line-height: 1;
    }

    #roleVisible .teamBadge {
        margin: 0 auto 16px !important;
    }

    #roleVisible .roleDescription {
        width: 100%;
        max-width: 330px !important;
        min-height: 0 !important;
        margin: 0 auto !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
        text-align: center !important;
    }

    #roleVisible .drunkWarning {
        width: 100%;
        max-width: 330px;
        margin: 14px auto 0 !important;
        font-size: 12px;
        text-align: center;
    }

    /*
       Keep the reveal button in a consistent thumb position near
       the bottom of the phone. It remains fixed while the role is shown.
    */
    #holdRevealButton {
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        bottom: calc(112px + env(safe-area-inset-bottom)) !important;

        width: min(calc(100vw - 48px), 390px) !important;
        height: 60px !important;
        min-height: 60px !important;

        margin: 0 !important;
        padding: 0 18px !important;

        transform: translateX(-50%) !important;

        border: 1px solid #555a67 !important;
        border-radius: 15px !important;

        background:
            linear-gradient(
                180deg,
                #454955,
                #2c2f37
            ) !important;

        color: #ffffff !important;

        font-size: 17px !important;
        font-weight: 750 !important;

        z-index: 50;

        touch-action: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -webkit-touch-callout: none !important;
        -webkit-tap-highlight-color: transparent;
    }

    #holdRevealButton.holding,
    #holdRevealButton:active {
        transform: translateX(-50%) scale(.98) !important;
    }

    #roleScreen .gameWaiting {
        position: fixed !important;
        left: 50% !important;
        bottom: calc(55px + env(safe-area-inset-bottom)) !important;

        width: min(calc(100vw - 48px), 390px) !important;

        margin: 0 !important;
        padding: 11px 12px !important;

        transform: translateX(-50%) !important;

        border-radius: 11px;

        font-size: 11px !important;
        line-height: 1.35;

        z-index: 30;
    }

    #roleHostNotice {
        position: fixed !important;
        left: 50% !important;
        bottom: calc(13px + env(safe-area-inset-bottom)) !important;

        width: min(calc(100vw - 48px), 390px) !important;

        margin: 0 !important;

        transform: translateX(-50%) !important;

        font-size: 10px !important;
        line-height: 1.25;
        text-align: center !important;

        z-index: 30;
    }

    .hideHint {
        display: none !important;
    }
}


/* ==================================================
   LOBBY QR JOIN
   ================================================== */

.qrJoinArea {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: -20px auto 30px;
    text-align: center;
}

.qrTitle {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
}

.joinQrCode {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 204px;
    min-height: 204px;
    padding: 12px;
    border-radius: 16px;
    background: #ffffff;
}

.joinQrCode img,
.joinQrCode canvas {
    display: block !important;
    width: 180px !important;
    height: 180px !important;
}

.qrHint {
    max-width: 260px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

/* ==================================================
   QR CODE - SHOW ONLY ONE RENDER
   ================================================== */

.joinQrCode {
    width: 204px;
    height: 204px;
    min-height: 204px;

    padding: 12px;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffffff;
    border-radius: 16px;

    overflow: hidden;
}

.joinQrCode canvas {
    display: block !important;
    width: 180px !important;
    height: 180px !important;
}

.joinQrCode img {
    display: none !important;
}

/* ==================================================
   ROLE SCREEN - MOBILE BOTTOM CONTROL OVERRIDES
   ================================================== */

@media (max-width: 700px) {

    /* Reveal button above the waiting panel */
    #holdRevealButton {
        bottom: calc(150px + env(safe-area-inset-bottom)) !important;
    }

    /* Waiting panel above Leave Game */
    #roleScreen .gameWaiting {
        bottom: calc(78px + env(safe-area-inset-bottom)) !important;
    }

    /* Leave Game pinned to the bottom */
    #roleScreen .leaveButton {
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        bottom: calc(15px + env(safe-area-inset-bottom)) !important;

        width: auto !important;
        margin: 0 !important;
        padding: 10px 15px !important;

        transform: translateX(-50%) !important;

        border: 0 !important;
        background: transparent !important;
        color: #c46666 !important;

        z-index: 60;
    }
}

/* ==================================================
   ROLE READY / ROUND 1
   ================================================== */

.roleReadyArea {
    width: 100%;
    max-width: 390px;
    margin: 22px auto 0;
}

.roleReadyStatus {
    margin: 10px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

#startRoundOneButton {
    margin-top: 12px;
}

.roundScreen {
    padding-bottom: 30px;
}

.roundTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}

.roundTop .smallTitle {
    margin: 0 0 5px;
    text-align: left;
}

.roundTop h2 {
    margin: 0;
}

.roundRoleChip {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border: 1px solid #343741;
    border-radius: 16px;
    background: var(--panel);
    font-size: 30px;
}

.supervisorPanel,
.actionPanel,
.supervisorControls {
    margin-top: 22px;
    padding: 16px;
    border: 1px solid #2e313a;
    border-radius: 14px;
    background: var(--panel);
}

.panelLabel {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
}

.supervisorPanel strong {
    display: block;
    font-size: 22px;
}

.supervisorPanel p,
.actionPanel p,
.supervisorControlHint,
.shareHint {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.roundSectionTitle {
    margin: 26px 0 10px;
    font-size: 17px;
}

.roomPlayerList {
    display: grid;
    gap: 8px;
}

.roomPlayer {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 54px;
    padding: 0 14px;
    border: 1px solid #2e313a;
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    text-align: left;
}

.roomPlayer:disabled {
    cursor: default;
    opacity: .72;
}

.roomPlayer.isSupervisor {
    border-color: rgba(211,169,68,.55);
}

.roomPlayerName {
    flex: 1;
    font-weight: 700;
}

.supervisorBadge {
    margin-left: 8px;
    padding: 5px 7px;
    border-radius: 7px;
    background: rgba(211,169,68,.15);
    color: #e5c36e;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .8px;
}

.supervisorControlTitle {
    margin: 0;
    color: #e5c36e;
    text-align: center;
    font-weight: 800;
}

.actionButtons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-top: 13px;
}

.smallAction {
    min-height: 44px;
    border: 1px solid #3b3f49;
    border-radius: 10px;
    background: #272a33;
    color: var(--text);
    font-weight: 750;
}

.smallAction.accept,
.smallAction.selected {
    border-color: var(--blue);
    background: rgba(53,120,229,.2);
}

.smallAction.decline {
    color: #ff8585;
}

.shareButtons {
    display: grid;
    gap: 10px;
}

.shareButton {
    min-height: 56px;
    background: linear-gradient(180deg, #454955, #2c2f37);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.shareOverlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px;
    text-align: center;
}

.share-blue {
    background: #245bb5;
}

.share-red {
    background: #a92d2d;
}

.share-grey {
    background: #555963;
}

.share-hidden {
    background: #7d6428;
}

.shareOverlayTeam {
    margin: 0 0 20px;
    font-size: clamp(34px, 10vw, 58px);
    font-weight: 900;
    letter-spacing: 2px;
}

.shareOverlayEmoji {
    font-size: clamp(90px, 28vw, 150px);
    line-height: 1;
}

.shareOverlayRole {
    margin: 22px 0 0;
    font-size: clamp(38px, 11vw, 64px);
}

.shareReleaseHint {
    position: absolute;
    bottom: max(28px, env(safe-area-inset-bottom));
    margin: 0;
    opacity: .75;
    font-size: 13px;
}

#roundLeaveGameButton {
    margin: 28px auto 0;
}

@media (max-width: 700px) {
    /* The role-ready controls sit above the fixed bottom stack. */
    #roleScreen .roleReadyArea {
        position: fixed;
        left: 50%;
        bottom: calc(214px + env(safe-area-inset-bottom));
        width: min(calc(100vw - 48px), 390px);
        margin: 0;
        transform: translateX(-50%);
        z-index: 45;
    }

    #roleScreen .roleReadyArea .button {
        min-height: 48px;
        height: 48px;
        font-size: 14px;
    }

    #roleScreen .roleReadyStatus {
        margin-top: 6px;
    }

    #roleScreen #holdRevealButton {
        bottom: calc(142px + env(safe-area-inset-bottom)) !important;
    }

    #roleScreen .gameWaiting {
        bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    }

    #roleLeaveGameButton {
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }
}


/* ==================================================
   V11 - ROUND TIMER / EXCHANGES / RESULTS
   ================================================== */

.roundTimerBox {
    min-width: 92px;
    padding: 10px 13px;
    border: 1px solid #343741;
    border-radius: 14px;
    background: var(--panel);
    text-align: center;
}

.roundTimerBox span {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.roundTimerBox strong {
    display: block;
    margin-top: 2px;
    font-size: 27px;
    font-variant-numeric: tabular-nums;
}

.exchangePanel {
    margin-top: 22px;
    padding: 16px;
    border: 1px solid #343741;
    border-radius: 14px;
    background: var(--panel);
}

.exchangePanel h3 {
    margin: 4px 0 8px;
    font-size: 21px;
}

.exchangePanel > p:not(.panelLabel) {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.exchangeSelections {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.hostageChoice.selected {
    border-color: #e5c36e;
    background: rgba(211,169,68,.12);
}

#exchangeCompleteButton,
#detonateButton {
    margin-top: 16px;
}

.resultScreen {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.resultBomb {
    margin: 25px 0 18px;
    font-size: 92px;
}

.resultScreen h2 {
    margin-bottom: 14px;
    font-size: clamp(32px, 9vw, 48px);
}

.resultSummary {
    max-width: 420px;
    color: var(--muted);
    line-height: 1.55;
}

.resultDetails {
    display: grid;
    gap: 9px;
    width: 100%;
    max-width: 390px;
    margin: 24px auto;
}

.resultLine {
    padding: 13px;
    border: 1px solid #30333c;
    border-radius: 11px;
    background: var(--panel);
    font-weight: 700;
}

/* The normal round screen deliberately contains no persistent role icon. */
.roundRoleChip {
    display: none !important;
}


/* V14 - full-screen hostage instruction */
.hostageTakeover {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 28px;
    background:
        radial-gradient(circle at 50% 35%, rgba(211,169,68,.13), transparent 34%),
        linear-gradient(135deg, #101722 0%, #0d0f14 55%, #1b1115 100%);
    text-align: center;
}
.hostageTakeover.hidden { display: none !important; }
.hostageTakeoverInner { width: min(100%, 520px); }
.hostageIcon { margin: 26px 0 12px; font-size: 72px; }
.hostageTakeover h1 {
    margin: 0;
    font-size: clamp(38px, 9vw, 62px);
    line-height: 1.02;
}
#hostageTakeoverRound {
    margin: 20px 0;
    color: var(--muted);
    font-size: 18px;
}
.hostageDestination {
    margin: 28px 0 18px;
    padding: 22px 18px;
    border: 1px solid rgba(211,169,68,.55);
    border-radius: 16px;
    background: rgba(211,169,68,.12);
    color: #f2cf72;
    font-size: clamp(28px, 8vw, 42px);
    font-weight: 900;
    letter-spacing: 1px;
}
.hostageWait {
    max-width: 430px;
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.55;
}

/* V16 - configurable round times */
.roundTimeSettings { display:grid; gap:9px; margin-bottom:22px; }
.roundTimeOption { display:flex; align-items:center; justify-content:space-between; gap:14px; min-height:58px; padding:10px 14px; border:1px solid #2e313a; border-radius:12px; background:var(--panel); font-weight:750; }
.roundTimeInputs { display:flex; align-items:center; gap:6px; }
.roundTimeInputs input { width:58px; min-width:0; height:40px; padding:6px; border-radius:8px; text-align:center; font-size:17px; font-variant-numeric:tabular-nums; }
#hostageHostExchangeComplete { width:100%; max-width:390px; margin:28px auto 0; }
@media (max-width:700px) { .roundTimeInputs input { width:52px; } }


/* ==================================================
   V18 - DRUNK SOBER NOTIFICATION
   ================================================== */

.soberOverlay {
    position: fixed;
    inset: 0;
    z-index: 13000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 10, 14, .96);
}

.soberOverlay.hidden {
    display: none !important;
}

.soberCard {
    width: min(100%, 460px);
    padding: 28px 22px;
    border: 1px solid #3a3e48;
    border-radius: 18px;
    background: var(--panel);
    text-align: center;
}

.soberEmoji {
    margin-bottom: 16px;
    font-size: 58px;
}

.soberCard h2 {
    margin: 8px 0 14px;
    font-size: clamp(30px, 8vw, 42px);
}

.soberCard p:not(.smallTitle) {
    margin: 0 auto 24px;
    color: var(--muted);
    line-height: 1.55;
}

.soberCard .button {
    width: 100%;
}

/* V19 - replay */
#playAgainButton {
    width: 100%;
    max-width: 390px;
    margin: 8px auto 10px;
}


/* ==================================================
   V21 - CLEAN HOSTAGE EXCHANGE PHASE
   ================================================== */

#roundScreen .hidden {
    display: none !important;
}

#exchangePanel {
    margin-top: 22px;
}

#exchangeSelections {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

#exchangeSelections:empty {
    display: none;
}

/* ==================================================
   V25 - MID-GAME PLAYER LEAVE PAUSE
   ================================================== */
.playerLeftOverlay {
    position: fixed;
    inset: 0;
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(7, 9, 13, .97);
}
.playerLeftOverlay.hidden { display: none !important; }
.playerLeftCard {
    width: min(100%, 480px);
    padding: 28px 22px;
    border: 1px solid #3a3e48;
    border-radius: 18px;
    background: var(--panel);
    text-align: center;
}
.playerLeftCard h2 { margin: 8px 0 14px; }
.playerLeftCard > p:not(.smallTitle) {
    color: var(--muted);
    line-height: 1.55;
}
.playerLeftActions {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}
.playerLeftActions .button { width: 100%; }

/* ==================================================
   V26 - DEDICATED FINAL PHASE
   ================================================== */
.finalScreen {
    width: min(100%, 430px);
    margin: 0 auto;
    min-height: 100dvh;
    padding: 120px 20px 48px;
    text-align: center;
}
.finalScreen h2 {
    margin: 10px 0 12px;
    font-size: 2rem;
}
.finalPhaseMessage {
    color: var(--muted);
    line-height: 1.55;
    margin: 0 auto 24px;
}
.finalGamblerButtons,
.finalHostControls {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}
.finalGamblerButtons.hidden,
.finalHostControls.hidden {
    display: none !important;
}
.finalGamblerButtons .button,
.finalHostControls .button {
    width: 100%;
}
#finalHostMessage {
    color: var(--muted);
    line-height: 1.5;
}

/* ==================================================
   V28 - CHARACTER SHEET
   ================================================== */
.characterSheetScreen {
    padding-bottom: 48px;
}
.characterSheetIntro {
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 26px;
}
.characterTeamHeading {
    margin: 28px 0 10px;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .12em;
}
.characterSheetList {
    display: grid;
    gap: 10px;
}
.characterReferenceCard {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 12px;
    align-items: start;
    padding: 15px;
    border: 1px solid #343842;
    border-radius: 14px;
    background: var(--panel);
}
.characterReferenceIcon {
    font-size: 1.75rem;
    text-align: center;
}
.characterReferenceCard strong {
    display: block;
    margin-bottom: 5px;
}
.characterReferenceCard p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.45;
}
.characterSheetButton {
    display: block;
    width: 100%;
    margin: 22px 0 8px;
}
.blueText { color: #6aa9ff; }
.redText { color: #ff7373; }
.greyText { color: #c8cbd2; }

/* V30 - consensual private sharing */
.roomPlayer { position: relative; padding-right: 82px; }
.roomShareRequestButton {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    border: 1px solid #555c68; border-radius: 9px; padding: 7px 10px;
    background: #252a33; color: #fff; font-size: .76rem; font-weight: 700;
}
.shareRequestOverlay,.shareResultOverlay {
    position: fixed; inset: 0; z-index: 16000; display:flex;
    align-items:center; justify-content:center; padding:22px;
    background:rgba(5,7,11,.96);
}
.shareRequestOverlay.hidden,.shareResultOverlay.hidden { display:none!important; }
.shareRequestCard,.shareResultCard {
    width:min(100%,440px); padding:26px 20px; border:1px solid #3a404c;
    border-radius:18px; background:var(--panel); text-align:center;
}
.shareRequestCard .button,.shareRequestCard .leaveButton { width:100%; margin-top:10px; }
.shareRequestActions { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:18px; }
.shareResultEmoji { margin:18px 0 8px; font-size:4rem; }
.shareResultTeam { font-size:1.4rem; font-weight:900; }
.shareResultRole { margin-top:10px; font-size:1.1rem; font-weight:800; }
.shareCountdown { margin-top:24px; color:var(--muted); font-size:.85rem; }
.shareResultCard.share-blue { border-color:#477fca; }
.shareResultCard.share-red { border-color:#c94f58; }
.shareResultCard.share-grey { border-color:#777d87; }

/* ==================================================
   V31 - DEDICATED SOBERED ROLE SCREEN
   ================================================== */
.soberRoleScreen {
    width: min(100%, 430px);
    margin: 0 auto;
    min-height: 100dvh;
    padding: 80px 20px 48px;
    text-align: center;
}
.soberRoleScreen h1 {
    margin: 8px 0 10px;
}
.soberRoleIntro {
    color: var(--muted);
    margin-bottom: 22px;
}
.soberRoleCard {
    padding: 28px 20px;
    margin-bottom: 22px;
    border: 1px solid #444a55;
    border-radius: 18px;
    background: var(--panel);
}
.soberRoleEmoji {
    font-size: 4rem;
    margin-bottom: 14px;
}
.soberRoleCard h2 {
    margin: 14px 0 10px;
    font-size: 1.8rem;
}
.soberRoleCard p {
    color: var(--muted);
    line-height: 1.55;
}
.soberRoleCard.sober-blue { border-color: #477fca; }
.soberRoleCard.sober-red { border-color: #c94f58; }
.soberRoleCard.sober-grey { border-color: #777d87; }
#returnFromSoberButton { width: 100%; }

/* ==================================================
   V33 - MENU ICONS, SETUP GROUPS, ROLE REMINDER
   ================================================== */
.room {
    display: flex;
    align-items: center;
    justify-content: center;
}
.roomSymbol {
    font-size: 34px;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.28));
}
.setupRoleGroup {
    margin: 26px 0;
    padding: 14px;
    border: 1px solid #343842;
    border-radius: 16px;
    background: rgba(255,255,255,.015);
}
.setupRoleGroup h3 {
    margin: 2px 0 14px;
    font-size: 17px;
}
.blueSetupGroup { border-color: rgba(76,139,230,.48); }
.redSetupGroup { border-color: rgba(220,76,85,.48); }
.independentSetupGroup { border-color: rgba(180,184,194,.38); }
.effectsSetupGroup { border-color: rgba(180,184,194,.22); }

.myCharacterButton {
    display: block;
    width: 100%;
    margin: 18px 0 8px;
}
.roleReminderOverlay,
.hotPotatoOverlay {
    position: fixed;
    inset: 0;
    z-index: 18000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(5,7,11,.97);
}
.roleReminderOverlay.hidden,
.hotPotatoOverlay.hidden { display: none !important; }
.roleReminderCard,
.hotPotatoCard {
    width: min(100%, 430px);
    padding: 28px 22px;
    border: 1px solid #3b414c;
    border-radius: 18px;
    background: var(--panel);
    text-align: center;
}
.roleReminderCard .button,
.hotPotatoCard .button { width: 100%; margin-top: 20px; }
.cloneStatus {
    margin: 18px 0 0;
    padding: 12px;
    border: 1px solid #565c67;
    border-radius: 11px;
    color: #e4e6eb;
    font-size: .9rem;
    line-height: 1.45;
}
.hotPotatoCard {
    border-color: #d05a60;
}
.hotPotatoEmoji {
    font-size: 5rem;
    margin-bottom: 8px;
}
.hotPotatoCard h2 {
    color: #ff777d;
    font-size: 1.65rem;
}

/* ==================================================
   V35 - APP MODALS + CURRENT PLAYER HIGHLIGHT
   ================================================== */
.appModal {
    position: fixed;
    inset: 0;
    z-index: 25000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(5, 7, 11, .94);
    backdrop-filter: blur(4px);
}
.appModal.hidden { display: none !important; }
.appModalCard {
    width: min(100%, 420px);
    padding: 26px 20px 20px;
    border: 1px solid #3c424d;
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 18px 60px rgba(0,0,0,.45);
    text-align: center;
}
.appModalCard h2 {
    margin: 6px 0 10px;
}
.appModalMessage {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}
.appModalActions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 22px;
}
.appModalActions:has(#appModalCancel:not(.hidden)) {
    grid-template-columns: 1fr 1fr;
}
.appModalActions .button {
    width: 100%;
    margin: 0;
}
#appModalCancel.secondary {
    background: #292e37;
    border-color: #4b515d;
    color: #fff;
}

/* Your identity is shown by the name colour rather than a YOU badge. */
.roomPlayer.isYou {
    border-color: inherit;
}
.roomPlayer.isYou .roomPlayerName {
    color: #ffd86b;
    font-weight: 800;
}
.roomPlayer .you {
    display: none !important;
}

/* ==================================================
   V36 - CONMAN + CLONE SHARE NOTICES
   ================================================== */
.shareEventNoticeOverlay {
    position: fixed;
    inset: 0;
    z-index: 17500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(5, 7, 11, .97);
}
.shareEventNoticeOverlay.hidden { display: none !important; }
.shareEventNoticeCard {
    width: min(100%, 430px);
    padding: 28px 22px;
    border: 1px solid #454b57;
    border-radius: 18px;
    background: var(--panel);
    text-align: center;
}
.shareEventNoticeEmoji {
    margin-bottom: 8px;
    font-size: 4.5rem;
}
.shareEventNoticeCard h2 {
    margin: 7px 0 12px;
}
.shareEventNoticeCard p:not(.smallTitle) {
    color: var(--muted);
    line-height: 1.55;
}
.shareEventNoticeCard .button {
    width: 100%;
    margin-top: 20px;
}
.shareEventNoticeCard.connedNotice {
    border-color: #b76ae0;
}
.shareEventNoticeCard.cloneNotice {
    border-color: #8b93a1;
}

/* ==================================================
   V37 - CHARACTER CARDS POLISH + PRODUCT VERSION
   ================================================== */
.characterCardFilters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 20px -4px 24px;
    padding: 4px 4px 8px;
    scrollbar-width: none;
}
.characterCardFilters::-webkit-scrollbar { display: none; }
.characterCardFilter {
    flex: 0 0 auto;
    padding: 8px 13px;
    border: 1px solid #424854;
    border-radius: 999px;
    background: #20242c;
    color: #c9cdd5;
    font: inherit;
    font-size: .8rem;
    font-weight: 750;
    cursor: pointer;
}
.characterCardFilter.active {
    border-color: #858d9b;
    background: #e8eaf0;
    color: #15181e;
}
.characterCardGroup.hidden { display: none !important; }
.characterReferenceContent { min-width: 0; flex: 1; }
.characterReferenceTitle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.characterRequiredBadge {
    display: inline-flex;
    padding: 3px 7px;
    border: 1px solid #5b626e;
    border-radius: 999px;
    color: #aeb4bf;
    font-size: .58rem;
    font-weight: 900;
    letter-spacing: .09em;
}

.productVersion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 30px;
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 7px;
    background: rgba(255,255,255,.025);
    color: #777e8a;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
    user-select: none;
}
.productVersionName {
    color: #a3a9b3;
}
.productVersionDivider {
    width: 1px;
    height: 11px;
    background: #4a505a;
}
.productVersionNumber {
    color: #737a85;
}

/* ==================================================
   V39 - LOBBY IDENTITY + SYNCHRONISED HOSTAGES
   ================================================== */
.player.isYou .playerName {
    color: #ffd86b;
    font-weight: 800;
}

/* Give the product/build mark more footer breathing room. */
.productVersion {
    margin-top: 48px;
    margin-bottom: 12px;
}

.hostageTakeover.exchangeReady .hostageDestination {
    border-color: #5f9dff;
    box-shadow: 0 0 0 1px rgba(95,157,255,.16), 0 0 24px rgba(95,157,255,.08);
}
.hostageTakeover.exchangeReady .hostageWait {
    color: #eef4ff;
}

/* ==================================================
   V40 - CHARACTER STATUS + PAIR BADGES
   ================================================== */
.characterPairBadge {
    display: inline-flex;
    padding: 3px 7px;
    border: 1px solid #6a6077;
    border-radius: 999px;
    background: rgba(165, 126, 202, .07);
    color: #c8acd9;
    font-size: .58rem;
    font-weight: 900;
    letter-spacing: .09em;
}

/* ==================================================
   V41 - SUPERVISOR HOSTAGE READINESS
   ================================================== */
.exchangeReadiness {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin: 17px 0 19px;
}
.exchangeReadiness.hidden { display: none !important; }

.exchangeRoomStatus {
    padding: 11px 8px;
    border: 1px solid #454b56;
    border-radius: 10px;
    background: rgba(255,255,255,.025);
    text-align: center;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.exchangeRoomStatusName {
    display: block;
    margin-bottom: 5px;
    color: #8d949f;
    font-size: .64rem;
    font-weight: 850;
    letter-spacing: .11em;
}
.exchangeRoomStatusState {
    display: block;
    color: #a8aeb8;
    font-size: .76rem;
    font-weight: 900;
}
.exchangeRoomStatus.ready {
    border-color: #57a778;
    background: rgba(64,151,99,.10);
}
.exchangeRoomStatus.ready .exchangeRoomStatusState {
    color: #7dd59d;
}
.exchangeReadiness.bothReady .exchangeRoomStatus.ready {
    border-color: #69b9ff;
    background: rgba(69,149,219,.11);
}
.exchangeReadiness.bothReady .exchangeRoomStatus.ready .exchangeRoomStatusState {
    color: #8dccff;
}

.exchangePanel.bothRoomsReady {
    border-color: #69b9ff;
    box-shadow: 0 0 0 1px rgba(105,185,255,.13), 0 0 28px rgba(105,185,255,.09);
    animation: exchangeReadyPulse .65s ease-out 1;
}
.exchangePanel.bothRoomsReady #exchangeTitle {
    color: #8dccff;
}
@keyframes exchangeReadyPulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.012); }
    100% { transform: scale(1); }
}

/* ==================================================
   V42 - COMPLETE WINNERS / LOSERS RESULTS
   ================================================== */
.resultDetails {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}
.resultSection {
    overflow: hidden;
    border: 1px solid #3d434e;
    border-radius: 14px;
    background: rgba(255,255,255,.025);
    text-align: left;
}
.resultSectionHeading {
    padding: 10px 13px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: #aeb4bf;
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .11em;
}
.resultSpecialSection .resultLine {
    padding: 11px 13px;
    border-bottom: 1px solid rgba(255,255,255,.055);
    line-height: 1.45;
}
.resultSpecialSection .resultLine:last-child {
    border-bottom: 0;
}
.resultWinnersSection {
    border-color: rgba(87,167,120,.52);
}
.resultWinnersSection .resultSectionHeading {
    color: #80d6a2;
    background: rgba(64,151,99,.08);
}
.resultLosersSection {
    border-color: rgba(191,90,90,.46);
}
.resultLosersSection .resultSectionHeading {
    color: #e09a9a;
    background: rgba(176,70,70,.07);
}
.resultPlayerList {
    display: grid;
}
.resultPlayerRow {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    border-bottom: 1px solid rgba(255,255,255,.055);
}
.resultPlayerRow:last-child {
    border-bottom: 0;
}
.resultPlayerIcon {
    width: 28px;
    flex: 0 0 28px;
    text-align: center;
    font-size: 1.25rem;
}
.resultPlayerIdentity {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}
.resultPlayerIdentity strong {
    color: #f0f1f4;
    font-size: .93rem;
}
.resultPlayerIdentity span {
    color: #858c98;
    font-size: .73rem;
}
.resultEmpty {
    padding: 12px 13px;
    color: #7e8590;
    font-size: .82rem;
}


/* ==================================================
   VERSION 42 · BUILD 2 - COY BOYS + COUNTER OFFERS
   ================================================== */
.counterShareButton {
    background: linear-gradient(180deg, #555b69, #3d424e);
    color: #fff;
}
.counterOfferCard {
    border-color: rgba(116, 153, 214, .55);
    box-shadow: 0 0 30px rgba(72, 117, 188, .08);
}
