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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    overflow: hidden;
    background-color: #f8f9fa;
    height: 100vh;
    width: 100vw;
    touch-action: none; /* Prevents default touch actions like scrolling */
}

/* Toolbar styles */
#toolbar {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#toolbar button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: white;
    color: #6c5ce7;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#toolbar button:hover {
    background-color: #f0f0f0;
    transform: scale(1.05);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-modal:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 15px;
    color: #6c5ce7;
}

.modal-content ul {
    list-style-position: inside;
    margin-left: 10px;
}

.modal-content li {
    margin-bottom: 10px;
    line-height: 1.4;
}

#mind-map-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
}

#mind-map-container.grabbing {
    cursor: grabbing;
}

.node {
    position: absolute;
    background-color: white;
    border-radius: 20px;
    padding: 10px 15px;
    min-width: 100px;
    max-width: 200px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transform-origin: center center;
    transition: box-shadow 0.2s ease;
    user-select: none;
    overflow: hidden;
    word-wrap: break-word;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    position: relative;
}

.node-delete {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 22px;
    height: 22px;
    background-color: #ff5252;
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

.node:hover .node-delete {
    display: flex;
}

.node.central {
    background-color: #6c5ce7;
    color: white;
    font-weight: bold;
}

.node.editing {
    box-shadow: 0 0 0 2px #6c5ce7, 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

.node-input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    text-align: center;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.connection {
    position: absolute;
    height: 2px;
    background-color: #ddd;
    transform-origin: left center;
    pointer-events: none;
    z-index: 1;
}

.temp-connection {
    position: absolute;
    height: 2px;
    background-color: #6c5ce7;
    transform-origin: left center;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

/* Animations */
.node {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .node {
        min-width: 80px;
        padding: 8px 12px;
        font-size: 14px;
    }
}