/* Version 9.0: Major UI refinement with a stronger Art Deco and electrical aesthetic. */

/* --- General Setup --- */
:root {
    --main-bg: #0d1b2a; 
    --container-bg: #1b263b; 
    --text-color: #e0e1dd; 
    --primary-border: #415a77; 
    --accent-brass: #c99e55; /* Slightly brightened brass */
    --accent-electric-blue: #00bfff; 
    --field-bg: #000;
}

body {
    background-color: var(--main-bg);
    color: var(--text-color);
    font-family: 'Jura', sans-serif;
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    background: #0d1b2a radial-gradient(circle at top left, rgba(65, 90, 119, 0.2) 0%, transparent 30%);
}

/* --- Main Layout --- */
#game-container {
    width: 95vw;
    max-width: 700px;
    height: 90vh;
    /* ANNOTATION: Version 9.0 - Using outline for a double-border Art Deco effect. */
    border: 1px solid var(--accent-brass);
    outline: 3px solid var(--primary-border);
    outline-offset: -6px;
    background: linear-gradient(160deg, #1f2d41, #16202e);
    padding: 20px;
    box-shadow: 0 0 35px rgba(0, 191, 255, 0.15), inset 0 0 25px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.5s, border-color 0.5s;
    position: relative;
}

/* ANNOTATION: Version 9.0 - New Art Deco frame styling. */
.art-deco-frame::before, .art-deco-frame::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    border-color: var(--accent-brass);
    border-style: solid;
}
.art-deco-frame::before { top: 10px; left: 10px; border-width: 2px 0 0 2px; }
.art-deco-frame::after { top: 10px; right: 10px; border-width: 2px 2px 0 0; }
#game-container > footer::before, #game-container > footer::after { /* Using footer for bottom corners */
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    border-color: var(--accent-brass);
    border-style: solid;
}
#game-container > footer::before { bottom: 10px; left: 10px; border-width: 0 0 2px 2px; }
#game-container > footer::after { bottom: 10px; right: 10px; border-width: 0 0 2px 2px; }


header h1 {
    text-align: center;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 5px;
    color: var(--text-color);
    font-family: 'Cinzel', serif;
    font-weight: 700;
}

#main-content { display: flex; flex-grow: 1; gap: 20px; height: calc(100% - 70px); min-height: 0; }
#ui-container { flex: 1; border: 1px solid var(--primary-border); padding: 15px; display: flex; flex-direction: column; gap: 15px; min-height: 0; }

/* --- Resonance Chamber --- */
#resonance-chamber {
    border: 1px solid var(--primary-border);
    height: 250px; 
    position: relative;
    background-color: var(--field-bg);
    overflow: hidden;
    box-shadow: inset 0 0 15px rgba(0, 191, 255, 0.3);
}

/* ANNOTATION: Version 9.0 - New, complex animation for the energy field. */
#energy-field { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; }
.orb {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, #fff, var(--accent-electric-blue), transparent 60%);
    border-radius: 50%;
    box-shadow: 0 0 10px #fff, 0 0 20px var(--accent-electric-blue), 0 0 35px var(--accent-electric-blue);
    animation: pulse-orb 4s infinite ease-in-out;
}
@keyframes pulse-orb {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px #fff, 0 0 20px var(--accent-electric-blue), 0 0 35px var(--accent-electric-blue); }
    50% { transform: scale(1.1); box-shadow: 0 0 15px #fff, 0 0 30px var(--accent-electric-blue), 0 0 50px var(--accent-electric-blue); }
}
.spark {
    position: absolute;
    width: 2px;
    height: 150%;
    background: linear-gradient(transparent, #fff, transparent);
    animation: spark-crackle 1s linear infinite;
    opacity: 0;
}
.spark:nth-child(2) { transform: rotate(45deg); animation-delay: -0.2s; }
.spark:nth-child(3) { transform: rotate(90deg); animation-delay: -0.5s; }
.spark:nth-child(4) { transform: rotate(135deg); animation-delay: -0.8s; }
@keyframes spark-crackle {
    0% { opacity: 0; transform: rotate(0deg) scaleY(1); }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; transform: rotate(360deg) scaleY(1.2); }
}


/* --- Dialogue Box & Log --- */
#dialogue-box {
    border: 1px dashed var(--primary-border);
    padding: 10px;
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* ANNOTATION: Version 9.0 - Added scanline effect. */
    background-image: repeating-linear-gradient(transparent, transparent 2px, rgba(0, 191, 255, 0.04) 3px);
}
.user-message { color: #8c8c8c; margin: 0; padding-left: 5px; font-style: italic; }
.max-message { position: relative; } 
.max-message p { margin: 0; white-space: pre-wrap; word-wrap: break-word; line-height: 1.6; }
.copy-btn { position: absolute; top: -5px; right: 0; background-color: var(--primary-border); color: var(--text-color); border: 1px solid var(--accent-brass); font-family: 'Jura', sans-serif; font-size: 14px; padding: 2px 8px; cursor: pointer; display: none; opacity: 0; transition: opacity 0.3s, background-color 0.2s; }
.max-message:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background-color: var(--accent-brass); color: var(--main-bg); }
.copy-btn.copied { background-color: #fff; color: #000; }
#dialogue-box::-webkit-scrollbar { width: 12px; }
#dialogue-box::-webkit-scrollbar-track { background: var(--container-bg); border-left: 1px solid var(--primary-border); }
#dialogue-box::-webkit-scrollbar-thumb { background-color: var(--primary-border); border: 1px solid var(--accent-brass); }
#dialogue-box::-webkit-scrollbar-thumb:hover { background-color: var(--accent-brass); }
.cursor { animation: blink 1s step-end infinite; background-color: var(--text-color); display: inline-block; width: 10px; height: 1.2rem; vertical-align: bottom; }

/* --- Player HUD & Controls --- */
#controls { border: 1px dashed var(--primary-border); padding: 10px; }
#talk-btn { width: 100%; padding: 15px; background-color: transparent; border: 2px solid var(--accent-brass); color: var(--accent-brass); font-family: 'Cinzel', serif; font-size: 18px; cursor: pointer; text-transform: uppercase; transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; margin-bottom: 10px; letter-spacing: 2px; text-shadow: 0 0 5px var(--accent-brass); }
#talk-btn:hover { background-color: var(--accent-brass); color: var(--main-bg); box-shadow: 0 0 15px var(--accent-brass); }
#text-input-container { display: flex; gap: 10px; width: 100%; }
#memo-input { flex-grow: 1; background-color: #0d1b2a; border: 1px solid var(--primary-border); color: var(--text-color); font-family: 'Jura', sans-serif; font-size: 17px; padding: 5px 10px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.5); }
#memo-input:focus { outline: none; border-color: var(--accent-electric-blue); box-shadow: 0 0 8px var(--accent-electric-blue), inset 0 1px 3px rgba(0,0,0,0.5); }
#send-text-btn { padding: 5px 15px; background-color: transparent; border: 2px solid var(--primary-border); color: var(--text-color); font-family: 'Cinzel', serif; font-size: 16px; cursor: pointer; text-transform: uppercase; transition: background-color 0.2s, color 0.2s; }
#send-text-btn:hover { background-color: var(--primary-border); }
.controls-info { font-size: 14px; text-align: center; margin-top: 10px; color: #8c8c8c; }

/* --- Footer --- */
footer { text-align: center; font-size: 12px; letter-spacing: 1px; color: var(--primary-border); padding-top: 10px; height: 20px; }

/* --- Animations & Effects --- */
.header-glow {
    position: relative;
    /* ANNOTATION: Version 9.0 - Intensified glow effect. */
    text-shadow: 0 0 4px #fff, 0 0 10px var(--accent-electric-blue), 0 0 20px var(--accent-electric-blue);
    animation: text-flicker 15s linear infinite;
}
@keyframes text-flicker {
    0%, 19.9%, 22%, 62.9%, 64%, 100% { text-shadow: 0 0 4px #fff, 0 0 10px var(--accent-electric-blue), 0 0 20px var(--accent-electric-blue); }
    20%, 21.9%, 63%, 63.9% { text-shadow: none; }
}

@keyframes blink { 50% { opacity: 0; } }

.resonant-cascade-effect { box-shadow: 0 0 35px var(--accent-electric-blue), inset 0 0 35px var(--accent-electric-blue); outline-color: var(--accent-electric-blue); }
.overload-pulse-effect { box-shadow: 0 0 45px var(--accent-brass), inset 0 0 45px var(--accent-brass); outline-color: var(--accent-brass); animation: pulse-red 1s 3; }
@keyframes pulse-red { 0%, 100% { outline-color: var(--accent-brass); } 50% { outline-color: #ff4d4d; } }

/* --- Responsive Design --- */
@media (max-width: 768px) {
    body { font-size: 17px; overflow: auto; height: auto; padding: 10px 0; }
    #game-container { height: auto; width: 95vw; padding: 10px; }
    #main-content { flex-direction: column; height: auto; }
    #resonance-chamber { height: 150px; }
    .orb { width: 30px; height: 30px; }
    #dialogue-box { min-height: 200px; max-height: 40vh; }
}