@font-face {
    font-family: 'Amsterdam Four';
    src: url('assets/fonts/Amsterdam Four_ttf 400.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

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

:root {
    --bg: #141414;
    --mint: #A8FFD2;
    --mint-dim: rgba(168, 255, 210, 0.5);
    --mint-glow: rgba(168, 255, 210, 0.08);
    --user-color: #80FFDB;
    --error-color: #FF6B6B;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--mint);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
}

/* Scanline overlay */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(0deg,
            rgba(168, 255, 210, 0.015) 0 1px,
            transparent 1px 3px);
}

/* ── Terminal container ── */
.terminal {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 100%;
}

/* Title bar */
.title-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #1a1a1a;
    border-bottom: 1px solid rgba(168, 255, 210, 0.1);
    flex-shrink: 0;
    user-select: none;
}

.title-bar-dots {
    display: flex;
    gap: 6px;
}

.title-bar-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
}

.title-bar-dots span:nth-child(1) {
    background: #FF5F56;
}

.title-bar-dots span:nth-child(2) {
    background: #FFBD2E;
}

.title-bar-dots span:nth-child(3) {
    background: #27C93F;
}

.title-bar-text {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: var(--mint-dim);
    letter-spacing: 0.5px;
}

/* ── Output area ── */
.output {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    scroll-behavior: smooth;
}

.output::-webkit-scrollbar {
    width: 6px;
}

.output::-webkit-scrollbar-track {
    background: transparent;
}

.output::-webkit-scrollbar-thumb {
    background: rgba(168, 255, 210, 0.15);
    border-radius: 3px;
}

.output::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 255, 210, 0.3);
}

/* ── Lines ── */
.line {
    margin-bottom: 4px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.line-system {
    color: var(--mint-dim);
    font-size: 12px;
}

.line-ascii {
    color: var(--mint);
    font-size: 11px;
    line-height: 1.2;
    opacity: 0.7;
}

/* ── Splash screen ── */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #141414;
    overflow: hidden;
}

.splash canvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* ── Splash → terminal fade-in ── */
.sidebar,
.title-bar,
.input-area,
.mobile-nav {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.output .line,
.output .line-divider {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.app-layout.revealed .sidebar,
.app-layout.revealed .title-bar,
.app-layout.revealed .input-area,
.app-layout.revealed .mobile-nav {
    opacity: 1;
}

.app-layout.revealed .output .line,
.app-layout.revealed .output .line-divider {
    opacity: 1;
}

.neon-name.hidden {
    visibility: hidden;
}

.app-layout.revealed .output .line:not(:has(.neon-name)),
.app-layout.revealed .output .line-divider {
    opacity: 1;
}

/* ── Fixed chat header ── */
.chat-header {
    flex-shrink: 0;
    padding: 0 24px;
    background: #141414;
    border-bottom: 1px solid rgba(168, 255, 210, 0.15);
}

/* ── Project link ── */
.project-link {
    color: var(--mint);
    font-weight: 700;
    text-decoration: none;
}

.project-link:hover {
    text-decoration: underline;
}

/* ── Neon name ── */
.neon-name {
    font-family: 'Amsterdam Four', cursive;
    font-size: 64px;
    font-weight: 400;
    color: #A8FFD2;
    text-align: center;
    padding: 64px 0 44px;
    margin: 0;
    line-height: 1.4;
    letter-spacing: 0;
    user-select: none;
}

@media (max-width: 600px) {
    .neon-name {
        font-size: 42px;
    }
}

/* ── Layout: sidebar + chat ── */
.app-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #111111;
    border-right: 1px solid rgba(168, 255, 210, 0.08);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    user-select: none;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(168, 255, 210, 0.06);
    margin-bottom: 8px;
}

.sidebar-header h2 {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--mint-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    flex: 1;
}

.sidebar-nav li {
    padding: 0;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--mint-dim);
    font-family: var(--mono);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    letter-spacing: 0.3px;
}

.sidebar-btn:hover {
    background: rgba(168, 255, 210, 0.04);
    color: var(--mint);
}

.sidebar-btn:active {
    background: rgba(168, 255, 210, 0.08);
}

.sidebar-btn .icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
    opacity: 0.7;
}

.sidebar-footer {
    padding: 16px 20px 0;
    border-top: 1px solid rgba(168, 255, 210, 0.06);
    margin-top: auto;
}

.sidebar-footer a {
    display: block;
    color: rgba(168, 255, 210, 0.25);
    font-size: 10px;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.sidebar-footer a:hover {
    color: var(--mint-dim);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Chat images ── */
.chat-img {
    max-width: 280px;
    border-radius: 6px;
    margin: 8px 0 4px 0;
    border: 1px solid rgba(168, 255, 210, 0.1);
    display: block;
}

.chat-img-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.chat-img-row img {
    max-width: 180px;
    border-radius: 6px;
    border: 1px solid rgba(168, 255, 210, 0.1);
}

/* ── Mobile nav ── */
.mobile-nav {
    display: none;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 8px 8px;
}

.mobile-nav-btn {
    background: rgba(168, 255, 210, 0.06);
    border: 1px solid rgba(168, 255, 210, 0.12);
    color: var(--mint-dim);
    font-family: var(--mono);
    font-size: 11px;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.3px;
}

.mobile-nav-btn:hover {
    background: rgba(168, 255, 210, 0.1);
    color: var(--mint);
    border-color: rgba(168, 255, 210, 0.25);
}

.mobile-nav-btn:active {
    background: rgba(168, 255, 210, 0.15);
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .mobile-nav {
        display: flex;
    }
}

/* ── User / bot lines ── */
.line-user .prompt-symbol {
    color: var(--mint);
    font-weight: 400;
}

.line-user .prompt-symbol .user {
    color: #A8FFD2;
    font-weight: 700;
}

.line-user .prompt-symbol .at {
    color: var(--mint-dim);
}

.line-user .prompt-symbol .host {
    color: #80FFDB;
    font-weight: 700;
}

.line-user .prompt-symbol .colon {
    color: var(--mint-dim);
}

.line-user .prompt-symbol .path {
    color: #7AA2F7;
    font-weight: 700;
}

.line-user .prompt-symbol .dollar {
    color: var(--mint-dim);
    margin-right: 8px;
}

.line-user .prompt-text {
    color: var(--mint);
}

.line-bot {
    color: #2DD4BF;
    padding-left: 4px;
}

.line-bot .bot-prefix {
    color: rgba(45, 212, 191, 0.6);
    font-weight: 500;
}

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

.line-divider {
    border: none;
    border-top: 1px solid rgba(168, 255, 210, 0.08);
    margin: 8px 0;
}

/* ── Custom cursor: glitch dot (split-channel) ── */
@media (hover: hover) and (pointer: fine) {

    body {
        cursor: none;
    }

    body * {
        cursor: none !important;
    }

    .cursor-glitch {
        position: fixed;
        top: 0;
        left: 0;
        width: 8px;
        height: 8px;
        pointer-events: none;
        z-index: 99999;
        transform: translate(-50%, -50%);
        will-change: transform;
    }

    /* The three stacked layers create the split-channel look.
       --gx / --gy are the live glitch offset, driven by JS on movement. */
    .cursor-glitch .layer {
        position: absolute;
        top: 0;
        left: 0;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        /* offsets ease back to 0 when the mouse stops → clean at rest */
        transition: transform 0.12s ease-out, opacity 0.2s ease;
    }

    /* Main clean mint core */
    .cursor-glitch .layer-core {
        background: #80FFDB;
        box-shadow: 0 0 6px rgba(128, 255, 219, 0.5);
    }

    /* Teal ghost channel — shifts one way */
    .cursor-glitch .layer-teal {
        background: #2DD4BF;
        mix-blend-mode: screen;
        opacity: 0.85;
        transform: translate(calc(var(--gx, 0px) * 1), calc(var(--gy, 0px) * 1));
    }

    /* Cyan/secondary ghost channel — shifts the opposite way */
    .cursor-glitch .layer-ghost {
        background: #5EEAD4;
        mix-blend-mode: screen;
        opacity: 0.7;
        transform: translate(calc(var(--gx, 0px) * -1), calc(var(--gy, 0px) * -1));
    }

    /* Hover: dot swells slightly, glow intensifies */
    .cursor-glitch.is-hover {
        width: 12px;
        height: 12px;
    }

    .cursor-glitch.is-hover .layer {
        width: 12px;
        height: 12px;
    }

    .cursor-glitch.is-hover .layer-core {
        box-shadow: 0 0 10px rgba(128, 255, 219, 0.8);
    }
}

/* ── Cursor & thinking ── */
.cursor-blink {
    display: inline-block;
    width: 8px;
    height: 15px;
    background: #2DD4BF;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.thinking-dots::after {
    content: "";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% {
        content: "";
    }

    25% {
        content: ".";
    }

    50% {
        content: "..";
    }

    75% {
        content: "...";
    }

    100% {
        content: "";
    }
}

/* ── Input area ── */
.input-area {
    display: block;
    position: relative;
    padding: 12px 24px 16px;
    border-top: 1px solid rgba(168, 255, 210, 0.06);
    background: var(--bg);
    flex-shrink: 0;
}

.input-prompt {
    position: absolute;
    top: 12px;
    left: 24px;
    color: var(--mint);
    font-weight: 400;
    margin-right: 0;
    white-space: nowrap;
    font-size: 14px;
    pointer-events: none;
}

.input-prompt .user {
    color: #A8FFD2;
    font-weight: 700;
}

.input-prompt .at {
    color: var(--mint-dim);
}

.input-prompt .host {
    color: #80FFDB;
    font-weight: 700;
}

.input-prompt .colon {
    color: var(--mint-dim);
}

.input-prompt .path {
    color: #7AA2F7;
    font-weight: 700;
}

.input-prompt .dollar {
    color: var(--mint-dim);
    margin-right: 8px;
}

.input-field {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--mint);
    font-family: var(--mono);
    font-size: 14px;
    caret-color: var(--mint);
    line-height: 1.6;
    resize: none;
    overflow-y: auto;
    /* 5 lines max: 5 × line-height(1.6) = 8em */
    max-height: 8em;
    word-break: break-word;
    overflow-wrap: anywhere;
    /* First line indents past the prompt; wrapped lines start at col 0 */
    text-indent: var(--prompt-indent, 0px);
}

.input-field::placeholder {
    color: rgba(168, 255, 210, 0.15);
}

.input-field:disabled {
    opacity: 0.4;
}

.input-area:focus-within {
    box-shadow: 0 -2px 20px rgba(168, 255, 210, 0.03);
}

/* ── Responsive ── */
@media (max-width: 600px) {

    html,
    body {
        font-size: 13px;
    }

    .output {
        padding: 16px;
    }

    .input-area {
        padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
    }

    .input-prompt {
        top: 10px;
        left: 16px;
    }

    .line-ascii {
        font-size: 8px;
    }
}

/* Selection */
::selection {
    background: rgba(168, 255, 210, 0.2);
    color: #fff;
}