/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #000;
    color: #e6e6e6;
    font-family: monospace;
    overflow: hidden;
    height: 100vh;
}

/* LOGO */
#logo-wrap {
    position: absolute;
    top: 40px;
    left: 88.5%;
    transform: translateX(-50%);
    z-index: 10;
}

#logo-wrap img {
    width: 28vw;
    max-width: 380px;
}

/* TERMINAL */
#terminal {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38vw;
    max-width: 520px;
    font-size: 14px;
    letter-spacing: 0.15em;
    line-height: 1.6;
    white-space: pre-line;
}

/* RIGHT SIDE DISPLAY */
#terminal-display {
    position: absolute;
    top: 0;
    right: 0;
    width: 28vw;
    max-width: 420px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 40px;
    text-align: center;
}

/* TERMINAL LINES */
.terminal-line {
    margin-bottom: 6px;
    transition: all 0.2s ease;
    padding: 2px 0;
}

.category-main {
    font-size: 18px;
    letter-spacing: 0.2em;
    margin-top: 18px;
}

.category-green { color: #00ff9c; }
.category-red   { color: #ff4d4d; }

.category-sub {
    font-size: 15px;
    margin-top: 10px;
    opacity: 0.9;
}

.clickable {
    cursor: pointer;
    color: #b8dfff;
}

.clickable:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.06);
}

.active-line {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
    padding-left: 8px;
}

/* POPUP */
#history-popup {
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 800px;
    max-height: 70vh;
    background: rgba(0,0,0,0.95);
    border: 1px solid rgba(255,255,255,0.2);
    display: none;
    overflow-y: auto;
    z-index: 1000;
}

#history-content {
    padding: 40px;
    white-space: normal;
    line-height: 1.6;
}

#history-content h2, #history-content h3, #history-content h4 {
    margin-bottom: 15px;
}

/* ROBOT */
#bottom-character {
    position: fixed;
    bottom: 0;
    left: -80px;
}

#bottom-character img {
    width: 45vw;
    max-width: 650px;
}

/* COLOR & CURSOR FIXES */
.purple-header {
    color: #c724ff !important;
    font-weight: bold;
}

.blue-item {
    color: #2ea3ff !important;
}

.clickable,
.purple-header,
.blue-item {
    cursor: pointer !important;
}

.clickable:hover,
.purple-header:hover,
.blue-item:hover {
    color: #ffffff !important;
    background: rgba(255,255,255,0.08);
}

/* RIGHT PANEL SIZE CONTROL */
#terminal-display .header img { width: 80px; height: auto; }
#terminal-display .emblem img { width: 220px; height: auto; }

#terminal-display .header h2 { font-size: 28px; margin: 10px 0; }
#terminal-display .desc { font-size: 16px; margin: 15px 0; }

/* HISTORY POPUP */
#history-popup {
    position: fixed;
    top: 10%;
    left: 52%;
    width: 900px;
    max-height: 100vh !important;
    height: auto !important;
    min-height: 900px;
    background: rgba(0,0,0,0.96);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 25px 30px;
    display: none;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.2);
    color: #e6e6e6;
}

#history-content {
    max-height: calc(75vh - 100px);
    line-height: 1.6;
}

.history-link {
    color: #2ea3ff !important;
    cursor: pointer !important;
    text-decoration: underline !important;
    margin-top: 25px;
    display: inline-block;
    font-weight: bold;
}

.history-link:hover {
    color: #ffffff !important;
    background: rgba(255,255,255,0.1) !important;
}
/* ====================== MOBILE ONLY ====================== */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
        overflow-x: hidden;
    }
    
    #logo-wrap {
        position: relative;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 20px;
    }
    #logo-wrap img {
        width: 260px;
        max-width: 90%;
    }
    
    #terminal {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 92%;
        max-width: 520px;
        margin: 0 auto 30px;
        font-size: clamp(13px, 3.8vw, 14px);
    }
    
    #terminal-display {
        position: relative;
        width: 92%;
        max-width: 420px;
        margin: 0 auto 40px;
        padding: 30px 20px;
        height: auto;
    }
    
    #bottom-character {
        display: none;
    }
    
    .clickable, .history-link {
        min-height: 48px;
        padding: 10px 12px;
    }
    
    /* STRONG MOBILE POPUP FIX */
    #history-popup {
        position: fixed !important;
        top: 10% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 94% !important;
        max-width: 94% !important;
        height: auto !important;
        max-height: 85vh !important;
        background: rgba(0,0,0,0.98) !important;
        border: 2px solid #00ff9c !important;
        z-index: 99999 !important;
        padding: 20px !important;
        box-shadow: 0 0 40px rgba(0, 255, 156, 0.3);
    }
    
    #history-content {
        max-height: 75vh;
        overflow-y: auto;
        padding: 10px;
    }
}