.home {
    --term-faint: #D4D4D8;
    --term-bg: #FAFAFA;
    --term-bar: #F4F4F5;
    --term-shadow: 0 16px 32px -16px rgba(24, 24, 27, 0.22);
    position: fixed;
    inset: var(--bar) 0 0;
    overflow-y: auto;
    outline: none;
    scrollbar-width: none;
    display: flex;
    flex-direction: column-reverse;
}

.home::-webkit-scrollbar {
    display: none;
}

:root[data-theme="dark"] .home {
    --term-faint: #4B5060;
    --term-bg: #121215;
    --term-bar: #18181C;
    --term-shadow: none;
}

:root:has(.home) {
    overflow: hidden;
}

:root:has(.home) .boot-sections {
    pointer-events: none;
}

:root:has(.home) .screen {
    visibility: hidden;
}

.home-stage {
    margin-bottom: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 12px 0;
}

.terminal {
    flex: none;
    width: 100%;
    max-width: 880px;
    min-height: min(420px, calc(var(--view) - 260px));
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: clip;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--term-bg);
    box-shadow: var(--term-shadow);
    font-family: var(--font-mono);
    transition: background .3s, border-color .3s, box-shadow .3s;
}

.terminal-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: var(--term-bar);
    transition: background .3s;
}

.terminal-bar i {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--term-faint);
}

.terminal-bar i:first-child {
    background: var(--accent);
}

.terminal-title {
    flex: 1;
    min-width: 0;
    margin-right: 52px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: center;
    font-size: 11px;
    line-height: 24px;
    color: var(--muted);
}

.terminal-screen {
    padding: 10px 10px 14px;
    font-size: 12px;
    line-height: 19px;
}

.term-line {
    display: none;
    min-height: 19px;
    margin-top: var(--gap, 0);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.term-banner {
    min-height: 0;
    white-space: pre;
    overflow-wrap: normal;
    font-size: 5.6px;
    line-height: 7px;
    color: var(--accent);
}

.term-blank {
    min-height: 0;
    height: 10px;
}

.term-line b,
.term-strong {
    font-weight: 600;
}

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

.term-soft {
    color: var(--body);
}

.term-red {
    color: var(--accent-ink);
}

.term-badge {
    padding: 0 1ch;
    font-weight: 600;
}

.term-badge-done {
    background: var(--accent);
    color: #FFFFFF;
}

.term-badge-info {
    background: var(--fg);
    color: var(--panel);
}

.term-line[data-cursor="on"]::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 14px;
    vertical-align: -2px;
    background: var(--accent);
    animation: term-blink 1s step-end .6s infinite;
}

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

.term-type {
    display: inline-block;
    vertical-align: top;
    max-width: calc(var(--chars, 999) * 1ch);
    overflow: hidden;
    white-space: pre;
}

.term-count,
.term-percent {
    display: inline-block;
    text-align: right;
}

.term-count {
    min-width: 2ch;
}

.term-percent {
    min-width: 3ch;
}

.term-progress {
    --done: 0;
}

.term-bar-done,
.term-bar-left {
    display: inline-block;
    vertical-align: top;
    overflow: hidden;
    white-space: pre;
}

.term-bar-done {
    max-width: calc(var(--done) * 1ch);
}

.term-bar-left {
    max-width: calc((20 - var(--done)) * 1ch);
    color: var(--term-faint);
}

.home-actions {
    flex: none;
    display: flex;
    justify-content: center;
    padding: 32px 0 56px;
}

.home-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.home-button {
    flex: 1 0 auto;
    min-width: 180px;
    height: 56px;
    padding: 0 28px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #FFFFFF;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 17px;
    line-height: 24px;
    white-space: nowrap;
    cursor: pointer;
    transition: filter .15s, transform .15s, opacity .3s;
}

.home-button:hover {
    filter: brightness(1.08);
}

.home-button:active {
    transform: translateY(1px);
}

.home-tldr {
    background: var(--fg);
    color: var(--panel);
}

.home[data-state="sent"] .home-button {
    opacity: 0.6;
    cursor: default;
}

@media (min-width: 1200px) {
    .home-stage {
        padding: 48px 24px 0;
    }

    .terminal {
        min-height: min(460px, calc(var(--view) - 300px));
    }

    .terminal-bar {
        padding: 12px 20px;
    }

    .terminal-title {
        font-size: 12px;
    }

    .terminal-screen {
        padding: 14px 24px 20px;
        font-size: 14px;
        line-height: 22px;
    }

    .term-line {
        min-height: 22px;
    }

    .term-banner {
        min-height: 0;
        font-size: 10px;
        line-height: 12px;
    }

    .term-blank {
        min-height: 0;
        height: 14px;
    }

    .term-badge {
        padding: 0 calc(6px + 1ch);
    }

    .term-line[data-cursor="on"]::after {
        width: 8px;
        height: 16px;
        vertical-align: -3px;
    }

    .home-actions {
        padding: 40px 0 64px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-button {
        transition: none;
    }
}

:root[data-entry] .home {
    visibility: hidden;
}
