:root {
    --bg-color: #282a36;
    --text-color: #f8f8f2;
    --prompt-color: #50fa7b;
    --accent-color: #bd93f9;
    --error-color: #ff5555;
    --link-color: #8be9fd;
    --base-font-size: clamp(14px, 2vw, 16px);
    --terminal-width: min(90vw, 900px);
    --terminal-height: min(85vh, 600px);
    --padding-base: clamp(10px, 2vw, 20px);
}

body.light-mode {
    --bg-color: #f0f0f0;
    --text-color: #333;
    --prompt-color: #28a745;
    --accent-color: #6f42c1;
    --error-color: #dc3545;
    --link-color: #007bff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: var(--padding-base);
    transition: all 0.3s ease;
    min-height: 100vh;
    font-size: var(--base-font-size);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Instructions */
.instructions {
    width: var(--terminal-width);
    margin-bottom: var(--padding-base);
    padding: var(--padding-base);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    text-align: center;
    font-size: max(12px, 1em);
}

.instructions p {
    margin: 5px 0;
}

/* Terminal Container */
#terminal {
    width: var(--terminal-width);
    height: var(--terminal-height);
    overflow-y: auto;
    padding: var(--padding-base);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

#terminal::-webkit-scrollbar {
    width: 8px;
}

#terminal::-webkit-scrollbar-track {
    background: transparent;
}

#terminal::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
}

/* Input Line */
.input-line {
    display: flex;
    margin-bottom: 10px;
    align-items: center;
    font-size: 1em;
    flex-wrap: wrap;
}

.input-line span {
    color: var(--prompt-color);
    margin-right: 10px;
    white-space: nowrap;
}

#input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1em;
    flex: 1;
    min-width: 200px;
    outline: none;
    font-family: inherit;
}

/* Output Styling */
.output {
    margin-bottom: var(--padding-base);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ASCII Art Banner */
.ascii-art {
    color: var(--accent-color);
    font-size: clamp(8px, 1.5vw, 12px);
    line-height: 1.2;
    margin: var(--padding-base) 0;
    white-space: pre;
    overflow-x: auto;
    max-width: 100%;
}

@media (max-width: 600px) {
    .ascii-art {
        font-size: 6px;
        letter-spacing: -0.5px;
    }
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    word-break: break-all;
}

a:hover {
    text-decoration: underline;
}

/* Project Cards */
.project-card {
    border: 1px solid var(--accent-color);
    padding: calc(var(--padding-base) * 0.75);
    margin: calc(var(--padding-base) * 0.5) 0;
    border-radius: 5px;
    font-size: 0.95em;
}

/* Blog Cards */
.blog-card {
    border-left: 3px solid var(--accent-color);
    padding: calc(var(--padding-base) * 0.75);
    margin: calc(var(--padding-base) * 0.5) 0;
    font-size: 0.95em;
}

/* Profile Image */
img.profile {
    max-width: min(150px, 50%);
    border-radius: 50%;
    margin: var(--padding-base) auto;
    display: block;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: var(--padding-base);
    right: var(--padding-base);
    background: var(--accent-color);
    border: none;
    color: var(--bg-color);
    padding: clamp(8px, 1.5vw, 12px);
    border-radius: 5px;
    cursor: pointer;
    z-index: 1000;
    font-size: clamp(14px, 1.5vw, 18px);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.theme-toggle:hover {
    opacity: 1;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    :root {
        --padding-base: 10px;
    }

    .input-line {
        font-size: 0.9em;
    }

    .project-card, .blog-card {
        font-size: 0.9em;
        padding: 10px;
    }

    #terminal {
        height: 75vh;
    }
}

/* Tablet Optimizations */
@media (min-width: 481px) and (max-width: 768px) {
    :root {
        --padding-base: 15px;
    }

    #terminal {
        height: 80vh;
    }
}

/* Make sure content is readable in landscape */
@media (max-height: 500px) and (orientation: landscape) {
    #terminal {
        height: 65vh;
    }

    .instructions {
        margin-bottom: 10px;
    }
}

/* High-DPI Screen Optimizations */
@media (min-width: 1440px) {
    :root {
        --base-font-size: 18px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    #terminal {
        border: 1px solid #ccc;
        height: auto;
    }

    .theme-toggle {
        display: none;
    }
}