body {
    background: black;
    color: #ff2222;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url('img/terminal.png') center center / cover no-repeat;
    opacity: 0.30; /* Opacidad */
    pointer-events: none;
}

/* Mobile detection overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    z-index: 10000;
    color: #ff2222;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.mobile-overlay h1 {
    font-size: 1.5em;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.mobile-overlay p {
    font-size: 1.1em;
    line-height: 1.4;
    max-width: 400px;
}

/* Show mobile overlay on small screens */
@media (max-width: 480px) {
    .mobile-overlay {
        display: flex !important;
    }
    
    .terminal, .header-bar, #secretPixel, #dungeonContainer {
        display: none !important;
    }
}

.header-bar {
    width: 100vw;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    font-size: 1.1em;
    letter-spacing: 2px;
    padding: 0 24px;
    box-sizing: border-box;
    background: transparent;
}

.chapter-title {
    color: #ff2222;
    font-weight: bold;
    font-size: 1.2em;
    letter-spacing: 2px;
    text-align: center;
    flex: 1;
    user-select: none;
    pointer-events: none;
}

.header-bar .rune-btn {
    margin-right: 12px;
}

.header-bar .social-btns {
    margin-left: 12px;
}

.rune-btn .runas {
    transition: color 0.3s;
    font-size: 1.3em;
    letter-spacing: 2px;
    display: inline-block;
    width: 22ch; /* Largo de caja runas */
    min-width: 22ch;
    max-width: 22ch;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    /* Forzar altura fija para evitar salto vertical */
    height: 1.3em;
    line-height: 1.3em;
    overflow: hidden;
}

.rune-btn:hover .runas {
    color: #fff;
    /* No blur, solo cambio de color */
}

.rune-btn {
    background: transparent;
    border: 2px solid #ff2222;
    color: #ff2222;
    padding: 6px 18px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.3em;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.2s, color 0.2s, border 0.2s;
    margin-right: 12px;
    outline: none;
    position: relative;
    overflow: hidden;
}

.rune-btn:hover {
    background: #ff2222;
    color: #1a1a1a;
    border-color: #ff2222;
}

.rune-btn:hover .runas {
    color: #fff;
    animation: runeChange 0.7s steps(10) 1;
}

@keyframes runeChange {
    0% { opacity: 1; }
    30% { opacity: 0.2; }
    60% { opacity: 0.7; }
    100% { opacity: 1; }
}

.social-btns {
    display: flex;
    gap: 10px;
}
.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px solid #ff2222;
    border-radius: 0;
    width: 38px;
    height: 38px;
    transition: background 0.2s, border 0.2s;
    text-decoration: none;
    margin-left: 2px;
}
.social-icon svg {
    stroke: #ff2222;
    fill: none;
    transition: stroke 0.2s;
}
.social-icon:hover {
    background: #ff2222;
    border-color: #ff2222;
}
.social-icon:hover svg {
    stroke: #1a1a1a;
}

.terminal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(700px, 90vw);
    height: min(400px, 60vh);
    min-height: 300px;
    max-height: 80vh;
    background: transparent;
    border: 3px solid #ff2222;
    border-radius: 0;
    padding: clamp(16px, 4vw, 32px);
    animation: fadeIn 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* Responsive adjustments for different screen sizes */
@media (max-height: 600px) {
    .terminal {
        height: 80vh;
        min-height: 250px;
        margin-top: 0;
    }
}

@media (max-width: 1200px) {
    .terminal {
        width: 90vw;
        height: 70vh;
    }
}

@media (max-width: 900px) {
    .terminal {
        width: 95vw;
        height: 75vh;
        padding: 20px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -60%) scale(0.98);}
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1);}
}

.scroll-area {
    font-size: clamp(0.9em, 2.5vw, 1.1em);
    letter-spacing: 0.5px;
    margin-right: -1.5vw;  /* Posicion del scroll (que tan a la derecha esta) */
    padding-right: 10px; /* Espacio entre el scroll y el texto */
    margin-bottom: 0; 
    height: calc(100% - 40px); /* Altura del recuadro invisible donde se escriben los comandos (cambiar los px) */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ff2222 transparent;
    background: transparent;
    box-sizing: border-box;
}

/* Scrollbar minimalista y cuadrado para Chrome, Edge y Safari */
.scroll-area::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}
.scroll-area::-webkit-scrollbar-thumb {
    background: #ff2222;
    border-radius: 0;
    min-height: 20px;
    opacity: 0.8;
    border: none;
}
.scroll-area::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 0;
}

.scroll-area::-webkit-scrollbar-button {
    display: none;
    height: 0;
    width: 0;
}

.scroll-area {
    scrollbar-width: thin;
    scrollbar-color: #ff2222 transparent;
}

.input-line {
    display: flex;
    align-items: center;
    font-size: clamp(0.9em, 2.5vw, 1.1em);
    position: absolute;
    left: clamp(16px, 4vw, 32px);
    bottom: clamp(12px, 3vw, 24px);
    width: calc(100% - clamp(32px, 8vw, 64px));
    background: transparent;
    box-sizing: border-box;
}

.input-line .prompt {
    color: #ff2222;
    font-weight: bold;
    margin-right: 8px;
    font-size: clamp(0.9em, 2.5vw, 1.1em);
}

.input-line input {
    background: transparent;
    border: none;
    color: #ff2222;
    font-family: inherit;
    font-size: clamp(0.9em, 2.5vw, 1.1em);
    outline: none;
    width: 100%;
    caret-color: #ff2222;
}

.input-line input:focus {
    outline: none;
}

.output, .input-line, .input-line input, .input-line .prompt {
    font-size: clamp(0.9em, 2.5vw, 1.1em);
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.4;
}

/* Responsive header adjustments */
@media (max-width: 600px) {
    .header-bar {
        padding: 0 16px;
        font-size: 0.9em;
    }
    
    .rune-btn {
        padding: 4px 12px;
        font-size: 1.1em;
    }
    
    .rune-btn .runas {
        font-size: 1.1em;
        width: 18ch;
        min-width: 18ch;
        max-width: 18ch;
    }
    
    .social-icon {
        width: 32px;
        height: 32px;
    }
    
    .social-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* Dungeon container responsive adjustments */
#dungeonContainer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    color: #48ee82;
    font-family: monospace;
    font-size: clamp(8px, 2vw, 16px);
    z-index: 999;
    overflow: hidden;
    box-sizing: border-box;
}

#dungeonDisplay {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 10px; /* Espacio alrededor del mapa */
    box-sizing: border-box;
    font-size: clamp(6px, 1.5vw, 12px); /* Tamaño de fuente del mapa */
    line-height: 1;
    white-space: pre;
    overflow: hidden;
}

#dungeonMessage {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: clamp(12px, 2.5vw, 16px);
    text-align: center;
    margin: 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #48ee82;
}

/* Responsive adjustments for different screen sizes */
@media (max-width: 1200px) {
    #dungeonDisplay {
        font-size: 8px;
    }
    #dungeonMessage {
        font-size: 12px;
        bottom: 15px;
    }
}

@media (max-width: 900px) {
    #dungeonDisplay {
        font-size: 6px;
        padding: 5px;
    }
    #dungeonMessage {
        font-size: 10px;
        bottom: 10px;
        padding: 8px;
    }
}

@media (max-height: 600px) {
    #dungeonDisplay {
        padding: 5px;
    }
    #dungeonMessage {
        bottom: 10px;
        font-size: 10px;
    }
}