:root {
    --bg: #1e1f22;
    --panel: #26282c;
    --border: #3a3d42;
    --text: #d8dade;
    --muted: #7d828a;
    --accent: #5aa9e6;
    --error: #ef7a7a;
    --ok: #7fc88a;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, sans-serif;
    font-size: 14px;
}

header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

h1 {
    margin: 0 8px 0 0;
    font-size: 18px;
}

.spacer {
    flex: 1;
}

select, input, button {
    font: inherit;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
}

button {
    cursor: pointer;
}

button:disabled {
    color: var(--muted);
    cursor: default;
}

#run:not(:disabled) {
    border-color: var(--accent);
}

main {
    flex: 1;
    display: flex;
    min-height: 0;
}

.editor {
    flex: 1;
    display: flex;
    min-width: 0;
    border-right: 1px solid var(--border);
}

#gutter, #source {
    margin: 0;
    padding: 12px 8px;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.5;
}

#gutter {
    min-width: 3em;
    overflow: hidden;
    text-align: right;
    color: var(--muted);
    background: var(--panel);
    user-select: none;
}

#gutter .error {
    color: var(--error);
    font-weight: bold;
}

#source {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    color: var(--text);
    background: var(--bg);
    white-space: pre;
    overflow: auto;
    tab-size: 4;
}

.side {
    width: 45%;
    display: flex;
    flex-direction: column;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel + .panel {
    border-top: 1px solid var(--border);
}

h2 {
    margin: 0;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: normal;
    color: var(--muted);
    background: var(--panel);
}

#status.ok {
    color: var(--ok);
}

#status.error {
    color: var(--error);
}

.panel pre {
    flex: 1;
    margin: 0;
    padding: 8px 12px;
    overflow: auto;
    font-family: var(--mono);
    font-size: 13px;
}

#output .error {
    color: var(--error);
}

#output .info {
    color: var(--muted);
}

.panel.host {
    flex: none;
}

h2 .hint {
    float: right;
}

#host {
    margin: 0;
    padding: 4px 0;
    list-style: none;
    font-size: 12px;
}

#host li {
    display: flex;
    flex-direction: column;
    padding: 3px 12px;
    cursor: pointer;
}

#host li:hover {
    background: var(--panel);
}

#host code {
    font-family: var(--mono);
    color: var(--muted);
}

#host li.used code {
    color: var(--accent);
}

#host li.used code::after {
    content: "  ← 使用中";
    color: var(--ok);
}

#host span {
    color: var(--muted);
}
