.global-chat-launch {
    position: fixed;
    z-index: 120;
    left: max(10px, var(--game-inset-left));
    right: max(10px, var(--game-inset-right));
    bottom: calc(var(--game-inset-bottom) + var(--bottom-nav-model-height, 88px) + 5px);
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    pointer-events: none;
}

.global-chat-launch-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 6px 11px;
    overflow: hidden;
    border: 1px solid rgba(0, 225, 255, .58);
    border-left: 3px solid #00e8ff;
    background:
        linear-gradient(90deg, rgba(4, 19, 32, .97), rgba(5, 12, 25, .94)),
        rgba(3, 9, 18, .96);
    box-shadow: 0 0 12px rgba(0, 232, 255, .12), inset 0 1px 0 rgba(176, 243, 255, .1);
    color: #eef8ff;
    text-align: left;
    cursor: pointer;
    pointer-events: auto;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 8px);
}

.global-chat-launch-button:active {
    border-color: #71f2ff;
    background: #082237;
}

body.global-chat-open .global-chat-launch {
    visibility: hidden;
    pointer-events: none;
}

.global-chat-launch-live {
    flex: 0 0 auto;
    color: #48f2e0;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .08em;
}

.global-chat-launch-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
}

.global-chat-teaser-name {
    flex: 0 0 auto;
    max-width: 28%;
    overflow: hidden;
    color: #ffd66e;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
}

.global-chat-teaser-text {
    overflow: hidden;
    color: #e4edf8;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
}

.global-chat-launch-action {
    flex: 0 0 auto;
    color: #4cddf7;
    font-family: 'Orbitron', sans-serif;
    font-size: 8px;
    letter-spacing: .07em;
}

.global-chat-unread {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border: 1px solid #fff;
    background: #ff315d;
    box-shadow: 0 0 8px rgba(255, 49, 93, .9);
}

.global-chat-overlay {
    position: fixed;
    z-index: 200001;
    inset: var(--game-inset-top, 0) var(--game-inset-right, 0) var(--game-inset-bottom, 0) var(--game-inset-left, 0);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 8px 10px calc(var(--bottom-nav-model-height, 88px) + 50px);
    background: rgba(1, 5, 13, .24);
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
}

.global-chat-overlay.hidden {
    display: none !important;
}

.global-chat-window {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(100%, 460px);
    min-width: 0;
    max-width: 100%;
    height: min(42dvh, 420px);
    min-height: min(280px, calc(100dvh - 160px));
    overflow: hidden;
    border: 1px solid rgba(0, 232, 255, .7);
    background:
        linear-gradient(155deg, rgba(9, 24, 42, .99), rgba(3, 8, 19, .99) 70%),
        #06101d;
    box-shadow: 0 0 28px rgba(0, 232, 255, .17), inset 0 1px 0 rgba(177, 242, 255, .13);
    color: #eef5ff;
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

.global-chat-head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(87, 156, 191, .3);
    background: linear-gradient(90deg, rgba(0, 232, 255, .09), transparent 70%);
}

.global-chat-title {
    color: #effaff;
    font-family: 'Orbitron', 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
}

.global-chat-subtitle {
    display: block;
    margin-top: 4px;
    color: #8da9bd;
    font-size: 12px;
}

.global-chat-head-state {
    color: #45e7d1;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    white-space: nowrap;
}

.global-chat-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(130, 174, 205, .42);
    background: rgba(7, 17, 30, .9);
    color: #d7e6f3;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.global-chat-messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 13px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.global-chat-message {
    width: 100%;
    min-width: 0;
    padding: 7px 2px 8px;
    border-bottom: 1px solid rgba(82, 119, 148, .2);
}

.global-chat-message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-bottom: 3px;
}

.global-chat-rank {
    display: inline-grid;
    flex: 0 0 19px;
    width: 19px;
    height: 19px;
    place-items: center;
    border: 1px solid rgba(0, 218, 255, .62);
    background: rgba(0, 111, 157, .17);
    color: #50eaff;
    font-size: 12px;
    line-height: 1;
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

.global-chat-rank-title {
    overflow: hidden;
    color: #61cbe4;
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-chat-player-name {
    overflow: hidden;
    color: #edf8ff;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
}

.global-chat-vip {
    flex: 0 0 auto;
    padding: 1px 5px;
    border: 1px solid rgba(255, 196, 67, .6);
    background: rgba(159, 98, 10, .19);
    color: #ffd56d;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    font-weight: 700;
}

.global-chat-time {
    flex: 0 0 auto;
    margin-left: auto;
    color: #8196ab;
    font-size: 11px;
}

.global-chat-message-text {
    max-width: 100%;
    min-width: 0;
    color: #dce8f3;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
    user-select: text;
    -webkit-user-select: text;
}

.global-chat-astra {
    max-width: 100%;
    min-width: 0;
    margin: 7px 0;
    padding: 8px 9px;
    border: 1px solid rgba(0, 218, 255, .28);
    border-left: 3px solid #38dcef;
    background: linear-gradient(90deg, rgba(0, 174, 206, .11), rgba(5, 21, 34, .7));
    clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}

.global-chat-astra-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.global-chat-astra-icon {
    color: #62f2ff;
    font-size: 16px;
}

.global-chat-astra-name {
    color: #91efff;
    font-size: 14px;
}

.global-chat-astra-role {
    overflow: hidden;
    color: #7eaabe;
    font-family: 'Orbitron', sans-serif;
    font-size: 8px;
    letter-spacing: .04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-chat-market {
    max-width: 100%;
    min-width: 0;
    margin: 8px 0;
    padding: 9px 10px;
    border: 1px solid rgba(255, 48, 123, .36);
    border-left: 3px solid #ff397f;
    background: linear-gradient(90deg, rgba(255, 39, 112, .12), rgba(26, 11, 29, .55));
    clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}

.global-chat-market-label {
    margin-bottom: 4px;
    color: #ff77a8;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
}

.global-chat-market .global-chat-time {
    display: block;
    margin-top: 4px;
    text-align: right;
}

.global-chat-empty {
    margin: auto;
    padding: 20px;
    color: #9fb2c3;
    font-size: 15px;
    text-align: center;
}

.global-chat-compose {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    padding: 10px 12px 7px;
    border-top: 1px solid rgba(87, 156, 191, .3);
    background: rgba(3, 9, 18, .78);
}

.global-chat-input {
    min-width: 0;
    min-height: 42px;
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(112, 148, 177, .43);
    border-radius: 0;
    outline: none;
    background: rgba(5, 13, 24, .96);
    color: #eff8ff;
    font: 500 16px 'Rajdhani', 'Segoe UI', sans-serif;
    user-select: text;
    -webkit-user-select: text;
}

.global-chat-input:focus {
    border-color: rgba(0, 232, 255, .85);
    box-shadow: 0 0 8px rgba(0, 232, 255, .12);
}

.global-chat-input:disabled {
    opacity: .55;
}

.global-chat-send {
    min-width: 48px;
    min-height: 42px;
    border: 1px solid #00bcd7;
    background: linear-gradient(180deg, #087c9c, #06435f);
    color: #f1fcff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

.global-chat-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.global-chat-status {
    min-height: 17px;
    padding: 0 13px;
    color: #ff9bb4;
    font-size: 12px;
}

.global-chat-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 13px 9px;
    color: #8da2b5;
    font-size: 11px;
}

@media (max-width: 640px) {
    .global-chat-launch { left: 7px; right: 7px; }
    .global-chat-launch-button { min-height: 40px; padding: 5px 8px; }
    .global-chat-launch-live { font-size: 8px; }
    .global-chat-launch-action { font-size: 7px; }
    .global-chat-window { height: min(42dvh, 380px); width: 100%; }
    .global-chat-overlay { box-sizing: border-box; padding-right: 7px; padding-left: 7px; }
    .global-chat-head { gap: 8px; padding-inline: 10px; }
    .global-chat-head > div { min-width: 0; flex: 1 1 auto; }
    .global-chat-head-state { display: none; }
    .global-chat-title,
    .global-chat-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .global-chat-footer > span:last-child { display: none; }
    .global-chat-messages { gap: 0; padding-top: 4px; padding-bottom: 4px; }
    .global-chat-message { padding-top: 3px; padding-bottom: 4px; }
    .global-chat-astra,
    .global-chat-market { margin-top: 2px; margin-bottom: 2px; padding-top: 4px; padding-bottom: 4px; }
}

@media (min-width: 720px) {
    .global-chat-overlay { justify-content: flex-end; padding-right: 18px; }
    .global-chat-window { width: min(460px, 44vw); height: min(48dvh, 440px); min-height: 320px; }
}

@media (max-height: 540px) {
    .global-chat-overlay { padding-bottom: calc(var(--bottom-nav-model-height, 88px) + 48px); }
    .global-chat-window { height: min(calc(100dvh - 155px), 360px); min-height: 220px; }
    .global-chat-head { min-height: 48px; padding-block: 6px; }
    .global-chat-compose { padding-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .global-chat-launch-button,
    .global-chat-window { scroll-behavior: auto; }
}
