:root {
    --bg-deep: #050505;
    --bg-panel: #0f0f0f;
    --bg-input: #1a1a1a;
    --gold-main: #d4af37;
    --gold-dim: #8a6e2f;
    --text-main: #e0e0e0;
    --text-dim: #888;
    --border-gold: 1px solid var(--gold-dim);
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Lato', sans-serif;
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

h1, h2, h3, .btn, .channel-btn { font-family: 'Cinzel', serif; text-transform: uppercase; }

/* --- LOGIN SCREEN --- */
.login-container {
    display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
}
.logo-area { text-align: center; margin-bottom: 30px; }
.logo-area h1 { font-size: 4rem; margin: 0; color: var(--gold-main); text-shadow: 0 0 20px rgba(212,175,55,0.3); }
.subtitle { letter-spacing: 5px; color: var(--gold-dim); font-size: 0.9rem; }

.panel {
    background: var(--bg-panel); border: var(--border-gold); padding: 30px; width: 400px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8); text-align: center;
}
.hidden { display: none !important; }

#preview-img {
    width: 120px; height: 120px; object-fit: cover; border-radius: 50%;
    border: 2px solid var(--gold-main); margin: 0 auto 15px auto; display: block;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

/* --- BUTTONS --- */
.btn {
    padding: 12px 20px; cursor: pointer; border: 1px solid var(--gold-dim); 
    background: transparent; color: var(--gold-main); transition: 0.3s;
    font-weight: bold; width: 100%;
}
.btn.gold-btn { background: rgba(212, 175, 55, 0.1); }
.btn:hover:not(.disabled) { background: var(--gold-main); color: #000; box-shadow: 0 0 15px var(--gold-dim); }
.btn.disabled { opacity: 0.5; cursor: not-allowed; border-color: #333; color: #555; }
.upload-btn-wrapper { position: relative; overflow: hidden; display: inline-block; width: 100%; margin: 20px 0; }
.upload-btn-wrapper input[type=file] { font-size: 100px; position: absolute; left: 0; top: 0; opacity: 0; cursor: pointer; }

/* --- MAIN LAYOUT --- */
.app-layout { display: flex; height: 100vh; }

.sidebar {
    width: 280px; background: #080808; border-right: var(--border-gold);
    display: flex; flex-direction: column; padding: 20px; overflow-y: auto;
}
.char-profile { text-align: center; border-bottom: 1px solid #222; padding-bottom: 20px; margin-bottom: 20px; }
.avatar-frame { 
    width: 80px; height: 80px; border: 2px solid var(--gold-dim); 
    margin: 0 auto 10px; overflow: hidden; border-radius: 50%; 
}
.avatar-frame img { width: 100%; height: 100%; object-fit: cover; }
.channel-list { flex-grow: 1; display: flex; flex-direction: column; gap: 5px; }
.nav-header { color: var(--text-dim); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; margin: 15px 0 5px; }

.channel-btn {
    background: transparent; border: none; color: #666; text-align: left;
    padding: 10px; cursor: pointer; transition: 0.2s; font-size: 0.8rem;
}
.channel-btn:hover { color: var(--gold-main); padding-left: 15px; }
.channel-btn.active { color: var(--gold-main); border-left: 2px solid var(--gold-main); background: rgba(212,175,55,0.05); }

/* --- CHAT INTERFACE --- */
.chat-interface { flex-grow: 1; display: flex; flex-direction: column; background: #0b0b0b; }
.chat-header { 
    height: 60px; border-bottom: var(--border-gold); display: flex; 
    align-items: center; justify-content: space-between; padding: 0 20px;
    background: #050505;
}
.status-indicator { font-size: 0.8rem; color: #4caf50; display: flex; align-items: center; gap: 5px; }

.chat-feed { 
    flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; 
    scroll-behavior: smooth;
}

/* --- MESSAGE STYLES --- */
.msg-row {
    display: flex; gap: 15px; align-items: flex-start;
    margin-bottom: 10px;
    /* Removed opacity/animation to guarantee visibility */
}

/* Avatar */
.msg-avatar {
    width: 50px; height: 50px; flex-shrink: 0;
    border-radius: 50%; border: 1px solid #444; overflow: hidden;
    background: #000;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.msg-content {
    flex-grow: 1; display: flex; flex-direction: column; gap: 4px;
}
.msg-meta { font-size: 0.8rem; display: flex; align-items: center; gap: 8px; }
.msg-author { font-family: 'Cinzel', serif; font-weight: bold; color: var(--gold-main); }
.msg-rank { font-size: 0.7rem; color: #666; text-transform: uppercase; border: 1px solid #333; padding: 0 4px; border-radius: 3px; }
.msg-time { font-size: 0.7rem; color: #444; margin-left: auto; }

/* Bubbles */
.msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #333;
    padding: 12px 15px;
    border-radius: 0 8px 8px 8px;
    line-height: 1.5;
    color: #e0e0e0; /* High Contrast Text */
    font-size: 0.95rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Variants */
.msg-row.rp .msg-bubble { border-left-color: var(--gold-dim); background: rgba(212, 175, 55, 0.05); }
.msg-row.rp .msg-author { color: var(--gold-main); }

.msg-row.ooc .msg-bubble { border-left-color: #555; background: transparent; font-style: italic; color: #999; border: 1px solid #333; }
.msg-row.ooc .msg-author { color: #888; }

.msg-row.action .msg-bubble { border-left-color: #a33; background: rgba(170, 50, 50, 0.08); color: #ebb; }
.msg-row.action .msg-author { color: #d55; }

.msg-row.dice .msg-bubble { border-left-color: #4ca1af; background: rgba(76, 161, 175, 0.08); }
.dice-val { font-family: 'Cinzel', serif; font-weight: bold; color: #4ca1af; font-size: 1.1rem; }

/* GM VISUAL OVERHAUL */
.msg-row.gm { 
    justify-content: center; 
    margin: 30px 0; 
}
.msg-row.gm .msg-avatar { display: none; }
.msg-row.gm .msg-content { align-items: center; width: 100%; }
.msg-row.gm .msg-bubble { 
    border: 1px solid var(--gold-main); 
    border-left: 1px solid var(--gold-main); /* Full border */
    background: #000; 
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
    text-align: center; 
    color: var(--gold-main); 
    font-family: 'Cinzel', serif; 
    font-size: 1.2rem;
    padding: 20px 40px; 
    border-radius: 2px;
    width: 80%;
}
.msg-row.gm .msg-author { 
    background: var(--gold-dim); color: #000; 
    padding: 4px 12px; border-radius: 2px; 
    letter-spacing: 2px; font-size: 0.8rem;
    margin-bottom: 5px;
}

/* System Messages */
.msg-system { text-align: center; color: #444; font-size: 0.8rem; margin: 10px 0; font-style: italic; }

.input-area { padding: 20px; background: #080808; border-top: 1px solid #222; }
textarea { width: 100%; height: 60px; background: #151515; border: 1px solid #333; color: white; padding: 10px; font-family: 'Lato', sans-serif; resize: none; outline: none; }
textarea:focus { border-color: var(--gold-dim); }
.input-controls { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
select { background: #111; color: #aaa; border: 1px solid #333; padding: 5px; }