:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #1d2330;
    --muted: #667085;
    --line: #d9dde5;
    --accent: #2f6fed;
    --accent-text: #ffffff;
    --danger: #c8372d;
    --ok-bg: #e7f6ec;
    --ok-text: #1a6b35;
    --error-bg: #fdecea;
    --error-text: #a3261d;
    --chip: #e9eefb;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171d;
        --panel: #1d222b;
        --text: #e6e9ef;
        --muted: #98a2b3;
        --line: #333a47;
        --accent: #6b9bff;
        --accent-text: #0d1117;
        --danger: #ff7b72;
        --ok-bg: #16301f;
        --ok-text: #8fdba6;
        --error-bg: #3a1b19;
        --error-text: #ffb4ac;
        --chip: #2a3550;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

.top {
    padding: 20px 24px 8px;
}

.top h1 {
    margin: 0;
    font-size: 22px;
}

.sub {
    margin: 4px 0 0;
    color: var(--muted);
}

.notice {
    margin: 8px 24px 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--ok-bg);
    color: var(--ok-text);
}

.notice.error {
    background: var(--error-bg);
    color: var(--error-text);
}

.notice p {
    margin: 0;
}

.notice button {
    margin-top: 8px;
}

.layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    padding: 16px 24px 48px;
    align-items: start;
}

.games,
.detail {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}

.detail {
    padding: 20px;
}

#game-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

#game-list button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

#game-list button:hover {
    background: var(--bg);
}

#game-list button[aria-current="true"] {
    background: var(--chip);
    font-weight: 600;
}

#game-list .repo {
    display: block;
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.empty {
    margin: 0;
    color: var(--muted);
}

h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

fieldset {
    margin: 0 0 16px;
    padding: 12px 14px 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

legend {
    padding: 0 6px;
    font-weight: 600;
}

.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    color: inherit;
    font: inherit;
}

input[type="text"]:read-only {
    color: var(--muted);
}

input[type="text"]:focus,
.tags:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
}

.tags input[type="text"] {
    flex: 1 1 140px;
    width: auto;
    padding: 2px 4px;
    border: 0;
    outline: 0;
    background: transparent;
}

.chips {
    display: contents;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px 2px 10px;
    border-radius: 999px;
    background: var(--chip);
}

.chip-remove {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: 1;
    padding: 2px 6px;
    cursor: pointer;
}

.hint {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.error {
    margin: 4px 0 0;
    color: var(--danger);
    font-size: 13px;
    white-space: pre-line;
}

.field.invalid input[type="text"],
.field.invalid .tags {
    border-color: var(--danger);
}

.actions {
    display: flex;
    gap: 8px;
}

button {
    padding: 8px 16px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    cursor: pointer;
}

button.secondary {
    width: 100%;
    background: transparent;
    color: var(--accent);
}

button.danger {
    margin-left: auto;
    border-color: var(--danger);
    background: transparent;
    color: var(--danger);
}

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

[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .layout {
        grid-template-columns: 1fr;
        padding: 12px 12px 32px;
    }

    .top {
        padding: 16px 12px 4px;
    }

    .notice {
        margin: 8px 12px 0;
    }
}
