← All Workshops

MudEngine Part 8: Inventory & Chat

Step 8 / 10

CSS Additions

The new UI needs styles for the floating player list, chat panel, command input, inventory panel, and room items. The floating player list uses position: fixed so it stays glued to the right edge of the viewport regardless of scrolling.

Append these styles to assets/main.css. Keep all existing styles from previous parts.

mud-engine/assets/main.css
/* ── Bottom area layout ── */
.bottom-area {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    align-items: stretch;
}

/* ── Chat panel ── */
.chat-panel {
    flex: 1;
    min-width: 0;
    background: #12122a;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    max-height: 200px;
}

.chat-header {
    font-size: 13px;
    color: #a0a0c0;
    margin-bottom: 6px;
    font-weight: bold;
}

.chat-scroll {
    flex: 1;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.5;
}

.chat-empty {
    color: #5a5a7a;
    font-style: italic;
    padding: 8px 0;
}

.chat-msg {
    padding: 2px 0;
}

.chat-system {
    color: #c0a060;
}

.chat-from {
    color: #60a0ff;
    font-weight: bold;
}

.chat-text {
    color: #d0d0e0;
}

/* ── Controls area ── */
.controls-area {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.command-row {
    width: 100%;
}

.command-input {
    width: 100%;
    padding: 8px 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    background: #12122a;
    color: #d0d0e0;
    outline: none;
    box-sizing: border-box;
}

.command-input:focus {
    border-color: #60a0ff;
}

.command-input::placeholder {
    color: #5a5a7a;
}

/* ── Inventory panel ── */
.inventory-panel {
    width: 180px;
    flex-shrink: 0;
    background: #12122a;
    border-radius: 8px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.inv-title {
    font-size: 13px;
    color: #a0a0c0;
    margin: 0 0 8px 0;
}

.inv-empty {
    color: #5a5a7a;
    font-style: italic;
    font-size: 12px;
}

.inv-item {
    font-size: 12px;
    color: #c0d0f0;
    padding: 3px 6px;
    margin-bottom: 2px;
    background: #1a1a30;
    border-radius: 4px;
}

.inv-item::before {
    content: "";
    color: #f0c060;
}

/* ── Room items display ── */
.room-items {
    margin-top: 12px;
    background: #12122a;
    border-radius: 8px;
    padding: 10px;
}

.room-items h3 {
    font-size: 13px;
    color: #a0a0c0;
    margin: 0 0 6px 0;
}

.room-item {
    font-size: 12px;
    color: #b0d0b0;
    padding: 2px 0;
}

.room-item::before {
    content: "";
    color: #60c060;
}

/* ── Description panel ── */
.desc-title {
    font-size: 16px;
    font-weight: bold;
    color: #e0e0f0;
    margin-bottom: 4px;
}

.desc-text {
    font-size: 13px;
    color: #a0a0c0;
    line-height: 1.5;
}

/* ── Floating player list ── */
.floating-player-list {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: #0e0e22;
    border-left: 1px solid #2a2a4a;
    padding: 12px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.fpl-title {
    font-size: 14px;
    color: #a0a0c0;
    margin: 0 0 12px 0;
    flex-shrink: 0;
}

.fpl-scroll {
    flex: 1;
    overflow-y: auto;
}

.fpl-entry {
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    background: #1a1a30;
    font-size: 13px;
}

.fpl-entry.me {
    background: #1a3050;
    border: 1px solid #3b82f6;
}

.fpl-name {
    color: #d0d0e0;
    font-weight: bold;
}

.fpl-room {
    color: #6b6b8a;
    font-size: 11px;
    margin-top: 2px;
}

.fpl-items {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.fpl-item {
    font-size: 10px;
    background: #2a2a4a;
    color: #b0d0b0;
    padding: 1px 6px;
    border-radius: 3px;
}

/* Shift content left so the fixed panel doesn't overlap */
.game-layout {
    margin-right: 250px;
}
💡 Layout strategy

The floating player list uses position: fixed to stay pinned to the right edge. This means it's outside the normal document flow — it doesn't push other elements.

We add margin-right: 250px to .game-layout to keep the main content visible without overlapping the panel. The panel width is 240px (width: 240px), so 250px of margin gives a 10px gap.

The bottom row uses display: flex to arrange chat, controls, and inventory side by side. Each panel has its own background and scroll behavior, so the page doesn't grow vertically beyond the viewport.

Step 8 / 10