/* Steampunk MAX Terminal — isolated UI styles */

:root {
    --bg-deep: #0d0804;
    --bg-panel: rgba(22, 14, 8, 0.82);
    --brass: #c9973a;
    --brass-light: #e8c56a;
    --brass-dark: #7a5520;
    --copper: #b8652a;
    --rust: #5c2e18;
    --steam: rgba(220, 210, 190, 0.35);
    --text: #f4e8d0;
    --text-dim: #a89070;
    --incoming: rgba(40, 28, 18, 0.95);
    --outgoing: rgba(90, 55, 22, 0.95);
    --border: linear-gradient(135deg, #e8c56a 0%, #7a5520 40%, #c9973a 70%, #3d2914 100%);
    --shadow-brass: 0 0 30px rgba(201, 151, 58, 0.25), inset 0 1px 0 rgba(255, 220, 150, 0.15);
    --font-display: 'Cinzel', Georgia, serif;
    --font-body: 'IM Fell English', Georgia, serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.45;
    overflow-x: hidden;
    background: var(--bg-deep);
}

#steam-scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.65) 100%);
}

.scanlines {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.04;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.5) 2px,
        rgba(0, 0, 0, 0.5) 4px
    );
}

.app-shell {
    position: relative;
    z-index: 10;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Header */
.brass-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-panel);
    border: 2px solid var(--brass-dark);
    border-radius: 4px;
    box-shadow: var(--shadow-brass);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.brass-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(232, 197, 106, 0.2);
    pointer-events: none;
}

.header-cog {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px dashed var(--brass);
    animation: spin 12s linear infinite;
    opacity: 0.85;
    position: relative;
    box-shadow:
        inset 0 0 12px rgba(0, 0, 0, 0.6),
        0 0 16px rgba(201, 151, 58, 0.2);
}

.cog-hub {
    position: absolute;
    inset: 30%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--brass-light), var(--brass-dark));
    box-shadow: inset 0 1px 2px rgba(255, 220, 150, 0.4);
}

.header-cog.right { animation-direction: reverse; animation-duration: 18s; }

.header-center { text-align: center; }

.eyebrow {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--brass-light);
}

.brass-header h1 {
    margin: 0.15rem 0;
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--brass-light);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

.user-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pseudo-3D panels */
.panel-3d {
    transform: perspective(900px) rotateX(0.6deg);
    box-shadow:
        var(--shadow-brass),
        0 12px 40px rgba(0, 0, 0, 0.55),
        inset 0 2px 0 rgba(255, 220, 150, 0.12),
        inset 0 -4px 12px rgba(0, 0, 0, 0.35);
}

.brass-frame.panel-3d::before { top: 10px; left: 10px; }
.brass-frame.panel-3d::after { top: 10px; right: 10px; }

.panel-bolts::before,
.panel-bolts::after {
    content: '⬡';
    position: absolute;
    bottom: 10px;
    font-size: 10px;
    color: var(--brass-dark);
    opacity: 0.9;
}

.panel-bolts::before { left: 10px; }
.panel-bolts::after { right: 10px; }

.frame-pipe {
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(180deg, var(--copper) 0%, #6b3a18 50%, var(--copper) 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.frame-pipe.top { top: 0; border-radius: 4px 4px 0 0; }

.frame-pipe::after {
    content: '';
    position: absolute;
    right: 12px;
    top: -4px;
    width: 14px;
    height: 14px;
    border: 2px solid var(--brass);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brass-light), var(--brass-dark));
    animation: spin 6s linear infinite;
}

/* CSS steam layer */
.steam-layer {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

.steam-wisp {
    position: absolute;
    bottom: -20%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(220, 210, 190, 0.18) 0%, transparent 70%);
    filter: blur(12px);
    animation: steam-rise 14s ease-in-out infinite;
}

.steam-wisp.w1 { left: 8%; animation-delay: 0s; }
.steam-wisp.w2 { left: 35%; animation-delay: 3s; width: 160px; }
.steam-wisp.w3 { left: 62%; animation-delay: 6s; }
.steam-wisp.w4 { left: 85%; animation-delay: 9s; width: 100px; }

/* Side copper pipes */
.deco-pipes {
    position: fixed;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.pipe {
    position: absolute;
    top: 10%;
    bottom: 10%;
    width: 14px;
    background: linear-gradient(90deg, #6b3a18 0%, var(--copper) 35%, #e8a060 50%, var(--copper) 65%, #4a2810 100%);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.4);
    border-radius: 7px;
}

.pipe-left { left: 4px; }
.pipe-right { right: 4px; }

.pipe-valve {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 3px solid var(--brass);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brass-light), var(--brass-dark));
    box-shadow: 0 0 10px rgba(201, 151, 58, 0.35);
    animation: spin 8s linear infinite;
}

.pipe-valve::before,
.pipe-valve::after {
    content: '';
    position: absolute;
    background: var(--copper);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pipe-valve::before { width: 70%; height: 3px; }
.pipe-valve::after { width: 3px; height: 70%; }

.valve-left { left: -2px; top: 40%; }
.valve-right { right: -2px; top: 55%; animation-direction: reverse; }

/* Header mini gauges */
.header-gauges {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.mini-gauge {
    width: 22px;
    height: 22px;
    border: 2px solid var(--brass-dark);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #3d2914, #1a0f0a);
    position: relative;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
}

.mini-needle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 8px;
    background: var(--brass-light);
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(-20deg);
    animation: gauge-sway 2.5s ease-in-out infinite;
}

.mini-gauge.g2 .mini-needle { animation-delay: 0.4s; }
.mini-gauge.g3 .mini-needle { animation-delay: 0.8s; animation-duration: 3.2s; }

/* Login boiler deco */
.boiler-deco {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 64px;
}

.boiler-stack {
    display: block;
    width: 28px;
    height: 48px;
    margin: 0 auto;
    background: linear-gradient(90deg, #4a3010, var(--brass), #4a3010);
    border-radius: 4px 4px 2px 2px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
    position: relative;
}

.boiler-stack::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: var(--copper);
    border-radius: 2px;
}

.pressure-dial {
    display: block;
    width: 24px;
    height: 24px;
    margin: 4px auto 0;
    border: 2px solid var(--brass);
    border-radius: 50%;
    background: #1a0f0a;
    position: relative;
}

.dial-needle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 9px;
    background: #ff6633;
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(30deg);
    animation: gauge-sway 1.8s ease-in-out infinite;
}

/* Placeholder boiler */
.placeholder-boiler {
    position: relative;
    width: 80px;
    height: 100px;
    margin-bottom: 1.25rem;
}

.boiler-body {
    width: 64px;
    height: 72px;
    margin: 0 auto;
    background: linear-gradient(135deg, #3d2914 0%, var(--brass-dark) 40%, #2a1810 100%);
    border: 2px solid var(--brass);
    border-radius: 8px 8px 4px 4px;
    box-shadow:
        inset 0 -8px 16px rgba(0, 0, 0, 0.5),
        0 8px 20px rgba(201, 151, 58, 0.15);
}

.boiler-body::before {
    content: '';
    display: block;
    width: 40px;
    height: 20px;
    margin: -12px auto 0;
    background: radial-gradient(ellipse at center, var(--brass-light), var(--brass-dark));
    border-radius: 50% 50% 0 0;
    border: 2px solid var(--brass);
}

.boiler-steam {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(220, 210, 190, 0.25), transparent);
    filter: blur(8px);
    animation: steam-puff 3s ease-in-out infinite;
}

.sidebar-valve {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border: 2px solid var(--brass);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brass-light), var(--brass-dark));
    animation: spin 10s linear infinite;
}

.sidebar-valve::before,
.sidebar-valve::after {
    content: '';
    position: absolute;
    background: var(--copper);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.sidebar-valve::before { width: 60%; height: 2px; }
.sidebar-valve::after { width: 2px; height: 60%; }

/* Toggle switch */
.conv-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-switch {
    width: 44px;
    height: 22px;
    border: 2px solid var(--brass-dark);
    border-radius: 11px;
    background: #1a0f0a;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brass-light), var(--brass-dark));
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    animation: toggle-slide 4s ease-in-out infinite;
}

.toggle-switch.on .toggle-knob {
    background: radial-gradient(circle at 30% 30%, #8f8, #363);
}

.footer-steam-icon {
    animation: chug 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes steam-rise {
    0% { transform: translateY(0) scale(0.8); opacity: 0; }
    20% { opacity: 0.5; }
    100% { transform: translateY(-120vh) scale(1.6); opacity: 0; }
}

@keyframes steam-puff {
    0%, 100% { opacity: 0.3; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateX(-50%) scale(1.3); }
}

@keyframes toggle-slide {
    0%, 100% { left: 2px; }
    50% { left: 22px; }
}

@keyframes chug {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Panels */
.brass-frame,
.panel {
    background: linear-gradient(165deg, rgba(28, 18, 10, 0.92) 0%, rgba(18, 10, 6, 0.88) 100%);
    border: 2px solid var(--brass-dark);
    border-radius: 6px;
    box-shadow: var(--shadow-brass);
    backdrop-filter: blur(12px);
    position: relative;
}

.panel-rivets::before,
.panel-rivets::after,
.brass-frame::before,
.brass-frame::after {
    content: '●';
    position: absolute;
    font-size: 8px;
    color: var(--brass-dark);
    opacity: 0.8;
}

.panel-rivets::before { top: 8px; left: 8px; }
.panel-rivets::after { top: 8px; right: 8px; }

.login-panel {
    max-width: 420px;
    margin: 2rem auto;
    padding: 2rem 2rem 1.5rem;
    text-align: center;
}

.gauge-ring {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border: 4px solid var(--brass-dark);
    border-top-color: var(--brass-light);
    border-radius: 50%;
    animation: spin 4s linear infinite;
}

.login-panel h2 {
    font-family: var(--font-display);
    color: var(--brass-light);
    margin: 0 0 0.5rem;
}

.panel-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.login-form label span {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brass);
    margin-bottom: 0.35rem;
}

.login-form input,
.chat-search input,
.composer textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--brass-dark);
    border-radius: 3px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus,
.chat-search input:focus,
.composer textarea:focus {
    outline: none;
    border-color: var(--brass-light);
    box-shadow: 0 0 12px rgba(201, 151, 58, 0.3);
}

.form-error {
    color: #ff8a65;
    font-size: 0.85rem;
    margin: 0;
}

/* Buttons */
.btn-brass {
    position: relative;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 0.55rem 1.1rem;
    background: linear-gradient(180deg, #8a6028 0%, #4a3010 100%);
    border: 2px solid var(--brass);
    border-radius: 3px;
    color: var(--brass-light);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    overflow: hidden;
}

.btn-brass:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(201, 151, 58, 0.35);
}

.btn-brass:active { transform: translateY(0); }

.btn-brass:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; }

.btn-send {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.btn-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 220, 150, 0.15), transparent);
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
}

/* Messenger layout */
.messenger-panel {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 1rem;
    flex: 1;
    min-height: 520px;
}

.chat-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 480px;
    overflow: hidden;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--brass-dark);
}

.sidebar-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--brass-light);
}

.status-lamp {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #444;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.8);
}

.status-lamp.on {
    background: #6bff6b;
    box-shadow: 0 0 8px #6bff6b;
    animation: pulse-lamp 2s ease-in-out infinite;
}

.chat-search { padding: 0.65rem; }

.chat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(122, 85, 32, 0.35);
    cursor: pointer;
    transition: background 0.15s;
}

.chat-item-body {
    flex: 1;
    min-width: 0;
}

.chat-item-badge {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--brass);
    border-radius: 3px;
    background: rgba(201, 151, 58, 0.2);
    box-shadow: 0 0 8px rgba(201, 151, 58, 0.35);
    animation: badge-pulse 1.5s ease-in-out infinite;
}

.badge-icon { font-size: 1rem; line-height: 1; }

.badge-count {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--brass-light);
}

.chat-item:hover,
.chat-item.active {
    background: rgba(201, 151, 58, 0.12);
}

.chat-item.active {
    border-left: 3px solid var(--brass-light);
}

.chat-item-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text);
    margin: 0 0 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-preview {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* Conversation area */
.conversation {
    display: flex;
    flex-direction: column;
    min-height: 480px;
    overflow: hidden;
    position: relative;
}

.conversation.conversation--empty {
    justify-content: center;
    align-items: center;
}

.conversation-placeholder {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    padding: 1.25rem 1.5rem;
    text-align: center;
    width: min(100%, 340px);
    max-width: 340px;
    margin: 1rem auto;
    border: 1px dashed rgba(122, 85, 32, 0.55);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
}

.conversation-placeholder .placeholder-boiler {
    transform: scale(0.75);
    margin-bottom: 0.5rem;
}

.conversation-placeholder p {
    margin: 0;
    font-size: 0.9rem;
    max-width: 260px;
}

.conversation-active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.conversation-active[hidden] {
    display: none !important;
}

.conversation-placeholder[hidden] {
    display: none !important;
}

.conv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--brass-dark);
    background: rgba(0, 0, 0, 0.25);
}

.conv-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--brass-light);
}

.conv-meta {
    margin: 0.15rem 0 0;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-dim);
}

.conv-gauge {
    width: 36px;
    height: 36px;
    border: 2px solid var(--brass-dark);
    border-radius: 50%;
    position: relative;
    background: radial-gradient(circle at 30% 30%, #3d2914, #1a0f0a);
}

.gauge-needle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 14px;
    background: var(--brass-light);
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(-30deg);
    animation: gauge-sway 3s ease-in-out infinite;
}

.messages-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 280px;
    background: rgba(0, 0, 0, 0.2);
}

.messages-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.message-bubble {
    max-width: 78%;
    padding: 0.65rem 0.85rem;
    border-radius: 4px;
    border: 1px solid var(--brass-dark);
    font-size: 0.92rem;
    word-break: break-word;
    animation: message-in 0.25s ease-out;
}

.message-bubble.incoming {
    align-self: flex-start;
    background: var(--incoming);
    border-left: 3px solid var(--copper);
}

.message-bubble.outgoing {
    align-self: flex-end;
    background: var(--outgoing);
    border-right: 3px solid var(--brass-light);
}

.message-bubble.failed {
    border-color: #a04030;
    opacity: 0.85;
}

.message-bubble.failed .message-meta {
    color: #ff8a65;
}

.message-meta {
    display: block;
    margin-top: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-dim);
}

.composer {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem;
    border-top: 1px solid var(--brass-dark);
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.composer-toolbar {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.composer-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.composer textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

.emoji-panel {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.45rem 0.55rem;
    background: var(--bg-panel);
    border: 1px solid var(--brass-dark);
    border-radius: 6px;
    box-shadow: var(--shadow-brass);
    position: static;
    width: 100%;
    max-height: 11rem;
    overflow: hidden;
}

.emoji-panel[hidden] {
    display: none !important;
}

.emoji-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    flex-shrink: 0;
}

.emoji-tab {
    flex: 1 1 auto;
    min-width: 4.5rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    padding: 0.3rem 0.45rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--brass-dark);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
}

.emoji-tab.active,
.emoji-tab:hover {
    border-color: var(--brass-light);
    color: var(--brass-light);
    background: rgba(201, 151, 58, 0.15);
}

.emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    overflow-y: auto;
    max-height: 8rem;
    padding-right: 0.15rem;
}

.emoji-btn {
    flex: 0 0 2.35rem;
    width: 2.35rem;
    height: 2.35rem;
    min-width: 2.35rem;
    min-height: 2.35rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(122, 85, 32, 0.45);
    border-radius: 4px;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.emoji-btn:hover {
    border-color: var(--brass-light);
    background: rgba(201, 151, 58, 0.2);
    transform: scale(1.08);
}

/* Password dialog */
.password-dialog {
    border: 2px solid var(--brass-dark);
    border-radius: 8px;
    background: var(--bg-panel);
    color: var(--text);
    padding: 0;
    max-width: 420px;
    width: calc(100% - 2rem);
    box-shadow: var(--shadow-brass);
}

.password-dialog::backdrop {
    background: rgba(0, 0, 0, 0.65);
}

.password-dialog form {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.password-dialog h3 {
    margin: 0;
    font-family: var(--font-display);
    color: var(--brass-light);
}

.password-dialog label span {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--brass);
    margin-bottom: 0.3rem;
}

.password-dialog input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--brass-dark);
    border-radius: 3px;
    color: var(--text);
    font-family: var(--font-mono);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.attach-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.4rem 0.5rem;
    border: 1px dashed var(--brass-dark);
    border-radius: 3px;
    font-size: 0.85rem;
    color: var(--text-dim);
    position: relative;
    z-index: 20;
}

.attach-cancel,
.attach-send {
    flex-shrink: 0;
    min-width: 36px;
    min-height: 36px;
    cursor: pointer;
    position: relative;
    z-index: 21;
}

.attach-cancel {
    font-size: 1rem;
    line-height: 1;
    padding: 0.35rem 0.5rem;
}

.attach-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-image,
.msg-video {
    display: block;
    max-width: min(320px, 100%);
    border: 1px solid var(--brass-dark);
    border-radius: 2px;
    margin-bottom: 0.35rem;
}

.msg-audio {
    display: block;
    width: min(280px, 100%);
    margin-bottom: 0.35rem;
}

.msg-document {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--brass-light);
    text-decoration: none;
    margin-bottom: 0.35rem;
}

.msg-document:hover { color: var(--brass); text-decoration: underline; }

.msg-text {
    display: block;
    white-space: pre-wrap;
}

.msg-placeholder {
    font-style: italic;
    color: var(--text-dim);
}

.message-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.brass-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    padding: 0.5rem 0;
}

.brass-footer a {
    color: var(--brass);
    text-decoration: none;
}

.brass-footer a:hover { color: var(--brass-light); }

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

@keyframes pulse-lamp {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes gauge-sway {
    0%, 100% { transform: translate(-50%, -100%) rotate(-30deg); }
    50% { transform: translate(-50%, -100%) rotate(30deg); }
}

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.72; }
}

@keyframes message-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float-panel {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.messenger-panel {
    animation: float-panel 8s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .deco-pipes,
    .pipe-left,
    .pipe-right { display: none; }

    .panel-3d { transform: none; }

    .brass-header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .header-cog { display: none; }

    .header-actions {
        justify-content: center;
    }

    .messenger-panel {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .chat-sidebar {
        max-height: 220px;
        min-height: 220px;
    }

    .conversation {
        min-height: 420px;
    }

    .message-bubble { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
