* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #000000;
    color: #00ff00;
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 10px;
    gap: 10px;
}

/* Title Bar */
.title-bar {
    background-color: #111;
    padding: 15px;
    border: 2px solid #00ff00;
    border-radius: 5px;
    text-align: center;
}

.title-bar h1 {
    font-size: 1.5rem;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
    margin: 0;
}

/* Lessons Button Container */
.lessons-button-container {
    display: flex;
    justify-content: center;
    padding: 0;
}

.btn-lessons {
    padding: 10px 20px;
    background-color: #00ff00;
    color: #000;
    border: none;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.btn-lessons:hover {
    background-color: #00cc00;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 255, 0, 0.3);
}

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

/* Map Button Container */
.map-button-container {
    display: flex;
    justify-content: center;
    padding: 0;
}

.btn-map {
    padding: 10px 20px;
    background-color: #00ffff;
    color: #000;
    border: none;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.btn-map:hover {
    background-color: #00cccc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 255, 255, 0.3);
}

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

/* Section Headers */
h2 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #00ff00;
    text-transform: uppercase;
}

/* Code Editor Section */
.code-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.code-editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 2px solid #00ff00;
    border-radius: 5px;
    background-color: #0a0a0a;
    padding: 10px;
}

.code-editor {
    flex: 1;
    width: 100%;
    background-color: #0a0a0a;
    color: #00ff00;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    padding: 10px;
}

.btn-run {
    margin-top: 10px;
    padding: 10px 20px;
    background-color: #00ff00;
    color: #000;
    border: none;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-run:hover {
    background-color: #00cc00;
    box-shadow: 0 0 15px #00ff00;
}

.btn-run:active {
    transform: scale(0.95);
}

/* Gameplay Section */
.gameplay-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.gameplay-text {
    flex: 1;
    overflow-y: auto;
    border: 2px solid #00ff00;
    border-radius: 5px;
    background-color: #0a0a0a;
    padding: 15px;
    font-size: 14px;
    line-height: 1.6;
}

.gameplay-text p {
    margin-bottom: 10px;
}

.gameplay-text .highlight {
    color: #ffff00;
    font-weight: bold;
}

.gameplay-text .enemy {
    color: #ff0000;
    font-weight: bold;
}

.gameplay-text .success {
    color: #00ffff;
    font-weight: bold;
}

/* Terminal Section */
.terminal-section {
    flex: 0.8;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    border: 2px solid #00ff00;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    background-color: #0a0a0a;
    padding: 10px;
    font-size: 13px;
    line-height: 1.5;
}

.terminal-controls {
    display: flex;
    justify-content: flex-end;
    padding: 5px 10px;
    border: 2px solid #00ff00;
    border-top: none;
    background-color: #0a0a0a;
}

.btn-terminal {
    padding: 8px 15px;
    background-color: #00ff00;
    color: #000;
    border: none;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-terminal:hover {
    background-color: #00cc00;
    box-shadow: 0 0 10px #00ff00;
}

.btn-terminal:active {
    transform: scale(0.95);
}

.terminal-input-wrapper {
    display: flex;
    align-items: center;
    border: 2px solid #00ff00;
    border-top: none;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    background-color: #0a0a0a;
    padding: 10px;
}

.terminal-prompt {
    color: #00ff00;
    font-weight: bold;
    margin-right: 5px;
}

.terminal-input {
    flex: 1;
    background-color: transparent;
    color: #00ff00;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    outline: none;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .title-bar h1 {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .btn-lessons {
        font-size: 0.95rem;
        padding: 10px 15px;
    }

    h2 {
        font-size: 0.9rem;
    }

    .code-editor,
    .gameplay-text,
    .terminal-output,
    .terminal-input {
        font-size: 12px;
    }

    .container {
        padding: 5px;
        gap: 5px;
    }
}

/* Animations */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.cursor {
    animation: blink 1s infinite;
}

/* Help Modal */
.help-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
}

.help-modal-content {
    background-color: #0a0a0a;
    border: 3px solid #00ffff;
    border-radius: 10px;
    padding: 20px;
    max-width: 800px;
    max-height: 90%;
    width: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #00ffff;
}

.help-header h2 {
    color: #00ffff;
    font-size: 1.5rem;
    margin: 0;
}

.btn-close-help {
    background-color: #ff0000;
    color: #fff;
    border: none;
    border-radius: 5px;
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-help:hover {
    background-color: #cc0000;
    box-shadow: 0 0 10px #ff0000;
}

.help-body {
    overflow-y: auto;
    padding: 10px;
    color: #00ff00;
    line-height: 1.6;
}

.help-section {
    margin-bottom: 20px;
}

.help-section-title {
    color: #ffff00;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.help-intro {
    color: #ffffff;
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(0, 255, 255, 0.1);
    border-left: 3px solid #00ffff;
    border-radius: 5px;
}

.help-command {
    margin: 8px 0;
    padding-left: 15px;
}

.help-command-name {
    color: #00ffff;
    font-weight: bold;
}

.help-command-desc {
    color: #ffffff;
}

.help-tip {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 0, 0.1);
    border-left: 3px solid #ffff00;
    border-radius: 5px;
    color: #ffff00;
}

/* Map Modal */
.map-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
}

.map-modal-content {
    background-color: #0a0a0a;
    border: 3px solid #00ff00;
    border-radius: 10px;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.map-header h2 {
    color: #00ffff;
    font-size: 1.3rem;
    margin: 0;
}

.btn-close-map {
    background-color: #ff0000;
    color: #fff;
    border: none;
    border-radius: 5px;
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-map:hover {
    background-color: #cc0000;
    box-shadow: 0 0 10px #ff0000;
}

#mapCanvas {
    border: 2px solid #00ff00;
    border-radius: 5px;
    background-color: #000000;
    margin-bottom: 15px;
}

.map-legend {
    background-color: #111;
    border: 2px solid #00ff00;
    border-radius: 5px;
    padding: 10px 15px;
}

.map-legend h3 {
    color: #00ffff;
    font-size: 1rem;
    margin: 0 0 10px 0;
    text-transform: uppercase;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.legend-symbol {
    display: inline-block;
    width: 20px;
    height: 20px;
    text-align: center;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.legend-symbol.player-symbol {
    color: #00ff00;
    font-size: 1.2rem;
}

.legend-symbol.enemy-symbol {
    color: #ff0000;
    font-size: 1.2rem;
}

.legend-symbol.npc-symbol {
    color: #ffffff;
    font-size: 1.2rem;
}

.legend-symbol.door-locked {
    color: #ff0000;
    font-size: 1.5rem;
}

.legend-symbol.door-unlocked {
    color: #00ff00;
    font-size: 1.5rem;
}

/* Mobile Responsive for Map */
@media (max-width: 768px) {
    .map-modal-content {
        padding: 15px;
        max-width: 95%;
        max-height: 95%;
    }
    
    .map-header h2 {
        font-size: 1.1rem;
    }
    
    #mapCanvas {
        width: 100%;
        height: auto;
        max-width: 100%;
    }
    
    .legend-items {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .legend-item {
        font-size: 0.85rem;
    }
    
    .map-legend {
        padding: 8px 12px;
    }
    
    .map-legend h3 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    /* Help Modal Mobile */
    .help-modal-content {
        padding: 15px;
        max-width: 95%;
        max-height: 95%;
    }
    
    .help-header h2 {
        font-size: 1.1rem;
    }
    
    .help-section-title {
        font-size: 1rem;
    }
    
    .help-body {
        font-size: 0.9rem;
    }
    
    .btn-close-help {
        width: 30px;
        height: 30px;
        font-size: 1.2rem;
    }
}

/* Portrait/Mobile specific adjustments */
@media (max-width: 768px) and (orientation: portrait) {
    #mapCanvas {
        width: 100%;
        height: 300px;
    }
    
    .btn-map {
        font-size: 0.95rem;
        padding: 10px 15px;
    }
}
