:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6; --secondary: #8b5cf6; --danger: #ef4444;
    --text-main: #f8fafc; --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background: var(--bg-color); color: var(--text-main); height: 100vh; display: flex; justify-content: center; align-items: center; padding: 15px; overflow: hidden; }

/* 3D Glassmorphism Container */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    width: 100%; max-width: 450px; padding: 30px;
    display: flex; flex-direction: column; overflow: hidden;
}

/* Panel Switching Logic */
.panel { display: none; flex-direction: column; width: 100%; animation: fadeIn 0.3s ease-out; }
.panel.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Typography */
header { text-align: center; margin-bottom: 10px; }
h1 { font-size: 2.2rem; background: linear-gradient(to right, #60a5fa, #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; }
.highlight { color: #a78bfa; font-weight: bold; letter-spacing: 1px; }
.text-center { text-align: center; }

/* Inputs & Buttons */
input { background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); border-radius: 12px; padding: 14px 15px; color: white; font-size: 1rem; outline: none; transition: 0.2s; width: 100%; }
input:focus { border-color: var(--primary); background: rgba(0,0,0,0.4); }
#room-input { text-transform: uppercase; }

.btn { padding: 14px 20px; border: none; border-radius: 12px; font-weight: 600; font-size: 1rem; color: white; cursor: pointer; transition: 0.2s; }
.btn:active { transform: translateY(2px); }
.primary-btn { background: var(--primary); box-shadow: 0 4px 10px rgba(59,130,246,0.3); }
.secondary-btn { background: var(--secondary); box-shadow: 0 4px 10px rgba(139,92,246,0.3); }
.danger-btn { background: var(--danger); }
.icon-btn { background: rgba(255,255,255,0.1); font-size: 1.2rem; padding: 0 15px; border: 1px solid var(--glass-border); border-radius: 12px; }
.small-btn { padding: 8px 15px; font-size: 0.9rem; }

/* Utility */
.w-full { width: 100%; } .mt-10 { margin-top: 10px; } .mt-15 { margin-top: 15px; } .mt-20 { margin-top: 20px; } .mb-10 { margin-bottom: 10px; }
.flex-row { display: flex; gap: 10px; }
.hide { display: none !important; }
.logs { font-size: 0.9rem; color: var(--text-muted); text-align: center; }
.divider { color: var(--text-muted); font-size: 0.8rem; margin: 20px 0; display: flex; align-items: center; gap: 10px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--glass-border); }

.room-code-display { font-size: 2rem; font-weight: bold; background: rgba(0,0,0,0.4); padding: 15px; border-radius: 16px; letter-spacing: 4px; color: #a78bfa; border: 1px dashed var(--glass-border); }

/* Chat Layout Specifics */
.chat-layout { height: 80vh; max-height: 700px; }
.chat-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); padding-bottom: 15px; text-align: left; margin-bottom: 15px; }
.chat-header h2 { font-size: 1.3rem; color: white; margin: 0; }

/* Chat Box */
.chat-box { flex: 1; overflow-y: auto; background: rgba(0,0,0,0.2); border-radius: 16px; padding: 15px; display: flex; flex-direction: column; gap: 15px; margin-bottom: 15px; border: 1px solid var(--glass-border); }
.message { padding: 12px 18px; border-radius: 18px; max-width: 80%; font-size: 0.95rem; word-break: break-word; line-height: 1.4; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.message.self { align-self: flex-end; background: var(--primary); border-bottom-right-radius: 4px; }
.message.peer { align-self: flex-start; background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border); border-bottom-left-radius: 4px; }
.sys-msg { align-self: center; font-size: 0.8rem; color: var(--text-muted); background: rgba(0,0,0,0.4); padding: 5px 12px; border-radius: 15px; text-align: center; }

/* File Rendering */
.file-img-preview { max-width: 100%; border-radius: 10px; margin: 8px 0; display: block; border: 1px solid rgba(255,255,255,0.2); }
.file-link { color: #fff; text-decoration: underline; font-weight: bold; font-size: 0.9rem; }

.input-area { display: flex; gap: 10px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }