:root {
    --bg: #0a0e18;
    --bg-card: #111827;
    --bg-elevated: #1a2235;
    --border: #1f2937;
    --text: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --orange-400: #fb923c;
    --orange-500: #f97316;
    --blue-400: #60a5fa;
    --purple-400: #a78bfa;
    --green-400: #4ade80;
    --red-400: #f87171;
    --cyan-400: #22d3ee;
    --pink-400: #f472b6;
    --yellow-400: #facc15;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.625rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo h1 {
    font-size: 1rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.input-sm {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.625rem;
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    width: 180px;
}

.input-sm:focus {
    outline: none;
    border-color: var(--orange-500);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text);
}

.btn-primary {
    background: var(--orange-500);
    color: #fff;
}

.btn-primary:hover {
    background: var(--orange-400);
}

.btn-lg {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
    margin-top: 0.75rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--border);
}

.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem;
}

.panel-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.input-area {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.input-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.input-hint code {
    background: var(--bg-elevated);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

#git-input {
    width: 100%;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    resize: vertical;
    line-height: 1.5;
}

#git-input:focus {
    outline: none;
    border-color: var(--orange-500);
}

/* Graph */
.graph-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-top: 1.25rem;
}

.graph-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.graph-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.zoom-controls {
    display: flex;
    gap: 0.25rem;
}

.graph-container {
    overflow: hidden;
    cursor: grab;
    position: relative;
    height: 500px;
}

.graph-container:active {
    cursor: grabbing;
}

#graph-canvas {
    display: block;
}

.commit-detail {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    font-size: 0.8125rem;
}

.commit-detail .detail-hash {
    font-family: var(--font-mono);
    color: var(--orange-400);
    font-weight: 600;
}

.commit-detail .detail-msg {
    color: var(--text);
    margin-top: 0.25rem;
}

.commit-detail .detail-author {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.legend-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
    .graph-container {
        height: 350px;
    }

    .input-sm {
        width: 120px;
    }
}