.mud-stack-width {
    max-width: 100%;
    display: flex;
    width: auto;
}

.mud-stack-child {
    flex-shrink: 0;
}

.parent-mud-centering {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh);
    width: 100%;
}

.parent-mud-centering-64 {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 64px);
    width: 100%;
}

.game-not-enabled-row {
    background: #f39b9b;
}

.game-enabled-row {
    background-color: #bdf6be;
}

.lol-parent {
    position: relative;
}

.lol-child {
    /*position: absolute;*/
    top: 0;
    left: 0;
    width: 90vw; /* Ширина на всю видимую область страницы */
    height: 80vh; /* Высота на всю видимую область страницы */
}

.page-size-general {
    width: 100%;
    /* Fill the host container instead of a viewport-absolute height. The host (standalone
       chat page, or the /chats conversation pane) owns the real available height, so an
       absolute calc(100vh - …) here overflowed once a switch bar sat above the chat and
       pushed the message input off the bottom of the screen. */
    height: 100%;
}

/* Профиль игры в /games. MudOverlay центрирует .mud-overlay-content и не задаёт ей высоту,
   поэтому height:100% у .page-size-general не разрешался, а панель выше области грида
   выпирала вверх и вниз одинаково — верх уезжал под шапку (z-index оверлея = 5, у AppBar 1100)
   и обрезал полосу вкладок. Прибиваем контент к коробке оверлея (от шапки до низа экрана),
   а прокрутку отдаём внутренним панелям: .page-row-full-size и .test-screen (обе overflow:auto). */
.game-profile-overlay .mud-overlay-content {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.collapser-item {
    width: 100%;
}

.sony-status-container {
    border: 1px solid lightgray;
    padding: 8px;
}

.chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Flex items default to min-width:auto, which refuses to shrink below the content's
   max-content width. Without min-width:0 a wide message (a row of 250px screenshots)
   stretches the chat past the window and pushes the orders panel — with the
   "Закрыть и сообщить" buttons — off screen. */
.chat-layout {
    min-width: 0;
    max-width: 100%;
}

.chat-column {
    min-width: 0;
}

/* The pane on the Chats page that hosts the open chat next to the 400px chat list. */
.chat-pane {
    min-width: 0;
}

/* The Chats page top switcher (list <-> conversation) is mobile-only; on desktop both
   columns are shown side by side, so the bar stays hidden. */
.chats-mobile-switch {
    display: none;
}

.chat-side-panel {
    flex-shrink: 0;
}

/* The info panel is a permanent side column on desktop, so its mobile-only chrome
   (open button, slide-in backdrop, in-panel close header) stays hidden here and is
   switched on inside the max-width:600px block below. */
.info-toggle-btn {
    display: none;
}

.chat-info-backdrop {
    display: none;
}

.info-panel-mobile-header {
    display: none;
}

.chat-paper {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
}

/* The message list is the one part that scrolls; min-height:0 lets it actually shrink
   inside the flex column so the header and input stay pinned instead of being pushed
   out of view when there are many messages. */
#message-container {
    min-height: 0;
}

.chat-header {
    /* Never let the flex column shrink the header — otherwise the long message list's
       content makes every flex item shrink and the (wrapped) header gets clipped. Only
       #message-container shrinks and scrolls. Same reason for .chat-input-container. */
    flex-shrink: 0;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    background-color: var(--mud-palette-background-grey);
}

.chat-messages-container {
    /*flex: 1;*/
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    background-color: var(--mud-palette-background);
    background-image: linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 20px 20px;
}

.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.message-row {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease-in-out;
    max-width: 85%;
}

.own-message {
    margin-left: auto;
    justify-content: flex-end;
}

.message {
    padding: 10px 12px;
    border-radius: 18px;
    position: relative;
    max-width: 100%;
    word-wrap: break-word;
}

.message-sent {
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    border-bottom-right-radius: 4px;
}

.message-received {
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border-bottom-left-radius: 4px;
}

.message-text {
    font-size: 12px;
    margin-bottom: 4px;
    /* break-word alone does not lower the min-content width, so a long link could still
       widen the chat; anywhere does. */
    overflow-wrap: anywhere;
}

/* Telegram messages arrive as HTML and may contain <pre> (order + payment links). Its default
   white-space:pre never wraps, which overflow-wrap cannot override, so one long payment link
   stretched the whole chat. pre-wrap keeps the formatting but allows wrapping. */
.message pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Attached screenshots wrap onto the next line instead of widening the chat. */
.chat-message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
}

.chat-message-files img {
    min-width: 0;
    max-width: 100%;
}

.message-time {
    font-size: 0.9rem;
    opacity: 0.8;
    text-align: right;
    margin-top: 2px;
    color: #7C90A1;
}

.chat-input-container {
    flex-shrink: 0;
    background-color: var(--mud-palette-background-grey);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

/*.chat-input {*/
/*    flex: 1;*/
/*}*/

.chat-input {
    field-sizing: content;
    flex: 1;
    font-family: inherit;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    min-height: 20px;
    max-height: 200px;
    overflow-y: auto;
    resize: none;
}

.chat-input ::deep .mud-input {
    margin-top: 0;
    padding: 8px 8px;
    background-color: var(--mud-palette-surface);
    border-radius: 24px;
}

.typing-indicator {
    padding: 10px;
    width: auto;
}

.typing-dots {
    display: flex;
    align-items: center;
    height: 20px;
}

.dot {
    height: 8px;
    width: 8px;
    background-color: var(--mud-palette-text-secondary);
    border-radius: 50%;
    margin: 0 3px;
    opacity: 0.6;
    animation: bounce 1.5s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

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

/* Mobile responsiveness */
@media (max-width: 600px) {
    .chat-paper {
        border-radius: 0;
    }

    .chat-header, .chat-input-container {
        border-radius: 0;
    }

    /* The chat header packs a lot (name, info toggle, probe + refresh, "Непрочитанные?"
       filter, "Прочитать все"). As one nowrap toolbar row it overflowed off the right edge
       on a phone, hiding the info button and clipping "Прочитать все". Let it wrap so every
       control stays on screen and reachable. */
    .chat-header {
        height: auto !important;
        min-height: 0 !important;
        flex-wrap: wrap;
        row-gap: 6px;
    }

    /* Left-align the wrapped controls instead of letting the spacer eat a whole row. */
    .chat-header .mud-spacer {
        display: none;
    }

    .chat-header-actions {
        flex-wrap: wrap;
        gap: 8px !important;
        row-gap: 6px;
    }

    /* Anchor for the absolutely-positioned info overlay + backdrop. overflow:hidden keeps the
       panel — parked off the right edge while closed — from adding a horizontal scrollbar. */
    .chat-layout {
        position: relative;
        overflow: hidden;
    }

    /* Show the header button that opens the info panel on mobile. */
    .info-toggle-btn {
        display: inline-flex;
    }

    /* The chat always keeps the full width; the info panel no longer sits beside it. */
    .chat-column {
        width: 100%;
        flex-basis: 100%;
    }

    /* Info panel becomes a slide-in overlay pinned to the right edge, hidden off-screen
       until the operator opens it, so it never squeezes or covers the chat by default. */
    .chat-side-panel {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: min(88%, 360px);
        max-width: 88%;
        z-index: 30;
        background-color: var(--mud-palette-surface);
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.3);
        transform: translateX(100%);
        transition: transform 0.25s ease;
    }

    .chat-layout.info-open .chat-side-panel {
        transform: translateX(0);
    }

    /* In-panel close row (only meaningful while the overlay is open). */
    .info-panel-mobile-header {
        display: flex;
    }

    /* Tap-anywhere-else backdrop that dims the chat and closes the overlay. */
    .chat-info-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 20;
        background-color: rgba(0, 0, 0, 0.4);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .chat-layout.info-open .chat-info-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* Chats page: the list and the conversation can't share the narrow screen, so show the
       top switcher and collapse to a single full-width column showing only the active view. */
    .chats-mobile-switch {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
        border-bottom: 1px solid var(--mud-palette-lines-default);
    }

    .chats-switch-btn {
        flex: 1;
    }

    .chats-list-col {
        width: 100% !important;
    }

    .chats-list-col .chats-list-scroll {
        width: 100% !important;
    }

    /* !important: the columns carry MudBlazor's .d-flex utility (display:flex !important),
       so the hide rule has to outrank it — the extra class specificity + !important does. */
    .chats-body.show-chat .chats-list-col {
        display: none !important;
    }

    .chats-body.show-list .chats-chat-col {
        display: none !important;
    }
}

.page-row-full-size {
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: auto;
    padding: 8px;
    display: flex;
}

.list-content {
    background-color: #aed9ff;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fields-content {
    display: flex;
    flex-direction: row;
    padding: 0 !important;
}

.column-max-height-1 {
    max-height: 100%;
    height: 100%;
    overflow: auto;
    width: 100%;
}

.just-wrap-content {
    flex-grow: 0; /* Don't grow */
    flex-shrink: 0; /* Prevent shrinking */
    flex-basis: auto; /* Size based on content */
}

.original-field-input {
    border-radius: 0;
    border: 1px solid lightgray;
    height: 32px;
    padding: 0 12px;
}

.center-block {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    flex-grow: 1;
    border: 1px solid gray;
}
