:root {
    /* Neutrals */
    --color-white: #fff;
    --color-bg-primary: #f5f5f5;
    --color-bg-secondary: #fafafa;
    --color-bg-tertiary: #f0f0f0;
    --color-bg-blue-light: #f0f8ff;
    
    /* Grays */
    --color-gray-dark: #333;
    --color-gray-medium: #374151;
    --color-gray-medium-2: #555;
    --color-gray-medium-3: #888;
    --color-gray-medium-4: #999;
    --color-gray-light: #bbb;
    --color-gray-lighter: #ccc;
    --color-gray-lightest: #d4d4d4;
    --color-gray-very-light: #e5e5e5;
    
    /* Accents */
    --color-blue-primary: #2563eb;
    
    /* Transparency */
    --color-shadow: rgba(0, 0, 0, 0.08);
    --color-border-shadow: rgba(0, 0, 0, 0.2);
}

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

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    user-select: none;
}

/* ===== TOOLBAR ===== */
#toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-gray-lightest);
    flex-shrink: 0;
    flex-wrap: wrap;
    z-index: 20;
}

#toolbar .brand {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-gray-medium-2);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-right: 6px;
}

#toolbar .sep {
    width: 1px;
    height: 18px;
    background: var(--color-gray-lightest);
    margin: 0 6px;
}

#toolbar button {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--color-gray-lighter);
    background: var(--color-white);
    color: var(--color-gray-medium);
    cursor: pointer;
    font-family: inherit;
}

#toolbar button:hover {
    background: var(--color-bg-tertiary);
}

#toolbar button:active {
    background: var(--color-gray-very-light);
}

#toolbar button:disabled {
    color: var(--color-gray-light);
    cursor: not-allowed;
    background: var(--color-bg-secondary);
}

#toolbar .swatch {
    width: 20px;
    height: 20px;
    border: 1px solid var(--color-border-shadow);
    cursor: pointer;
    flex-shrink: 0;
}

#toolbar .swatch:hover {
    transform: scale(1.1);
}

#toolbar .swatch.active {
    border: 2px solid var(--color-gray-dark);
}

#toolbar .color-label {
    font-size: 10px;
    color: var(--color-gray-medium-4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#toolbar .zoom-label {
    font-size: 11px;
    color: var(--color-gray-medium-3);
    font-family: monospace;
    width: 40px;
    text-align: center;
}

#toolbar #export-filename {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--color-gray-lighter);
    background: var(--color-white);
    color: var(--color-gray-medium);
    font-family: inherit;
    width: 120px;
}

#toolbar #export-filename:focus {
    outline: none;
    border-color: var(--color-blue-primary);
    background: var(--color-bg-blue-light);
}

/* ===== CANVAS ===== */
#container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--color-bg-primary);
    cursor: default;
}

#cv {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

#nodes-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ===== NODES ===== */
.node {
    position: absolute;
    pointer-events: none;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: center;
    overflow: visible;
    word-break: break-word;
    white-space: pre-wrap;
    font-weight: 500;
    color: var(--color-gray-dark);
    line-height: 1.35;
    box-shadow: 1px 2px 4px var(--color-shadow);
    width: auto;
    height: auto;
    min-width: 160px;
    max-width: 300px;
}

.node-title {
    word-break: break-word;
    white-space: pre-wrap;
}

.node-desc {
    word-break: break-word;
    white-space: pre-wrap;
}

/* ===== EDITOR ===== */
#editor-title {
    position: absolute;
    display: none;
    border: 2px solid var(--color-blue-primary);
    outline: none;
    resize: none;
    padding: 4px;
    font-size: 14px;
    text-align: center;
    font-family: inherit;
    font-weight: 600;
    color: var(--color-gray-dark);
    z-index: 15;
    line-height: 1.2;
    word-break: break-word;
}

#editor-desc {
    position: absolute;
    display: none;
    border: 2px solid var(--color-blue-primary);
    outline: none;
    resize: none;
    padding: 4px;
    font-size: 12px;
    text-align: left;
    font-family: inherit;
    font-weight: 400;
    color: var(--color-gray-dark);
    z-index: 15;
    line-height: 1.35;
    word-break: break-word;
}

/* ===== HINT BANNER ===== */
#hint {
    display: none;
    position: absolute;
    top: 44px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    padding: 4px 14px;
    font-size: 11px;
    color: var(--color-gray-medium-2);
    background: var(--color-white);
    border: 1px solid var(--color-gray-lighter);
}

/* ===== STATUS BAR ===== */
#statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 12px;
    background: var(--color-white);
    border-top: 1px solid var(--color-gray-lightest);
    font-size: 11px;
    color: var(--color-gray-medium-4);
    flex-shrink: 0;
    z-index: 20;
}