:root {
    --bg: #0b0f14;
    --card: #111826;
    --text: #e6edf3;
    --muted: #93a4b3;
    --accent: #7dd3fc;
    --border: #223046;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(17, 24, 38, 0.8);
    position: sticky;
    top: 0;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav a {
    margin-left: 14px;
    color: var(--muted);
}

.nav a:hover {
    color: var(--text);
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 18px;
}

.card {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 10px;
    padding: 14px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.kv {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.kv span:first-child {
    color: var(--muted);
}

.moves {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px;
    min-height: 120px;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.board {
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.18);
}

.rank {
    display: grid;
    grid-template-columns: repeat(8, 44px);
}

.sq {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    user-select: none;
}

.sq.light {
    background: #2a3b52;
}

.sq.dark {
    background: #1b2534;
}

.table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

.table th,
.table td {
    padding: 10px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.table th {
    color: var(--muted);
    font-weight: 600;
}

.form label {
    display: block;
    margin-top: 12px;
    color: var(--muted);
}

.form input,
.form textarea {
    width: 100%;
    margin-top: 6px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    color: var(--muted);
}

.check input {
    width: auto;
    margin-top: 0;
}

.row {
    margin-top: 14px;
    display: flex;
    gap: 12px;
}

button {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(125, 211, 252, 0.12);
    color: var(--text);
    cursor: pointer;
}

button:hover {
    background: rgba(125, 211, 252, 0.18);
}

.linkish {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--muted);
}

.linkish:hover {
    color: var(--text);
    text-decoration: underline;
}

.error {
    color: #fca5a5;
}

.hint {
    color: var(--muted);
}

.opening-summary {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
}

.opening-tree,
.opening-children {
    list-style: none;
    margin: 0;
    padding-left: 16px;
}

.opening-node {
    margin: 6px 0;
}

.opening-row {
    display: flex;
    gap: 12px;
    align-items: baseline;
    padding: 4px 6px;
    border-left: 2px solid rgba(255, 255, 255, 0.08);
}

.opening-row .move {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: var(--text);
    min-width: 60px;
}

.opening-row .meta {
    color: var(--muted);
    font-size: 13px;
}

.opening-empty {
    color: var(--muted);
    font-size: 13px;
}