.tui {
    width: calc(100% - 1rem); /* fix borders after transform */
    max-width: 1200px;
    border: 1px solid var(--border);
    background: var(--panel);
    display: flex;
    flex-direction: column;
    height: 90vh;
}

.tui-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.tui-header .title {
    font-weight: bold;
}

.tui-header .status {
    font-weight: bold;
}

.tui-header .lang {
    margin-left: 1em;
    font-size: 0.9em;
    opacity: 0.7;
}

.tui-header .lang a {
    text-decoration: none;
}

.tui-header .lang .active {
    opacity: 1;
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.tui-body {
    min-height: 0;
    flex: 1;
    display: flex;
    min-height: 0; /* REQUIRED for scroll to work */
}

.tui-menu {
    border-right: 1px solid var(--border);
    padding: 0.5rem 0;
    width: 165px;
    flex-shrink: 0;
    overflow: hidden;
}

.tui-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tui-menu li {
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--fg);
    text-transform: uppercase;
    position: relative;
    padding-left: 1.5em; /* space for arrow */
}

.tui-menu li.active {
    background: rgba(122, 162, 247, 0.15);
    color: var(--accent);
}

.tui-menu li::before {
    content: " ";
    position: absolute;
    left: 0;
}

.tui-menu li.active::before {
    content: "▶";
}

.tui-menu li:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tui-content {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.tui-content pre {
    margin: 0;
    white-space: pre-wrap;
}

.tui-footer {
    padding: 0.4rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--muted);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (max-width: 700px) {
    body {
        font-size: 16px;
    }

    .tui {
        /*margin: auto;*/
        height: calc(100dvh - 1rem);
        transform: none;
        border-radius: 0;
    }

    .tui-body {
        flex-direction: column;
    }

    .tui-menu {
        width: 100%;
        overflow-x: auto;
    }

    .tui-menu ul {
        display: flex;
        justify-content: space-around;
    }

    .tui-menu li.active::before {
        content: "";
    }

    .footer-help {
        display: none;
    }
}

.footer-help {
    opacity: 0.6;
    font-size: 0.6rem;
}

.footer-prompt {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.footer-prompt input {
    flex: 1;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    outline: none;
}
