body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#canvas {
    display: block;
    cursor: crosshair;
    touch-action: none;
}

/* UI Panels */
.ui-panel {
    position: fixed;
    display: flex;
    gap: 6px;
    pointer-events: none;
    z-index: 10;
}

.top-left { top: 15px; left: 15px; flex-direction: row; }
.top-right { top: 15px; right: 15px; flex-direction: row; align-items: flex-start; }
.bottom-left { bottom: 15px; left: 15px; align-items: center; background: rgba(255, 255, 255, 0.9); padding: 5px 10px; border-radius: 4px; border: 1px solid #eee; }
.bottom-right { bottom: 15px; right: 15px; }

.ui-panel button, .dropdown-content button {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ui-panel button:active, .dropdown-content button:active { background: #eee; }
.ui-panel button:disabled { opacity: 0.3; cursor: default; }

/* Dropdown Menu */
.dropdown { position: relative; display: inline-block; pointer-events: auto; }
.dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 20;
    border-radius: 4px;
    padding: 5px 0;
    flex-direction: column;
}
.dropdown-content button {
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    padding: 8px 16px;
    border-radius: 0;
    box-shadow: none;
}
.dropdown-content button:hover { background-color: #f1f1f1; }
.dropdown-divider { height: 1px; background-color: #eee; margin: 4px 0; }
.show { display: flex !important; }

/* Help Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center; justify-content: center;
}
.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.modal-header { font-weight: bold; margin-bottom: 10px; font-size: 16px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.modal-body { font-size: 14px; line-height: 1.5; }
.modal-footer { margin-top: 15px; text-align: right; }
.close-btn { background: #333; color: #fff; border: none; padding: 6px 15px; border-radius: 4px; cursor: pointer; }

.btn-danger { color: #a00; }
