:root {
    --bg: #040806;
    --panel: #06130b;
    --line: #134d27;
    --green: #39ff7a;
    --muted: #5fae7c;
    --amber: #ffb547;
    --cyan: #6fd3ff;
    --red: #ff5f5f;
    --glow: 0 0 6px rgba(57, 255, 122, 0.55);
    --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono",
        monospace;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.6;
    color: var(--green);
    background: radial-gradient(ellipse at 50% 30%, #0b1d12 0%, var(--bg) 70%)
        fixed,
        var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    text-shadow: var(--glow);
    overflow-x: hidden;
    overflow-wrap: break-word;
}

/* ── Эффект ЭЛТ-монитора: строки развёртки и виньетка ─────────── */
body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

body::before {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 2px,
        rgba(0, 0, 0, 0.22) 3px
    );
}

body::after {
    box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.85);
}

a {
    color: var(--amber);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

::selection {
    background: var(--green);
    color: var(--bg);
    text-shadow: none;
}

/* ── Окно терминала ────────────────────────────────────────────── */
.term {
    max-width: 980px;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(4, 12, 7, 0.92);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(57, 255, 122, 0.06);
    overflow: hidden;
}

.term__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    font-size: 13px;
    color: var(--muted);
    text-shadow: none;
}

.term__dot {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.term__dot--r {
    background: #c0443c;
}

.term__dot--y {
    background: #c79a2a;
}

.term__dot--g {
    background: #2f9e44;
}

.term__title {
    margin-left: 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.term__body {
    padding: 28px 30px 34px;
}

.prompt__user {
    color: var(--amber);
}

.prompt__path {
    color: var(--cyan);
}

.out {
    color: var(--muted);
}

.cursor {
    display: inline-block;
    width: 0.6em;
    height: 1em;
    margin-left: 4px;
    background: var(--green);
    vertical-align: -0.1em;
    box-shadow: var(--glow);
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.title {
    margin: 14px 0 10px;
    font-size: clamp(24px, 4.6vw, 38px);
    line-height: 1.2;
    font-weight: 700;
}

.lead {
    color: var(--muted);
    max-width: 66ch;
}

/* ── Главная ───────────────────────────────────────────────────── */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 34px;
    margin-top: 28px;
}

.motd {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.motd li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
}

.tag-ok {
    height: fit-content;
    padding: 0 6px;
    color: var(--bg);
    background: var(--green);
    font-weight: 700;
    text-shadow: none;
}

.motd strong {
    font-weight: 700;
}

.motd .d {
    display: block;
    color: var(--muted);
}

.cmds {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 26px;
}

.cmds a::before {
    content: "$ ";
    color: var(--muted);
}

/* ── Форма входа ───────────────────────────────────────────────── */
.login {
    padding: 22px 22px 18px;
    border: 1px dashed var(--line);
    border-radius: 6px;
    background: rgba(57, 255, 122, 0.03);
    align-self: start;
}

.login__head {
    margin-bottom: 14px;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--muted);
}

.field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.field:focus-within {
    border-bottom-color: var(--green);
}

.field__label {
    flex: none;
    color: var(--amber);
}

.field__input {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    font: inherit;
    color: var(--green);
    background: transparent;
    border: none;
    outline: none;
    text-shadow: var(--glow);
    caret-color: var(--green);
}

.field__input::placeholder {
    color: #2e6b43;
    text-shadow: none;
}

.field__toggle {
    flex: none;
    padding: 2px 8px;
    font: inherit;
    font-size: 12px;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: pointer;
}

.field__toggle:hover,
.field__toggle.is-active {
    color: var(--green);
    border-color: var(--green);
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-size: 13.5px;
    color: var(--muted);
    cursor: pointer;
}

.check input {
    width: 15px;
    height: 15px;
    accent-color: var(--green);
}

.btn {
    display: inline-block;
    width: 100%;
    margin-top: 18px;
    padding: 12px;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--bg);
    background: var(--green);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-shadow: none;
    box-shadow: 0 0 18px rgba(57, 255, 122, 0.35);
    transition: filter 0.15s, box-shadow 0.15s;
}

.btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 26px rgba(57, 255, 122, 0.55);
}

.btn:disabled {
    cursor: progress;
    opacity: 0.8;
}

.note {
    min-height: 1.6em;
    margin-top: 12px;
    font-size: 13.5px;
    color: var(--muted);
}

.note.is-error {
    color: var(--red);
    text-shadow: 0 0 6px rgba(255, 95, 95, 0.5);
}

.login__foot {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

/* ── Навигация внутренних страниц ──────────────────────────────── */
.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    padding: 10px 30px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.nav a {
    color: var(--muted);
}

.nav a.is-active {
    color: var(--green);
}

.nav a.is-active::before {
    content: "> ";
}

.nav__spacer {
    flex: 1;
}

.nav .nav__back {
    color: var(--amber);
}

/* ── Страница man ──────────────────────────────────────────────── */
.manbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

.man-h {
    margin: 30px 0 10px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--amber);
}

.man-p {
    padding-left: 4ch;
    max-width: 80ch;
}

.man-p + .man-p {
    margin-top: 10px;
}

.timeline {
    list-style: none;
    margin-left: 4ch;
}

.timeline li {
    display: grid;
    grid-template-columns: 7ch minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dotted var(--line);
}

.timeline .y {
    color: var(--amber);
    font-weight: 700;
}

.timeline .t span {
    display: block;
    color: var(--muted);
}

.table-wrap {
    margin-left: 4ch;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
}

table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--amber);
    background: rgba(255, 181, 71, 0.05);
}

tr:last-child td {
    border-bottom: none;
}

td code {
    font: inherit;
    color: var(--cyan);
}

/* ── Шпаргалка ─────────────────────────────────────────────────── */
.sheet {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
    gap: 18px;
    margin-top: 26px;
}

.block {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(57, 255, 122, 0.02);
}

.block__head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    color: var(--amber);
}

.block__head span {
    font-size: 12.5px;
    font-weight: 400;
    color: var(--muted);
}

.block pre {
    padding: 12px 14px;
    overflow-x: auto;
    font: inherit;
    font-size: 13.5px;
    line-height: 1.8;
}

.block .p,
.block .c {
    color: var(--muted);
}

.block .p {
    user-select: none;
}

.tip {
    margin-top: 26px;
    padding: 14px 16px;
    border: 1px solid var(--amber);
    border-radius: 6px;
    color: var(--amber);
    text-shadow: 0 0 6px rgba(255, 181, 71, 0.4);
}

.footer {
    max-width: 980px;
    margin: 18px auto 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
}

/* ── Адаптив ───────────────────────────────────────────────────── */
@media (max-width: 820px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 26px;
    }

    .term__body {
        padding: 22px 18px 26px;
    }

    .nav {
        padding: 10px 18px;
    }

    .man-p,
    .timeline,
    .table-wrap {
        margin-left: 0;
        padding-left: 0;
    }

    .manbar span:nth-child(2) {
        display: none;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        font-size: 14px;
    }

    /* 16px — иначе Safari на iOS зумит страницу при фокусе в поле */
    .field__input {
        font-size: 16px;
    }

    .field {
        flex-wrap: wrap;
    }

    .timeline li {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    .nav__spacer {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cursor {
        animation: none;
    }

    * {
        transition: none !important;
    }
}
