body {
    font-family: Calibri, Arial, sans-serif;
	font-size:1.4rem;
}

.messages-panel {
    height: min(62vh, 560px);
    min-height: 340px;
    overflow-y: auto;
    background: #e5e5e5;
    direction: ltr;
    padding: .45rem .6rem;
    border-bottom: 0;
}
.chat-footer {
    padding: 0;
    border-top: 1px solid rgba(0,0,0,.12);
}
#startButton {
    font-size: 20px;
}
#messageForm {
    position: relative;
    margin: 0 !important;
}
.emoji-button {
    min-width: 3.6rem;
    min-height: 3.45rem;
    border-top: 0;
    border-left: 0;
    border-radius: 0;
    font-size: 1.3rem;
}
#messageInput {
    min-height: 3.45rem;
    max-height: 8.25rem;
    font-size: 1.15rem;
    padding: .8rem 1rem;
    border-top: 0;
    border-left: 0;
    border-radius: 0;
    line-height: 1.35;
    overflow-y: auto;
    resize: none;
}
#sendButton {
    min-width: 6rem;
    min-height: 3.45rem;
    font-size: 1.12rem;
    font-weight: 600;
    border-top: 0;
    border-right: 0;
    border-radius: 0;
}
.emoji-picker {
    position: absolute;
    left: .45rem;
    bottom: calc(100% + .45rem);
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(6, 2.2rem);
    gap: .25rem;
    padding: .45rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,.14);
    border-radius: .5rem;
    box-shadow: 0 .35rem 1rem rgba(0,0,0,.12);
}
.emoji-option {
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border: 0;
    border-radius: .35rem;
    background: transparent;
    font-size: 1.25rem;
    line-height: 1;
}
.emoji-option:hover,
.emoji-option:focus {
    background: #f1f3f5;
}
#nextButton,
#reportButton,
#leaveButton {
    min-height: 2.65rem;
}
.chat-actions {
    justify-content: center;
    padding: .55rem .75rem .75rem;
    background: #fff;
}
#nextButton {
    min-width: 11rem;
}
#leaveButton {
    min-width: 4.5rem;
}
#reportButton {
    min-width: 5.5rem;
}
.report-dialog {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, .46);
}
.report-card {
    width: min(100%, 440px);
    padding: 1rem;
    background: #fff;
    border-radius: .55rem;
    box-shadow: 0 1rem 2.5rem rgba(0,0,0,.22);
}
.report-card textarea {
    resize: vertical;
}
.message-row {
    display: block;
    margin-bottom: .05rem;
    text-align: left;
}
.message-row.mine,
.message-row.stranger {
    justify-content: initial;
}
.message-bubble {
    max-width: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    overflow-wrap: anywhere;
    direction: auto;
    color: #111;
    font-size: 1rem;
    line-height: 1.12;
    white-space: pre-wrap;
}
.message-row.mine .message-bubble {
    background: transparent;
    color: #111;
    border-color: transparent;
}
.message-speaker {
    font-weight: 700;
    color: #dc3545;
}
.message-row.mine .message-speaker {
    color: #0d6efd;
}
.message-time {
    display: block;
    margin-top: .25rem;
    font-size: .7rem;
    opacity: .72;
}
.system-message {
    text-align: center;
    color: #6c757d;
    font-size: .875rem;
    margin: .75rem 0;
}
.language-button {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    min-height: 1.8rem;
    padding: .16rem .38rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,.18);
    border-radius: .32rem;
    color: #212529;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.2;
}
.language-button:hover,
.language-button.active {
    border-color: #0d6efd;
    box-shadow: 0 0 0 .1rem rgba(13,110,253,.12);
}
.language-flag {
    width: 1.15rem;
    height: .78rem;
    object-fit: cover;
    border-radius: .08rem;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12);
}
.gender-badge {
    display: inline-block;
    vertical-align: middle;
    padding: .08rem .42rem;
    border-radius: .35rem;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.25;
}
.gender-badge.male {
    color: #084298;
    background: #cfe2ff;
}
.gender-badge.female {
    color: #842029;
    background: #f8d7da;
}
.chat-status-line {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}
.status-spinner {
    width: .9rem;
    height: .9rem;
    border: 2px solid rgba(13,110,253,.22);
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: status-spin .75s linear infinite;
    flex: 0 0 auto;
}
@keyframes status-spin {
    to {
        transform: rotate(360deg);
    }
}

[dir="rtl"] #messageForm .form-control {
    border-radius: 0;
}

[dir="rtl"] #messageForm .btn {
    border-radius: 0;
}

[dir="rtl"] .emoji-picker {
    right: .45rem;
    left: auto;
}

[dir="rtl"] body {
    text-align: right;
}

[dir="rtl"] .text-center {
    text-align: center !important;
}

[dir="rtl"] .messages-panel {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .message-row {
    justify-content: initial;
    text-align: right;
}

[dir="rtl"] .message-bubble {
    margin: 0;
    direction: rtl;
}

.admin-login {
    max-width: 420px;
}
.admin-browser {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.admin-list-panel,
.admin-detail-panel {
    min-width: 0;
}
.admin-session-list {
    display: grid;
    gap: .5rem;
}
.admin-session-item {
    width: 100%;
    padding: .8rem .9rem;
    text-align: left;
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: .5rem;
}
.admin-session-item:hover,
.admin-session-item.active {
    border-color: #0d6efd;
    box-shadow: 0 0 0 .15rem rgba(13,110,253,.12);
}
.admin-session-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.admin-session-item-meta {
    margin-top: .35rem;
    color: #6c757d;
    font-size: .82rem;
}
.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: 1rem;
}
.admin-room {
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: .5rem;
    box-shadow: 0 .125rem .35rem rgba(0,0,0,.04);
}
.admin-room-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.admin-users {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.admin-user {
    min-width: 0;
}
.admin-meta {
    display: grid;
    grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
    gap: .25rem .75rem;
    margin-top: .5rem;
    font-size: .875rem;
}
.admin-meta dt {
    color: #6c757d;
    font-weight: 600;
}
.admin-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}
.admin-transcript {
    max-height: 360px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
}
.admin-transcript-large {
    max-height: 58vh;
}
.admin-detail-empty {
    padding: 3rem 1rem;
    color: #6c757d;
    text-align: center;
    background: #fff;
    border: 1px dashed rgba(0,0,0,.18);
    border-radius: .5rem;
}
.admin-session-summary {
    padding: .65rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,.08);
    color: #6c757d;
    font-size: .875rem;
}
.admin-message {
    padding: .65rem .75rem;
    margin-bottom: .5rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: .5rem;
}
.admin-message-header {
    margin-bottom: .25rem;
    color: #6c757d;
    font-size: .78rem;
    font-weight: 600;
}
.admin-message-body {
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    body {
        background: #f3f4f6;
    }

    main.container {
        max-width: 100%;
        padding: .35rem !important;
    }

    main.container > .row,
    main.container > .row > [class*="col-"] {
        min-height: calc(100dvh - .7rem);
    }

    .text-center.mb-4 {
        margin-bottom: .45rem !important;
    }

    .language-switcher {
        margin-bottom: .35rem !important;
    }

    #chatCard,
    #startCard,
    #joinCard {
        width: 100%;
    }

    #chatCard {
        min-height: calc(100dvh - .7rem);
        display: flex;
        flex-direction: column;
        border-radius: .6rem;
        overflow: hidden;
    }

    #chatCard .card-header {
        flex: 0 0 auto;
        padding: .7rem .8rem !important;
    }

    .messages-panel {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        padding: .45rem .55rem;
    }

    .chat-footer {
        flex: 0 0 auto;
    }

    #messageForm {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
    }

    .emoji-button {
        min-width: 2.9rem;
        width: 2.9rem;
        padding-left: 0;
        padding-right: 0;
    }

    #messageInput {
        min-width: 0;
        flex: 1 1 auto;
        font-size: 1rem;
        padding-left: .75rem;
        padding-right: .75rem;
    }

    #sendButton {
        min-width: 4.3rem;
        width: 4.3rem;
        padding-left: .4rem;
        padding-right: .4rem;
    }

    .chat-actions {
        padding: .5rem .6rem .65rem;
    }

    #nextButton {
        min-width: 9.5rem;
    }

    #leaveButton {
        min-width: 4.25rem;
    }

    #reportButton {
        min-width: 4.75rem;
    }
}

@media (max-width: 767.98px) {
    .admin-browser {
        grid-template-columns: 1fr;
    }
    .admin-users {
        grid-template-columns: 1fr;
    }
}
