/* --- SOCIAL PROGRESSION --- */
.user-title {
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--cyber-cyan);
    margin-right: 4px;
    letter-spacing: 1px;
    opacity: 0.9;
}

.message.own .user-title {
    color: var(--ancient-gold);
}

/* --- SPLIT LAYOUT --- */
#dashboard-grid {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    top: 120px; /* Constrain grid to viewport height */
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    pointer-events: none;
    /* Let clicks pass through gaps */
    z-index: 2000;
}

/* Reset Global Chat Position for Grid */
#global-chat-container {
    position: relative;
    /* Inside grid now */
    bottom: auto;
    left: auto;
    width: 60%;
    height: 450px; /* Reduced from 100% to fulfill request for shorter chat */
    pointer-events: auto;
    flex-shrink: 0;
    transition: all 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Added to constrain internal content */
}

#global-chat-container.full-width {
    width: 100%;
}

/* Paradox Encoder Container */
#paradox-encoder-container,
#phantom-container,
#destiny-container,
#desired-destiny-container,
#matrix-container,
#lore-container {
    position: relative;
    width: 38%;
    /* Let the widget height fit its content, bounded by the screen */
    height: auto;
    max-height: 85vh; /* Allow it to be taller than the chat, but not taller than the screen */
    background: rgba(5, 5, 5, 0.95);
    border: 1px solid var(--ancient-gold);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    overflow: hidden; /* Added to constrain internal content */
}

/* Encoder Internals */
.encoder-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    overflow-y: auto; /* Changed from hidden to auto so tall widgets can scroll */
    flex: 1;
}

.encoder-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.encoder-group label,
.encoder-output label,
.encoder-body label {
    font-family: var(--font-tech);
    color: var(--ancient-gold);
    font-size: 0.7rem;
    letter-spacing: 1px;
    opacity: 0.8;
}

.close-module-btn {
    background: transparent;
    border: none;
    color: var(--glitch-red);
    font-family: var(--font-tech);
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s;
    padding: 0 5px;
    line-height: 1;
    margin-left: auto;
}

.close-module-btn:hover {
    opacity: 1;
    text-shadow: 0 0 10px var(--glitch-red);
}

#cipher-input,
#phantom-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: var(--cyber-cyan);
    font-family: var(--font-tech);
    padding: 10px;
    resize: none;
    font-size: 0.8rem;
    outline: none;
}

#cipher-seed,
#phantom-seed,
#destiny-key {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid var(--ancient-gold) !important;
    color: var(--ancient-gold) !important;
    font-family: var(--font-tech);
    padding: 8px;
    outline: none;
}

/* Ensure all form inputs in encoder panels match theme */
.encoder-group input,
.encoder-group textarea,
#destiny-container input,
#desired-destiny-container input {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid rgba(255, 215, 0, 0.3) !important;
    color: var(--ancient-gold) !important;
    font-family: var(--font-tech);
    outline: none;
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-dial {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--ancient-gold);
    color: var(--ancient-gold);
    font-family: var(--font-tech);
    font-size: 1.2rem;
    padding: 5px;
    width: 60px;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
    /* Firefox */
}

/* Hide Spinners */
.time-dial::-webkit-outer-spin-button,
.time-dial::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Gray Date Inputs (Refined v306) */
input[type="date"].time-dial {
    color: #888 !important;
    /* Forces the text to gray */
}

/* Gold Date Inputs (Filled State v308) */
input[type="date"].time-dial.has-value,
input[type="date"].time-dial.has-value::-webkit-datetime-edit-month-field,
input[type="date"].time-dial.has-value::-webkit-datetime-edit-day-field,
input[type="date"].time-dial.has-value::-webkit-datetime-edit-year-field,
input[type="date"].time-dial.has-value::-webkit-datetime-edit-text {
    color: var(--ancient-gold) !important;
}

/* Specific pseudo-elements for WebKit browsers to target mm/dd/yyyy */
input[type="date"].time-dial::-webkit-datetime-edit-month-field,
input[type="date"].time-dial::-webkit-datetime-edit-day-field,
input[type="date"].time-dial::-webkit-datetime-edit-year-field,
input[type="date"].time-dial::-webkit-datetime-edit-text {
    color: #888 !important;
}

/* Ensure placeholder-like behavior for the empty state */
input[type="date"].time-dial:focus {
    color: var(--ancient-gold) !important;
    /* Optional: transitions to gold when active */
}

/* --- PHANTOM SPECIFIC STYLES --- */
#phantom-file-input::file-selector-button {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--cyber-cyan);
    color: var(--cyber-cyan);
    padding: 5px 10px;
    margin-right: 10px;
    font-family: var(--font-tech);
    cursor: pointer;
    transition: all 0.3s;
}

#phantom-file-input::file-selector-button:hover {
    background: var(--cyber-cyan);
    color: #000;
    box-shadow: 0 0 10px var(--cyber-cyan);
}

#phantom-file-input {
    color: var(--ancient-gold) !important;
}

/* Override Seed/Input Colors to match Theme */
#cipher-seed,
#phantom-seed,
#phantom-hour,
#phantom-minute {
    color: var(--ancient-gold);
    border-color: rgba(255, 215, 0, 0.4);
}

#phantom-output {
    /* Ensure it stays inside container */
    box-sizing: border-box;
    width: 100%;
}

.encoder-actions {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.cipher-btn {
    flex: 1;
    padding: 10px;
    font-family: var(--font-tech);
    cursor: pointer;
    font-weight: bold;
    border: 1px solid transparent;
    transition: all 0.3s;
}

.cipher-btn.encrypt {
    background: rgba(255, 0, 60, 0.1);
    /* Red tint */
    border-color: var(--glitch-red);
    color: var(--glitch-red);
}

.cipher-btn.encrypt:hover {
    background: var(--glitch-red);
    color: #fff;
    box-shadow: 0 0 15px var(--glitch-red);
}

.cipher-btn.decrypt {
    background: rgba(0, 243, 255, 0.1);
    /* Cyan tint */
    border-color: var(--cyber-cyan);
    color: var(--cyber-cyan);
}

.cipher-btn.decrypt:hover {
    background: var(--cyber-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--cyber-cyan);
}



.copy-btn {
    background: transparent;
    border: 1px solid var(--ancient-gold);
    color: var(--ancient-gold);
    font-family: var(--font-tech);
    font-size: 0.7rem;
    margin-top: 5px;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s;
}

.copy-btn:hover {
    background: var(--ancient-gold);
    color: #000;
    box-shadow: 0 0 15px var(--ancient-gold);
}

/* Custom Scrollbars for Encoder */
#cipher-input::-webkit-scrollbar,
#phantom-input::-webkit-scrollbar,
.output-screen::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#cipher-input::-webkit-scrollbar-track,
#phantom-input::-webkit-scrollbar-track,
.output-screen::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-left: 1px solid rgba(255, 215, 0, 0.1);
}

#cipher-input::-webkit-scrollbar-thumb,
#phantom-input::-webkit-scrollbar-thumb,
.output-screen::-webkit-scrollbar-thumb {
    background: var(--ancient-gold);
    border: 1px solid #000;
}

#cipher-input::-webkit-scrollbar-thumb:hover,
#phantom-input::-webkit-scrollbar-thumb:hover,
.output-screen::-webkit-scrollbar-thumb:hover {
    background: #fff;
    box-shadow: 0 0 10px var(--ancient-gold);
}

/* Ensure output scrolls */
.output-screen {
    background: #000;
    border: 1px solid var(--ancient-gold);
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #0f0;
    /* Terminal Green */
    height: 120px;
    /* Fixed height to force scroll */
    max-height: 120px;
    overflow-y: scroll;
    /* Always show scrollbar track */
    word-break: break-all;
}

/* Specific Override for Paradox Output to Fill Space */
#cipher-output {
    height: 200px;
    max-height: 200px;
}

/* Mobile Responsiveness for Split Layout */
/* --- THE PARADOX MATRIX: CPU CORE STYLES --- */
.node {
    background: rgba(0, 40, 0, 0.4);
    border: 1px solid rgba(74, 246, 38, 0.3);
    padding: 10px;
    text-align: center;
    cursor: pointer;
    font-family: var(--font-tech);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.node.active {
    border-color: #4af626;
    color: #4af626;
    animation: core-pulse 2s infinite ease-in-out;
}

.node.overclocked {
    background: rgba(255, 0, 60, 0.2);
    border-color: #ff003c;
    color: #ff003c;
    animation: core-overclock 0.3s infinite linear;
}

.node.off {
    background: rgba(20, 20, 20, 0.9);
    border-color: #444;
    color: #555;
    animation: none;
    box-shadow: inset 0 0 10px #000;
}

.node.blown {
    background: rgba(50, 50, 50, 0.5);
    border-color: #555;
    color: #555;
    cursor: not-allowed;
    filter: grayscale(1);
}

.node.hit {
    background: rgba(0, 243, 255, 0.4) !important;
    border-color: #00f3ff !important;
    box-shadow: 0 0 20px #00f3ff;
    transform: scale(1.05);
}

.core-label {
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.core-status {
    font-size: 0.5rem;
    opacity: 0.8;
}

@keyframes core-pulse {
    0% {
        box-shadow: inset 0 0 5px rgba(74, 246, 38, 0.2);
    }

    50% {
        box-shadow: inset 0 0 15px rgba(74, 246, 38, 0.5);
    }

    100% {
        box-shadow: inset 0 0 5px rgba(74, 246, 38, 0.2);
    }
}

@keyframes core-overclock {
    0% {
        transform: translate(0);
        box-shadow: 0 0 10px #ff003c;
    }

    25% {
        transform: translate(1px, -1px);
    }

    50% {
        transform: translate(-1px, 1px);
        box-shadow: 0 0 20px #ff003c;
    }

    75% {
        transform: translate(1px, 1px);
    }

    100% {
        transform: translate(0);
    }
}

@keyframes node-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 0, 0, 0.2);
    }

    100% {
        transform: scale(1.08);
        box-shadow: 0 0 25px rgba(255, 0, 0, 0.7);
    }
}

@media (max-width: 900px) {
    #dashboard-grid {
        flex-direction: column;
        align-items: center;
        bottom: 0px;
        left: 0;
        right: 0;
        width: 100%;
        padding: 10px;
        overflow-y: auto;
        pointer-events: auto;
    }

    #global-chat-container,
    #paradox-encoder-container,
    #phantom-container,
    #destiny-container,
    #desired-destiny-container,
    #matrix-container,
    #lore-container {
        width: 100% !important;
        height: auto !important;
        min-height: 450px;
        position: relative;
        bottom: auto;
        left: auto;
    }
}