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

:root {
    --matrix-green: #00ff66;
    --matrix-dim: #3f9e63;
    --matrix-bg: #020804;
    --accent: #2dd4bf;
}

html,
body {
    height: 100%;
}

body {
    background: var(--matrix-bg);
    color: var(--matrix-green);
    font-family: 'Cascadia Code', 'Fira Code', Consolas, Menlo, monospace;
    font-size: 15px;
    overflow: hidden;
}

/* ── Matrix rain na pozadí ── */
#matrix-rain {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.5;
}

/* ── Okno terminálu ── */
.terminal {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(52rem, calc(100vw - 2rem));
    height: min(34rem, calc(100dvh - 2rem));
    margin: max(1rem, calc((100dvh - 34rem) / 2)) auto 0;
    background: rgba(2, 12, 6, 0.88);
    border: 1px solid rgba(0, 255, 102, 0.35);
    border-radius: 0.5rem;
    box-shadow:
        0 0 24px rgba(0, 255, 102, 0.15),
        0 12px 48px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

/* CRT scanlines přes celé okno */
.terminal::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.12) 3px
    );
}

.term-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid rgba(0, 255, 102, 0.2);
    flex-shrink: 0;
}

.term-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    opacity: 0.8;
}

.dot-red    { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #27c93f; }

.term-title {
    margin-left: 0.5rem;
    color: var(--matrix-dim);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.term-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 102, 0.3) transparent;
}

/* ── Výstup ── */
.line {
    margin-bottom: 0.35rem;
    text-shadow: 0 0 6px rgba(0, 255, 102, 0.35);
    word-break: break-word;
}

.term-h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dim {
    color: var(--matrix-dim);
    text-shadow: none;
}

.err {
    color: #ff6b6b;
    text-shadow: 0 0 6px rgba(255, 107, 107, 0.35);
}

.kbd {
    color: var(--accent);
    border: 1px solid rgba(45, 212, 191, 0.4);
    border-radius: 0.2rem;
    padding: 0 0.3rem;
}

.echo {
    color: #d9ffe9;
}

.tool-list {
    list-style: none;
    margin: 0.5rem 0;
}

.arrow {
    color: var(--accent);
    margin-right: 0.4rem;
}

#term-output a,
.tool-list a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted rgba(45, 212, 191, 0.5);
}

#term-output a:hover,
#term-output a:focus-visible {
    color: #7ff7e8;
    border-bottom-style: solid;
    text-shadow: 0 0 8px rgba(45, 212, 191, 0.6);
}

/* ── Vstupní řádka ── */
.input-line {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.prompt {
    color: var(--matrix-green);
    white-space: nowrap;
    text-shadow: 0 0 6px rgba(0, 255, 102, 0.35);
}

#term-input {
    flex: 1;
    min-width: 4rem;
    background: transparent;
    border: none;
    outline: none;
    color: #d9ffe9;
    font: inherit;
    caret-color: var(--matrix-green);
    text-shadow: 0 0 6px rgba(0, 255, 102, 0.35);
}

noscript .line {
    position: relative;
    z-index: 1;
    display: block;
    text-align: center;
    padding: 1rem;
}

/* ── Mobil ── */
@media (max-width: 600px) {
    body {
        font-size: 13px;
    }

    .terminal {
        width: calc(100vw - 1rem);
        height: calc(100dvh - 1rem);
        margin: 0.5rem auto 0;
    }

    .prompt {
        font-size: 0.75rem;
    }
}

/* Při omezených animacích zůstává déšť jako statický obraz (kreslí se jednorázově v JS) */
