:root {
    color-scheme: light dark;
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}

body {
    margin: 0;
    background: canvas;
    color: canvastext;
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

h1 {
    margin: 0;
}

.join {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.join input,
.composer input,
.identity input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font: inherit;
    border: 1px solid color-mix(in srgb, canvastext 30%, transparent);
    border-radius: 6px;
    background: canvas;
    color: canvastext;
}

button {
    padding: 0.5rem 1rem;
    font: inherit;
    border: 1px solid color-mix(in srgb, canvastext 30%, transparent);
    border-radius: 6px;
    background: color-mix(in srgb, canvastext 8%, canvas);
    color: canvastext;
    cursor: pointer;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-header .leave {
    padding: 0.25rem 0.5rem;
}

.identity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.identity small {
    opacity: 0.6;
    font-family: ui-monospace, monospace;
}

.messages {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    border: 1px solid color-mix(in srgb, canvastext 15%, transparent);
    border-radius: 8px;
    min-height: 12rem;
    max-height: 60vh;
    overflow-y: auto;
}

.messages li {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, canvastext 8%, transparent);
}

.messages li:last-child {
    border-bottom: none;
}

.messages li.system {
    grid-template-columns: auto 1fr;
    opacity: 0.7;
    font-style: italic;
}

.messages .time {
    opacity: 0.5;
    font-family: ui-monospace, monospace;
    font-size: 0.85em;
    align-self: center;
}

.composer {
    display: flex;
    gap: 0.5rem;
}
