/* ─── Local Dialogue Modal ─── */

/* ── WhatsApp-style chat modal (fixed size) ── */
#local-dialogue-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(850px, 95vw);
    height: 82vh;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.03em;
}

#local-dialogue-box.active {
    display: flex !important;
}


/* WhatsApp-green tinted background with subtle dot-grid. */
#chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #0b141a;
    background-image: radial-gradient(rgba(100, 255, 218, 0.03) 1px, transparent 0);
    background-size: 24px 24px;
}

.chat-hdr {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-hdr .chr {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
}

.chat-hdr .st {
    color: var(--green);
    font-size: 0.7rem;
}


/* End-conversation button in chat header. */
#end-conv-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#end-conv-btn:hover {
    background: rgba(255, 80, 80, 0.2);
    border-color: rgba(255, 80, 80, 0.6);
    color: #ff6b6b;
}


/* Scrollable message area. */
#bub-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}


/* Choice buttons bar (hidden when no choices). */
#bar-choices {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

#bar-choices.hide {
    display: none;
}




/* Ink narrative-choice pill. */
.choice-btn {
    background: rgba(0, 168, 132, 0.1);
    border: 1px solid rgba(0, 168, 132, 0.4);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.choice-btn:hover {
    background: var(--green);
    color: var(--bg);
    border-color: var(--green);
}


/* ── Message bubbles & typing indicator ── */

/* Base bubble (colour set by modifier class). */
.msg {
    max-width: 80%;
    font-size: 0.88rem;
    line-height: 1.45;
    padding: 5px 0px;
    border-radius: 12px;
    word-wrap: break-word;
}

/* Incoming (NPC) bubble: left-aligned, dark surface. */
.msg.npc {
    align-self: flex-start;
    background: var(--surface);
    color: var(--text);
    border-top-left-radius: 2px;
}

/* Outgoing (player) bubble: right-aligned, WhatsApp green. */
.msg.player {
    align-self: flex-end;
    background: #005c4b;
    color: var(--text);
    padding: 5px 10px;
    border-top-right-radius: 2px;
}

/* System / handshake bubble: centred, dim monospace. */
.msg.system {
    align-self: center;
    background: var(--surface3);
    color: var(--text-dim);
    font-size: 0.72rem;
    padding: 6px 12px;
    border-radius: 6px;
    max-width: 85%;
}

/* Ambient filler text (gold tint, dashed border). */
.msg.npc-filler {
    align-self: flex-start;
    background: rgba(255, 183, 77, 0.05);
    border: 1px dashed rgba(255, 183, 77, 0.2);
    color: var(--gold);
    font-size: 0.75rem;
    font-style: italic;
    padding: 6px 12px;
    border-radius: 8px;
    max-width: 85%;
}

/* 'NPC is typing' animated row. */
.typing-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: 12px;
    align-self: flex-start;
    animation: fadeSlide 0.2s var(--ease-out);
}

.typing-row .dot {
    width: 5px;
    height: 5px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}

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

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

.typing-lbl {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-left: 4px;
}

@keyframes blink {
    0%,
    80%,
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}
