/*
 * ChatPanel — styles for the shared in-room chat (js/chat-panel.js).
 *
 * Colours come from the host page's variables where it defines them, with
 * fallbacks that stand on their own, so the panel looks native in a game with
 * its own palette and still readable in a page with none.
 */

.chat-panel {
    position: absolute;
    left: 16px;
    z-index: 15;
    width: min(88vw, 320px);
    max-height: 44vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
    color: var(--text, #e8eefc);
    background: var(--panel, rgba(17, 24, 44, 0.86));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.10));
    backdrop-filter: blur(10px);
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.chat-panel.chat-right { left: auto; right: 16px; }
.chat-panel.hidden { display: none !important; }

.chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.10));
}
.chat-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    color: var(--muted, #97a3bf);
}

.chat-log {
    flex: 1 1 auto;
    min-height: 90px;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.chat-line { font-size: 12px; line-height: 1.45; word-break: break-word; }
.chat-who { font-weight: 700; margin-right: 6px; }
.chat-text { color: var(--text, #e8eefc); }
.chat-line.me .chat-text { color: #c7d2fe; }
.chat-line.guess .chat-text { color: var(--muted, #97a3bf); font-style: italic; }
.chat-line.system { text-align: center; font-size: 11px; }
.chat-line.system .chat-who { margin-right: 4px; }
.chat-line.system .chat-text { color: #86efac; font-weight: 600; }

.chat-form {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.10));
}
.chat-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    outline: none;
    border-radius: 9px;
    color: var(--text, #e8eefc);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.10));
}
.chat-input:focus { border-color: var(--accent, #6366f1); }
.chat-input:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-send {
    padding: 7px 12px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--text, #e8eefc);
    background: rgba(99, 102, 241, 0.28);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.10));
}
.chat-send:hover { background: rgba(99, 102, 241, 0.42); }

/* The floating toggle, used only when the page supplies no button of its own. */
.chat-toggle {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 16;
    padding: 9px 13px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text, #e8eefc);
    background: var(--panel, rgba(17, 24, 44, 0.86));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.10));
}
.chat-toggle.chat-right { left: auto; right: 16px; }

.chat-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
}
.chat-badge.hidden { display: none !important; }

@media (max-width: 640px) {
    .chat-panel { left: 8px; right: 8px; width: auto; max-height: 34vh; }
    .chat-panel.chat-right { left: 8px; right: 8px; }
}
