:root {
    /* Tokyo Night Theme Colors */
    --bg-color: #1a1b26;
    --bg-dark: #16161e;
    --text-color: #a9b1d6;
    --text-highlight: #c0caf5;
    --primary: #7aa2f7;
    /* Blue */
    --accent: #bb9af7;
    /* Purple */
    --success: #9ece6a;
    /* Green */
    --warning: #e0af68;
    /* Orange/Yellow */
    --error: #f7768e;
    /* Red */
    --muted: #565f89;
    /* Grey */
    --border: #414868;

    --font-main: 'Fira Code', monospace;
    --font-header: 'Press Start 2P', monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 16px;
    /* Increased base font size for better visibility */
    overflow: hidden;
}

/* --- Loader Screen --- */
#loader-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader-content {
    width: 400px;
    max-width: 90%;
}

.loader-text {
    margin-bottom: 10px;
    color: var(--text-color);
    font-family: var(--font-main);
    text-align: center;
}

.progress-container {
    display: flex;
    align-items: center;
    height: 24px;
    background-color: var(--border);
    width: 100%;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
}

.progress-text {
    margin-left: 10px;
    color: var(--text-highlight);
    background-color: transparent;
    padding: 0 5px;
    min-width: 40px;
    font-size: 14px;
}

/* --- Utility Classes --- */
.hidden {
    display: none !important;
}

.highlight {
    color: var(--text-highlight);
}

.success {
    color: var(--success);
}

.error {
    color: var(--error);
}

.text-dim {
    color: var(--muted);
}

/* --- Main Layout --- */
#main-interface {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 5%;
    max-width: 1600px;
    /* Increased max width for big screens */
    margin: 0 auto;
}

/* Top Nav */
.top-nav {
    text-align: center;
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.nav-item {
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item:hover {
    color: var(--primary);
}

/* Header & Info */
.portfolio-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
    /* Don't shrink header */
}

.pixel-name {
    font-family: var(--font-header);
    color: var(--accent);
    font-size: 42px;
    /* Bigger title */
    margin: 0 0 30px 0;
    text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    text-align: center;
    line-height: 1.2;
}

.info-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 10px 40px;
    font-size: 16px;
}

.info-row {
    display: contents;
}

.info-label {
    color: var(--accent);
    font-weight: bold;
    text-align: right;
}

.info-value {
    color: var(--text-highlight);
}

.info-link {
    color: var(--text-highlight);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent);
    transition: color 0.2s, border-color 0.2s;
}

.info-link:hover {
    color: var(--primary);
    border-bottom-style: solid;
}

.external-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 5px;
    opacity: 0.8;
}

.info-link:hover .external-icon {
    opacity: 1;
}

/* --- Terminal Box --- */
.terminal-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Crucial for flex scrolling */
    margin-bottom: 10px;
}

.terminal-box {
    flex-grow: 1;
    border: 2px solid var(--border);
    /* Thicker border */
    margin: 0;
    padding: 20px;
    background-color: var(--bg-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    /* Nice shadow depth */
}

.terminal-legend {
    color: var(--muted);
    padding: 0 10px;
    font-size: 14px;
    margin-bottom: 10px;
}

#terminal-output {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--muted) var(--bg-dark);
    font-size: 18px;
    /* Larger terminal text */
    line-height: 1.6;
}

#terminal-output::-webkit-scrollbar {
    width: 8px;
}

#terminal-output::-webkit-scrollbar-thumb {
    background-color: var(--muted);
    border-radius: 4px;
}

#terminal-output::-webkit-scrollbar-track {
    background-color: var(--bg-dark);
}

/* User Input Line */
.input-line {
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 10px;
    border-top: 1px solid rgba(65, 72, 104, 0.3);
    font-size: 18px;
    /* Match output size */
}

.prompt {
    color: var(--accent);
    font-weight: bold;
    margin-right: 12px;
    white-space: nowrap;
}

#cmd-input {
    position: absolute;
    opacity: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: text;
    z-index: 10;
}

#ghost-input {
    color: var(--text-highlight);
    white-space: pre-wrap;
    min-height: 1.2em;
}

#cmd-suggestion {
    pointer-events: none;
    /* Make sure clicks go through to input */
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--text-highlight);
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* --- Footer --- */
.status-bar {
    display: flex;
    gap: 30px;
    color: var(--muted);
    font-size: 14px;
    justify-content: center;
    padding-bottom: 10px;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    #main-interface {
        padding: 15px;
    }

    .pixel-name {
        font-size: 32px;
    }
}

@media (max-width: 768px) {

    html,
    body {
        overflow: auto;
        height: auto;
        min-height: 100%;
    }

    #main-interface {
        height: auto;
        min-height: 100vh;
        padding: 10px 4%;
        display: block;
    }

    .portfolio-header {
        margin-bottom: 20px;
    }

    .pixel-name {
        font-size: 26px;
        margin-bottom: 20px;
        line-height: 1.4;
    }

    .top-nav {
        gap: 15px;
        margin-bottom: 25px;
    }

    .nav-item {
        font-size: 13px;
        border: 1px solid var(--muted);
        padding: 5px 10px;
        border-radius: 4px;
        background: rgba(26, 27, 38, 0.5);
    }

    .info-grid {
        grid-template-columns: 1fr;
        text-align: center;
        width: 100%;
        gap: 12px;
        margin-bottom: 25px;
    }

    .info-label {
        text-align: center;
        display: block;
        color: var(--primary);
        margin-bottom: 2px;
    }

    .info-row {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding-bottom: 10px;
    }

    /* Bigger Terminal on Mobile */
    .terminal-wrapper {
        height: auto;
        min-height: 250px;
        flex-grow: 1;
        margin-bottom: 20px;
    }

    .terminal-box {
        padding: 15px;
    }

    #terminal-output {
        font-size: 16px;
        min-height: 100px;
    }

    .input-line {
        font-size: 16px;
        flex-wrap: wrap;
        min-height: 2em;
    }

    .prompt {
        width: 100%;
        display: block;
        margin-bottom: 5px;
        color: var(--success);
    }

    #ghost-input {
        min-width: 1px;
    }

    .status-bar {
        display: none;
    }
}

@media (max-width: 480px) {
    .pixel-name {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .terminal-wrapper {
        min-height: 200px;
    }
}