:root {
    color-scheme: light;
    --background: #f5f7fb;
    --surface: #ffffff;
    --surface-strong: #eef2f7;
    --text: #172033;
    --muted: #64748b;
    --border: #d8dee8;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --focus: #f59e0b;
    --shadow: 0 18px 45px rgba(23, 32, 51, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark-mode {
    color-scheme: dark;
    --background: #111827;
    --surface: #182235;
    --surface-strong: #233047;
    --text: #f8fafc;
    --muted: #b6c2d2;
    --border: #334155;
    --accent: #38bdf8;
    --accent-strong: #0ea5e9;
    --focus: #facc15;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

button {
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0 16px;
}

button:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 18px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1;
}

.theme-button {
    flex: 0 0 auto;
    background: var(--text);
    color: var(--surface);
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto 36px;
}

.toolbar,
.tab-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.toolbar {
    margin-bottom: 12px;
}

.tab-container {
    margin-bottom: 16px;
}

.tab-button.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.graph-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

#cy {
    width: 100%;
    height: min(68vh, 640px);
    min-height: 420px;
    background-color: var(--surface);
    background-image:
        linear-gradient(to right, color-mix(in srgb, var(--border) 68%, transparent) 1px, transparent 1px),
        linear-gradient(to bottom, color-mix(in srgb, var(--border) 68%, transparent) 1px, transparent 1px);
    background-size: 24px 24px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.58);
}

.modal.is-open {
    display: flex;
}

.modal-content {
    position: relative;
    width: min(520px, 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 28px;
}

.modal-content h2 {
    margin: 0 48px 14px 0;
}

.modal-content ul {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.65;
}

.close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    padding: 0;
    font-size: 1.4rem;
}

@media (max-width: 680px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    button {
        flex: 1 1 130px;
    }

    .theme-button {
        flex: 0 0 auto;
    }

    #cy {
        min-height: 360px;
        height: 62vh;
    }
}
