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

body {
    background: #222;
    color: #e9e9e9;
    line-height: 1.2;
}

h1,
h2,
h3,
h4,
h5 {
    margin-bottom: 0.5em;
}

h1:not(:first-child),
h2:not(:first-child),
h3:not(:first-child),
h4:not(:first-child),
h5:not(:first-child) {
    margin-top: 0.5em;
}

p:not(:first-child),
ol:not(:first-child),
ul:not(:first-child) {
    margin-top: 0.5em;
}

a,
a:visited {
    color: #abc;
}

a:hover {
    color: #fff;
}

hr {
    margin: 1em;
}

div#output {
    max-width: 50em;
    margin: 1em 1em 1em 4em;
}

div.output-paragraph {
    margin-top: 1em;
    padding-left: 1em;
}

div.output-paragraph .ai-response {
    display: flex;
}

div.output-paragraph pre {
    font-size: 0.9rem;
}

div.output-paragraph .ai-response p code { /* Code not in a <pre> code block */
    background: #000;
    color: #fff;
}

div.output-paragraph.current .metadata {
    box-sizing: border-box;
    border-right: 1px solid #666;
}

div.output-paragraph .metadata {
    flex-shrink: 0;
    width: 2em;
    margin-right: 1em;
}

div.output-paragraph .text:not(.pretty-print) {
    white-space: pre-wrap;
}

.in-chat-mode div.output-paragraph .text {
    font-family: monospace;
    font-size: 1.1em;
    max-width: calc(100% - 3em);
}

.in-story-mode div.output-paragraph .text {
    line-height: 1.5;
}

div.output-paragraph th {
    border-bottom: 1px solid;
    text-align: left;
}

div.output-paragraph th,
div.output-paragraph td {
    padding: 0.25em;
}

div.output-paragraph table {
    border-top: 1px solid;
    border-bottom: 1px solid;
}

.in-chat-mode .story-mode-only {
    display: none !important;
}

.in-story-mode .chat-mode-only {
    display: none !important;
}

.hidden {
    display: none !important;
}

div.overlay {
    display: flex;
    width: 100%;
    height: 100%;
    background: #00000066;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
}

div.overlay-contents {
    margin: auto;
    border: 1px solid #000;
    padding: 1em;
    background: #000;
    max-width: 35em;
}

#command-palette {
    text-align: center;
}

#command-instructions {
    text-align: left;
}

#command-instructions ul,
#instructions ul {
    list-style: none;
    padding-left: 2em;
}

#command-instructions code,
#instructions code {
    display: inline-block;
    min-width: 4em;
}

#command-instructions code {
    min-width: 15em;
}

.overlay-contents textarea {
    display: block;
    width: calc(100% - 0.5em);
    height: 8em;
    margin: 1em 0 0.5em 0;
}

#import-text div.overlay-contents,
#summarize div.overlay-contents {
    max-width: 50em;
    width: 50em;
}

#import-text textarea,
#summarize textarea {
    height: 20em;
}

#summarize textarea:disabled {
    background: #aaa;
    color: #000;
    border: 1px solid #666;
}

#edit-var div.overlay-contents {
    width: 30em;
}

#info {
    position: fixed;
    top: 0;
    right: 0;
    width: 20em;
    font-size: 0.75em;
    color: #666;
}

#info > * {
    margin-top: 1em;
}

div#gen-stats p {
    margin: 0;
}

div#temp-context-preview {
    margin-right: 0.5em;
}

table#gen-settings {
    border-top: 1px solid #666;
    border-bottom: 1px solid #666;
    border-collapse: collapse;
    text-align: left;
}

table#gen-settings thead th {
    border-bottom: 1px solid #666;
}

table#gen-settings th,
table#gen-settings td {
    padding: 0.125em 0.5em 0.125em 0.5em;
}

table#gen-settings td p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

div.prompt {
    background: #111;
    padding: 0.5em;
    margin: 2em 0 0.5em 0;
}

div.reasoning {
    display: inline-block;
    color: #888;
    border-bottom: 1px solid #888;
    padding-bottom: 0.5em;
    white-space: pre-wrap;
}
