.linkshell-chat-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.nav-group .linkshell-chat-toggle { flex: 0 0 2.5rem; }
.linkshell-chat-badge { position: absolute; top: -.35rem; right: -.4rem; min-width: 1.1rem; height: 1.1rem; padding: 0 .15rem; border-radius: 1rem; background: #b43c32; color: #fff; font: 800 .65rem/1.1rem system-ui, sans-serif; text-align: center; }
.linkshell-chat-panel { position: fixed; z-index: 50; top: 4.4rem; right: clamp(.65rem, 3vw, 2rem); box-sizing: border-box; width: min(23rem, calc(100vw - 1.3rem)); height: min(35rem, calc(100dvh - 5rem)); max-height: calc(100dvh - 5rem); display: flex; flex-direction: column; border: 1px solid rgba(201,162,75,.64); background: #171a18; color: #f1e8d5; box-shadow: 0 1.25rem 3rem rgba(0,0,0,.58); }
.linkshell-chat-panel[hidden] { display: none; }
.linkshell-chat-standalone-page { margin: 0; background: #171a18; }
.linkshell-chat-standalone-page .linkshell-chat-panel { inset: 0; width: 100%; height: 100dvh; max-height: none; box-shadow: none; }
.linkshell-chat-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem .75rem; background: rgba(201,162,75,.14); border-bottom: 1px solid rgba(201,162,75,.34); font: 800 .78rem/1.3 system-ui, sans-serif; letter-spacing: .08em; }
.linkshell-chat-tabs { display: flex; flex: 1; align-items: center; gap: .28rem; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.linkshell-chat-tab { position: relative; display: inline-flex; align-items: center; gap: .3rem; flex: none; max-width: 10rem; min-height: 1.9rem; padding: .25rem .48rem; border: 1px solid rgba(201,162,75,.35); background: #171a18; color: #d4c8ac; font: 700 .7rem/1.2 system-ui, sans-serif; letter-spacing: 0; cursor: pointer; }
.linkshell-chat-tab[aria-selected="true"] { background: rgba(201,162,75,.2); color: #fff3cf; border-color: #c9a24b; }
.linkshell-chat-tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkshell-chat-tab-unread { min-width: .4rem; min-height: .4rem; border-radius: 50%; background: #e65344; }
.linkshell-chat-tab-close { border: 0 !important; min-width: 1rem !important; min-height: 1rem !important; padding: 0; color: #e65344 !important; font-size: 1rem; line-height: 1; }
.linkshell-chat-tab-close:hover { color: #ff9d91 !important; }
.linkshell-chat-name { border: 0; padding: 0; background: transparent; color: var(--character-color, var(--gold)); font: 750 .84rem/1.4 system-ui, sans-serif; text-decoration: none; }
.linkshell-chat-name[href] { cursor: pointer; }
.linkshell-chat-name[href]:hover { text-decoration: underline; }
.linkshell-chat-heading button { border: 1px solid rgba(201,162,75,.35); background: transparent; color: inherit; min-width: 1.8rem; min-height: 1.8rem; cursor: pointer; }
.linkshell-chat-messages { min-height: 12rem; flex: 1; overflow-y: auto; padding: .6rem .7rem; overscroll-behavior: contain; }
.linkshell-chat-line { display: grid; grid-template-columns: 2rem minmax(0, 1fr); align-items: start; gap: .5rem; padding: .42rem .15rem; border-bottom: 1px solid rgba(201,162,75,.12); font: .84rem/1.4 system-ui, sans-serif; overflow-wrap: anywhere; }
.linkshell-chat-content { min-width: 0; }
.linkshell-chat-content > span { color: #f1e8d5; font: inherit; letter-spacing: normal; text-transform: none; }
.linkshell-chat-portrait { display: block; width: 2rem; height: 2rem; overflow: hidden; border: 0; background: var(--character-background, rgba(0,0,0,.35)); box-sizing: border-box; }
.linkshell-chat-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.linkshell-chat-line a, .linkshell-chat-line strong { color: var(--character-color, var(--gold)); font-weight: 750; text-decoration: none; }
.linkshell-chat-line a:hover { text-decoration: underline; }
.linkshell-chat-line time { display: block; margin-top: .15rem; color: #adad9e; font-size: .68rem; }
.linkshell-chat-form { padding: .55rem .7rem .65rem; border-top: 1px solid rgba(201,162,75,.34); }
.linkshell-chat-compose input { width: 100%; min-width: 0; box-sizing: border-box; padding: .4rem .5rem; border: 1px solid rgba(201,162,75,.4); background: #101311; color: #f1e8d5; font: .82rem/1.3 system-ui, sans-serif; }
.linkshell-chat-compose { display: flex; gap: .4rem; margin-top: .45rem; }
.linkshell-chat-compose button { flex: none; min-width: 2.2rem; border: 1px solid rgba(201,162,75,.55); background: rgba(201,162,75,.16); color: #f1e8d5; cursor: pointer; }
.linkshell-chat-form p { margin: .35rem 0 0; font: .72rem/1.3 system-ui, sans-serif; }
.linkshell-chat-login { margin: 0; padding: .7rem; border-top: 1px solid rgba(201,162,75,.34); font: .8rem/1.3 system-ui, sans-serif; }
.linkshell-chat-login a { color: var(--gold); }
@media (max-width: 600px) { .linkshell-chat-panel { top: 3.5rem; max-height: calc(100dvh - 4rem); } .nav-group .linkshell-chat-toggle { flex-basis: 2.2rem; } }
@media (max-width: 600px) { .linkshell-chat-standalone-page .linkshell-chat-panel { top: 0; max-height: none; } }
@media (max-width: 640px) {
  .topbar nav a.linkshell-chat-toggle,
  .topbar nav a.linkshell-chat-toggle:hover {
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }
  .topbar nav a.linkshell-chat-toggle:focus-visible {
    border: 0;
    box-shadow: none;
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }
}
