
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    background: #262626;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#toolbar {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);  /* Center it */
    width: auto;
    border-radius: 8px;
    background: #363636;
    z-index: 100;

    display: flex;
    gap: 4px;
    padding: 4px;
    flex-shrink: 0;
}

#bottombar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: auto;
    border-radius: 8px;
    background: #363636;
    z-index: 100;

    display: flex;
    gap: 4px;
    padding: 4px;
    flex-shrink: 0;
}

.tool {
    height: 40px;
    width: 40px;
    border-radius: 4px;
    background: #363636;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
    color: #F0F0F0;

    transition: all 0.2s ease;
}

.tool img {
    width: 20px;
    height: 20px;
    filter: invert(1);
    opacity: 0.9;
    pointer-events: none; /* Let clicks pass through to parent */
}

.tool:hover {
    background: #bbb;
}

.tool:hover img {
    opacity: 1;
}

#viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    width: 100%;
    min-height: 0; /* Important for flex child */
    touch-action: none; /* Enable touch gestures for panning */
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

#svgContainer {
    transform-origin: 0 0;
    overflow: visible;
    display: inline-block;
    position: absolute;
    top: 0;
    left: 0;
}

#svgContainer svg {
    border: 2px solid #eee;
    display: block;
}

#svgContainer svg text {
    cursor: text;
    user-select: none;
}

#svgContainer svg text:hover {
    opacity: 0.7;
}

.custom-menu {
    position: absolute;
    background: #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 8px;
    z-index: 1000;
    min-width: 150px;
}

.menu-item {
    padding: 10px 16px;
    color: #f0f0f0;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    font-size: 14px;
}

.menu-item:hover {
    background: #4a90e2;
    transform: translateX(2px);
}

.axis-panel {
    min-width: 250px;
    max-width: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.axis-section {
    padding: 12px;
    border-bottom: 1px solid #444;
}

.axis-section:last-of-type {
    border-bottom: none;
}

.axis-section h4 {
    margin: 0 0 10px 0;
    color: #f0f0f0;
    font-size: 14px;
    font-weight: 600;
}

.axis-section label {
    display: block;
    color: #ccc;
    font-size: 12px;
    margin-bottom: 8px;
}

.axis-section input[type="number"],
.axis-section select {
    width: 100%;
    padding: 4px 8px;
    background: #363636;
    border: 1px solid #555;
    border-radius: 4px;
    color: #f0f0f0;
    font-size: 12px;
    margin-top: 4px;
}

.axis-section input[type="color"] {
    width: 60px;
    height: 30px;
    padding: 2px;
    background: #363636;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 4px;
}

.axis-section input[type="checkbox"] {
    margin-right: 8px;
}

.axis-tabs {
    display: flex;
    border-bottom: 1px solid #444;
    margin-bottom: 12px;
}

.axis-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    color: #999;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.axis-tab:hover {
    color: #f0f0f0;
}

.axis-tab.active {
    color: #4a90e2;
    border-bottom-color: #4a90e2;
}

.axis-tab-content {
    display: none;
}

.axis-tab-content.active {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2a2a2a;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #444;
    position: relative;
}

.modal-header h2 {
    margin: 0 0 8px 0;
    color: #f0f0f0;
    font-size: 28px;
    font-weight: 600;
}

.modal-header .email-link {
    margin: 0;
    font-size: 15px;
}

.modal-header .email-link a {
    color: #ccc;
    text-decoration: none;
}

.modal-header .email-link a:hover {
    color: #f0f0f0;
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

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

.modal-body {
    padding: 32px;
}

.modal-body > p {
    color: #ccc;
    font-size: 15px;
    margin: 0 0 24px 0;
    text-align: center;
}

.modal-body > p a {
    color: #ccc;
    text-decoration: none;
}

.modal-body > p a:hover {
    color: #f0f0f0;
}

.principle {
    margin-bottom: 32px;
}

.principle:last-of-type {
    margin-bottom: 0;
}

.principle h3 {
    color: #f0f0f0;
    font-size: 20px;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.principle p {
    color: #ccc;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #444;
    text-align: center;
}

.modal-footer p {
    color: #999;
    font-size: 14px;
    margin: 8px 0;
}

.modal-footer a {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.2s;
}

.modal-footer a:hover {
    color: #5fa3f5;
    text-decoration: underline;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Notification styles - extends from question mark button */
#notification {
    position: fixed;
    bottom: 20px;
    right: 60px;
    background: #363636;
    color: #f0f0f0;
    padding: 0 16px;
    height: 48px;
    display: flex;
    align-items: center;
    border-radius: 8px 0 0 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 99;
    font-size: 13px;
    font-weight: 400;
    min-width: 0;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    width: 0;
    padding: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#notification.show {
    opacity: 1;
    width: auto;
    padding: 0 16px;
    pointer-events: auto;
}

#notification.hide {
    opacity: 0;
    width: 0;
    padding: 0;
}

#notification.success {
    color: #2ecc71;
}

#notification.error {
    color: #e74c3c;
}

#notification.info {
    color: #4a90e2;
}

/* Mobile responsive */
@media (max-width: 600px) {
    #notification {
        bottom: 74px;
        right: 20px;
        left: 20px;
        width: 0;
        max-width: none;
        font-size: 12px;
        justify-content: center;
        border-radius: 8px;
    }

    #notification.show {
        width: calc(100% - 40px);
    }
}
