/* Hide the Leave button for battle rooms */
.hide-leave-btn { display: none !important; }
/* Plus menu styles */
.plus-menu-wrapper { position: relative; }
.plus-menu { min-width: 120px; background: #222; border: 1px solid #444; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.5); z-index: 10; padding: 0; }
.plus-menu button { display: block; width: 100%; background: none; color: #fff; border: none; padding: 10px; text-align: left; font-size: 1.1em; cursor: pointer; border-radius: 0; transition: background 0.15s; }

/* Visually indicate disabled plus/add button specifically */
#plus-btn[disabled], #plus-btn[aria-disabled="true"] {
    opacity: 0.5 !important;
    pointer-events: none !important;
    cursor: default !important;
}

/* Reactions UI */
.reactions { display:flex; gap:6px; align-items:center; margin:6px 6px 0 6px; position:relative; }
.reactions .reaction, .reactions .reaction-picker-toggle { background:#2b2b2b; border:1px solid #444; color:var(--text); padding:4px 6px; border-radius:12px; cursor:pointer; font-size:0.9em; display:inline-flex; align-items:center; width:auto; }
.reactions .reaction.reacted { background:var(--primary); color:#fff; border-color:var(--primary); }
.reaction-picker { position:absolute; bottom: calc(100% + 6px); left: 0; display:flex; gap:6px; padding:0 0 3px 0; margin-left:100px; border-radius:8px; width:auto; flex-wrap:wrap; z-index:500; background-color: #333; }
.message-wrapper.mine .reactions .reaction-picker { left: auto; right: 0; }
.reaction-picker .reaction-option { background:none; border:none; color:var(--text); cursor:pointer; font-size:1.2em; padding:6px; border-radius:6px; width:auto; display:inline-flex; align-items:center; }

:root { --bg: #1a1a1a; --panel: #2d2d2d; --primary: #6c5ce7; --text: #eee; --danger: #ff7675; --mod: #55efc4; --system: #fd79a8; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', sans-serif; margin: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; flex-direction: column; }
.container { background: var(--panel); padding: 2rem; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); width: 90%; max-width: 400px; }

h2 { text-align: center; margin-top: 0; }
input { width: 100%; padding: 12px; margin: 8px 0; background: #333; border: 1px solid #444; color: white; border-radius: 6px; box-sizing: border-box;}
textarea { width: 100%; padding: 12px; margin: 8px 0; background: #333; border: 1px solid #444; color: white; border-radius: 6px; box-sizing: border-box; resize: vertical; }
button { width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; margin-top: 10px; }
#stop-record-btn { z-index: 9999 !important; position: relative; }
/* Recording button visual classes (removed in favor of inline styles) */
button:disabled { background: #555; cursor: not-allowed; }
button:hover:not(:disabled) { background: #5a4ad1; }

.switch-link { text-align: center; margin-top: 15px; font-size: 0.9rem; color: #aaa; cursor: pointer; text-decoration: underline; }
.error { color: #ff7675; text-align: center; margin-bottom: 10px; font-size: 0.9rem; }

.visually-hidden { opacity: 0; position: absolute; top: 0; left: 0; height: 0; width: 0; z-index: -1; }
.pow-status { text-align: center; font-size: 0.85rem; color: #fdcb6e; margin-bottom: 10px; display: none; }

/* Chat UI */
#chat-view { width: 90%; max-width: 1200px; height: 80vh; display: flex; flex-direction: column; }
.chat-header { padding: 15px; background: #222; border-bottom: 1px solid #444; display: flex; justify-content: space-between; border-radius: 12px 12px 0 0; align-items: center; }
.chat-box { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px; background: #2d2d2d; }
.input-area { padding: 15px; background: #222; display: flex; gap: 10px; border-radius: 0 0 12px 12px; }

/* Battle banner and roll button */
#battle-banner { background: rgba(108,92,231,0.12); border: 1px solid rgba(108,92,231,0.25); padding: 4px 8px; border-radius: 8px; }
#roll-btn { background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; }
#roll-btn:hover { background: #5a4ad1; }
#battle-replay { font-family: monospace; font-size: 0.95em; }
#battle-replay-toggle { cursor: pointer; }

.message-wrapper { display: flex; flex-direction: column; max-width: 70%; position: relative; }
.message-wrapper.mine { align-self: flex-end; align-items: flex-end; }

.username { font-size: 0.75rem; color: #aaa; margin-bottom: 4px; margin-left: 5px; display: flex; align-items: center; gap: 5px; cursor: pointer; transition: color 0.2s; }
.username:hover { color: white; }
.message-wrapper.mine .username { margin-right: 5px; flex-direction: row-reverse; }

.msg-time { font-size: 0.85em; color: #666; margin-left: 8px; font-weight: normal; }
.message-wrapper.mine .msg-time { margin-left: 0; margin-right: 8px; }

/* Bubble Styling */
.msg-bubble { 
    padding: 10px 14px; 
    border-radius: 10px; 
    background: #383838; 
    color: #eee; 
    width: fit-content;
    display: inline-flex; 
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    position: relative;
}
.msg-bubble.clickable { cursor: pointer; }
.msg-bubble.clickable:hover { background: #444; }

.message-wrapper.mine .msg-bubble { background: var(--primary); }
.message-wrapper.mine .msg-bubble.clickable:hover { background: #5a4ad1; }

.msg-bubble.action-msg {
    font-style: italic;
    background: transparent !important;
    border: none;
    color: #aaa;
    padding: 4px 0; 
    width: 100%;
}
.message-wrapper.mine .msg-bubble.action-msg {
    color: #ddd;
    justify-content: flex-end;
}

/* System Message Style */
.message-wrapper.system {
    align-self: center;
    max-width: 70%;
    width: 100%;
    display: flex;
    justify-content: center;
}
.msg-bubble.system-msg {
    background: rgba(255,255,255,0.02) !important;
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--system);
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 12px;
    text-align: center;
    width: auto;
    max-width: 100%;
    opacity: 0.95;
    font-style: italic;
    box-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

/* Slightly dim system messages for better contrast and readability */
.msg-bubble.system-msg a { color: var(--system); text-decoration: underline; }

.role-icon { width: 14px; height: 14px; vertical-align: middle; }
.role-badge { font-size: 0.7em; padding: 1px 5px; border-radius: 3px; text-transform: uppercase; font-weight: bold; color: #000; }
.role-admin { background: #ffda79; }
.role-moderator { background: #55efc4; }
.icon-admin { fill: #ffd60a; }
.icon-mod { fill: #30d158; }

/* In-Bubble Toolbar */
.mod-toolbar { display: flex; align-items: center; gap: 5px; padding-right: 8px; border-right: 1px solid rgba(255,255,255,0.2); position: absolute; left: 6px; top: 6px; opacity: 0; transform: translateX(-6px); pointer-events: none; transition: opacity 0.12s ease, transform 0.12s ease; }
.mod-toolbar.active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.mod-btn { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; padding: 2px; font-size: 1.1em; line-height: 1; }
.mod-btn:hover { color: white; transform: scale(1.1); }
.mod-btn.delete:hover { color: var(--danger); }

.report-toolbar { display: flex; align-items: center; gap: 5px; padding-right: 8px; border-right: 1px solid rgba(255,255,255,0.2); position: absolute; left: 6px; top: 6px; opacity: 0; transform: translateX(-6px); pointer-events: none; transition: opacity 0.12s ease, transform 0.12s ease; }
.report-toolbar.active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.report-btn { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; padding: 2px; font-size: 1.1em; line-height: 1; }
.report-btn:hover { color: var(--danger); transform: scale(1.1); }

@keyframes slideIn { from { opacity: 0; transform: translateX(-5px); } to { opacity: 1; transform: translateX(0); } }

.status-pill { font-size: 0.8rem; background: #e74c3c; color: white; padding: 2px 8px; border-radius: 12px; display: none; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 999; display: none; justify-content: center; align-items: center; }
.modal-content { background: var(--panel); padding: 2rem; border-radius: 12px; width: 100%; max-width: 600px; box-sizing: border-box; border: 1px solid #444; max-height: 80vh; overflow-y: auto; }
.close-btn { background: #636e72; width: auto; padding: 5px 15px; margin-top: 10px; float: right; }

#rules-modal .modal-content { width: 90%; max-width: 700px; }

.info-row { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.info-label { color: #aaa; font-size: 0.9rem; }
.info-value { font-family: monospace; background: #222; padding: 2px 6px; border-radius: 4px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

.key-box { background: #111; padding: 10px; font-family: monospace; text-align: center; border: 1px solid #444; margin: 10px 0; font-size: 1.2em; color: var(--primary); cursor: pointer; word-break: break-all; }
.key-box:hover { background: #000; border-color: var(--primary); }

/* Rules List */
.rules-list { text-align: left; margin: 20px 0; color: #ccc; padding-left: 50px; line-height: 1.6; }

/* Footer */
.site-footer { position: fixed; bottom: 10px; font-size: 0.8em; color: #666; z-index: 50; }
.site-footer a { color: #888; text-decoration: none; margin: 0 10px; cursor: pointer; }
.site-footer a:hover { text-decoration: underline; color: #aaa; }

.policy-content { text-align: left; line-height: 1.6; color: #ccc; font-size: 0.9em; }
.policy-content h3 { color: var(--primary); margin-bottom: 10px; }

.blocked-item { display: flex; justify-content: space-between; align-items: center; padding: 8px; border-bottom: 1px solid #333; }
.blocked-item:last-child { border-bottom: none; }
.unblock-btn { background: none; border: 1px solid #555; color: #aaa; width: auto; padding: 2px 8px; margin: 0; font-size: 0.8em; }
.unblock-btn:hover { border-color: var(--primary); color: white; }

/* Unread dot indicator (small red circle) */
.unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: red;
    border-radius: 50%;
    margin-left: 5px;
}
.unread-mention {
    display: inline-block;
    color: #fff;
    background: red;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1em;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    margin-left: 5px;
    vertical-align: middle;
}
.mention.highlight-mention {
    background: #ff7675;
    color: #fff;
    border-radius: 4px;
    padding: 0 4px;
}

/* User Options Modal - align toggles */
#user-options-modal .option-toggle-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 1em;
}
#user-options-modal .option-toggle-group label {
    display: flex;
    align-items: center;
    justify-content: space-between; /* keep text left and checkbox right */
    gap: 10px;
    font-size: 1em;
    width: 100%;
    padding: 8px 10px;
    box-sizing: border-box;
    border-radius: 6px;
    background: rgba(0,0,0,0.06);
    border: 1px solid rgba(255,255,255,0.03);
    cursor: pointer; /* make entire row clickable */
}
#user-options-modal .option-toggle-group label > span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; color: var(--text); }
#user-options-modal .option-toggle-group label > input[type="checkbox"] { flex: 0 0 auto; margin-left: 12px; }
#user-options-modal .option-toggle-group input[type="checkbox"] {
    margin: 0;
    align-self: center;
    transform: scale(1.03);
    cursor: pointer;
    width: auto; /* override global input width */
    padding: 0; /* remove global input padding */
    height: 18px;
    width: 18px;
}