/* ── Chat mini / maxi state ──────────────────────────────────────────── */

#chronicles-mini-bar {
    display: none;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

#chronicles-mini-bar .panel-tabs {
    flex: 1;
    min-width: 0;
    border-bottom: none;
}

#mini-chat-tabs .panel-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
}

#chronicles-box.chronicles--mini {
    flex: 0 0 auto;
    min-height: 40px;
    background: none;
    background-image: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
}

#chronicles-box.chronicles--mini #chronicles-mini-bar {
    display: flex;
    justify-content: center;
    padding: 0;
}

#chronicles-box.chronicles--mini #mini-chat-tabs {
    display: none;
}

#chronicles-box.chronicles--mini #chat-expand-btn.chat-closed-btn {
    position: relative;
    flex-shrink: 0;
    width: 55%;
    height: 164px;
    margin: 0 -55px -30px 0;
    padding: 0;
    border: none;
    background: transparent url(/assets/bg-chat-full-closed-BbWHxV8G.png) no-repeat center / contain;
    cursor: pointer;
    transition: filter 0.15s ease;
}

#chronicles-box.chronicles--mini #chat-expand-btn.chat-closed-btn:hover {
    filter: brightness(1.08);
}

#chronicles-box.chronicles--mini .chat-closed-btn__unread {
    position: absolute;
    top: 65px;
    right: 27px;
}

#chronicles-box.chronicles--mini #chat-expand-btn.chat-closed-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

#chronicles-box.chronicles--mini #chronicles-view,
#chronicles-box.chronicles--mini #ship-inspector-view,
#chronicles-box.chronicles--mini #tile-info-panel {
    display: none !important;
}

.chat-header-row {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-right: 38px;
}

.chat-header-row .panel-tabs {
    flex: 1;
    min-width: 0;
}

#chronicles-box.chronicles--mini-capable .chat-header-row {
    padding-right: 58px;
}

/* Anchored to #chronicles-box - outside .panel-view so negative offsets are not clipped */
#chronicles-box > .chat-toggle-btn--anchored {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    margin: -0.8rem 0 0;
    z-index: 3;
}

#chronicles-box.chronicles--mini-capable > #chat-panel-open-btn {
    right: calc(var(--space-lg) + 36px);
}

#chronicles-box.chronicles--mini > #chat-panel-open-btn,
#chronicles-box.chronicles--mini-capable.chronicles--mini > #chat-minimize-btn,
#chronicles-box.chronicles--mini-capable.chronicles--mini > #chat-pin-btn {
    display: none;
}

.chat-toggle-btn {
    background: none;
    border: 1px solid rgba(197, 160, 89, 0.25);
    color: var(--gold);
    height: 30px;
    width: 30px;
    padding: 5px 10px;
    min-width: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    margin: 0 4px;
    transition:
        background 0.15s,
        border-color 0.15s;
}

#chronicles-mini-bar .panel-tab {
    border-bottom: none;
    margin-bottom: 0;
    padding: 5px 10px;
}

.chat-toggle-btn:hover {
    background: rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.4);
}

#chat-minimize-btn {
    display: none;
}

#chat-pin-btn {
    display: none;
}

#chronicles-box.chronicles--mini-capable > #chat-minimize-btn,
#chronicles-box.chronicles--mini-capable > #chat-pin-btn {
    display: flex;
}

#lower-sidebar #chronicles-box > #chat-minimize-btn {
    display: none !important;
}

/* Sidebar chat shell - stage + drawer + composer (mirrors chat-panel layout) */
#chronicles-view [data-chat-sidebar-shell] {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: visible;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}

#chronicles-view .chat-panel__stage {
    flex: 1;
    min-height: 0;
    min-width: 0;
}

#chronicles-view .chat-panel__composer {
    flex-shrink: 0;
    margin-top: 8px;
}

/* Scrollable message log */
#chronicles-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 0px;
    font-family: monospace;
    font-size: var(--font-size-md);
    line-height: 1.8;
    color: #c9d1d9;
    scrollbar-width: thin;
    scrollbar-color: rgba(197, 160, 89, 0.55) rgba(0, 0, 0, 0.25);
}
#chronicles-log::-webkit-scrollbar {
    width: 6px;
}
#chronicles-log::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.25);
}
#chronicles-log::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.55);
    border-radius: 3px;
}
#chronicles-log::-webkit-scrollbar-thumb:hover {
    background: rgba(197, 160, 89, 0.75);
}

/* Log entry base */
.log-entry {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.4rem;
    align-items: baseline;
    padding: 3px 0px;
    border-left: 2px solid transparent;
    transition: background 0.1s;
    line-height: 1.4rem;
    font-family: var(--font-body);
}
.log-entry:hover {
    background: rgba(197, 160, 89, 0.05);
    cursor: default;
}
.log-ts {
    color: #4a5568;
    font-size: var(--font-size-xs);
    white-space: nowrap;
    flex-shrink: 0;
}
.log-body {
    min-width: 0;
}

/* Color coding by event type - text only, no left border */
.log-entry.log-level {
    color: #e2c97e;
}
.log-entry.log-level .log-ts {
    color: #7a6030;
}

.log-entry.log-guild {
    color: #c39bd3;
}
.log-entry.log-guild .log-ts {
    color: #5e3570;
}

.log-entry.log-trade {
    color: #76d7c4;
    border-left-color: #1a7a6e;
}
.log-entry.log-trade .log-ts {
    color: #0e6655;
}

/* ── Chat feed message types ────────────────────────────────────────── */
.log-entry.log-player {
    color: var(--text-gold);
}
.log-entry.log-player .log-ts {
    color: #4e422b;
}
.log-entry.log-player .log-author {
    color: rgb(137 125 96);
    font-weight: 600;
    margin-right: 1px;
}
.log-guild-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1rem;
    margin-right: 0.3rem;
    margin-top: -2px;
    padding: 2px 0.32rem 0 0.32rem;
    box-sizing: border-box;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--chat-guild-tag-bg);
    border-radius: 2px;
    vertical-align: middle;
}
.log-guild-tag--link {
    cursor: pointer;
    transition:
        color 0.15s,
        background 0.15s;
}
.log-guild-tag--link:hover {
    color: var(--gold);
    background: rgba(197, 160, 89, 0.14);
}
.log-author--player {
    cursor: pointer;
}
.log-author--player:hover .log-author-name {
    color: var(--gold);
    text-decoration: underline;
}
.log-member-icon {
    width: 14px;
    height: 14px;
    margin-right: 3px;
    vertical-align: -3px;
    object-fit: contain;
    cursor: default;
}
.log-member-icon[data-help-key] {
    cursor: pointer;
}

.log-entry.log-system {
    color: #e2c97e;
    font-style: italic;
}
.log-entry.log-system .log-ts {
    color: #7a6030;
}

.log-entry.log-dev-coord {
    font-style: normal;
}

.log-entry.log-dev-coord .log-body {
    white-space: pre-wrap;
    font-family: 'Gothic A1', monospace;
    font-size: var(--font-size-xs);
    line-height: 1.45;
    color: rgba(226, 201, 126, 0.92);
}

.log-entry.log-activity {
    color: rgb(150 183 200 / 55%);
    /* font-size: 0.92em; */
    font-style: normal;
    line-height: 1.4rem;
}
.log-entry.log-activity .log-ts {
    color: rgb(55 61 65);
}
.log-activity-mark {
    color: #7ca7a6;
    font-size: 0.75em;
    margin-right: 1px;
}
.log-author--activity {
    cursor: pointer;
    color: rgb(117 117 117);
    margin-right: 1px;
}
.log-author--activity:hover {
    color: var(--gold) !important;
    text-decoration: underline;
}

.log-entry.log-ambient {
    color: #4a6070;
    border-left-color: transparent;
}
.log-entry.log-ambient .log-ts {
    color: #2e3840;
}
.log-entry.log-ambient .log-author--npc {
    color: #3d5568;
}

/* Combat rows (.log-entry.log-combat) are styled in combat-chat-log.css. */

/* --- Panel system --- */
/* All panel views share the same flex-column layout inside the sidebar */
.panel-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    position: relative;
}
